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 no result type.
3380 That is, the called method must be declared <code>void</code>.
3381 </description>
3382 <origin>new</origin>
3383 <capabilities>
3384 <required id="can_force_early_return"></required>
3385 </capabilities>
3386 <parameters>
3387 <param id="thread">
3388 <jthread null="current" impl="noconvert"/>
3389 <description>
3390 The thread whose current frame is to return early.
3391 </description>
3392 </param>
3393 </parameters>
3394 <errors>
3395 <error id="JVMTI_ERROR_OPAQUE_FRAME">
3396 The implementation is unable to force the current frame to return
3397 (e.g. current frame is executing a native method).
3398 </error>
3399 <error id="JVMTI_ERROR_TYPE_MISMATCH">
3400 The called method has a result type.
3401 </error>
3402 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
3403 Thread was not suspended and was not the current thread.
3404 </error>
3405 <error id="JVMTI_ERROR_NO_MORE_FRAMES">
3406 There are no frames on the call stack.
3407 </error>
3408 </errors>
3409 </function>
3410
3411 </category>
3412
3413 <category id="Heap" label="Heap">
3414 <intro>
3415 These functions are used to analyze the heap.
3416 Functionality includes the ability to view the objects in the
3417 heap and to tag these objects.
3418 </intro>
3419
3420 <intro id="objectTags" label="Object Tags">
3421 A <i>tag</i> is a value associated with an object.
3422 Tags are explicitly set by the agent using the
3423 <functionlink id="SetTag"></functionlink> function or by
3424 callback functions such as <functionlink id="jvmtiHeapIterationCallback"/>.
3425 <p/>
3426 Tags are local to the environment; that is, the tags of one
3427 environment are not visible in another.
3428 <p/>
3429 Tags are <code>jlong</code> values which can be used
3430 simply to mark an object or to store a pointer to more detailed
3431 information. Objects which have not been tagged have a
3432 tag of zero.
3433 Setting a tag to zero makes the object untagged.
3434 </intro>
3435
3436 <intro id="heapCallbacks" label="Heap Callback Functions">
3437 Heap functions which iterate through the heap and recursively
3438 follow object references use agent supplied callback functions
3439 to deliver the information.
3440 <p/>
3441 These heap callback functions must adhere to the following restrictions --
3442 These callbacks must not use JNI functions.
3443 These callbacks must not use <jvmti/> functions except
3444 <i>callback safe</i> functions which
3445 specifically allow such use (see the raw monitor, memory management,
3446 and environment local storage functions).
3447 <p/>
3448 An implementation may invoke a callback on an internal thread or
3449 the thread which called the iteration function.
3450 Heap callbacks are single threaded -- no more than one callback will
3451 be invoked at a time.
3452 <p/>
3453 The Heap Filter Flags can be used to prevent reporting
3454 based on the tag status of an object or its class.
3455 If no flags are set (the <code>jint</code> is zero), objects
3456 will not be filtered out.
3457
3458 <constants id="jvmtiHeapFilter" label="Heap Filter Flags" kind="bits">
3459 <constant id="JVMTI_HEAP_FILTER_TAGGED" num="0x4">
3460 Filter out tagged objects. Objects which are tagged are not included.
3461 </constant>
3462 <constant id="JVMTI_HEAP_FILTER_UNTAGGED" num="0x8">
3463 Filter out untagged objects. Objects which are not tagged are not included.
3464 </constant>
3465 <constant id="JVMTI_HEAP_FILTER_CLASS_TAGGED" num="0x10">
3466 Filter out objects with tagged classes. Objects whose class is tagged are not included.
3467 </constant>
3468 <constant id="JVMTI_HEAP_FILTER_CLASS_UNTAGGED" num="0x20">
3469 Filter out objects with untagged classes. Objects whose class is not tagged are not included.
3470 </constant>
3471 </constants>
3472
3473 <p/>
3474 The Heap Visit Control Flags are returned by the heap callbacks
3475 and can be used to abort the iteration. For the
3476 <functionlink id="jvmtiHeapReferenceCallback">Heap
3477 Reference Callback</functionlink>, it can also be used
3478 to prune the graph of traversed references
3479 (<code>JVMTI_VISIT_OBJECTS</code> is not set).
3480
3481 <constants id="jvmtiHeapVisitControl"
3482 label="Heap Visit Control Flags"
3483 kind="bits"
3484 since="1.1">
3485 <constant id="JVMTI_VISIT_OBJECTS" num="0x100">
3486 If we are visiting an object and if this callback
3487 was initiated by <functionlink id="FollowReferences"/>,
3488 traverse the references of this object.
3489 Otherwise ignored.
3490 </constant>
3491 <constant id="JVMTI_VISIT_ABORT" num="0x8000">
3492 Abort the iteration. Ignore all other bits.
3493 </constant>
3494 </constants>
3495
3496 <p/>
3497 The Heap Reference Enumeration is provided by the
3498 <functionlink id="jvmtiHeapReferenceCallback">Heap
3499 Reference Callback</functionlink> and
3500 <functionlink id="jvmtiPrimitiveFieldCallback">Primitive Field
3501 Callback</functionlink> to
3502 describe the kind of reference
3503 being reported.
3504
3505 <constants id="jvmtiHeapReferenceKind"
3506 label="Heap Reference Enumeration"
3507 kind="enum"
3508 since="1.1">
3509 <constant id="JVMTI_HEAP_REFERENCE_CLASS" num="1">
3510 Reference from an object to its class.
3511 </constant>
3512 <constant id="JVMTI_HEAP_REFERENCE_FIELD" num="2">
3513 Reference from an object to the value of one of its instance fields.
3514 </constant>
3515 <constant id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT" num="3">
3516 Reference from an array to one of its elements.
3517 </constant>
3518 <constant id="JVMTI_HEAP_REFERENCE_CLASS_LOADER" num="4">
3519 Reference from a class to its class loader.
3520 </constant>
3521 <constant id="JVMTI_HEAP_REFERENCE_SIGNERS" num="5">
3522 Reference from a class to its signers array.
3523 </constant>
3524 <constant id="JVMTI_HEAP_REFERENCE_PROTECTION_DOMAIN" num="6">
3525 Reference from a class to its protection domain.
3526 </constant>
3527 <constant id="JVMTI_HEAP_REFERENCE_INTERFACE" num="7">
3528 Reference from a class to one of its interfaces.
3529 Note: interfaces are defined via a constant pool reference,
3530 so the referenced interfaces may also be reported with a
3531 <code>JVMTI_HEAP_REFERENCE_CONSTANT_POOL</code> reference kind.
3532 </constant>
3533 <constant id="JVMTI_HEAP_REFERENCE_STATIC_FIELD" num="8">
3534 Reference from a class to the value of one of its static fields.
3535 </constant>
3536 <constant id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL" num="9">
3537 Reference from a class to a resolved entry in the constant pool.
3538 </constant>
3539 <constant id="JVMTI_HEAP_REFERENCE_SUPERCLASS" num="10">
3540 Reference from a class to its superclass.
3541 A callback is not sent if the superclass is <code>java.lang.Object</code>.
3542 Note: loaded classes define superclasses via a constant pool
3543 reference, so the referenced superclass may also be reported with
3544 a <code>JVMTI_HEAP_REFERENCE_CONSTANT_POOL</code> reference kind.
3545 </constant>
3546 <constant id="JVMTI_HEAP_REFERENCE_JNI_GLOBAL" num="21">
3547 Heap root reference: JNI global reference.
3548 </constant>
3549 <constant id="JVMTI_HEAP_REFERENCE_SYSTEM_CLASS" num="22">
3550 Heap root reference: System class.
3551 </constant>
3552 <constant id="JVMTI_HEAP_REFERENCE_MONITOR" num="23">
3553 Heap root reference: monitor.
3554 </constant>
3555 <constant id="JVMTI_HEAP_REFERENCE_STACK_LOCAL" num="24">
3556 Local variable on a thread stack.
3557 </constant>
3558 <constant id="JVMTI_HEAP_REFERENCE_JNI_LOCAL" num="25">
3559 JNI local reference.
3560 </constant>
3561 <constant id="JVMTI_HEAP_REFERENCE_THREAD" num="26">
3562 Heap root reference: Thread.
3563 </constant>
3564 <constant id="JVMTI_HEAP_REFERENCE_OTHER" num="27">
3565 Heap root reference: other heap root reference.
3566 </constant>
3567 </constants>
3568
3569 <p/>
3570 Definitions for the single character type descriptors of
3571 primitive types.
3572
3573 <constants id="jvmtiPrimitiveType"
3574 label="Primitive Type Enumeration"
3575 kind="enum"
3576 since="1.1">
3577 <constant id="JVMTI_PRIMITIVE_TYPE_BOOLEAN" num="90">
3578 'Z' - Java programming language <code>boolean</code> - JNI <code>jboolean</code>
3579 </constant>
3580 <constant id="JVMTI_PRIMITIVE_TYPE_BYTE" num="66">
3581 'B' - Java programming language <code>byte</code> - JNI <code>jbyte</code>
3582 </constant>
3583 <constant id="JVMTI_PRIMITIVE_TYPE_CHAR" num="67">
3584 'C' - Java programming language <code>char</code> - JNI <code>jchar</code>
3585 </constant>
3586 <constant id="JVMTI_PRIMITIVE_TYPE_SHORT" num="83">
3587 'S' - Java programming language <code>short</code> - JNI <code>jshort</code>
3588 </constant>
3589 <constant id="JVMTI_PRIMITIVE_TYPE_INT" num="73">
3590 'I' - Java programming language <code>int</code> - JNI <code>jint</code>
3591 </constant>
3592 <constant id="JVMTI_PRIMITIVE_TYPE_LONG" num="74">
3593 'J' - Java programming language <code>long</code> - JNI <code>jlong</code>
3594 </constant>
3595 <constant id="JVMTI_PRIMITIVE_TYPE_FLOAT" num="70">
3596 'F' - Java programming language <code>float</code> - JNI <code>jfloat</code>
3597 </constant>
3598 <constant id="JVMTI_PRIMITIVE_TYPE_DOUBLE" num="68">
3599 'D' - Java programming language <code>double</code> - JNI <code>jdouble</code>
3600 </constant>
3601 </constants>
3602 </intro>
3603
3604 <typedef id="jvmtiHeapReferenceInfoField"
3605 label="Reference information structure for Field references"
3606 since="1.1">
3607 <description>
3608 Reference information returned for
3609 <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/> and
3610 <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/> references.
3611 </description>
3612 <field id="index">
3613 <jint/>
3614 <description>
3615 For <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/>, the
3616 referrer object is not a class or an interface.
3617 In this case, <code>index</code> is the index of the field
3618 in the class of the referrer object.
3619 This class is referred to below as <i>C</i>.
3620 <p/>
3621 For <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/>,
3622 the referrer object is a class (referred to below as <i>C</i>)
3623 or an interface (referred to below as <i>I</i>).
3624 In this case, <code>index</code> is the index of the field in
3625 that class or interface.
3626 <p/>
3627 If the referrer object is not an interface, then the field
3628 indices are determined as follows:
3629 <ul>
3630 <li>make a list of all the fields in <i>C</i> and its
3631 superclasses, starting with all the fields in
3632 <code>java.lang.Object</code> and ending with all the
3633 fields in <i>C</i>.</li>
3634 <li>Within this list, put
3635 the fields for a given class in the order returned by
3636 <functionlink id="GetClassFields"/>.</li>
3637 <li>Assign the fields in this list indices
3638 <i>n</i>, <i>n</i>+1, ..., in order, where <i>n</i>
3639 is the count of the fields in all the interfaces
3640 implemented by <i>C</i>.
3641 Note that <i>C</i> implements all interfaces
3642 directly implemented by its superclasses; as well
3643 as all superinterfaces of these interfaces.</li>
3644 </ul>
3645 If the referrer object is an interface, then the field
3646 indices are determined as follows:
3647 <ul>
3648 <li>make a list of the fields directly declared in
3649 <i>I</i>.</li>
3650 <li>Within this list, put
3651 the fields in the order returned by
3652 <functionlink id="GetClassFields"/>.</li>
3653 <li>Assign the fields in this list indices
3654 <i>n</i>, <i>n</i>+1, ..., in order, where <i>n</i>
3655 is the count of the fields in all the superinterfaces
3656 of <i>I</i>.</li>
3657 </ul>
3658 All fields are included in this computation, regardless of
3659 field modifier (static, public, private, etc).
3660 <p/>
3661 For example, given the following classes and interfaces:
3662 <example>
3663 interface I0 {
3664 int p = 0;
3665 }
3666
3667 interface I1 extends I0 {
3668 int x = 1;
3669 }
3670
3671 interface I2 extends I0 {
3672 int y = 2;
3673 }
3674
3675 class C1 implements I1 {
3676 public static int a = 3;
3677 private int b = 4;
3678 }
3679
3680 class C2 extends C1 implements I2 {
3681 static int q = 5;
3682 final int r = 6;
3683 }
3684 </example>
3685 Assume that <functionlink id="GetClassFields"/> called on
3686 <code>C1</code> returns the fields of <code>C1</code> in the
3687 order: a, b; and that the fields of <code>C2</code> are
3688 returned in the order: q, r.
3689 An instance of class <code>C1</code> will have the
3690 following field indices:
3691 <blockquote><table>
3692 <tr class="bgLight">
3693 <th class="centered" scope="col">Field</th>
3694 <th class="centered" scope="col">Index</th>
3695 <th scope="col">Description</th>
3696 </tr>
3697 <tr>
3698 <th class="centered" scope="row">
3699 a
3700 </th>
3701 <td class="centered">
3702 2
3703 </td>
3704 <td>
3705 The count of the fields in the interfaces
3706 implemented by <code>C1</code> is two (<i>n</i>=2):
3707 <code>p</code> of <code>I0</code>
3708 and <code>x</code> of <code>I1</code>.
3709 </td>
3710 </tr>
3711 <tr>
3712 <th class="centered" scope="row">
3713 b
3714 </th>
3715 <td class="centered">
3716 3
3717 </td>
3718 <td>
3719 the subsequent index.
3720 </td>
3721 </tr>
3722 </table></blockquote>
3723 The class <code>C1</code> will have the same field indices.
3724 <p/>
3725 An instance of class <code>C2</code> will have the
3726 following field indices:
3727 <blockquote><table>
3728 <tr class="bgLight">
3729 <th class="centered" scope="col">Field</th>
3730 <th class="centered" scope="col">Index</th>
3731 <th scope="col">Description</th>
3732 </tr>
3733 <tr>
3734 <th class="centered" scope="row">
3735 a
3736 </th>
3737 <td class="centered">
3738 3
3739 </td>
3740 <td>
3741 The count of the fields in the interfaces
3742 implemented by <code>C2</code> is three (<i>n</i>=3):
3743 <code>p</code> of <code>I0</code>,
3744 <code>x</code> of <code>I1</code> and <code>y</code> of <code>I2</code>
3745 (an interface of <code>C2</code>). Note that the field <code>p</code>
3746 of <code>I0</code> is only included once.
3747 </td>
3748 </tr>
3749 <tr>
3750 <th class="centered" scope="row">
3751 b
3752 </th>
3753 <td class="centered">
3754 4
3755 </td>
3756 <td>
3757 the subsequent index to "a".
3758 </td>
3759 </tr>
3760 <tr>
3761 <th class="centered" scope="row">
3762 q
3763 </th>
3764 <td class="centered">
3765 5
3766 </td>
3767 <td>
3768 the subsequent index to "b".
3769 </td>
3770 </tr>
3771 <tr>
3772 <th class="centered" scope="row">
3773 r
3774 </th>
3775 <td class="centered">
3776 6
3777 </td>
3778 <td>
3779 the subsequent index to "q".
3780 </td>
3781 </tr>
3782 </table></blockquote>
3783 The class <code>C2</code> will have the same field indices.
3784 Note that a field may have a different index depending on the
3785 object that is viewing it -- for example field "a" above.
3786 Note also: not all field indices may be visible from the
3787 callbacks, but all indices are shown for illustrative purposes.
3788 <p/>
3789 The interface <code>I1</code> will have the
3790 following field indices:
3791 <blockquote><table>
3792 <tr class="bgLight">
3793 <th class="centered" scope="col">Field</th>
3794 <th class="centered" scope="col">Index</th>
3795 <th scope="col">Description</th>
3796 </tr>
3797 <tr>
3798 <th class="centered" scope="row">
3799 x
3800 </th>
3801 <td class="centered">
3802 1
3803 </td>
3804 <td>
3805 The count of the fields in the superinterfaces
3806 of <code>I1</code> is one (<i>n</i>=1):
3807 <code>p</code> of <code>I0</code>.
3808 </td>
3809 </tr>
3810 </table></blockquote>
3811 </description>
3812 </field>
3813 </typedef>
3814
3815 <typedef id="jvmtiHeapReferenceInfoArray"
3816 label="Reference information structure for Array references"
3817 since="1.1">
3818 <description>
3819 Reference information returned for
3820 <datalink id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT"/> references.
3821 </description>
3822 <field id="index">
3823 <jint/>
3824 <description>
3825 The array index.
3826 </description>
3827 </field>
3828 </typedef>
3829
3830 <typedef id="jvmtiHeapReferenceInfoConstantPool"
3831 label="Reference information structure for Constant Pool references"
3832 since="1.1">
3833 <description>
3834 Reference information returned for
3835 <datalink id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL"/> references.
3836 </description>
3837 <field id="index">
3838 <jint/>
3839 <description>
3840 The index into the constant pool of the class. See the description in
3841 <vmspec chapter="4.4"/>.
3842 </description>
3843 </field>
3844 </typedef>
3845
3846 <typedef id="jvmtiHeapReferenceInfoStackLocal"
3847 label="Reference information structure for Local Variable references"
3848 since="1.1">
3849 <description>
3850 Reference information returned for
3851 <datalink id="JVMTI_HEAP_REFERENCE_STACK_LOCAL"/> references.
3852 </description>
3853 <field id="thread_tag">
3854 <jlong/>
3855 <description>
3856 The tag of the thread corresponding to this stack, zero if not tagged.
3857 </description>
3858 </field>
3859 <field id="thread_id">
3860 <jlong/>
3861 <description>
3862 The unique thread ID of the thread corresponding to this stack.
3863 </description>
3864 </field>
3865 <field id="depth">
3866 <jint/>
3867 <description>
3868 The depth of the frame.
3869 </description>
3870 </field>
3871 <field id="method">
3872 <jmethodID/>
3873 <description>
3874 The method executing in this frame.
3875 </description>
3876 </field>
3877 <field id="location">
3878 <jlocation/>
3879 <description>
3880 The currently executing location in this frame.
3881 </description>
3882 </field>
3883 <field id="slot">
3884 <jint/>
3885 <description>
3886 The slot number of the local variable.
3887 </description>
3888 </field>
3889 </typedef>
3890
3891 <typedef id="jvmtiHeapReferenceInfoJniLocal"
3892 label="Reference information structure for JNI local references"
3893 since="1.1">
3894 <description>
3895 Reference information returned for
3896 <datalink id="JVMTI_HEAP_REFERENCE_JNI_LOCAL"/> references.
3897 </description>
3898 <field id="thread_tag">
3899 <jlong/>
3900 <description>
3901 The tag of the thread corresponding to this stack, zero if not tagged.
3902 </description>
3903 </field>
3904 <field id="thread_id">
3905 <jlong/>
3906 <description>
3907 The unique thread ID of the thread corresponding to this stack.
3908 </description>
3909 </field>
3910 <field id="depth">
3911 <jint/>
3912 <description>
3913 The depth of the frame.
3914 </description>
3915 </field>
3916 <field id="method">
3917 <jmethodID/>
3918 <description>
3919 The method executing in this frame.
3920 </description>
3921 </field>
3922 </typedef>
3923
3924 <typedef id="jvmtiHeapReferenceInfoReserved"
3925 label="Reference information structure for Other references"
3926 since="1.1">
3927 <description>
3928 Reference information returned for other references.
3929 </description>
3930 <field id="reserved1">
3931 <jlong/>
3932 <description>
3933 reserved for future use.
3934 </description>
3935 </field>
3936 <field id="reserved2">
3937 <jlong/>
3938 <description>
3939 reserved for future use.
3940 </description>
3941 </field>
3942 <field id="reserved3">
3943 <jlong/>
3944 <description>
3945 reserved for future use.
3946 </description>
3947 </field>
3948 <field id="reserved4">
3949 <jlong/>
3950 <description>
3951 reserved for future use.
3952 </description>
3953 </field>
3954 <field id="reserved5">
3955 <jlong/>
3956 <description>
3957 reserved for future use.
3958 </description>
3959 </field>
3960 <field id="reserved6">
3961 <jlong/>
3962 <description>
3963 reserved for future use.
3964 </description>
3965 </field>
3966 <field id="reserved7">
3967 <jlong/>
3968 <description>
3969 reserved for future use.
3970 </description>
3971 </field>
3972 <field id="reserved8">
3973 <jlong/>
3974 <description>
3975 reserved for future use.
3976 </description>
3977 </field>
3978 </typedef>
3979
3980 <uniontypedef id="jvmtiHeapReferenceInfo"
3981 label="Reference information structure"
3982 since="1.1">
3983 <description>
3984 The information returned about referrers.
3985 Represented as a union of the various kinds of reference information.
3986 </description>
3987 <field id="field">
3988 <struct>jvmtiHeapReferenceInfoField</struct>
3989 <description>
3990 The referrer information for
3991 <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/>
3992 and <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/> references.
3993 </description>
3994 </field>
3995 <field id="array">
3996 <struct>jvmtiHeapReferenceInfoArray</struct>
3997 <description>
3998 The referrer information for
3999 For <datalink id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT"/> references.
4000 </description>
4001 </field>
4002 <field id="constant_pool">
4003 <struct>jvmtiHeapReferenceInfoConstantPool</struct>
4004 <description>
4005 The referrer information for
4006 For <datalink id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL"/> references.
4007 </description>
4008 </field>
4009 <field id="stack_local">
4010 <struct>jvmtiHeapReferenceInfoStackLocal</struct>
4011 <description>
4012 The referrer information for
4013 For <datalink id="JVMTI_HEAP_REFERENCE_STACK_LOCAL"/> references.
4014 </description>
4015 </field>
4016 <field id="jni_local">
4017 <struct>jvmtiHeapReferenceInfoJniLocal</struct>
4018 <description>
4019 The referrer information for
4020 For <datalink id="JVMTI_HEAP_REFERENCE_JNI_LOCAL"/> references.
4021 </description>
4022 </field>
4023 <field id="other">
4024 <struct>jvmtiHeapReferenceInfoReserved</struct>
4025 <description>
4026 reserved for future use.
4027 </description>
4028 </field>
4029 </uniontypedef>
4030
4031 <typedef id="jvmtiHeapCallbacks"
4032 label="Heap callback function structure"
4033 since="1.1">
4034 <field id="heap_iteration_callback">
4035 <ptrtype>
4036 <struct>jvmtiHeapIterationCallback</struct>
4037 </ptrtype>
4038 <description>
4039 The callback to be called to describe an
4040 object in the heap. Used by the
4041 <functionlink id="IterateThroughHeap"/> function, ignored by the
4042 <functionlink id="FollowReferences"/> function.
4043 </description>
4044 </field>
4045 <field id="heap_reference_callback">
4046 <ptrtype>
4047 <struct>jvmtiHeapReferenceCallback</struct>
4048 </ptrtype>
4049 <description>
4050 The callback to be called to describe an
4051 object reference. Used by the
4052 <functionlink id="FollowReferences"/> function, ignored by the
4053 <functionlink id="IterateThroughHeap"/> function.
4054 </description>
4055 </field>
4056 <field id="primitive_field_callback">
4057 <ptrtype>
4058 <struct>jvmtiPrimitiveFieldCallback</struct>
4059 </ptrtype>
4060 <description>
4061 The callback to be called to describe a
4062 primitive field.
4063 </description>
4064 </field>
4065 <field id="array_primitive_value_callback">
4066 <ptrtype>
4067 <struct>jvmtiArrayPrimitiveValueCallback</struct>
4068 </ptrtype>
4069 <description>
4070 The callback to be called to describe an
4071 array of primitive values.
4072 </description>
4073 </field>
4074 <field id="string_primitive_value_callback">
4075 <ptrtype>
4076 <struct>jvmtiStringPrimitiveValueCallback</struct>
4077 </ptrtype>
4078 <description>
4079 The callback to be called to describe a String value.
4080 </description>
4081 </field>
4082 <field id="reserved5">
4083 <ptrtype>
4084 <struct>jvmtiReservedCallback</struct>
4085 </ptrtype>
4086 <description>
4087 Reserved for future use..
4088 </description>
4089 </field>
4090 <field id="reserved6">
4091 <ptrtype>
4092 <struct>jvmtiReservedCallback</struct>
4093 </ptrtype>
4094 <description>
4095 Reserved for future use..
4096 </description>
4097 </field>
4098 <field id="reserved7">
4099 <ptrtype>
4100 <struct>jvmtiReservedCallback</struct>
4101 </ptrtype>
4102 <description>
4103 Reserved for future use..
4104 </description>
4105 </field>
4106 <field id="reserved8">
4107 <ptrtype>
4108 <struct>jvmtiReservedCallback</struct>
4109 </ptrtype>
4110 <description>
4111 Reserved for future use..
4112 </description>
4113 </field>
4114 <field id="reserved9">
4115 <ptrtype>
4116 <struct>jvmtiReservedCallback</struct>
4117 </ptrtype>
4118 <description>
4119 Reserved for future use..
4120 </description>
4121 </field>
4122 <field id="reserved10">
4123 <ptrtype>
4124 <struct>jvmtiReservedCallback</struct>
4125 </ptrtype>
4126 <description>
4127 Reserved for future use..
4128 </description>
4129 </field>
4130 <field id="reserved11">
4131 <ptrtype>
4132 <struct>jvmtiReservedCallback</struct>
4133 </ptrtype>
4134 <description>
4135 Reserved for future use..
4136 </description>
4137 </field>
4138 <field id="reserved12">
4139 <ptrtype>
4140 <struct>jvmtiReservedCallback</struct>
4141 </ptrtype>
4142 <description>
4143 Reserved for future use..
4144 </description>
4145 </field>
4146 <field id="reserved13">
4147 <ptrtype>
4148 <struct>jvmtiReservedCallback</struct>
4149 </ptrtype>
4150 <description>
4151 Reserved for future use..
4152 </description>
4153 </field>
4154 <field id="reserved14">
4155 <ptrtype>
4156 <struct>jvmtiReservedCallback</struct>
4157 </ptrtype>
4158 <description>
4159 Reserved for future use..
4160 </description>
4161 </field>
4162 <field id="reserved15">
4163 <ptrtype>
4164 <struct>jvmtiReservedCallback</struct>
4165 </ptrtype>
4166 <description>
4167 Reserved for future use..
4168 </description>
4169 </field>
4170 </typedef>
4171
4172
4173 <intro>
4174 <rationale>
4175 The heap dumping functionality (below) uses a callback
4176 for each object. While it would seem that a buffered approach
4177 would provide better throughput, tests do
4178 not show this to be the case--possibly due to locality of
4179 memory reference or array access overhead.
4180 </rationale>
4181
4182 <issue>
4183 Still under investigation as to if java.lang.ref references
4184 are reported as a different type of reference.
4185 </issue>
4186
4187 <issue>
4188 Should or can an indication of the cost or relative cost of
4189 these operations be included?
4190 </issue>
4191
4192 </intro>
4193
4194 <callback id="jvmtiHeapIterationCallback" since="1.1">
4195 <jint/>
4196 <synopsis>Heap Iteration Callback</synopsis>
4197 <description>
4198 Agent supplied callback function.
4199 Describes (but does not pass in) an object in the heap.
4200 <p/>
4201 This function should return a bit vector of the desired
4202 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>.
4203 This will determine if the entire iteration should be aborted
4204 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored).
4205 <p/>
4206 See the <internallink id="heapCallbacks">heap callback
4207 function restrictions</internallink>.
4208 </description>
4209 <parameters>
4210 <param id="class_tag">
4211 <jlong/>
4212 <description>
4213 The tag of the class of object (zero if the class is not tagged).
4214 If the object represents a runtime class,
4215 the <code>class_tag</code> is the tag
4216 associated with <code>java.lang.Class</code>
4217 (zero if <code>java.lang.Class</code> is not tagged).
4218 </description>
4219 </param>
4220 <param id="size">
4221 <jlong/>
4222 <description>
4223 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>.
4224 </description>
4225 </param>
4226 <param id="tag_ptr">
4227 <outptr><jlong/></outptr>
4228 <description>
4229 The object tag value, or zero if the object is not tagged.
4230 To set the tag value to be associated with the object
4231 the agent sets the <code>jlong</code> pointed to by the parameter.
4232 </description>
4233 </param>
4234 <param id="length">
4235 <jint/>
4236 <description>
4237 If this object is an array, the length of the array. Otherwise negative one (-1).
4238 </description>
4239 </param>
4240 <param id="user_data">
4241 <outptr><void/></outptr>
4242 <description>
4243 The user supplied data that was passed into the iteration function.
4244 </description>
4245 </param>
4246 </parameters>
4247 </callback>
4248
4249 <callback id="jvmtiHeapReferenceCallback" since="1.1">
4250 <jint/>
4251 <synopsis>Heap Reference Callback</synopsis>
4252 <description>
4253 Agent supplied callback function.
4254 Describes a reference from an object or the VM (the referrer) to another object
4255 (the referree) or a heap root to a referree.
4256 <p/>
4257 This function should return a bit vector of the desired
4258 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>.
4259 This will determine if the objects referenced by the referree
4260 should be visited or if the entire iteration should be aborted.
4261 <p/>
4262 See the <internallink id="heapCallbacks">heap callback
4263 function restrictions</internallink>.
4264 </description>
4265 <parameters>
4266 <param id="reference_kind">
4267 <enum>jvmtiHeapReferenceKind</enum>
4268 <description>
4269 The kind of reference.
4270 </description>
4271 </param>
4272 <param id="reference_info">
4273 <inptr>
4274 <struct>jvmtiHeapReferenceInfo</struct>
4275 </inptr>
4276 <description>
4277 Details about the reference.
4278 Set when the <datalink id="jvmtiHeapReferenceCallback.reference_kind">reference_kind</datalink> is
4279 <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/>,
4280 <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/>,
4281 <datalink id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT"/>,
4282 <datalink id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL"/>,
4283 <datalink id="JVMTI_HEAP_REFERENCE_STACK_LOCAL"/>,
4284 or <datalink id="JVMTI_HEAP_REFERENCE_JNI_LOCAL"/>.
4285 Otherwise a null pointer.
4286 </description>
4287 </param>
4288 <param id="class_tag">
4289 <jlong/>
4290 <description>
4291 The tag of the class of referree object (zero if the class is not tagged).
4292 If the referree object represents a runtime class,
4293 the <code>class_tag</code> is the tag
4294 associated with <code>java.lang.Class</code>
4295 (zero if <code>java.lang.Class</code> is not tagged).
4296 </description>
4297 </param>
4298 <param id="referrer_class_tag">
4299 <jlong/>
4300 <description>
4301 The tag of the class of the referrer object (zero if the class is not tagged
4302 or the referree is a heap root). If the referrer object represents a runtime
4303 class, the <code>referrer_class_tag</code> is the tag associated with
4304 the <code>java.lang.Class</code>
4305 (zero if <code>java.lang.Class</code> is not tagged).
4306 </description>
4307 </param>
4308 <param id="size">
4309 <jlong/>
4310 <description>
4311 Size of the referree object (in bytes).
4312 See <functionlink id="GetObjectSize"/>.
4313 </description>
4314 </param>
4315 <param id="tag_ptr">
4316 <outptr><jlong/></outptr>
4317 <description>
4318 Points to the referree object tag value, or zero if the object is not
4319 tagged.
4320 To set the tag value to be associated with the object
4321 the agent sets the <code>jlong</code> pointed to by the parameter.
4322 </description>
4323 </param>
4324 <param id="referrer_tag_ptr">
4325 <outptr><jlong/></outptr>
4326 <description>
4327 Points to the tag of the referrer object, or
4328 points to the zero if the referrer
4329 object is not tagged.
4330 Null if the referrer in not an object (that is,
4331 this callback is reporting a heap root).
4332 To set the tag value to be associated with the referrer object
4333 the agent sets the <code>jlong</code> pointed to by the parameter.
4334 If this callback is reporting a reference from an object to itself,
4335 <code>referrer_tag_ptr == tag_ptr</code>.
4336 </description>
4337 </param>
4338 <param id="length">
4339 <jint/>
4340 <description>
4341 If this object is an array, the length of the array. Otherwise negative one (-1).
4342 </description>
4343 </param>
4344 <param id="user_data">
4345 <outptr><void/></outptr>
4346 <description>
4347 The user supplied data that was passed into the iteration function.
4348 </description>
4349 </param>
4350 </parameters>
4351 </callback>
4352
4353 <callback id="jvmtiPrimitiveFieldCallback" since="1.1">
4354 <jint/>
4355 <synopsis>Primitive Field Callback</synopsis>
4356 <description>
4357 Agent supplied callback function which
4358 describes a primitive field of an object (<i>the object</i>).
4359 A primitive field is a field whose type is a primitive type.
4360 This callback will describe a static field if the object is a class,
4361 and otherwise will describe an instance field.
4362 <p/>
4363 This function should return a bit vector of the desired
4364 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>.
4365 This will determine if the entire iteration should be aborted
4366 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored).
4367 <p/>
4368 See the <internallink id="heapCallbacks">heap callback
4369 function restrictions</internallink>.
4370 </description>
4371 <parameters>
4372 <param id="kind">
4373 <enum>jvmtiHeapReferenceKind</enum>
4374 <description>
4375 The kind of field -- instance or static (<datalink id="JVMTI_HEAP_REFERENCE_FIELD"/> or
4376 <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/>).
4377 </description>
4378 </param>
4379 <param id="info">
4380 <inptr>
4381 <struct>jvmtiHeapReferenceInfo</struct>
4382 </inptr>
4383 <description>
4384 Which field (the field index).
4385 </description>
4386 </param>
4387 <param id="object_class_tag">
4388 <jlong/>
4389 <description>
4390 The tag of the class of the object (zero if the class is not tagged).
4391 If the object represents a runtime class, the
4392 <code>object_class_tag</code> is the tag
4393 associated with <code>java.lang.Class</code>
4394 (zero if <code>java.lang.Class</code> is not tagged).
4395 </description>
4396 </param>
4397 <param id="object_tag_ptr">
4398 <outptr><jlong/></outptr>
4399 <description>
4400 Points to the tag of the object, or zero if the object is not
4401 tagged.
4402 To set the tag value to be associated with the object
4403 the agent sets the <code>jlong</code> pointed to by the parameter.
4404 </description>
4405 </param>
4406 <param id="value">
4407 <jvalue/>
4408 <description>
4409 The value of the field.
4410 </description>
4411 </param>
4412 <param id="value_type">
4413 <enum>jvmtiPrimitiveType</enum>
4414 <description>
4415 The type of the field.
4416 </description>
4417 </param>
4418 <param id="user_data">
4419 <outptr><void/></outptr>
4420 <description>
4421 The user supplied data that was passed into the iteration function.
4422 </description>
4423 </param>
4424 </parameters>
4425 </callback>
4426
4427 <callback id="jvmtiArrayPrimitiveValueCallback" since="1.1">
4428 <jint/>
4429 <synopsis>Array Primitive Value Callback</synopsis>
4430 <description>
4431 Agent supplied callback function.
4432 Describes the values in an array of a primitive type.
4433 <p/>
4434 This function should return a bit vector of the desired
4435 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>.
4436 This will determine if the entire iteration should be aborted
4437 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored).
4438 <p/>
4439 See the <internallink id="heapCallbacks">heap callback
4440 function restrictions</internallink>.
4441 </description>
4442 <parameters>
4443 <param id="class_tag">
4444 <jlong/>
4445 <description>
4446 The tag of the class of the array object (zero if the class is not tagged).
4447 </description>
4448 </param>
4449 <param id="size">
4450 <jlong/>
4451 <description>
4452 Size of the array (in bytes).
4453 See <functionlink id="GetObjectSize"/>.
4454 </description>
4455 </param>
4456 <param id="tag_ptr">
4457 <outptr><jlong/></outptr>
4458 <description>
4459 Points to the tag of the array object, or zero if the object is not
4460 tagged.
4461 To set the tag value to be associated with the object
4462 the agent sets the <code>jlong</code> pointed to by the parameter.
4463 </description>
4464 </param>
4465 <param id="element_count">
4466 <jint/>
4467 <description>
4468 The length of the primitive array.
4469 </description>
4470 </param>
4471 <param id="element_type">
4472 <enum>jvmtiPrimitiveType</enum>
4473 <description>
4474 The type of the elements of the array.
4475 </description>
4476 </param>
4477 <param id="elements">
4478 <vmbuf><void/></vmbuf>
4479 <description>
4480 The elements of the array in a packed array of <code>element_count</code>
4481 items of <code>element_type</code> size each.
4482 </description>
4483 </param>
4484 <param id="user_data">
4485 <outptr><void/></outptr>
4486 <description>
4487 The user supplied data that was passed into the iteration function.
4488 </description>
4489 </param>
4490 </parameters>
4491 </callback>
4492
4493 <callback id="jvmtiStringPrimitiveValueCallback" since="1.1">
4494 <jint/>
4495 <synopsis>String Primitive Value Callback</synopsis>
4496 <description>
4497 Agent supplied callback function.
4498 Describes the value of a java.lang.String.
4499 <p/>
4500 This function should return a bit vector of the desired
4501 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>.
4502 This will determine if the entire iteration should be aborted
4503 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored).
4504 <p/>
4505 See the <internallink id="heapCallbacks">heap callback
4506 function restrictions</internallink>.
4507 </description>
4508 <parameters>
4509 <param id="class_tag">
4510 <jlong/>
4511 <description>
4512 The tag of the class of the String class (zero if the class is not tagged).
4513 <issue>Is this needed?</issue>
4514 </description>
4515 </param>
4516 <param id="size">
4517 <jlong/>
4518 <description>
4519 Size of the string (in bytes).
4520 See <functionlink id="GetObjectSize"/>.
4521 </description>
4522 </param>
4523 <param id="tag_ptr">
4524 <outptr><jlong/></outptr>
4525 <description>
4526 Points to the tag of the String object, or zero if the object is not
4527 tagged.
4528 To set the tag value to be associated with the object
4529 the agent sets the <code>jlong</code> pointed to by the parameter.
4530 </description>
4531 </param>
4532 <param id="value">
4533 <vmbuf><jchar/></vmbuf>
4534 <description>
4535 The value of the String, encoded as a Unicode string.
4536 </description>
4537 </param>
4538 <param id="value_length">
4539 <jint/>
4540 <description>
4541 The length of the string.
4542 The length is equal to the number of 16-bit Unicode
4543 characters in the string.
4544 </description>
4545 </param>
4546 <param id="user_data">
4547 <outptr><void/></outptr>
4548 <description>
4549 The user supplied data that was passed into the iteration function.
4550 </description>
4551 </param>
4552 </parameters>
4553 </callback>
4554
4555
4556 <callback id="jvmtiReservedCallback" since="1.1">
4557 <jint/>
4558 <synopsis>reserved for future use Callback</synopsis>
4559 <description>
4560 Placeholder -- reserved for future use.
4561 </description>
4562 <parameters>
4563 </parameters>
4564 </callback>
4565
4566 <function id="FollowReferences" num="115" since="1.1">
4567 <synopsis>Follow References</synopsis>
4568 <description>
4569 This function initiates a traversal over the objects that are
4570 directly and indirectly reachable from the specified object or,
4571 if <code>initial_object</code> is not specified, all objects
4572 reachable from the heap roots.
4573 The heap root are the set of system classes,
4574 JNI globals, references from platform thread stacks, and other objects used as roots
4575 for the purposes of garbage collection.
4576 <p/>
4577 This function operates by traversing the reference graph.
4578 Let <i>A</i>, <i>B</i>, ... represent objects.
4579 When a reference from <i>A</i> to <i>B</i> is traversed,
4580 when a reference from a heap root to <i>B</i> is traversed,
4581 or when <i>B</i> is specified as the <paramlink id="initial_object"/>,
4582 then <i>B</i> is said to be <i>visited</i>.
4583 A reference from <i>A</i> to <i>B</i> is not traversed until <i>A</i>
4584 is visited.
4585 References are reported in the same order that the references are traversed.
4586 Object references are reported by invoking the agent supplied
4587 callback function <functionlink id="jvmtiHeapReferenceCallback"/>.
4588 In a reference from <i>A</i> to <i>B</i>, <i>A</i> is known
4589 as the <i>referrer</i> and <i>B</i> as the <i>referree</i>.
4590 The callback is invoked exactly once for each reference from a referrer;
4591 this is true even if there are reference cycles or multiple paths to
4592 the referrer.
4593 There may be more than one reference between a referrer and a referree,
4594 each reference is reported.
4595 These references may be distinguished by examining the
4596 <datalink
4597 id="jvmtiHeapReferenceCallback.reference_kind"><code>reference_kind</code></datalink>
4598 and
4599 <datalink
4600 id="jvmtiHeapReferenceCallback.reference_info"><code>reference_info</code></datalink>
4601 parameters of the <functionlink id="jvmtiHeapReferenceCallback"/> callback.
4602 <p/>
4603 This function reports a Java programming language view of object references,
4604 not a virtual machine implementation view. The following object references
4605 are reported when they are non-null:
4606 <ul>
4607 <li>Instance objects report references to each non-primitive instance fields
4608 (including inherited fields).</li>
4609 <li>Instance objects report a reference to the object type (class).</li>
4610 <li>Classes report a reference to the superclass and directly
4611 implemented/extended interfaces.</li>
4612 <li>Classes report a reference to the class loader, protection domain,
4613 signers, and resolved entries in the constant pool.</li>
4614 <li>Classes report a reference to each directly declared non-primitive
4615 static field.</li>
4616 <li>Arrays report a reference to the array type (class) and each
4617 array element.</li>
4618 <li>Primitive arrays report a reference to the array type.</li>
4619 </ul>
4620 <p/>
4621 This function can also be used to examine primitive (non-object) values.
4622 The primitive value of an array or String
4623 is reported after the object has been visited;
4624 it is reported by invoking the agent supplied callback function
4625 <functionlink id="jvmtiArrayPrimitiveValueCallback"/> or
4626 <functionlink id="jvmtiStringPrimitiveValueCallback"/>.
4627 A primitive field
4628 is reported after the object with that field is visited;
4629 it is reported by invoking the agent supplied callback function
4630 <functionlink id="jvmtiPrimitiveFieldCallback"/>.
4631 <p/>
4632 Whether a callback is provided or is null only determines
4633 whether the callback will be invoked, it does not influence
4634 which objects are visited nor does it influence whether other callbacks
4635 will be invoked.
4636 However, the
4637 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>
4638 returned by <functionlink id="jvmtiHeapReferenceCallback"/>
4639 do determine if the objects referenced by the
4640 current object as visited.
4641 The <datalink id="jvmtiHeapFilter">heap filter flags</datalink>
4642 and <paramlink id="klass"/> provided as parameters to this function
4643 do not control which objects are visited but they do control which
4644 objects and primitive values are reported by the callbacks.
4645 For example, if the only callback that was set is
4646 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> and <code>klass</code>
4647 is set to the array of bytes class, then only arrays of byte will be
4648 reported.
4649 The table below summarizes this:
4650 <p/>
4651 <table>
4652 <tr class="bgLight">
4653 <th/>
4654 <th class="centered" scope="col">Controls objects visited</th>
4655 <th class="centered" scope="col">Controls objects reported</th>
4656 <th class="centered" scope="col">Controls primitives reported</th>
4657 </tr>
4658 <tr>
4659 <th scope="row">
4660 the
4661 <datalink id="jvmtiHeapVisitControl">Heap Visit Control Flags</datalink>
4662 returned by <functionlink id="jvmtiHeapReferenceCallback"/>
4663 </th>
4664 <td class="centered">
4665 <b>Yes</b>
4666 </td>
4667 <td class="centered">
4668 <b>Yes</b>, since visits are controlled
4669 </td>
4670 <td class="centered">
4671 <b>Yes</b>, since visits are controlled
4672 </td>
4673 </tr>
4674 <tr>
4675 <th scope="row">
4676 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/>
4677 in <paramlink id="callbacks"/> set
4678 </th>
4679 <td class="centered">
4680 No
4681 </td>
4682 <td class="centered">
4683 <b>Yes</b>
4684 </td>
4685 <td class="centered">
4686 No
4687 </td>
4688 </tr>
4689 <tr>
4690 <th scope="row">
4691 <paramlink id="heap_filter"/>
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 <b>Yes</b>
4701 </td>
4702 </tr>
4703 <tr>
4704 <th scope="row">
4705 <paramlink id="klass"/>
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 </table>
4718 <p/>
4719 During the execution of this function the state of the heap
4720 does not change: no objects are allocated, no objects are
4721 garbage collected, and the state of objects (including
4722 held values) does not change.
4723 As a result, threads executing Java
4724 programming language code, threads attempting to resume the
4725 execution of Java programming language code, and threads
4726 attempting to execute JNI functions are typically stalled.
4727 </description>
4728 <origin>new</origin>
4729 <capabilities>
4730 <required id="can_tag_objects"></required>
4731 </capabilities>
4732 <parameters>
4733 <param id="heap_filter">
4734 <jint/>
4735 <description>
4736 This bit vector of
4737 <datalink id="jvmtiHeapFilter">heap filter flags</datalink>.
4738 restricts the objects for which the callback function is called.
4739 This applies to both the object and primitive callbacks.
4740 </description>
4741 </param>
4742 <param id="klass">
4743 <ptrtype>
4744 <jclass/>
4745 <nullok>callbacks are not limited to instances of a particular
4746 class</nullok>
4747 </ptrtype>
4748 <description>
4749 Callbacks are only reported when the object is an instance of
4750 this class.
4751 Objects which are instances of a subclass of <code>klass</code>
4752 are not reported.
4753 If <code>klass</code> is an interface, no objects are reported.
4754 This applies to both the object and primitive callbacks.
4755 </description>
4756 </param>
4757 <param id="initial_object">
4758 <ptrtype>
4759 <jobject/>
4760 <nullok>references are followed from the heap roots</nullok>
4761 </ptrtype>
4762 <description>
4763 The object to follow
4764 </description>
4765 </param>
4766 <param id="callbacks">
4767 <inptr>
4768 <struct>jvmtiHeapCallbacks</struct>
4769 </inptr>
4770 <description>
4771 Structure defining the set of callback functions.
4772 </description>
4773 </param>
4774 <param id="user_data">
4775 <inbuf>
4776 <void/>
4777 <nullok>a null pointer is passed as the user supplied data</nullok>
4778 </inbuf>
4779 <description>
4780 User supplied data to be passed to the callback.
4781 </description>
4782 </param>
4783 </parameters>
4784 <errors>
4785 <error id="JVMTI_ERROR_INVALID_CLASS">
4786 <paramlink id="klass"/> is not a valid class.
4787 </error>
4788 <error id="JVMTI_ERROR_INVALID_OBJECT">
4789 <paramlink id="initial_object"/> is not a valid object.
4790 </error>
4791 </errors>
4792 </function>
4793
4794
4795 <function id="IterateThroughHeap" num="116" since="1.1">
4796 <synopsis>Iterate Through Heap</synopsis>
4797 <description>
4798 Initiate an iteration over all objects in the heap.
4799 This includes both reachable and
4800 unreachable objects. Objects are visited in no particular order.
4801 <p/>
4802 Heap objects are reported by invoking the agent supplied
4803 callback function <functionlink id="jvmtiHeapIterationCallback"/>.
4804 References between objects are not reported.
4805 If only reachable objects are desired, or if object reference information
4806 is needed, use <functionlink id="FollowReferences"/>.
4807 <p/>
4808 This function can also be used to examine primitive (non-object) values.
4809 The primitive value of an array or String
4810 is reported after the object has been visited;
4811 it is reported by invoking the agent supplied callback function
4812 <functionlink id="jvmtiArrayPrimitiveValueCallback"/> or
4813 <functionlink id="jvmtiStringPrimitiveValueCallback"/>.
4814 A primitive field
4815 is reported after the object with that field is visited;
4816 it is reported by invoking the agent supplied
4817 callback function
4818 <functionlink id="jvmtiPrimitiveFieldCallback"/>.
4819 <p/>
4820 Unless the iteration is aborted by the
4821 <datalink id="jvmtiHeapVisitControl">Heap Visit Control Flags</datalink>
4822 returned by a callback, all objects in the heap are visited.
4823 Whether a callback is provided or is null only determines
4824 whether the callback will be invoked, it does not influence
4825 which objects are visited nor does it influence whether other callbacks
4826 will be invoked.
4827 The <datalink id="jvmtiHeapFilter">heap filter flags</datalink>
4828 and <paramlink id="klass"/> provided as parameters to this function
4829 do not control which objects are visited but they do control which
4830 objects and primitive values are reported by the callbacks.
4831 For example, if the only callback that was set is
4832 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> and <code>klass</code>
4833 is set to the array of bytes class, then only arrays of byte will be
4834 reported. The table below summarizes this (contrast this with
4835 <functionlink id="FollowReferences"/>):
4836 <p/>
4837 <table>
4838 <tr class="bgLight">
4839 <th/>
4840 <th class="centered" scope="col">Controls objects visited</th>
4841 <th class="centered" scope="col">Controls objects reported</th>
4842 <th class="centered" scope="col">Controls primitives reported</th>
4843 </tr>
4844 <tr>
4845 <th scope="row">
4846 the
4847 <datalink id="jvmtiHeapVisitControl">Heap Visit Control Flags</datalink>
4848 returned by <functionlink id="jvmtiHeapIterationCallback"/>
4849 </th>
4850 <td class="centered">
4851 No<br/>(unless they abort the iteration)
4852 </td>
4853 <td class="centered">
4854 No<br/>(unless they abort the iteration)
4855 </td>
4856 <td class="centered">
4857 No<br/>(unless they abort the iteration)
4858 </td>
4859 </tr>
4860 <tr>
4861 <th scope="row">
4862 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/>
4863 in <paramlink id="callbacks"/> set
4864 </th>
4865 <td class="centered">
4866 No
4867 </td>
4868 <td class="centered">
4869 <b>Yes</b>
4870 </td>
4871 <td class="centered">
4872 No
4873 </td>
4874 </tr>
4875 <tr>
4876 <th scope="row">
4877 <paramlink id="heap_filter"/>
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 <b>Yes</b>
4887 </td>
4888 </tr>
4889 <tr>
4890 <th scope="row">
4891 <paramlink id="klass"/>
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 </table>
4904 <p/>
4905 During the execution of this function the state of the heap
4906 does not change: no objects are allocated, no objects are
4907 garbage collected, and the state of objects (including
4908 held values) does not change.
4909 As a result, threads executing Java
4910 programming language code, threads attempting to resume the
4911 execution of Java programming language code, and threads
4912 attempting to execute JNI functions are typically stalled.
4913 </description>
4914 <origin>new</origin>
4915 <capabilities>
4916 <required id="can_tag_objects"></required>
4917 </capabilities>
4918 <parameters>
4919 <param id="heap_filter">
4920 <jint/>
4921 <description>
4922 This bit vector of
4923 <datalink id="jvmtiHeapFilter">heap filter flags</datalink>.
4924 restricts the objects for which the callback function is called.
4925 This applies to both the object and primitive callbacks.
4926 </description>
4927 </param>
4928 <param id="klass">
4929 <ptrtype>
4930 <jclass/>
4931 <nullok>callbacks are not limited to instances of a particular class</nullok>
4932 </ptrtype>
4933 <description>
4934 Callbacks are only reported when the object is an instance of
4935 this class.
4936 Objects which are instances of a subclass of <code>klass</code>
4937 are not reported.
4938 If <code>klass</code> is an interface, no objects are reported.
4939 This applies to both the object and primitive callbacks.
4940 </description>
4941 </param>
4942 <param id="callbacks">
4943 <inptr>
4944 <struct>jvmtiHeapCallbacks</struct>
4945 </inptr>
4946 <description>
4947 Structure defining the set callback functions.
4948 </description>
4949 </param>
4950 <param id="user_data">
4951 <inbuf>
4952 <void/>
4953 <nullok>a null pointer is passed as the user supplied data</nullok>
4954 </inbuf>
4955 <description>
4956 User supplied data to be passed to the callback.
4957 </description>
4958 </param>
4959 </parameters>
4960 <errors>
4961 <error id="JVMTI_ERROR_INVALID_CLASS">
4962 <paramlink id="klass"/> is not a valid class.
4963 </error>
4964 </errors>
4965 </function>
4966
4967 <function id="GetTag" phase="start" num="106">
4968 <synopsis>Get Tag</synopsis>
4969 <description>
4970 Retrieve the tag associated with an object.
4971 The tag is a long value typically used to store a
4972 unique identifier or pointer to object information.
4973 The tag is set with
4974 <functionlink id="SetTag"></functionlink>.
4975 Objects for which no tags have been set return a
4976 tag value of zero.
4977 </description>
4978 <origin>new</origin>
4979 <capabilities>
4980 <required id="can_tag_objects"></required>
4981 </capabilities>
4982 <parameters>
4983 <param id="object">
4984 <jobject/>
4985 <description>
4986 The object whose tag is to be retrieved.
4987 </description>
4988 </param>
4989 <param id="tag_ptr">
4990 <outptr><jlong/></outptr>
4991 <description>
4992 On return, the referenced long is set to the value
4993 of the tag.
4994 </description>
4995 </param>
4996 </parameters>
4997 <errors>
4998 </errors>
4999 </function>
5000
5001 <function id="SetTag" phase="start" num="107">
5002 <synopsis>Set Tag</synopsis>
5003 <description>
5004 Set the tag associated with an object.
5005 The tag is a long value typically used to store a
5006 unique identifier or pointer to object information.
5007 The tag is visible with
5008 <functionlink id="GetTag"></functionlink>.
5009 </description>
5010 <origin>new</origin>
5011 <capabilities>
5012 <required id="can_tag_objects"></required>
5013 </capabilities>
5014 <parameters>
5015 <param id="object">
5016 <jobject/>
5017 <description>
5018 The object whose tag is to be set.
5019 </description>
5020 </param>
5021 <param id="tag">
5022 <jlong/>
5023 <description>
5024 The new value of the tag.
5025 </description>
5026 </param>
5027 </parameters>
5028 <errors>
5029 </errors>
5030 </function>
5031
5032 <function id="GetObjectsWithTags" num="114">
5033 <synopsis>Get Objects With Tags</synopsis>
5034 <description>
5035 Return objects in the heap with the specified tags.
5036 The format is parallel arrays of objects and tags.
5037 </description>
5038 <origin>new</origin>
5039 <capabilities>
5040 <required id="can_tag_objects"></required>
5041 </capabilities>
5042 <parameters>
5043 <param id="tag_count">
5044 <jint min="0"/>
5045 <description>
5046 Number of tags to scan for.
5047 </description>
5048 </param>
5049 <param id="tags">
5050 <inbuf incount="tag_count">
5051 <jlong/>
5052 </inbuf>
5053 <description>
5054 Scan for objects with these tags.
5055 Zero is not permitted in this array.
5056 </description>
5057 </param>
5058 <param id="count_ptr">
5059 <outptr>
5060 <jint/>
5061 </outptr>
5062 <description>
5063 Return the number of objects with any of the tags
5064 in <paramlink id="tags"/>.
5065 </description>
5066 </param>
5067 <param id="object_result_ptr">
5068 <allocbuf outcount="count_ptr">
5069 <jobject/>
5070 <nullok>this information is not returned</nullok>
5071 </allocbuf>
5072 <description>
5073 Returns the array of objects with any of the tags
5074 in <paramlink id="tags"/>.
5075 </description>
5076 </param>
5077 <param id="tag_result_ptr">
5078 <allocbuf outcount="count_ptr">
5079 <jlong/>
5080 <nullok>this information is not returned</nullok>
5081 </allocbuf>
5082 <description>
5083 For each object in <paramlink id="object_result_ptr"/>,
5084 return the tag at the corresponding index.
5085 </description>
5086 </param>
5087 </parameters>
5088 <errors>
5089 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
5090 Zero is present in <paramlink id="tags"></paramlink>.
5091 </error>
5092 </errors>
5093 </function>
5094
5095 <function id="ForceGarbageCollection" num="108">
5096 <synopsis>Force Garbage Collection</synopsis>
5097 <description>
5098 Force the VM to perform a garbage collection.
5099 The garbage collection is as complete as possible.
5100 This function does not cause finalizers to be run.
5101 This function does not return until the garbage collection
5102 is finished.
5103 <p/>
5104 Although garbage collection is as complete
5105 as possible there is no guarantee that all
5106 <eventlink id="ObjectFree"/>
5107 events will have been
5108 sent by the time that this function
5109 returns. In particular, an object may be
5110 prevented from being freed because it
5111 is awaiting finalization.
5112 </description>
5113 <origin>new</origin>
5114 <capabilities>
5115 </capabilities>
5116 <parameters>
5117 </parameters>
5118 <errors>
5119 </errors>
5120 </function>
5121
5122
5123 </category>
5124
5125 <category id="Heap_1_0" label="Heap (1.0)">
5126 <intro>
5127 <b>
5128 These functions and data types were introduced in the original
5129 <jvmti/> version 1.0. They are deprecated and will be changed
5130 to return an error in a future release. They were superseded in
5131 <jvmti/> version 1.2 (Java SE 6) by more
5132 </b>
5133 <internallink id="Heap"><b>powerful and flexible versions</b></internallink>
5134 <b>
5135 which:
5136 </b>
5137 <ul>
5138 <li>
5139 <b>
5140 Allow access to primitive values (the value of Strings, arrays,
5141 and primitive fields)
5142 </b>
5143 </li>
5144 <li>
5145 <b>
5146 Allow the tag of the referrer to be set, thus enabling more
5147 efficient localized reference graph building
5148 </b>
5149 </li>
5150 <li>
5151 <b>
5152 Provide more extensive filtering abilities
5153 </b>
5154 </li>
5155 <li>
5156 <b>
5157 Are extensible, allowing their abilities to grow in future versions of <jvmti/>
5158 </b>
5159 </li>
5160 </ul>
5161 <p/>
5162 <b>Please use the </b>
5163 <internallink id="Heap"><b>current Heap functions</b></internallink>.
5164 <p/>
5165 <constants id="jvmtiHeapObjectFilter" label="Heap Object Filter Enumeration" kind="enum">
5166 <constant id="JVMTI_HEAP_OBJECT_TAGGED" num="1">
5167 Tagged objects only.
5168 </constant>
5169 <constant id="JVMTI_HEAP_OBJECT_UNTAGGED" num="2">
5170 Untagged objects only.
5171 </constant>
5172 <constant id="JVMTI_HEAP_OBJECT_EITHER" num="3">
5173 Either tagged or untagged objects.
5174 </constant>
5175 </constants>
5176
5177 <constants id="jvmtiHeapRootKind" label="Heap Root Kind Enumeration" kind="enum">
5178 <constant id="JVMTI_HEAP_ROOT_JNI_GLOBAL" num="1">
5179 JNI global reference.
5180 </constant>
5181 <constant id="JVMTI_HEAP_ROOT_SYSTEM_CLASS" num="2">
5182 System class.
5183 </constant>
5184 <constant id="JVMTI_HEAP_ROOT_MONITOR" num="3">
5185 Monitor.
5186 </constant>
5187 <constant id="JVMTI_HEAP_ROOT_STACK_LOCAL" num="4">
5188 Stack local.
5189 </constant>
5190 <constant id="JVMTI_HEAP_ROOT_JNI_LOCAL" num="5">
5191 JNI local reference.
5192 </constant>
5193 <constant id="JVMTI_HEAP_ROOT_THREAD" num="6">
5194 Thread.
5195 </constant>
5196 <constant id="JVMTI_HEAP_ROOT_OTHER" num="7">
5197 Other.
5198 </constant>
5199 </constants>
5200
5201 <constants id="jvmtiObjectReferenceKind" label="Object Reference Enumeration" kind="enum">
5202 <constant id="JVMTI_REFERENCE_CLASS" num="1">
5203 Reference from an object to its class.
5204 </constant>
5205 <constant id="JVMTI_REFERENCE_FIELD" num="2">
5206 Reference from an object to the value of one of its instance fields.
5207 For references of this kind the <code>referrer_index</code>
5208 parameter to the <internallink id="jvmtiObjectReferenceCallback">
5209 jvmtiObjectReferenceCallback</internallink> is the index of the
5210 the instance field. The index is based on the order of all the
5211 object's fields. This includes all fields of the directly declared
5212 static and instance fields in the class, and includes all fields (both
5213 public and private) fields declared in superclasses and superinterfaces.
5214 The index is thus calculated by summing the index of the field in the directly
5215 declared class (see <functionlink id="GetClassFields"/>), with the total
5216 number of fields (both public and private) declared in all superclasses
5217 and superinterfaces. The index starts at zero.
5218 </constant>
5219 <constant id="JVMTI_REFERENCE_ARRAY_ELEMENT" num="3">
5220 Reference from an array to one of its elements.
5221 For references of this kind the <code>referrer_index</code>
5222 parameter to the <internallink id="jvmtiObjectReferenceCallback">
5223 jvmtiObjectReferenceCallback</internallink> is the array index.
5224 </constant>
5225 <constant id="JVMTI_REFERENCE_CLASS_LOADER" num="4">
5226 Reference from a class to its class loader.
5227 </constant>
5228 <constant id="JVMTI_REFERENCE_SIGNERS" num="5">
5229 Reference from a class to its signers array.
5230 </constant>
5231 <constant id="JVMTI_REFERENCE_PROTECTION_DOMAIN" num="6">
5232 Reference from a class to its protection domain.
5233 </constant>
5234 <constant id="JVMTI_REFERENCE_INTERFACE" num="7">
5235 Reference from a class to one of its interfaces.
5236 </constant>
5237 <constant id="JVMTI_REFERENCE_STATIC_FIELD" num="8">
5238 Reference from a class to the value of one of its static fields.
5239 For references of this kind the <code>referrer_index</code>
5240 parameter to the <internallink id="jvmtiObjectReferenceCallback">
5241 jvmtiObjectReferenceCallback</internallink> is the index of the
5242 the static field. The index is based on the order of all the
5243 object's fields. This includes all fields of the directly declared
5244 static and instance fields in the class, and includes all fields (both
5245 public and private) fields declared in superclasses and superinterfaces.
5246 The index is thus calculated by summing the index of the field in the directly
5247 declared class (see <functionlink id="GetClassFields"/>), with the total
5248 number of fields (both public and private) declared in all superclasses
5249 and superinterfaces. The index starts at zero.
5250 Note: this definition differs from that in the <jvmti/> 1.0 Specification.
5251 <rationale>No known implementations used the 1.0 definition.</rationale>
5252 </constant>
5253 <constant id="JVMTI_REFERENCE_CONSTANT_POOL" num="9">
5254 Reference from a class to a resolved entry in the constant pool.
5255 For references of this kind the <code>referrer_index</code>
5256 parameter to the <internallink id="jvmtiObjectReferenceCallback">
5257 jvmtiObjectReferenceCallback</internallink> is the index into
5258 constant pool table of the class, starting at 1. See
5259 <vmspec chapter="4.4"/>.
5260 </constant>
5261 </constants>
5262
5263 <constants id="jvmtiIterationControl" label="Iteration Control Enumeration" kind="enum">
5264 <constant id="JVMTI_ITERATION_CONTINUE" num="1">
5265 Continue the iteration.
5266 If this is a reference iteration, follow the references of this object.
5267 </constant>
5268 <constant id="JVMTI_ITERATION_IGNORE" num="2">
5269 Continue the iteration.
5270 If this is a reference iteration, ignore the references of this object.
5271 </constant>
5272 <constant id="JVMTI_ITERATION_ABORT" num="0">
5273 Abort the iteration.
5274 </constant>
5275 </constants>
5276 </intro>
5277
5278 <callback id="jvmtiHeapObjectCallback">
5279 <enum>jvmtiIterationControl</enum>
5280 <synopsis>Heap Object Callback</synopsis>
5281 <description>
5282 Agent supplied callback function.
5283 Describes (but does not pass in) an object in the heap.
5284 <p/>
5285 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration,
5286 or <code>JVMTI_ITERATION_ABORT</code> to stop iteration.
5287 <p/>
5288 See the <internallink id="heapCallbacks">heap callback
5289 function restrictions</internallink>.
5290 </description>
5291 <parameters>
5292 <param id="class_tag">
5293 <jlong/>
5294 <description>
5295 The tag of the class of object (zero if the class is not tagged).
5296 If the object represents a runtime class,
5297 the <code>class_tag</code> is the tag
5298 associated with <code>java.lang.Class</code>
5299 (zero if <code>java.lang.Class</code> is not tagged).
5300 </description>
5301 </param>
5302 <param id="size">
5303 <jlong/>
5304 <description>
5305 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>.
5306 </description>
5307 </param>
5308 <param id="tag_ptr">
5309 <outptr><jlong/></outptr>
5310 <description>
5311 The object tag value, or zero if the object is not tagged.
5312 To set the tag value to be associated with the object
5313 the agent sets the <code>jlong</code> pointed to by the parameter.
5314 </description>
5315 </param>
5316 <param id="user_data">
5317 <outptr><void/></outptr>
5318 <description>
5319 The user supplied data that was passed into the iteration function.
5320 </description>
5321 </param>
5322 </parameters>
5323 </callback>
5324
5325 <callback id="jvmtiHeapRootCallback">
5326 <enum>jvmtiIterationControl</enum>
5327 <synopsis>Heap Root Object Callback</synopsis>
5328 <description>
5329 Agent supplied callback function.
5330 Describes (but does not pass in) an object that is a root for the purposes
5331 of garbage collection.
5332 <p/>
5333 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration,
5334 <code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing
5335 references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration.
5336 <p/>
5337 See the <internallink id="heapCallbacks">heap callback
5338 function restrictions</internallink>.
5339 </description>
5340 <parameters>
5341 <param id="root_kind">
5342 <enum>jvmtiHeapRootKind</enum>
5343 <description>
5344 The kind of heap root.
5345 </description>
5346 </param>
5347 <param id="class_tag">
5348 <jlong/>
5349 <description>
5350 The tag of the class of object (zero if the class is not tagged).
5351 If the object represents a runtime class, the <code>class_tag</code> is the tag
5352 associated with <code>java.lang.Class</code>
5353 (zero if <code>java.lang.Class</code> is not tagged).
5354 </description>
5355 </param>
5356 <param id="size">
5357 <jlong/>
5358 <description>
5359 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>.
5360 </description>
5361 </param>
5362 <param id="tag_ptr">
5363 <outptr><jlong/></outptr>
5364 <description>
5365 The object tag value, or zero if the object is not tagged.
5366 To set the tag value to be associated with the object
5367 the agent sets the <code>jlong</code> pointed to by the parameter.
5368 </description>
5369 </param>
5370 <param id="user_data">
5371 <outptr><void/></outptr>
5372 <description>
5373 The user supplied data that was passed into the iteration function.
5374 </description>
5375 </param>
5376 </parameters>
5377 </callback>
5378
5379 <callback id="jvmtiStackReferenceCallback">
5380 <enum>jvmtiIterationControl</enum>
5381 <synopsis>Stack Reference Object Callback</synopsis>
5382 <description>
5383 Agent supplied callback function.
5384 Describes (but does not pass in) an object on the stack that is a root for
5385 the purposes of garbage collection.
5386 <p/>
5387 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration,
5388 <code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing
5389 references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration.
5390 <p/>
5391 See the <internallink id="heapCallbacks">heap callback
5392 function restrictions</internallink>.
5393 </description>
5394 <parameters>
5395 <param id="root_kind">
5396 <enum>jvmtiHeapRootKind</enum>
5397 <description>
5398 The kind of root (either <code>JVMTI_HEAP_ROOT_STACK_LOCAL</code> or
5399 <code>JVMTI_HEAP_ROOT_JNI_LOCAL</code>).
5400 </description>
5401 </param>
5402 <param id="class_tag">
5403 <jlong/>
5404 <description>
5405 The tag of the class of object (zero if the class is not tagged).
5406 If the object represents a runtime class, the <code>class_tag</code> is the tag
5407 associated with <code>java.lang.Class</code>
5408 (zero if <code>java.lang.Class</code> is not tagged).
5409 </description>
5410 </param>
5411 <param id="size">
5412 <jlong/>
5413 <description>
5414 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>.
5415 </description>
5416 </param>
5417 <param id="tag_ptr">
5418 <outptr><jlong/></outptr>
5419 <description>
5420 The object tag value, or zero if the object is not tagged.
5421 To set the tag value to be associated with the object
5422 the agent sets the <code>jlong</code> pointed to by the parameter.
5423 </description>
5424 </param>
5425 <param id="thread_tag">
5426 <jlong/>
5427 <description>
5428 The tag of the thread corresponding to this stack, zero if not tagged.
5429 </description>
5430 </param>
5431 <param id="depth">
5432 <jint/>
5433 <description>
5434 The depth of the frame.
5435 </description>
5436 </param>
5437 <param id="method">
5438 <jmethodID/>
5439 <description>
5440 The method executing in this frame.
5441 </description>
5442 </param>
5443 <param id="slot">
5444 <jint/>
5445 <description>
5446 The slot number.
5447 </description>
5448 </param>
5449 <param id="user_data">
5450 <outptr><void/></outptr>
5451 <description>
5452 The user supplied data that was passed into the iteration function.
5453 </description>
5454 </param>
5455 </parameters>
5456 </callback>
5457
5458 <callback id="jvmtiObjectReferenceCallback">
5459 <enum>jvmtiIterationControl</enum>
5460 <synopsis>Object Reference Callback</synopsis>
5461 <description>
5462 Agent supplied callback function.
5463 Describes a reference from an object (the referrer) to another object
5464 (the referree).
5465 <p/>
5466 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration,
5467 <code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing
5468 references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration.
5469 <p/>
5470 See the <internallink id="heapCallbacks">heap callback
5471 function restrictions</internallink>.
5472 </description>
5473 <parameters>
5474 <param id="reference_kind">
5475 <enum>jvmtiObjectReferenceKind</enum>
5476 <description>
5477 The type of reference.
5478 </description>
5479 </param>
5480 <param id="class_tag">
5481 <jlong/>
5482 <description>
5483 The tag of the class of referree object (zero if the class is not tagged).
5484 If the referree object represents a runtime class,
5485 the <code>class_tag</code> is the tag
5486 associated with <code>java.lang.Class</code>
5487 (zero if <code>java.lang.Class</code> is not tagged).
5488 </description>
5489 </param>
5490 <param id="size">
5491 <jlong/>
5492 <description>
5493 Size of the referree object (in bytes).
5494 See <functionlink id="GetObjectSize"/>.
5495 </description>
5496 </param>
5497 <param id="tag_ptr">
5498 <outptr><jlong/></outptr>
5499 <description>
5500 The referree object tag value, or zero if the object is not
5501 tagged.
5502 To set the tag value to be associated with the object
5503 the agent sets the <code>jlong</code> pointed to by the parameter.
5504 </description>
5505 </param>
5506 <param id="referrer_tag">
5507 <jlong/>
5508 <description>
5509 The tag of the referrer object, or zero if the referrer
5510 object is not tagged.
5511 </description>
5512 </param>
5513 <param id="referrer_index">
5514 <jint/>
5515 <description>
5516 For references of type <code>JVMTI_REFERENCE_FIELD</code> or
5517 <code>JVMTI_REFERENCE_STATIC_FIELD</code> the index
5518 of the field in the referrer object. The index is based on the
5519 order of all the object's fields - see <internallink
5520 id="JVMTI_REFERENCE_FIELD">JVMTI_REFERENCE_FIELD</internallink>
5521 or <internallink
5522 id="JVMTI_REFERENCE_STATIC_FIELD">JVMTI_REFERENCE_STATIC_FIELD
5523 </internallink> for further description.
5524 <p/>
5525 For references of type <code>JVMTI_REFERENCE_ARRAY_ELEMENT</code>
5526 the array index - see <internallink id="JVMTI_REFERENCE_ARRAY_ELEMENT">
5527 JVMTI_REFERENCE_ARRAY_ELEMENT</internallink> for further description.
5528 <p/>
5529 For references of type <code>JVMTI_REFERENCE_CONSTANT_POOL</code>
5530 the index into the constant pool of the class - see
5531 <internallink id="JVMTI_REFERENCE_CONSTANT_POOL">
5532 JVMTI_REFERENCE_CONSTANT_POOL</internallink> for further
5533 description.
5534 <p/>
5535 For references of other kinds the <code>referrer_index</code> is
5536 <code>-1</code>.
5537 </description>
5538 </param>
5539 <param id="user_data">
5540 <outptr><void/></outptr>
5541 <description>
5542 The user supplied data that was passed into the iteration function.
5543 </description>
5544 </param>
5545 </parameters>
5546 </callback>
5547
5548 <function id="IterateOverObjectsReachableFromObject" num="109">
5549 <synopsis>Iterate Over Objects Reachable From Object</synopsis>
5550 <description>
5551 This function iterates over all objects that are directly
5552 and indirectly reachable from the specified object.
5553 For each object <i>A</i> (known
5554 as the referrer) with a reference to object <i>B</i> the specified
5555 callback function is called to describe the object reference.
5556 The callback is called exactly once for each reference from a referrer;
5557 this is true even if there are reference cycles or multiple paths to
5558 the referrer.
5559 There may be more than one reference between a referrer and a referree,
5560 These may be distinguished by the
5561 <datalink id="jvmtiObjectReferenceCallback.reference_kind"></datalink> and
5562 <datalink id="jvmtiObjectReferenceCallback.referrer_index"></datalink>.
5563 The callback for an object will always occur after the callback for
5564 its referrer.
5565 <p/>
5566 See <functionlink id="FollowReferences"/> for the object
5567 references which are reported.
5568 <p/>
5569 During the execution of this function the state of the heap
5570 does not change: no objects are allocated, no objects are
5571 garbage collected, and the state of objects (including
5572 held values) does not change.
5573 As a result, threads executing Java
5574 programming language code, threads attempting to resume the
5575 execution of Java programming language code, and threads
5576 attempting to execute JNI functions are typically stalled.
5577 </description>
5578 <origin>new</origin>
5579 <capabilities>
5580 <required id="can_tag_objects"></required>
5581 </capabilities>
5582 <parameters>
5583 <param id="object">
5584 <jobject/>
5585 <description>
5586 The object
5587 </description>
5588 </param>
5589 <param id="object_reference_callback">
5590 <ptrtype>
5591 <struct>jvmtiObjectReferenceCallback</struct>
5592 </ptrtype>
5593 <description>
5594 The callback to be called to describe each
5595 object reference.
5596 </description>
5597 </param>
5598 <param id="user_data">
5599 <inbuf>
5600 <void/>
5601 <nullok>a null pointer is passed as the user supplied data</nullok>
5602 </inbuf>
5603 <description>
5604 User supplied data to be passed to the callback.
5605 </description>
5606 </param>
5607 </parameters>
5608 <errors>
5609 </errors>
5610 </function>
5611
5612 <function id="IterateOverReachableObjects" num="110">
5613 <synopsis>Iterate Over Reachable Objects</synopsis>
5614 <description>
5615 This function iterates over the root objects and all objects that
5616 are directly and indirectly reachable from the root objects.
5617 The root objects comprise the set of system classes,
5618 JNI globals, references from platform thread stacks, and other objects used as roots
5619 for the purposes of garbage collection.
5620 <p/>
5621 For each root the <paramlink id="heap_root_callback"></paramlink>
5622 or <paramlink id="stack_ref_callback"></paramlink> callback is called.
5623 An object can be a root object for more than one reason and in that case
5624 the appropriate callback is called for each reason.
5625 <p/>
5626 For each object reference the <paramlink id="object_ref_callback"></paramlink>
5627 callback function is called to describe the object reference.
5628 The callback is called exactly once for each reference from a referrer;
5629 this is true even if there are reference cycles or multiple paths to
5630 the referrer.
5631 There may be more than one reference between a referrer and a referree,
5632 These may be distinguished by the
5633 <datalink id="jvmtiObjectReferenceCallback.reference_kind"></datalink> and
5634 <datalink id="jvmtiObjectReferenceCallback.referrer_index"></datalink>.
5635 The callback for an object will always occur after the callback for
5636 its referrer.
5637 <p/>
5638 See <functionlink id="FollowReferences"/> for the object
5639 references which are reported.
5640 <p/>
5641 Roots are always reported to the profiler before any object references
5642 are reported. In other words, the <paramlink id="object_ref_callback"></paramlink>
5643 callback will not be called until the appropriate callback has been called
5644 for all roots. If the <paramlink id="object_ref_callback"></paramlink> callback is
5645 specified as null then this function returns after
5646 reporting the root objects to the profiler.
5647 <p/>
5648 During the execution of this function the state of the heap
5649 does not change: no objects are allocated, no objects are
5650 garbage collected, and the state of objects (including
5651 held values) does not change.
5652 As a result, threads executing Java
5653 programming language code, threads attempting to resume the
5654 execution of Java programming language code, and threads
5655 attempting to execute JNI functions are typically stalled.
5656 </description>
5657 <origin>new</origin>
5658 <capabilities>
5659 <required id="can_tag_objects"></required>
5660 </capabilities>
5661 <parameters>
5662 <param id="heap_root_callback">
5663 <ptrtype>
5664 <struct>jvmtiHeapRootCallback</struct>
5665 <nullok>do not report heap roots</nullok>
5666 </ptrtype>
5667 <description>
5668 The callback function to be called for each heap root of type
5669 <code>JVMTI_HEAP_ROOT_JNI_GLOBAL</code>,
5670 <code>JVMTI_HEAP_ROOT_SYSTEM_CLASS</code>,
5671 <code>JVMTI_HEAP_ROOT_MONITOR</code>,
5672 <code>JVMTI_HEAP_ROOT_THREAD</code>, or
5673 <code>JVMTI_HEAP_ROOT_OTHER</code>.
5674 </description>
5675 </param>
5676 <param id="stack_ref_callback">
5677 <ptrtype>
5678 <struct>jvmtiStackReferenceCallback</struct>
5679 <nullok>do not report stack references</nullok>
5680 </ptrtype>
5681 <description>
5682 The callback function to be called for each heap root of
5683 <code>JVMTI_HEAP_ROOT_STACK_LOCAL</code> or
5684 <code>JVMTI_HEAP_ROOT_JNI_LOCAL</code>.
5685 </description>
5686 </param>
5687 <param id="object_ref_callback">
5688 <ptrtype>
5689 <struct>jvmtiObjectReferenceCallback</struct>
5690 <nullok>do not follow references from the root objects</nullok>
5691 </ptrtype>
5692 <description>
5693 The callback function to be called for each object reference.
5694 </description>
5695 </param>
5696 <param id="user_data">
5697 <inbuf>
5698 <void/>
5699 <nullok>a null pointer is passed as the user supplied data</nullok>
5700 </inbuf>
5701 <description>
5702 User supplied data to be passed to the callback.
5703 </description>
5704 </param>
5705 </parameters>
5706 <errors>
5707 </errors>
5708 </function>
5709
5710 <function id="IterateOverHeap" num="111">
5711 <synopsis>Iterate Over Heap</synopsis>
5712 <description>
5713 Iterate over all objects in the heap. This includes both reachable and
5714 unreachable objects.
5715 <p/>
5716 The <paramlink id="object_filter"></paramlink> parameter indicates the
5717 objects for which the callback function is called. If this parameter
5718 is <code>JVMTI_HEAP_OBJECT_TAGGED</code> then the callback will only be
5719 called for every object that is tagged. If the parameter is
5720 <code>JVMTI_HEAP_OBJECT_UNTAGGED</code> then the callback will only be
5721 for objects that are not tagged. If the parameter
5722 is <code>JVMTI_HEAP_OBJECT_EITHER</code> then the callback will be
5723 called for every object in the heap, irrespective of whether it is
5724 tagged or not.
5725 <p/>
5726 During the execution of this function the state of the heap
5727 does not change: no objects are allocated, no objects are
5728 garbage collected, and the state of objects (including
5729 held values) does not change.
5730 As a result, threads executing Java
5731 programming language code, threads attempting to resume the
5732 execution of Java programming language code, and threads
5733 attempting to execute JNI functions are typically stalled.
5734 </description>
5735 <origin>new</origin>
5736 <capabilities>
5737 <required id="can_tag_objects"></required>
5738 </capabilities>
5739 <parameters>
5740 <param id="object_filter">
5741 <enum>jvmtiHeapObjectFilter</enum>
5742 <description>
5743 Indicates the objects for which the callback function is called.
5744 </description>
5745 </param>
5746 <param id="heap_object_callback">
5747 <ptrtype>
5748 <struct>jvmtiHeapObjectCallback</struct>
5749 </ptrtype>
5750 <description>
5751 The iterator function to be called for each
5752 object matching the <paramlink id="object_filter"/>.
5753 </description>
5754 </param>
5755 <param id="user_data">
5756 <inbuf>
5757 <void/>
5758 <nullok>a null pointer is passed as the user supplied data</nullok>
5759 </inbuf>
5760 <description>
5761 User supplied data to be passed to the callback.
5762 </description>
5763 </param>
5764 </parameters>
5765 <errors>
5766 </errors>
5767 </function>
5768
5769 <function id="IterateOverInstancesOfClass" num="112">
5770 <synopsis>Iterate Over Instances Of Class</synopsis>
5771 <description>
5772 Iterate over all objects in the heap that are instances of the specified class.
5773 This includes direct instances of the specified class and
5774 instances of all subclasses of the specified class.
5775 This includes both reachable and unreachable objects.
5776 <p/>
5777 The <paramlink id="object_filter"></paramlink> parameter indicates the
5778 objects for which the callback function is called. If this parameter
5779 is <code>JVMTI_HEAP_OBJECT_TAGGED</code> then the callback will only be
5780 called for every object that is tagged. If the parameter is
5781 <code>JVMTI_HEAP_OBJECT_UNTAGGED</code> then the callback will only be
5782 called for objects that are not tagged. If the parameter
5783 is <code>JVMTI_HEAP_OBJECT_EITHER</code> then the callback will be
5784 called for every object in the heap, irrespective of whether it is
5785 tagged or not.
5786 <p/>
5787 During the execution of this function the state of the heap
5788 does not change: no objects are allocated, no objects are
5789 garbage collected, and the state of objects (including
5790 held values) does not change.
5791 As a result, threads executing Java
5792 programming language code, threads attempting to resume the
5793 execution of Java programming language code, and threads
5794 attempting to execute JNI functions are typically stalled.
5795 </description>
5796 <origin>new</origin>
5797 <capabilities>
5798 <required id="can_tag_objects"></required>
5799 </capabilities>
5800 <parameters>
5801 <param id="klass">
5802 <jclass/>
5803 <description>
5804 Iterate over objects of this class only.
5805 </description>
5806 </param>
5807 <param id="object_filter">
5808 <enum>jvmtiHeapObjectFilter</enum>
5809 <description>
5810 Indicates the objects for which the callback function is called.
5811 </description>
5812 </param>
5813 <param id="heap_object_callback">
5814 <ptrtype>
5815 <struct>jvmtiHeapObjectCallback</struct>
5816 </ptrtype>
5817 <description>
5818 The iterator function to be called for each
5819 <paramlink id="klass"/> instance matching
5820 the <paramlink id="object_filter"/>.
5821 </description>
5822 </param>
5823 <param id="user_data">
5824 <inbuf>
5825 <void/>
5826 <nullok>null pointeris passed as the user supplied data</nullok>
5827 </inbuf>
5828 <description>
5829 User supplied data to be passed to the callback.
5830 </description>
5831 </param>
5832 </parameters>
5833 <errors>
5834 </errors>
5835 </function>
5836
5837 </category>
5838
5839 <category id="local" label="Local Variable">
5840
5841 <intro>
5842 These functions are used to retrieve or set the value of a local variable.
5843 The variable is identified by the depth of the frame containing its
5844 value and the variable's slot number within that frame.
5845 The mapping of variables to
5846 slot numbers can be obtained with the function
5847 <functionlink id="GetLocalVariableTable"></functionlink>.
5848 <p/>
5849 The <code>GetLocalXXX</code> functions may be used to retrieve the value of
5850 a local variable contained in the frame of a virtual thread.
5851 The <code>SetLocalXXX</code> functions may be used to set the value of a
5852 local variable in the topmost frame of a virtual thread suspended at an event.
5853 An implementation may support setting locals in other cases.
5854 </intro>
5855
5856 <function id="GetLocalObject" num="21">
5857 <synopsis>Get Local Variable - Object</synopsis>
5858 <description>
5859 This function can be used to retrieve the value of a local
5860 variable whose type is <code>Object</code> or a subclass of <code>Object</code>.
5861 <p/>
5862 The specified thread must be suspended or must be the current thread.
5863 </description>
5864 <origin>jvmdi</origin>
5865 <capabilities>
5866 <required id="can_access_local_variables"></required>
5867 </capabilities>
5868 <parameters>
5869 <param id="thread">
5870 <jthread null="current" frame="frame" impl="noconvert"/>
5871 <description>
5872 The thread of the frame containing the variable's value.
5873 </description>
5874 </param>
5875 <param id="depth">
5876 <jframeID thread="thread"/>
5877 <description>
5878 The depth of the frame containing the variable's value.
5879 </description>
5880 </param>
5881 <param id="slot">
5882 <jint/>
5883 <description>
5884 The variable's slot number.
5885 </description>
5886 </param>
5887 <param id="value_ptr">
5888 <outptr><jobject/></outptr>
5889 <description>
5890 On return, points to the variable's value.
5891 When preview features are enabled, if the requested local is the
5892 "<code>this</code>" object, and "<code>this</code>" is a value
5893 object under construction, the value_ptr is set to a snapshot
5894 of the "<code>this</code>" object that represents the value
5895 object's state at the point the snapshot is taken.
5896 </description>
5897 </param>
5898 </parameters>
5899 <errors>
5900 <error id="JVMTI_ERROR_INVALID_SLOT">
5901 Invalid <code>slot</code>.
5902 </error>
5903 <error id="JVMTI_ERROR_TYPE_MISMATCH">
5904 The variable type is not
5905 <code>Object</code> or a subclass of <code>Object</code>.
5906 </error>
5907 <error id="JVMTI_ERROR_OPAQUE_FRAME">
5908 The implementation is unable to get the frame locals
5909 (e.g. the frame at <code>depth</code> is executing a native method).
5910 </error>
5911 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
5912 Thread was not suspended and was not the current thread.
5913 </error>
5914 </errors>
5915 </function>
5916
5917 <function id="GetLocalInstance" num="155" since="1.2">
5918 <synopsis>Get Local Instance</synopsis>
5919 <description>
5920 This function can be used to retrieve the value of the local object
5921 variable at slot 0 (the "<code>this</code>" object) from non-static
5922 frames. This function can retrieve the "<code>this</code>" object from
5923 native method frames, whereas <code>GetLocalObject()</code> would
5924 return <code>JVMTI_ERROR_OPAQUE_FRAME</code> in those cases.
5925 <p/>
5926 The specified thread must be suspended or must be the current thread.
5927 </description>
5928 <origin>new</origin>
5929 <capabilities>
5930 <required id="can_access_local_variables"></required>
5931 </capabilities>
5932 <parameters>
5933 <param id="thread">
5934 <jthread null="current" frame="frame" impl="noconvert"/>
5935 <description>
5936 The thread of the frame containing the variable's value.
5937 </description>
5938 </param>
5939 <param id="depth">
5940 <jframeID thread="thread"/>
5941 <description>
5942 The depth of the frame containing the variable's value.
5943 </description>
5944 </param>
5945 <param id="value_ptr">
5946 <outptr><jobject/></outptr>
5947 <description>
5948 On return, points to the variable's value.
5949 When preview features are enabled, and the local instance is a value
5950 object under construction, the value_ptr is set to a snapshot
5951 of the "<code>this</code>" object that represents the value
5952 object's state at the point the snapshot is taken.
5953 </description>
5954 </param>
5955 </parameters>
5956 <errors>
5957 <error id="JVMTI_ERROR_INVALID_SLOT">
5958 If the specified frame is a static method frame.
5959 </error>
5960 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
5961 Thread was not suspended and was not the current thread.
5962 </error>
5963 </errors>
5964 </function>
5965 <function id="GetLocalInt" num="22">
5966 <synopsis>Get Local Variable - Int</synopsis>
5967 <description>
5968 This function can be used to retrieve the value of a local
5969 variable whose type is <code>int</code>,
5970 <code>short</code>, <code>char</code>, <code>byte</code>, or
5971 <code>boolean</code>.
5972 <p/>
5973 The specified thread must be suspended or must be the current thread.
5974 </description>
5975 <origin>jvmdi</origin>
5976 <capabilities>
5977 <required id="can_access_local_variables"></required>
5978 </capabilities>
5979 <parameters>
5980 <param id="thread">
5981 <jthread null="current" frame="frame" impl="noconvert"/>
5982 <description>
5983 The thread of the frame containing the variable's value.
5984 </description>
5985 </param>
5986 <param id="depth">
5987 <jframeID thread="thread"/>
5988 <description>
5989 The depth of the frame containing the variable's value.
5990 </description>
5991 </param>
5992 <param id="slot">
5993 <jint/>
5994 <description>
5995 The variable's slot number.
5996 </description>
5997 </param>
5998 <param id="value_ptr">
5999 <outptr><jint/></outptr>
6000 <description>
6001 On return, points to the variable's value.
6002 </description>
6003 </param>
6004 </parameters>
6005 <errors>
6006 <error id="JVMTI_ERROR_INVALID_SLOT">
6007 Invalid <code>slot</code>.
6008 </error>
6009 <error id="JVMTI_ERROR_TYPE_MISMATCH">
6010 The variable type is not
6011 <code>int</code>, <code>short</code>,
6012 <code>char</code>, <code>byte</code>, or
6013 <code>boolean</code>.
6014 </error>
6015 <error id="JVMTI_ERROR_OPAQUE_FRAME">
6016 The implementation is unable to get the frame locals
6017 (e.g. the frame at <code>depth</code> is executing a native method).
6018 </error>
6019 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
6020 Thread was not suspended and was not the current thread.
6021 </error>
6022 </errors>
6023 </function>
6024
6025 <function id="GetLocalLong" num="23">
6026 <synopsis>Get Local Variable - Long</synopsis>
6027 <description>
6028 This function can be used to retrieve the value of a local
6029 variable whose type is <code>long</code>.
6030 <p/>
6031 The specified thread must be suspended or must be the current thread.
6032 </description>
6033 <origin>jvmdi</origin>
6034 <capabilities>
6035 <required id="can_access_local_variables"></required>
6036 </capabilities>
6037 <parameters>
6038 <param id="thread">
6039 <jthread null="current" frame="frame" impl="noconvert"/>
6040 <description>
6041 The thread of the frame containing the variable's value.
6042 </description>
6043 </param>
6044 <param id="depth">
6045 <jframeID thread="thread"/>
6046 <description>
6047 The depth of the frame containing the variable's value.
6048 </description>
6049 </param>
6050 <param id="slot">
6051 <jint/>
6052 <description>
6053 The variable's slot number.
6054 </description>
6055 </param>
6056 <param id="value_ptr">
6057 <outptr><jlong/></outptr>
6058 <description>
6059 On return, points to the variable's value.
6060 </description>
6061 </param>
6062 </parameters>
6063 <errors>
6064 <error id="JVMTI_ERROR_INVALID_SLOT">
6065 Invalid <code>slot</code>.
6066 </error>
6067 <error id="JVMTI_ERROR_TYPE_MISMATCH">
6068 The variable type is not <code>long</code>.
6069 </error>
6070 <error id="JVMTI_ERROR_OPAQUE_FRAME">
6071 The implementation is unable to get the frame locals
6072 (e.g. the frame at <code>depth</code> is executing a native method).
6073 </error>
6074 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
6075 Thread was not suspended and was not the current thread.
6076 </error>
6077 </errors>
6078 </function>
6079
6080 <function id="GetLocalFloat" num="24">
6081 <synopsis>Get Local Variable - Float</synopsis>
6082 <description>
6083 This function can be used to retrieve the value of a local
6084 variable whose type is <code>float</code>.
6085 <p/>
6086 The specified thread must be suspended or must be the current thread.
6087 </description>
6088 <origin>jvmdi</origin>
6089 <capabilities>
6090 <required id="can_access_local_variables"></required>
6091 </capabilities>
6092 <parameters>
6093 <param id="thread">
6094 <jthread null="current" frame="frame" impl="noconvert"/>
6095 <description>
6096 The thread of the frame containing the variable's value.
6097 </description>
6098 </param>
6099 <param id="depth">
6100 <jframeID thread="thread"/>
6101 <description>
6102 The depth of the frame containing the variable's value.
6103 </description>
6104 </param>
6105 <param id="slot">
6106 <jint/>
6107 <description>
6108 The variable's slot number.
6109 </description>
6110 </param>
6111 <param id="value_ptr">
6112 <outptr><jfloat/></outptr>
6113 <description>
6114 On return, points to the variable's value.
6115 </description>
6116 </param>
6117 </parameters>
6118 <errors>
6119 <error id="JVMTI_ERROR_INVALID_SLOT">
6120 Invalid <code>slot</code>.
6121 </error>
6122 <error id="JVMTI_ERROR_TYPE_MISMATCH">
6123 The variable type is not <code>float</code>.
6124 </error>
6125 <error id="JVMTI_ERROR_OPAQUE_FRAME">
6126 The implementation is unable to get the frame locals
6127 (e.g. the frame at <code>depth</code> is executing a native method).
6128 </error>
6129 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
6130 Thread was not suspended and was not the current thread.
6131 </error>
6132 </errors>
6133 </function>
6134
6135 <function id="GetLocalDouble" num="25">
6136 <synopsis>Get Local Variable - Double</synopsis>
6137 <description>
6138 This function can be used to retrieve the value of a local
6139 variable whose type is <code>double</code>.
6140 <p/>
6141 The specified thread must be suspended or must be the current thread.
6142 </description>
6143 <origin>jvmdi</origin>
6144 <capabilities>
6145 <required id="can_access_local_variables"></required>
6146 </capabilities>
6147 <parameters>
6148 <param id="thread">
6149 <jthread null="current" frame="frame" impl="noconvert"/>
6150 <description>
6151 The thread of the frame containing the variable's value.
6152 </description>
6153 </param>
6154 <param id="depth">
6155 <jframeID thread="thread"/>
6156 <description>
6157 The depth of the frame containing the variable's value.
6158 </description>
6159 </param>
6160 <param id="slot">
6161 <jint/>
6162 <description>
6163 The variable's slot number.
6164 </description>
6165 </param>
6166 <param id="value_ptr">
6167 <outptr><jdouble/></outptr>
6168 <description>
6169 On return, points to the variable's value.
6170 </description>
6171 </param>
6172 </parameters>
6173 <errors>
6174 <error id="JVMTI_ERROR_INVALID_SLOT">
6175 Invalid <code>slot</code>.
6176 </error>
6177 <error id="JVMTI_ERROR_TYPE_MISMATCH">
6178 The variable type is not <code>double</code>.
6179 </error>
6180 <error id="JVMTI_ERROR_OPAQUE_FRAME">
6181 The implementation is unable to get the frame locals
6182 (e.g. the frame at <code>depth</code> is executing a native method).
6183 </error>
6184 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
6185 Thread was not suspended and was not the current thread.
6186 </error>
6187 </errors>
6188 </function>
6189
6190 <function id="SetLocalObject" num="26">
6191 <synopsis>Set Local Variable - Object</synopsis>
6192 <description>
6193 This function can be used to set the value of a local
6194 variable whose type is <code>Object</code> or a subclass of <code>Object</code>.
6195 <p/>
6196 The specified thread must be suspended or must be the current thread.
6197 </description>
6198 <origin>jvmdi</origin>
6199 <capabilities>
6200 <required id="can_access_local_variables"></required>
6201 </capabilities>
6202 <parameters>
6203 <param id="thread">
6204 <jthread null="current" frame="frame" impl="noconvert"/>
6205 <description>
6206 The thread of the frame containing the variable's value.
6207 </description>
6208 </param>
6209 <param id="depth">
6210 <jframeID thread="thread"/>
6211 <description>
6212 The depth of the frame containing the variable's value.
6213 </description>
6214 </param>
6215 <param id="slot">
6216 <jint/>
6217 <description>
6218 The variable's slot number.
6219 </description>
6220 </param>
6221 <param id="value">
6222 <jobject/>
6223 <description>
6224 The new value for the variable.
6225 </description>
6226 </param>
6227 </parameters>
6228 <errors>
6229 <error id="JVMTI_ERROR_INVALID_SLOT">
6230 Invalid <code>slot</code>.
6231 </error>
6232 <error id="JVMTI_ERROR_TYPE_MISMATCH">
6233 The variable type is not
6234 <code>Object</code> or a subclass of <code>Object</code>.
6235 </error>
6236 <error id="JVMTI_ERROR_TYPE_MISMATCH">
6237 The supplied <paramlink id="value"/> is not compatible
6238 with the variable type.
6239 </error>
6240 <error id="JVMTI_ERROR_OPAQUE_FRAME">
6241 The implementation is unable to set the frame locals
6242 (e.g. the frame at <code>depth</code> is executing a native method).
6243 </error>
6244 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
6245 Thread was not suspended and was not the current thread.
6246 </error>
6247 </errors>
6248 </function>
6249
6250 <function id="SetLocalInt" num="27">
6251 <synopsis>Set Local Variable - Int</synopsis>
6252 <description>
6253 This function can be used to set the value of a local
6254 variable whose type is <code>int</code>,
6255 <code>short</code>, <code>char</code>, <code>byte</code>, or
6256 <code>boolean</code>.
6257 <p/>
6258 The specified thread must be suspended or must be the current thread.
6259 </description>
6260 <origin>jvmdi</origin>
6261 <capabilities>
6262 <required id="can_access_local_variables"></required>
6263 </capabilities>
6264 <parameters>
6265 <param id="thread">
6266 <jthread null="current" frame="frame" impl="noconvert"/>
6267 <description>
6268 The thread of the frame containing the variable's value.
6269 </description>
6270 </param>
6271 <param id="depth">
6272 <jframeID thread="thread"/>
6273 <description>
6274 The depth of the frame containing the variable's value.
6275 </description>
6276 </param>
6277 <param id="slot">
6278 <jint/>
6279 <description>
6280 The variable's slot number.
6281 </description>
6282 </param>
6283 <param id="value">
6284 <jint/>
6285 <description>
6286 The new value for the variable.
6287 </description>
6288 </param>
6289 </parameters>
6290 <errors>
6291 <error id="JVMTI_ERROR_INVALID_SLOT">
6292 Invalid <code>slot</code>.
6293 </error>
6294 <error id="JVMTI_ERROR_TYPE_MISMATCH">
6295 The variable type is not
6296 <code>int</code>, <code>short</code>,
6297 <code>char</code>, <code>byte</code>, or
6298 <code>boolean</code>.
6299 </error>
6300 <error id="JVMTI_ERROR_OPAQUE_FRAME">
6301 The implementation is unable to set the frame locals
6302 (e.g. the frame at <code>depth</code> is executing a native method).
6303 </error>
6304 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
6305 Thread was not suspended and was not the current thread.
6306 </error>
6307 </errors>
6308 </function>
6309
6310 <function id="SetLocalLong" num="28">
6311 <synopsis>Set Local Variable - Long</synopsis>
6312 <description>
6313 This function can be used to set the value of a local
6314 variable whose type is <code>long</code>.
6315 <p/>
6316 The specified thread must be suspended or must be the current thread.
6317 </description>
6318 <origin>jvmdi</origin>
6319 <capabilities>
6320 <required id="can_access_local_variables"></required>
6321 </capabilities>
6322 <parameters>
6323 <param id="thread">
6324 <jthread null="current" frame="frame" impl="noconvert"/>
6325 <description>
6326 The thread of the frame containing the variable's value.
6327 </description>
6328 </param>
6329 <param id="depth">
6330 <jframeID thread="thread"/>
6331 <description>
6332 The depth of the frame containing the variable's value.
6333 </description>
6334 </param>
6335 <param id="slot">
6336 <jint/>
6337 <description>
6338 The variable's slot number.
6339 </description>
6340 </param>
6341 <param id="value">
6342 <jlong/>
6343 <description>
6344 The new value for the variable.
6345 </description>
6346 </param>
6347 </parameters>
6348 <errors>
6349 <error id="JVMTI_ERROR_INVALID_SLOT">
6350 Invalid <code>slot</code>.
6351 </error>
6352 <error id="JVMTI_ERROR_TYPE_MISMATCH">
6353 The variable type is not <code>long</code>.
6354 </error>
6355 <error id="JVMTI_ERROR_OPAQUE_FRAME">
6356 The implementation is unable to set the frame locals
6357 (e.g. the frame at <code>depth</code> is executing a native method).
6358 </error>
6359 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
6360 Thread was not suspended and was not the current thread.
6361 </error>
6362 </errors>
6363 </function>
6364
6365 <function id="SetLocalFloat" num="29">
6366 <synopsis>Set Local Variable - Float</synopsis>
6367 <description>
6368 This function can be used to set the value of a local
6369 variable whose type is <code>float</code>.
6370 <p/>
6371 The specified thread must be suspended or must be the current thread.
6372 </description>
6373 <origin>jvmdi</origin>
6374 <capabilities>
6375 <required id="can_access_local_variables"></required>
6376 </capabilities>
6377 <parameters>
6378 <param id="thread">
6379 <jthread null="current" frame="frame" impl="noconvert"/>
6380 <description>
6381 The thread of the frame containing the variable's value.
6382 </description>
6383 </param>
6384 <param id="depth">
6385 <jframeID thread="thread"/>
6386 <description>
6387 The depth of the frame containing the variable's value.
6388 </description>
6389 </param>
6390 <param id="slot">
6391 <jint/>
6392 <description>
6393 The variable's slot number.
6394 </description>
6395 </param>
6396 <param id="value">
6397 <jfloat/>
6398 <description>
6399 The new value for the variable.
6400 </description>
6401 </param>
6402 </parameters>
6403 <errors>
6404 <error id="JVMTI_ERROR_INVALID_SLOT">
6405 Invalid <code>slot</code>.
6406 </error>
6407 <error id="JVMTI_ERROR_TYPE_MISMATCH">
6408 The variable type is not <code>float</code>.
6409 </error>
6410 <error id="JVMTI_ERROR_OPAQUE_FRAME">
6411 The implementation is unable to set the frame locals
6412 (e.g. the frame at <code>depth</code> is executing a native method).
6413 </error>
6414 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
6415 Thread was not suspended and was not the current thread.
6416 </error>
6417 </errors>
6418 </function>
6419
6420 <function id="SetLocalDouble" num="30">
6421 <synopsis>Set Local Variable - Double</synopsis>
6422 <description>
6423 This function can be used to set the value of a local
6424 variable whose type is <code>double</code>.
6425 <p/>
6426 The specified thread must be suspended or must be the current thread.
6427 </description>
6428 <origin>jvmdi</origin>
6429 <capabilities>
6430 <required id="can_access_local_variables"></required>
6431 </capabilities>
6432 <parameters>
6433 <param id="thread">
6434 <jthread null="current" frame="frame" impl="noconvert"/>
6435 <description>
6436 The thread of the frame containing the variable's value.
6437 </description>
6438 </param>
6439 <param id="depth">
6440 <jframeID thread="thread"/>
6441 <description>
6442 The depth of the frame containing the variable's value.
6443 </description>
6444 </param>
6445 <param id="slot">
6446 <jint/>
6447 <description>
6448 The variable's slot number.
6449 </description>
6450 </param>
6451 <param id="value">
6452 <jdouble/>
6453 <description>
6454 The new value for the variable.
6455 </description>
6456 </param>
6457 </parameters>
6458 <errors>
6459 <error id="JVMTI_ERROR_INVALID_SLOT">
6460 Invalid <code>slot</code>.
6461 </error>
6462 <error id="JVMTI_ERROR_TYPE_MISMATCH">
6463 The variable type is not <code>double</code>.
6464 </error>
6465 <error id="JVMTI_ERROR_OPAQUE_FRAME">
6466 The implementation is unable to set the frame locals
6467 (e.g. the frame at <code>depth</code> is executing a native method).
6468 </error>
6469 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
6470 Thread was not suspended and was not the current thread.
6471 </error>
6472 </errors>
6473 </function>
6474 </category>
6475
6476 <category id="breakpointCategory" label="Breakpoint">
6477
6478 <intro>
6479 </intro>
6480
6481 <function id="SetBreakpoint" num="38">
6482 <synopsis>Set Breakpoint</synopsis>
6483 <description>
6484 Set a breakpoint at the instruction indicated by
6485 <code>method</code> and <code>location</code>.
6486 An instruction can only have one breakpoint.
6487 <p/>
6488 Whenever the designated instruction is about to be executed, a
6489 <eventlink id="Breakpoint"></eventlink> event is generated.
6490 </description>
6491 <origin>jvmdi</origin>
6492 <capabilities>
6493 <required id="can_generate_breakpoint_events"></required>
6494 </capabilities>
6495 <parameters>
6496 <param id="klass">
6497 <jclass method="method"/>
6498 <description>
6499 The class in which to set the breakpoint
6500 </description>
6501 </param>
6502 <param id="method">
6503 <jmethodID class="klass"/>
6504 <description>
6505 The method in which to set the breakpoint
6506 </description>
6507 </param>
6508 <param id="location">
6509 <jlocation/>
6510 <description>
6511 the index of the instruction at which to set the breakpoint
6512
6513 </description>
6514 </param>
6515 </parameters>
6516 <errors>
6517 <error id="JVMTI_ERROR_DUPLICATE">
6518 The designated bytecode already has a breakpoint.
6519 </error>
6520 </errors>
6521 </function>
6522
6523 <function id="ClearBreakpoint" num="39">
6524 <synopsis>Clear Breakpoint</synopsis>
6525 <description>
6526 Clear the breakpoint at the bytecode indicated by
6527 <code>method</code> and <code>location</code>.
6528 </description>
6529 <origin>jvmdi</origin>
6530 <capabilities>
6531 <required id="can_generate_breakpoint_events"></required>
6532 </capabilities>
6533 <parameters>
6534 <param id="klass">
6535 <jclass method="method"/>
6536 <description>
6537 The class in which to clear the breakpoint
6538 </description>
6539 </param>
6540 <param id="method">
6541 <jmethodID class="klass"/>
6542 <description>
6543 The method in which to clear the breakpoint
6544 </description>
6545 </param>
6546 <param id="location">
6547 <jlocation/>
6548 <description>
6549 the index of the instruction at which to clear the breakpoint
6550 </description>
6551 </param>
6552 </parameters>
6553 <errors>
6554 <error id="JVMTI_ERROR_NOT_FOUND">
6555 There's no breakpoint at the designated bytecode.
6556 </error>
6557 </errors>
6558 </function>
6559
6560 </category>
6561
6562 <category id="fieldWatch" label="Watched Field">
6563
6564 <intro>
6565 </intro>
6566
6567 <function id="SetFieldAccessWatch" num="41">
6568 <synopsis>Set Field Access Watch</synopsis>
6569 <description>
6570 Generate a <eventlink id="FieldAccess"></eventlink> event
6571 when the field specified
6572 by <code>klass</code> and
6573 <code>field</code> is about to be accessed.
6574 An event will be generated for each access of the field
6575 until it is canceled with
6576 <functionlink id="ClearFieldAccessWatch"></functionlink>.
6577 Field accesses from Java programming language code or from JNI code are watched,
6578 fields modified by other means are not watched.
6579 Note that <jvmti/> users should be aware that their own field accesses
6580 will trigger the watch.
6581 A field can only have one field access watch set.
6582 Modification of a field is not considered an access--use
6583 <functionlink id="SetFieldModificationWatch"></functionlink>
6584 to monitor modifications.
6585 </description>
6586 <origin>jvmdi</origin>
6587 <capabilities>
6588 <required id="can_generate_field_access_events"></required>
6589 </capabilities>
6590 <parameters>
6591 <param id="klass">
6592 <jclass field="field"/>
6593 <description>
6594 The class containing the field to watch
6595 </description>
6596 </param>
6597 <param id="field">
6598 <jfieldID class="klass"/>
6599 <description>
6600 The field to watch
6601
6602 </description>
6603 </param>
6604 </parameters>
6605 <errors>
6606 <error id="JVMTI_ERROR_DUPLICATE">
6607 The designated field is already being watched for accesses.
6608 </error>
6609 </errors>
6610 </function>
6611
6612 <function id="ClearFieldAccessWatch" num="42">
6613 <synopsis>Clear Field Access Watch</synopsis>
6614 <description>
6615 Cancel a field access watch previously set by
6616 <functionlink id="SetFieldAccessWatch"></functionlink>, on the
6617 field specified
6618 by <code>klass</code> and
6619 <code>field</code>.
6620 </description>
6621 <origin>jvmdi</origin>
6622 <capabilities>
6623 <required id="can_generate_field_access_events"></required>
6624 </capabilities>
6625 <parameters>
6626 <param id="klass">
6627 <jclass field="field"/>
6628 <description>
6629 The class containing the field to watch
6630 </description>
6631 </param>
6632 <param id="field">
6633 <jfieldID class="klass"/>
6634 <description>
6635 The field to watch
6636
6637 </description>
6638 </param>
6639 </parameters>
6640 <errors>
6641 <error id="JVMTI_ERROR_NOT_FOUND">
6642 The designated field is not being watched for accesses.
6643 </error>
6644 </errors>
6645 </function>
6646
6647 <function id="SetFieldModificationWatch" num="43">
6648 <synopsis>Set Field Modification Watch</synopsis>
6649 <description>
6650 Generate a <eventlink id="FieldModification"></eventlink> event
6651 when the field specified
6652 by <code>klass</code> and
6653 <code>field</code> is about to be modified.
6654 An event will be generated for each modification of the field
6655 until it is canceled with
6656 <functionlink id="ClearFieldModificationWatch"></functionlink>.
6657 Field modifications from Java programming language code or from JNI code are watched,
6658 fields modified by other means are not watched.
6659 Note that <jvmti/> users should be aware that their own field modifications
6660 will trigger the watch.
6661 A field can only have one field modification watch set.
6662 </description>
6663 <origin>jvmdi</origin>
6664 <capabilities>
6665 <required id="can_generate_field_modification_events"></required>
6666 </capabilities>
6667 <parameters>
6668 <param id="klass">
6669 <jclass field="field"/>
6670 <description>
6671 The class containing the field to watch
6672 </description>
6673 </param>
6674 <param id="field">
6675 <jfieldID class="klass"/>
6676 <description>
6677 The field to watch
6678
6679 </description>
6680 </param>
6681 </parameters>
6682 <errors>
6683 <error id="JVMTI_ERROR_DUPLICATE">
6684 The designated field is already being watched for modifications.
6685 </error>
6686 </errors>
6687 </function>
6688
6689 <function id="ClearFieldModificationWatch" num="44">
6690 <synopsis>Clear Field Modification Watch</synopsis>
6691 <description>
6692
6693 Cancel a field modification watch previously set by
6694 <functionlink id="SetFieldModificationWatch"></functionlink>, on the
6695 field specified
6696 by <code>klass</code> and
6697 <code>field</code>.
6698 </description>
6699 <origin>jvmdi</origin>
6700 <capabilities>
6701 <required id="can_generate_field_modification_events"></required>
6702 </capabilities>
6703 <parameters>
6704 <param id="klass">
6705 <jclass field="field"/>
6706 <description>
6707 The class containing the field to watch
6708 </description>
6709 </param>
6710 <param id="field">
6711 <jfieldID class="klass"/>
6712 <description>
6713 The field to watch
6714
6715 </description>
6716 </param>
6717 </parameters>
6718 <errors>
6719 <error id="JVMTI_ERROR_NOT_FOUND">
6720 The designated field is not being watched for modifications.
6721 </error>
6722 </errors>
6723 </function>
6724 </category>
6725
6726 <category id="module" label="Module">
6727
6728 <intro>
6729 </intro>
6730
6731 <function id="GetAllModules" num="3" since="9">
6732 <synopsis>Get All Modules</synopsis>
6733 <description>
6734 Return an array of all modules loaded in the virtual machine.
6735 The array includes the unnamed module for each class loader.
6736 The number of modules in the array is returned via
6737 <code>module_count_ptr</code>, and the array itself via
6738 <code>modules_ptr</code>.
6739 <p/>
6740 </description>
6741 <origin>new</origin>
6742 <capabilities>
6743 </capabilities>
6744 <parameters>
6745 <param id="module_count_ptr">
6746 <outptr><jint/></outptr>
6747 <description>
6748 On return, points to the number of returned modules.
6749 </description>
6750 </param>
6751 <param id="modules_ptr">
6752 <allocbuf outcount="module_count_ptr"><jobject/></allocbuf>
6753 <description>
6754 On return, points to an array of references, one
6755 for each module.
6756 </description>
6757 </param>
6758 </parameters>
6759 <errors>
6760 </errors>
6761 </function>
6762
6763 <function id="GetNamedModule" num="40" since="9">
6764 <synopsis>Get Named Module</synopsis>
6765 <description>
6766 Return the <code>java.lang.Module</code> object for a named
6767 module defined to a class loader that contains a given package.
6768 The module is returned via <code>module_ptr</code>.
6769 <p/>
6770 If a named module is defined to the class loader and it
6771 contains the package then that named module is returned,
6772 otherwise null is returned.
6773 <p/>
6774 </description>
6775 <origin>new</origin>
6776 <capabilities>
6777 </capabilities>
6778 <parameters>
6779 <param id="class_loader">
6780 <ptrtype>
6781 <jobject/>
6782 <nullok>the bootstrap loader is assumed</nullok>
6783 </ptrtype>
6784 <description>
6785 A class loader.
6786 If the <code>class_loader</code> is not null
6787 or a subclass of <code>java.lang.ClassLoader</code>
6788 this function returns
6789 <errorlink id="JVMTI_ERROR_ILLEGAL_ARGUMENT"></errorlink>.
6790 </description>
6791 </param>
6792 <param id="package_name">
6793 <inbuf><char/></inbuf>
6794 <description>
6795 The name of the package, encoded as a
6796 <internallink id="mUTF">modified UTF-8</internallink> string.
6797 The package name is in internal form (JVMS 4.2.1);
6798 identifiers are separated by forward slashes rather than periods.
6799 </description>
6800 </param>
6801 <param id="module_ptr">
6802 <outptr><jobject/></outptr>
6803 <description>
6804 On return, points to a <code>java.lang.Module</code> object
6805 or points to null.
6806 </description>
6807 </param>
6808 </parameters>
6809 <errors>
6810 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
6811 If class loader is not null and is not a class loader object.
6812 </error>
6813 </errors>
6814 </function>
6815
6816 <function id="AddModuleReads" num="94" since="9">
6817 <synopsis>Add Module Reads</synopsis>
6818 <description>
6819 Update a module to read another module. This function is a no-op
6820 when <paramlink id="module"></paramlink> is an unnamed module.
6821 This function facilitates the instrumentation of code
6822 in named modules where that instrumentation requires
6823 expanding the set of modules that a module reads.
6824 </description>
6825 <origin>new</origin>
6826 <capabilities>
6827 </capabilities>
6828 <parameters>
6829 <param id="module">
6830 <ptrtype><jobject/></ptrtype>
6831 <description>
6832 The module to update.
6833 </description>
6834 </param>
6835 <param id="to_module">
6836 <ptrtype><jobject/></ptrtype>
6837 <description>
6838 The additional module to read.
6839 </description>
6840 </param>
6841 </parameters>
6842 <errors>
6843 <error id="JVMTI_ERROR_INVALID_MODULE">
6844 If <paramlink id="module"></paramlink> is not a module object.
6845 </error>
6846 <error id="JVMTI_ERROR_INVALID_MODULE">
6847 If <paramlink id="to_module"></paramlink> is not a module object.
6848 </error>
6849 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">
6850 if the module cannot be modified.
6851 See <functionlink id="IsModifiableModule"/>.
6852 </error>
6853 </errors>
6854 </function>
6855
6856 <function id="AddModuleExports" num="95" since="9">
6857 <synopsis>Add Module Exports</synopsis>
6858 <description>
6859 Update a module to export a package to another module.
6860 This function is a no-op when <paramlink id="module"></paramlink>
6861 is an unnamed module or an open module.
6862 This function facilitates the instrumentation of code
6863 in named modules where that instrumentation requires
6864 expanding the set of packages that a module exports.
6865 </description>
6866 <origin>new</origin>
6867 <capabilities>
6868 </capabilities>
6869 <parameters>
6870 <param id="module">
6871 <ptrtype><jobject/></ptrtype>
6872 <description>
6873 The module to update.
6874 </description>
6875 </param>
6876 <param id="pkg_name">
6877 <inbuf><char/></inbuf>
6878 <description>
6879 The exported package name.
6880 </description>
6881 </param>
6882 <param id="to_module">
6883 <ptrtype><jobject/></ptrtype>
6884 <description>
6885 The module the package is exported to.
6886 If the <code>to_module</code> is not a subclass of
6887 <code>java.lang.Module</code> this function returns
6888 <errorlink id="JVMTI_ERROR_INVALID_MODULE"></errorlink>.
6889 </description>
6890 </param>
6891 </parameters>
6892 <errors>
6893 <error id="JVMTI_ERROR_INVALID_MODULE">
6894 If <paramlink id="module"></paramlink> is not a module object.
6895 </error>
6896 <error id="JVMTI_ERROR_INVALID_MODULE">
6897 If <paramlink id="to_module"></paramlink> is not a module object.
6898 </error>
6899 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
6900 If the package <paramlink id="pkg_name"></paramlink>
6901 does not belong to the module.
6902 </error>
6903 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">
6904 if the module cannot be modified.
6905 See <functionlink id="IsModifiableModule"/>.
6906 </error>
6907 </errors>
6908 </function>
6909
6910 <function id="AddModuleOpens" num="96" since="9">
6911 <synopsis>Add Module Opens</synopsis>
6912 <description>
6913 Update a module to open a package to another module.
6914 This function is a no-op when <paramlink id="module"></paramlink>
6915 is an unnamed module or an open module.
6916 This function facilitates the instrumentation of code
6917 in modules where that instrumentation requires
6918 expanding the set of packages that a module opens to
6919 other modules.
6920 </description>
6921 <origin>new</origin>
6922 <capabilities>
6923 </capabilities>
6924 <parameters>
6925 <param id="module">
6926 <ptrtype><jobject/></ptrtype>
6927 <description>
6928 The module to update.
6929 </description>
6930 </param>
6931 <param id="pkg_name">
6932 <inbuf><char/></inbuf>
6933 <description>
6934 The package name of the package to open.
6935 </description>
6936 </param>
6937 <param id="to_module">
6938 <ptrtype><jobject/></ptrtype>
6939 <description>
6940 The module with the package to open.
6941 If the <code>to_module</code> is not a subclass of
6942 <code>java.lang.Module</code> this function returns
6943 <errorlink id="JVMTI_ERROR_INVALID_MODULE"></errorlink>.
6944 </description>
6945 </param>
6946 </parameters>
6947 <errors>
6948 <error id="JVMTI_ERROR_INVALID_MODULE">
6949 If <paramlink id="module"></paramlink> is not a module object.
6950 </error>
6951 <error id="JVMTI_ERROR_INVALID_MODULE">
6952 If <paramlink id="to_module"></paramlink> is not a module object.
6953 </error>
6954 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
6955 If the package <paramlink id="pkg_name"></paramlink>
6956 does not belong to the module.
6957 </error>
6958 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">
6959 if the module cannot be modified.
6960 See <functionlink id="IsModifiableModule"/>.
6961 </error>
6962 </errors>
6963 </function>
6964
6965 <function id="AddModuleUses" num="97" since="9">
6966 <synopsis>Add Module Uses</synopsis>
6967 <description>
6968 Updates a module to add a service to the set of services that
6969 a module uses. This function is a no-op when the module
6970 is an unnamed module.
6971 This function facilitates the instrumentation of code
6972 in named modules where that instrumentation requires
6973 expanding the set of services that a module is using.
6974 </description>
6975 <origin>new</origin>
6976 <capabilities>
6977 </capabilities>
6978 <parameters>
6979 <param id="module">
6980 <ptrtype><jobject/></ptrtype>
6981 <description>
6982 The module to update.
6983 </description>
6984 </param>
6985 <param id="service">
6986 <ptrtype><jclass/></ptrtype>
6987 <description>
6988 The service to use.
6989 </description>
6990 </param>
6991 </parameters>
6992 <errors>
6993 <error id="JVMTI_ERROR_INVALID_MODULE">
6994 If <paramlink id="module"></paramlink> is not a module object.
6995 </error>
6996 <error id="JVMTI_ERROR_INVALID_CLASS">
6997 If <paramlink id="service"></paramlink> is not a class object.
6998 </error>
6999 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">
7000 if the module cannot be modified.
7001 See <functionlink id="IsModifiableModule"/>.
7002 </error>
7003 </errors>
7004 </function>
7005
7006 <function id="AddModuleProvides" num="98" since="9">
7007 <synopsis>Add Module Provides</synopsis>
7008 <description>
7009 Updates a module to add a service to the set of services that
7010 a module provides. This function is a no-op when the module
7011 is an unnamed module.
7012 This function facilitates the instrumentation of code
7013 in named modules where that instrumentation requires
7014 changes to the services that are provided.
7015 </description>
7016 <origin>new</origin>
7017 <capabilities>
7018 </capabilities>
7019 <parameters>
7020 <param id="module">
7021 <ptrtype><jobject/></ptrtype>
7022 <description>
7023 The module to update.
7024 </description>
7025 </param>
7026 <param id="service">
7027 <ptrtype><jclass/></ptrtype>
7028 <description>
7029 The service to provide.
7030 </description>
7031 </param>
7032 <param id="impl_class">
7033 <ptrtype><jclass/></ptrtype>
7034 <description>
7035 The implementation class for the provided service.
7036 </description>
7037 </param>
7038 </parameters>
7039 <errors>
7040 <error id="JVMTI_ERROR_INVALID_MODULE">
7041 If <paramlink id="module"></paramlink> is not a module object.
7042 </error>
7043 <error id="JVMTI_ERROR_INVALID_CLASS">
7044 If <paramlink id="service"></paramlink> is not a class object.
7045 </error>
7046 <error id="JVMTI_ERROR_INVALID_CLASS">
7047 If <paramlink id="impl_class"></paramlink> is not a class object.
7048 </error>
7049 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">
7050 if the module cannot be modified.
7051 See <functionlink id="IsModifiableModule"/>.
7052 </error>
7053 </errors>
7054 </function>
7055
7056 <function id="IsModifiableModule" num="99" since="9">
7057 <synopsis>Is Modifiable Module</synopsis>
7058 <description>
7059 Determines whether a module is modifiable.
7060 If a module is modifiable then this module can be updated with
7061 <functionlink id="AddModuleReads"/>, <functionlink id="AddModuleExports"/>,
7062 <functionlink id="AddModuleOpens"/>, <functionlink id="AddModuleUses"/>,
7063 and <functionlink id="AddModuleProvides"/>. If a module is not modifiable
7064 then the module can not be updated with these functions. The result of
7065 this function is always <code>JNI_TRUE</code> when called to determine
7066 if an unnamed module is modifiable.
7067 </description>
7068 <origin>new</origin>
7069 <capabilities>
7070 </capabilities>
7071 <parameters>
7072 <param id="module">
7073 <ptrtype><jobject/></ptrtype>
7074 <description>
7075 The module to query.
7076 </description>
7077 </param>
7078 <param id="is_modifiable_module_ptr">
7079 <outptr><jboolean/></outptr>
7080 <description>
7081 On return, points to the boolean result of this function.
7082 </description>
7083 </param>
7084 </parameters>
7085 <errors>
7086 <error id="JVMTI_ERROR_INVALID_MODULE">
7087 If <paramlink id="module"></paramlink> is not a module object.
7088 </error>
7089 </errors>
7090 </function>
7091
7092 </category>
7093
7094 <category id="class" label="Class">
7095 <function id="GetLoadedClasses" jkernel="yes" num="78">
7096 <synopsis>Get Loaded Classes</synopsis>
7097 <description>
7098 Return an array of all classes loaded in the virtual machine.
7099 The number of classes in the array is returned via
7100 <code>class_count_ptr</code>, and the array itself via
7101 <code>classes_ptr</code>.
7102 <p/>
7103 A class or interface creation can be triggered by one of the following:
7104 <ul>
7105 <li>By loading and deriving a class from a <code>class</code> file representation
7106 using a class loader (see <vmspec chapter="5.3"/>).</li>
7107 <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>
7108 that creates a hidden class or interface from a <code>class</code> file representation.</li>
7109 <li>By invoking methods in certain Java SE Platform APIs such as reflection.</li>
7110 </ul>
7111 <p/>
7112 An array class is created directly by the Java virtual machine. The creation
7113 can be triggered by using class loaders or by invoking methods in certain
7114 Java SE Platform APIs such as reflection.
7115 <p/>
7116 The returned list includes all classes and interfaces, including
7117 <externallink id="../api/java.base/java/lang/Class.html#isHidden()">
7118 hidden classes or interfaces</externallink>,
7119 and also array classes of all types
7120 (including arrays of primitive types).
7121 Primitive classes (for example, <code>java.lang.Integer.TYPE</code>) are
7122 <i>not</i> included in the returned list.
7123 </description>
7124 <origin>jvmdi</origin>
7125 <capabilities>
7126 </capabilities>
7127 <parameters>
7128 <param id="class_count_ptr">
7129 <outptr><jint/></outptr>
7130 <description>
7131 On return, points to the number of classes.
7132 </description>
7133 </param>
7134 <param id="classes_ptr">
7135 <allocbuf outcount="class_count_ptr"><jclass/></allocbuf>
7136 <description>
7137 On return, points to an array of references, one
7138 for each class.
7139 </description>
7140 </param>
7141 </parameters>
7142 <errors>
7143 </errors>
7144 </function>
7145
7146 <function id="GetClassLoaderClasses" jkernel="yes" num="79">
7147 <synopsis>Get Classloader Classes</synopsis>
7148 <description>
7149 Returns an array of all classes which this class loader
7150 can find by name via
7151 <externallink id="../api/java.base/java/lang/ClassLoader.html#loadClass(java.lang.String,boolean)">ClassLoader::loadClass</externallink>,
7152 <externallink id="../api/java.base/java/lang/Class.html#forName(java.lang.String,boolean,java.lang.ClassLoader)">Class::forName</externallink> and bytecode linkage.
7153 That is, all classes for which <code>initiating_loader</code>
7154 has been recorded as an initiating loader.
7155 Each class in the returned array was created by this class loader,
7156 either by defining it directly or by delegation to another class loader.
7157 See <vmspec chapter="5.3"/>.
7158 <p/>
7159 The returned list does not include
7160 <externallink id="../api/java.base/java/lang/Class.html#isHidden()">hidden
7161 classes or interfaces</externallink> or array classes whose
7162 element type is a hidden class or interface as they cannot be discovered
7163 by any class loader.
7164 <p/>
7165 The number of classes in the array is returned via
7166 <code>class_count_ptr</code>, and the array itself via
7167 <code>classes_ptr</code>.
7168 <p/>
7169 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>.
7170 </description>
7171 <origin>jvmdi</origin>
7172 <capabilities>
7173 </capabilities>
7174 <parameters>
7175 <param id="initiating_loader">
7176 <ptrtype>
7177 <jobject/>
7178 <nullok>the classes initiated by the bootstrap loader will be returned</nullok>
7179 </ptrtype>
7180 <description>
7181 An initiating class loader.
7182 </description>
7183 </param>
7184 <param id="class_count_ptr">
7185 <outptr><jint/></outptr>
7186 <description>
7187 On return, points to the number of classes.
7188 </description>
7189 </param>
7190 <param id="classes_ptr">
7191 <allocbuf outcount="class_count_ptr"><jclass/></allocbuf>
7192 <description>
7193 On return, points to an array of references, one
7194 for each class.
7195 </description>
7196 </param>
7197 </parameters>
7198 <errors>
7199 </errors>
7200 </function>
7201
7202 <function id="GetClassSignature" phase="start" num="48">
7203 <synopsis>Get Class Signature</synopsis>
7204 <description>
7205 Return the name and the generic signature of the class indicated by <code>klass</code>.
7206 <p/>
7207 If the class is a class or interface, then:
7208 <ul>
7209 <li>If the class or interface is not <externallink id="../api/java.base/java/lang/Class.html#isHidden()">hidden</externallink>,
7210 then the returned name is the <externallink id="jni/types.html#type-signatures">
7211 JNI type signature</externallink>.
7212 For example, java.util.List is "Ljava/util/List;"
7213 </li>
7214 <li>If the class or interface is <externallink id="../api/java.base/java/lang/Class.html#isHidden()">hidden</externallink>,
7215 then the returned name is a string of the form:
7216 <code>"L" + N + "." + S + ";"</code>
7217 where <code>N</code> is the binary name encoded in internal form (JVMS 4.2.1)
7218 indicated by the <code>class</code> file passed to
7219 <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>,
7220 and <code>S</code> is an unqualified name.
7221 The returned name is not a type descriptor and does not conform to JVMS 4.3.2.
7222 For example, com.foo.Foo/AnySuffix is "Lcom/foo/Foo.AnySuffix;"
7223 </li>
7224 </ul>
7225 <p/>
7226 If the class indicated by <code>klass</code> represents an array class, then
7227 the returned name is a string consisting of one or more "<code>[</code>" characters
7228 representing the depth of the array nesting, followed by the class signature
7229 of the element type. For example the class signature of java.lang.String[] is
7230 "[Ljava/lang/String;" and that of int[] is "[I".
7231 <p/>
7232 If the class indicated by <code>klass</code> represents primitive type or <code>void</code>,
7233 then the returned name is the <externallink id="jni/types.html#type-signatures">
7234 type signature character of the corresponding primitive type</externallink>.
7235 For example, java.lang.Integer.TYPE is "I".
7236 </description>
7237 <origin>jvmdiClone</origin>
7238 <capabilities>
7239 </capabilities>
7240 <parameters>
7241 <param id="klass">
7242 <jclass/>
7243 <description>
7244 The class to query.
7245 </description>
7246 </param>
7247 <param id="signature_ptr">
7248 <allocbuf>
7249 <char/>
7250 <nullok>the signature is not returned</nullok>
7251 </allocbuf>
7252 <description>
7253 On return, points to the JNI type signature of the class, encoded as a
7254 <internallink id="mUTF">modified UTF-8</internallink> string.
7255 </description>
7256 </param>
7257 <param id="generic_ptr">
7258 <allocbuf>
7259 <char/>
7260 <nullok>the generic signature is not returned</nullok>
7261 </allocbuf>
7262 <description>
7263 On return, points to the generic signature of the class, encoded as a
7264 <internallink id="mUTF">modified UTF-8</internallink> string.
7265 If there is no generic signature attribute for the class, then,
7266 on return, points to null.
7267 </description>
7268 </param>
7269 </parameters>
7270 <errors>
7271 </errors>
7272 </function>
7273
7274 <function id="GetClassStatus" phase="start" num="49">
7275 <synopsis>Get Class Status</synopsis>
7276 <description>
7277 Get the status of the class. Zero or more of the following bits can be
7278 set.
7279 <constants id="jvmtiClassStatus" label="Class Status Flags" kind="bits">
7280 <constant id="JVMTI_CLASS_STATUS_VERIFIED" num="1">
7281 Class bytecodes have been verified
7282 </constant>
7283 <constant id="JVMTI_CLASS_STATUS_PREPARED" num="2">
7284 Class preparation is complete
7285 </constant>
7286 <constant id="JVMTI_CLASS_STATUS_INITIALIZED" num="4">
7287 Class initialization is complete. Static initializer has been run.
7288 </constant>
7289 <constant id="JVMTI_CLASS_STATUS_ERROR" num="8">
7290 Error during initialization makes class unusable
7291 </constant>
7292 <constant id="JVMTI_CLASS_STATUS_ARRAY" num="16">
7293 Class is an array. If set, all other bits are zero.
7294 </constant>
7295 <constant id="JVMTI_CLASS_STATUS_PRIMITIVE" num="32">
7296 Class is a primitive class (for example, <code>java.lang.Integer.TYPE</code>).
7297 If set, all other bits are zero.
7298 </constant>
7299 </constants>
7300 </description>
7301 <origin>jvmdi</origin>
7302 <capabilities>
7303 </capabilities>
7304 <parameters>
7305 <param id="klass">
7306 <jclass/>
7307 <description>
7308 The class to query.
7309 </description>
7310 </param>
7311 <param id="status_ptr">
7312 <outptr><jint/></outptr>
7313 <description>
7314 On return, points to the current state of this class as one or
7315 more of the <internallink id="jvmtiClassStatus">class status flags</internallink>.
7316 </description>
7317 </param>
7318 </parameters>
7319 <errors>
7320 </errors>
7321 </function>
7322
7323 <function id="GetSourceFileName" phase="start" num="50">
7324 <synopsis>Get Source File Name</synopsis>
7325 <description>
7326 For the class indicated by <code>klass</code>, return the source file
7327 name via <code>source_name_ptr</code>. The returned string
7328 is a file name only and never contains a directory name.
7329 <p/>
7330 For primitive classes (for example, <code>java.lang.Integer.TYPE</code>)
7331 and for arrays this function returns
7332 <errorlink id="JVMTI_ERROR_ABSENT_INFORMATION"></errorlink>.
7333 </description>
7334 <origin>jvmdi</origin>
7335 <capabilities>
7336 <required id="can_get_source_file_name"></required>
7337 </capabilities>
7338 <parameters>
7339 <param id="klass">
7340 <jclass/>
7341 <description>
7342 The class to query.
7343 </description>
7344 </param>
7345 <param id="source_name_ptr">
7346 <allocbuf><char/></allocbuf>
7347 <description>
7348 On return, points to the class's source file name, encoded as a
7349 <internallink id="mUTF">modified UTF-8</internallink> string.
7350 </description>
7351 </param>
7352 </parameters>
7353 <errors>
7354 <error id="JVMTI_ERROR_ABSENT_INFORMATION">
7355 Class information does not include a source file name. This includes
7356 cases where the class is an array class or primitive class.
7357 </error>
7358 </errors>
7359 </function>
7360
7361 <function id="GetClassModifiers" phase="start" num="51">
7362 <synopsis>Get Class Modifiers</synopsis>
7363 <description>
7364 For the class indicated by <code>klass</code>, return the Java language
7365 modifiers and class/interface properties of the corresponding
7366 <code>java.lang.Class</code> object, via <code>modifiers_ptr</code>.
7367 <p/>
7368 The modifiers are encoded as a mask of access-flag bit values defined in
7369 <vmspec chapter="4"/>. The returned value is not necessarily the value of the
7370 access_flags item in the class file of <code>klass</code>.
7371 In particular, for member, local, or anonymous classes and interfaces, the result
7372 may include modifiers represented by access flags from the <code>InnerClasses</code>
7373 attribute, such as <code>ACC_STATIC</code>.
7374 <p/>
7375 The modifiers include, as applicable, the Java Virtual Machine constants for
7376 public, private, protected, final, static, abstract, and interface, as well as
7377 access-flag bit values for other class/interface properties encoded in the
7378 result of invoking <code>java.lang.Class.getModifiers()</code> on the
7379 corresponding <code>java.lang.Class</code> object.
7380 <p/>
7381 If <code>klass</code> is an array class, then its public, private, and
7382 protected modifiers are the same as those of its component type. For arrays of
7383 primitives, this component type is represented by one of the primitive
7384 classes, such as <code>java.lang.Integer.TYPE</code>. For array classes, the
7385 abstract and final modifiers are set, and the interface modifier is not set.
7386 <p/>
7387 If <code>klass</code> is a primitive type or void, then its public, abstract,
7388 and final modifiers are always set, and its protected, private, and interface
7389 modifiers are never set.
7390 <p/>
7391 When preview features are enabled, the <code>ACC_IDENTITY</code> access flag
7392 is set if and only if <code>klass</code> is an identity class or an array class.
7393 <p/>
7394 When preview features are disabled, the <code>ACC_SUPER</code> access flag may be
7395 set only if <code>klass</code> is not a primitive type or void. The flag has no
7396 effective meaning.
7397 </description>
7398 <origin>jvmdi</origin>
7399 <capabilities>
7400 </capabilities>
7401 <parameters>
7402 <param id="klass">
7403 <jclass/>
7404 <description>
7405 The class to query.
7406 </description>
7407 </param>
7408 <param id="modifiers_ptr">
7409 <outptr><jint/></outptr>
7410 <description>
7411 On return, points to the modifiers of this class.
7412
7413 </description>
7414 </param>
7415 </parameters>
7416 <errors>
7417 </errors>
7418 </function>
7419
7420 <function id="GetClassMethods" phase="start" num="52">
7421 <synopsis>Get Class Methods</synopsis>
7422 <description>
7423 For the class indicated by <code>klass</code>, return a count of
7424 methods via <code>method_count_ptr</code> and a list of
7425 method IDs via <code>methods_ptr</code>. The method list contains
7426 constructors and static initializers as well as true methods.
7427 Only directly declared methods are returned (not inherited methods).
7428 An empty method list is returned for array classes and primitive classes
7429 (for example, <code>java.lang.Integer.TYPE</code>).
7430 </description>
7431 <origin>jvmdi</origin>
7432 <capabilities>
7433 <capability id="can_maintain_original_method_order"/>
7434 </capabilities>
7435 <parameters>
7436 <param id="klass">
7437 <jclass/>
7438 <description>
7439 The class to query.
7440 </description>
7441 </param>
7442 <param id="method_count_ptr">
7443 <outptr><jint/></outptr>
7444 <description>
7445 On return, points to the number of methods declared in this class.
7446 </description>
7447 </param>
7448 <param id="methods_ptr">
7449 <allocbuf outcount="method_count_ptr"><jmethodID class="klass"/></allocbuf>
7450 <description>
7451 On return, points to the method ID array.
7452 </description>
7453 </param>
7454 </parameters>
7455 <errors>
7456 <error id="JVMTI_ERROR_CLASS_NOT_PREPARED">
7457 <paramlink id="klass"></paramlink> is not prepared.
7458 </error>
7459 </errors>
7460 </function>
7461
7462 <function id="GetClassFields" phase="start" num="53">
7463 <synopsis>Get Class Fields</synopsis>
7464 <description>
7465 For the class indicated by <code>klass</code>, return a count of fields
7466 via <code>field_count_ptr</code> and a list of field IDs via
7467 <code>fields_ptr</code>.
7468 Only directly declared fields are returned (not inherited fields).
7469 Fields are returned in the order they occur in the class file.
7470 An empty field list is returned for array classes and primitive classes
7471 (for example, <code>java.lang.Integer.TYPE</code>).
7472 Use JNI to determine the length of an array.
7473 </description>
7474 <origin>jvmdi</origin>
7475 <capabilities>
7476 </capabilities>
7477 <parameters>
7478 <param id="klass">
7479 <jclass/>
7480 <description>
7481 The class to query.
7482 </description>
7483 </param>
7484 <param id="field_count_ptr">
7485 <outptr><jint/></outptr>
7486 <description>
7487 On return, points to the number of fields declared in this class.
7488 </description>
7489 </param>
7490 <param id="fields_ptr">
7491 <allocbuf outcount="field_count_ptr"><jfieldID/></allocbuf>
7492 <description>
7493 On return, points to the field ID array.
7494 </description>
7495 </param>
7496 </parameters>
7497 <errors>
7498 <error id="JVMTI_ERROR_CLASS_NOT_PREPARED">
7499 <paramlink id="klass"></paramlink> is not prepared.
7500 </error>
7501 </errors>
7502 </function>
7503
7504 <function id="GetImplementedInterfaces" phase="start" num="54">
7505 <synopsis>Get Implemented Interfaces</synopsis>
7506 <description>
7507 Return the direct super-interfaces of this class. For a class, this
7508 function returns the interfaces declared in its <code>implements</code>
7509 clause. For an interface, this function returns the interfaces declared in
7510 its <code>extends</code> clause.
7511 An empty interface list is returned for array classes and primitive classes
7512 (for example, <code>java.lang.Integer.TYPE</code>).
7513 </description>
7514 <origin>jvmdi</origin>
7515 <capabilities>
7516 </capabilities>
7517 <parameters>
7518 <param id="klass">
7519 <jclass/>
7520 <description>
7521 The class to query.
7522 </description>
7523 </param>
7524 <param id="interface_count_ptr">
7525 <outptr><jint/></outptr>
7526 <description>
7527 On return, points to the number of interfaces.
7528 </description>
7529 </param>
7530 <param id="interfaces_ptr">
7531 <allocbuf outcount="interface_count_ptr"><jclass/></allocbuf>
7532 <description>
7533 On return, points to the interface array.
7534 </description>
7535 </param>
7536 </parameters>
7537 <errors>
7538 <error id="JVMTI_ERROR_CLASS_NOT_PREPARED">
7539 <paramlink id="klass"></paramlink> is not prepared.
7540 </error>
7541 </errors>
7542 </function>
7543
7544 <function id="GetClassVersionNumbers" phase="start" num="145" since="1.1">
7545 <synopsis>Get Class Version Numbers</synopsis>
7546 <description>
7547 For the class indicated by <code>klass</code>,
7548 return the minor and major version numbers,
7549 as defined in
7550 <vmspec chapter="4"/>.
7551 </description>
7552 <origin>new</origin>
7553 <capabilities>
7554 </capabilities>
7555 <parameters>
7556 <param id="klass">
7557 <jclass/>
7558 <description>
7559 The class to query.
7560 </description>
7561 </param>
7562 <param id="minor_version_ptr">
7563 <outptr><jint/></outptr>
7564 <description>
7565 On return, points to the value of the
7566 <code>minor_version</code> item of the
7567 Class File Format.
7568 Note: to be consistent with the Class File Format,
7569 the minor version number is the first parameter.
7570 </description>
7571 </param>
7572 <param id="major_version_ptr">
7573 <outptr><jint/></outptr>
7574 <description>
7575 On return, points to the value of the
7576 <code>major_version</code> item of the
7577 Class File Format.
7578 </description>
7579 </param>
7580 </parameters>
7581 <errors>
7582 <error id="JVMTI_ERROR_ABSENT_INFORMATION">
7583 The class is a primitive or array class.
7584 </error>
7585 </errors>
7586 </function>
7587
7588 <function id="GetConstantPool" phase="start" num="146" since="1.1">
7589 <synopsis>Get Constant Pool</synopsis>
7590 <description>
7591 For the class indicated by <code>klass</code>,
7592 return the raw bytes of the constant pool in the format of the
7593 <code>constant_pool</code> item of
7594 <vmspec chapter="4"/>.
7595 The format of the constant pool may differ between versions
7596 of the Class File Format, so, the
7597 <functionlink id="GetClassVersionNumbers">minor and major
7598 class version numbers</functionlink> should be checked for
7599 compatibility.
7600 <p/>
7601 The returned constant pool might not have the same layout or
7602 contents as the constant pool in the defining class file.
7603 The constant pool returned by GetConstantPool() may have
7604 more or fewer entries than the defining constant pool.
7605 Entries may be in a different order.
7606 The constant pool returned by GetConstantPool() will match the
7607 constant pool used by
7608 <functionlink id="GetBytecodes">GetBytecodes()</functionlink>.
7609 That is, the bytecodes returned by GetBytecodes() will have
7610 constant pool indices which refer to constant pool entries returned
7611 by GetConstantPool().
7612 Note that since <functionlink id="RetransformClasses"/>
7613 and <functionlink id="RedefineClasses"/> can change
7614 the constant pool, the constant pool returned by this function
7615 can change accordingly. Thus, the correspondence between
7616 GetConstantPool() and GetBytecodes() does not hold if there
7617 is an intervening class retransformation or redefinition.
7618 The value of a constant pool entry used by a given bytecode will
7619 match that of the defining class file (even if the indices don't match).
7620 Constant pool entries which are not used directly or indirectly by
7621 bytecodes (for example, UTF-8 strings associated with annotations) are
7622 not required to exist in the returned constant pool.
7623 </description>
7624 <origin>new</origin>
7625 <capabilities>
7626 <required id="can_get_constant_pool"></required>
7627 </capabilities>
7628 <parameters>
7629 <param id="klass">
7630 <jclass/>
7631 <description>
7632 The class to query.
7633 </description>
7634 </param>
7635 <param id="constant_pool_count_ptr">
7636 <outptr><jint/></outptr>
7637 <description>
7638 On return, points to the number of entries
7639 in the constant pool table plus one.
7640 This corresponds to the <code>constant_pool_count</code>
7641 item of the Class File Format.
7642 </description>
7643 </param>
7644 <param id="constant_pool_byte_count_ptr">
7645 <outptr><jint/></outptr>
7646 <description>
7647 On return, points to the number of bytes
7648 in the returned raw constant pool.
7649 </description>
7650 </param>
7651 <param id="constant_pool_bytes_ptr">
7652 <allocbuf outcount="constant_pool_byte_count_ptr"><uchar/></allocbuf>
7653 <description>
7654 On return, points to the raw constant pool, that is the bytes
7655 defined by the <code>constant_pool</code> item of the
7656 Class File Format
7657 </description>
7658 </param>
7659 </parameters>
7660 <errors>
7661 <error id="JVMTI_ERROR_ABSENT_INFORMATION">
7662 The class is a primitive or array class.
7663 </error>
7664 </errors>
7665 </function>
7666
7667 <function id="IsInterface" phase="start" num="55">
7668 <synopsis>Is Interface</synopsis>
7669 <description>
7670 Determines whether a class object reference represents an interface.
7671 The <code>jboolean</code> result is
7672 <code>JNI_TRUE</code> if the "class" is actually an interface,
7673 <code>JNI_FALSE</code> otherwise.
7674 </description>
7675 <origin>jvmdi</origin>
7676 <capabilities>
7677 </capabilities>
7678 <parameters>
7679 <param id="klass">
7680 <jclass/>
7681 <description>
7682 The class to query.
7683 </description>
7684 </param>
7685 <param id="is_interface_ptr">
7686 <outptr><jboolean/></outptr>
7687 <description>
7688 On return, points to the boolean result of this function.
7689
7690 </description>
7691 </param>
7692 </parameters>
7693 <errors>
7694 </errors>
7695 </function>
7696
7697 <function id="IsArrayClass" phase="start" num="56">
7698 <synopsis>Is Array Class</synopsis>
7699 <description>
7700 Determines whether a class object reference represents an array.
7701 The <code>jboolean</code> result is
7702 <code>JNI_TRUE</code> if the class is an array,
7703 <code>JNI_FALSE</code> otherwise.
7704 </description>
7705 <origin>jvmdi</origin>
7706 <capabilities>
7707 </capabilities>
7708 <parameters>
7709 <param id="klass">
7710 <jclass/>
7711 <description>
7712 The class to query.
7713 </description>
7714 </param>
7715 <param id="is_array_class_ptr">
7716 <outptr><jboolean/></outptr>
7717 <description>
7718 On return, points to the boolean result of this function.
7719
7720 </description>
7721 </param>
7722 </parameters>
7723 <errors>
7724 </errors>
7725 </function>
7726
7727 <function id="IsModifiableClass" jkernel="yes" phase="start" num="45" since="1.1">
7728 <synopsis>Is Modifiable Class</synopsis>
7729 <description>
7730 Determines whether a class is modifiable.
7731 If a class is modifiable (<paramlink id="is_modifiable_class_ptr"/>
7732 returns <code>JNI_TRUE</code>) the class can be
7733 redefined with <functionlink id="RedefineClasses"/> (assuming
7734 the agent possesses the
7735 <fieldlink id="can_redefine_classes" struct="jvmtiCapabilities"/>
7736 capability) or
7737 retransformed with <functionlink id="RetransformClasses"/> (assuming
7738 the agent possesses the
7739 <fieldlink id="can_retransform_classes" struct="jvmtiCapabilities"/>
7740 capability).
7741 If a class is not modifiable (<paramlink id="is_modifiable_class_ptr"/>
7742 returns <code>JNI_FALSE</code>) the class can be neither
7743 redefined nor retransformed.
7744 <p/>
7745 Primitive classes (for example, <code>java.lang.Integer.TYPE</code>),
7746 array classes, and some implementation defined classes are never modifiable.
7747 <p/>
7748 </description>
7749 <origin>new</origin>
7750 <capabilities>
7751 <capability id="can_redefine_any_class">
7752 If possessed then all classes (except primitive, array, and some implementation defined
7753 classes) are modifiable with <functionlink id="RedefineClasses"/>.
7754 </capability>
7755 <capability id="can_retransform_any_class">
7756 If possessed then all classes (except primitive, array, and some implementation defined
7757 classes) are modifiable with <functionlink id="RetransformClasses"/>.
7758 </capability>
7759 <capability id="can_redefine_classes">
7760 No effect on the result of the function.
7761 But must additionally be possessed to modify the class with
7762 <functionlink id="RedefineClasses"/>.
7763 </capability>
7764 <capability id="can_retransform_classes">
7765 No effect on the result of the function.
7766 But must additionally be possessed to modify the class with
7767 <functionlink id="RetransformClasses"/>.
7768 </capability>
7769 </capabilities>
7770 <parameters>
7771 <param id="klass">
7772 <jclass/>
7773 <description>
7774 The class to query.
7775 </description>
7776 </param>
7777 <param id="is_modifiable_class_ptr">
7778 <outptr><jboolean/></outptr>
7779 <description>
7780 On return, points to the boolean result of this function.
7781 </description>
7782 </param>
7783 </parameters>
7784 <errors>
7785 </errors>
7786 </function>
7787
7788 <function id="GetClassLoader" phase="start" num="57">
7789 <synopsis>Get Class Loader</synopsis>
7790 <description>
7791 For the class indicated by <code>klass</code>, return via
7792 <code>classloader_ptr</code> a reference to the class loader for the
7793 class.
7794 </description>
7795 <origin>jvmdi</origin>
7796 <capabilities>
7797 </capabilities>
7798 <parameters>
7799 <param id="klass">
7800 <jclass/>
7801 <description>
7802 The class to query.
7803 </description>
7804 </param>
7805 <param id="classloader_ptr">
7806 <outptr><jobject/></outptr>
7807 <description>
7808 On return, points to the class loader that loaded
7809 this class.
7810 If the class was not created by a class loader
7811 or if the class loader is the bootstrap class loader,
7812 points to null.
7813 </description>
7814 </param>
7815 </parameters>
7816 <errors>
7817 </errors>
7818
7819 </function>
7820
7821 <function id="GetSourceDebugExtension" phase="start" num="90">
7822 <synopsis>Get Source Debug Extension</synopsis>
7823 <description>
7824 For the class indicated by <code>klass</code>, return the debug
7825 extension via <code>source_debug_extension_ptr</code>.
7826 The returned string
7827 contains exactly the debug extension information present in the
7828 class file of <code>klass</code>.
7829 </description>
7830 <origin>jvmdi</origin>
7831 <capabilities>
7832 <required id="can_get_source_debug_extension"></required>
7833 </capabilities>
7834 <parameters>
7835 <param id="klass">
7836 <jclass/>
7837 <description>
7838 The class to query.
7839 </description>
7840 </param>
7841 <param id="source_debug_extension_ptr">
7842 <allocbuf><char/></allocbuf>
7843 <description>
7844 On return, points to the class's debug extension, encoded as a
7845 <internallink id="mUTF">modified UTF-8</internallink> string.
7846 </description>
7847 </param>
7848 </parameters>
7849 <errors>
7850 <error id="JVMTI_ERROR_ABSENT_INFORMATION">
7851 Class information does not include a debug extension.
7852 </error>
7853 </errors>
7854 </function>
7855
7856 <function id="RetransformClasses" jkernel="yes" num="152" since="1.1">
7857 <synopsis>Retransform Classes</synopsis>
7858 <description>
7859 This function facilitates the
7860 <internallink id="bci">bytecode instrumentation</internallink>
7861 of already loaded classes.
7862 To replace the class definition without reference to the existing
7863 bytecodes, as one might do when recompiling from source for
7864 fix-and-continue debugging, <functionlink id="RedefineClasses"/>
7865 function should be used instead.
7866 <p/>
7867 When classes are initially loaded or when they are
7868 <functionlink id="RedefineClasses">redefined</functionlink>,
7869 the initial class file bytes can be transformed with the
7870 <eventlink id="ClassFileLoadHook"/> event.
7871 This function reruns the transformation process
7872 (whether or not a transformation has previously occurred).
7873 This retransformation follows these steps:
7874 <ul>
7875 <li>starting from the initial class file bytes
7876 </li>
7877 <li>for each <fieldlink id="can_retransform_classes"
7878 struct="jvmtiCapabilities">retransformation
7879 incapable</fieldlink>
7880 agent which received a
7881 <code>ClassFileLoadHook</code> event during the previous
7882 load or redefine, the bytes it returned
7883 (via the <code>new_class_data</code> parameter)
7884 are reused as the output of the transformation;
7885 note that this is equivalent to reapplying
7886 the previous transformation, unaltered. except that
7887 the <code>ClassFileLoadHook</code> event
7888 is <b>not</b> sent to these agents
7889 </li>
7890 <li>for each <fieldlink id="can_retransform_classes"
7891 struct="jvmtiCapabilities">retransformation
7892 capable</fieldlink>
7893 agent, the <code>ClassFileLoadHook</code> event is sent,
7894 allowing a new transformation to be applied
7895 </li>
7896 <li>the transformed class file bytes are installed as the new
7897 definition of the class
7898 </li>
7899 </ul>
7900 See the <eventlink id="ClassFileLoadHook"/> event for more details.
7901 <p/>
7902 The initial class file bytes represent the bytes passed to
7903 <code>ClassLoader.defineClass</code>
7904 or <code>RedefineClasses</code> (before any transformations
7905 were applied), however they may not exactly match them.
7906 The constant pool may differ in ways described in
7907 <functionlink id="GetConstantPool"/>.
7908 Constant pool indices in the bytecodes of methods will correspond.
7909 Some attributes may not be present.
7910 Where order is not meaningful, for example the order of methods,
7911 order may not be preserved.
7912 <p/>
7913 Retransformation can cause new versions of methods to be installed.
7914 Old method versions may become
7915 <internallink id="obsoleteMethods">obsolete</internallink>
7916 The new method version will be used on new invokes.
7917 If a method has active stack frames, those active frames continue to
7918 run the bytecodes of the original method version.
7919 <p/>
7920 This function does not cause any initialization except that which
7921 would occur under the customary JVM semantics.
7922 In other words, retransforming a class does not cause its initializers to be
7923 run. The values of static fields will remain as they were
7924 prior to the call.
7925 <p/>
7926 Threads need not be suspended.
7927 <p/>
7928 All breakpoints in the class are cleared.
7929 <p/>
7930 All attributes are updated.
7931 <p/>
7932 Instances of the retransformed class are not affected -- fields retain their
7933 previous values.
7934 <functionlink id="GetTag">Tags</functionlink> on the instances are
7935 also unaffected.
7936 <p/>
7937 In response to this call, no events other than the
7938 <eventlink id="ClassFileLoadHook"/> event
7939 will be sent.
7940 <p/>
7941 The retransformation may change method bodies, the constant pool and attributes
7942 (unless explicitly prohibited).
7943 The retransformation must not add, remove or rename fields or methods, change the
7944 signatures of methods, change modifiers, or change inheritance.
7945 The retransformation must not change the <code>NestHost</code>,
7946 <code>NestMembers</code>, <code>Record</code>, or <code>PermittedSubclasses</code>
7947 attributes.
7948 These restrictions may be lifted in future versions.
7949 See the error return description below for information on error codes
7950 returned if an unsupported retransformation is attempted.
7951 The class file bytes are not verified or installed until they have passed
7952 through the chain of <eventlink id="ClassFileLoadHook"/> events, thus the
7953 returned error code reflects the result of the transformations.
7954 If any error code is returned other than <code>JVMTI_ERROR_NONE</code>,
7955 none of the classes to be retransformed will have a new definition installed.
7956 When this function returns (with the error code of <code>JVMTI_ERROR_NONE</code>)
7957 all of the classes to be retransformed will have their new definitions installed.
7958 </description>
7959 <origin>new</origin>
7960 <capabilities>
7961 <required id="can_retransform_classes"></required>
7962 <capability id="can_retransform_any_class"></capability>
7963 </capabilities>
7964 <parameters>
7965 <param id="class_count">
7966 <jint min="0"/>
7967 <description>
7968 The number of classes to be retransformed.
7969 </description>
7970 </param>
7971 <param id="classes">
7972 <inbuf incount="class_count"><jclass/></inbuf>
7973 <description>
7974 The array of classes to be retransformed.
7975 </description>
7976 </param>
7977 </parameters>
7978 <errors>
7979 <error id="JVMTI_ERROR_UNMODIFIABLE_CLASS">
7980 One of the <paramlink id="classes"/> cannot be modified.
7981 See <functionlink id="IsModifiableClass"/>.
7982 </error>
7983 <error id="JVMTI_ERROR_INVALID_CLASS">
7984 One of the <paramlink id="classes"/> is not a valid class.
7985 </error>
7986 <error id="JVMTI_ERROR_UNSUPPORTED_VERSION">
7987 A retransformed class file has a version number not supported by this VM.
7988 </error>
7989 <error id="JVMTI_ERROR_INVALID_CLASS_FORMAT">
7990 A retransformed class file is malformed (The VM would return a <code>ClassFormatError</code>).
7991 </error>
7992 <error id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION">
7993 The retransformed class file definitions would lead to a circular definition
7994 (the VM would return a <code>ClassCircularityError</code>).
7995 </error>
7996 <error id="JVMTI_ERROR_FAILS_VERIFICATION">
7997 The retransformed class file bytes fail verification.
7998 </error>
7999 <error id="JVMTI_ERROR_NAMES_DONT_MATCH">
8000 The class name defined in a retransformed class file is
8001 different from the name in the old class object.
8002 </error>
8003 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED">
8004 A retransformed class file would require adding a method.
8005 </error>
8006 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED">
8007 A retransformed class file changes a field.
8008 </error>
8009 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED">
8010 A direct superclass is different for a retransformed class file,
8011 or the set of directly implemented
8012 interfaces is different.
8013 </error>
8014 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED">
8015 A retransformed class file does not declare a method
8016 declared in the old class version.
8017 </error>
8018 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED">
8019 A retransformed class file has unsupported differences in class attributes.
8020 </error>
8021 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED">
8022 A retransformed class file has different class modifiers.
8023 </error>
8024 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED">
8025 A method in the retransformed class file has different modifiers
8026 than its counterpart in the old class version.
8027 </error>
8028 </errors>
8029 </function>
8030
8031 <function id="RedefineClasses" jkernel="yes" num="87">
8032 <synopsis>Redefine Classes</synopsis>
8033 <typedef id="jvmtiClassDefinition" label="Class redefinition description">
8034 <field id="klass">
8035 <jclass/>
8036 <description>
8037 Class object for this class
8038 </description>
8039 </field>
8040 <field id="class_byte_count">
8041 <jint/>
8042 <description>
8043 Number of bytes defining class (below)
8044 </description>
8045 </field>
8046 <field id="class_bytes">
8047 <inbuf incount="class_byte_count"><uchar/></inbuf>
8048 <description>
8049 Bytes defining class (in <vmspec chapter="4"/>)
8050 </description>
8051 </field>
8052 </typedef>
8053 <description>
8054 All classes given are redefined according to the definitions
8055 supplied.
8056 This function is used to replace the definition of a class
8057 with a new definition, as might be needed in fix-and-continue
8058 debugging.
8059 Where the existing class file bytes are to be transformed, for
8060 example in
8061 <internallink id="bci">bytecode instrumentation</internallink>,
8062 <functionlink id="RetransformClasses"/> should be used.
8063 <p/>
8064 Redefinition can cause new versions of methods to be installed.
8065 Old method versions may become
8066 <internallink id="obsoleteMethods">obsolete</internallink>
8067 The new method version will be used on new invokes.
8068 If a method has active stack frames, those active frames continue to
8069 run the bytecodes of the original method version.
8070 If resetting of stack frames is desired, use
8071 <functionlink id="PopFrame"></functionlink>
8072 to pop frames with obsolete method versions.
8073 <p/>
8074 This function does not cause any initialization except that which
8075 would occur under the customary JVM semantics.
8076 In other words, redefining a class does not cause its initializers to be
8077 run. The values of static fields will remain as they were
8078 prior to the call.
8079 <p/>
8080 Threads need not be suspended.
8081 <p/>
8082 All breakpoints in the class are cleared.
8083 <p/>
8084 All attributes are updated.
8085 <p/>
8086 Instances of the redefined class are not affected -- fields retain their
8087 previous values.
8088 <functionlink id="GetTag">Tags</functionlink> on the instances are
8089 also unaffected.
8090 <p/>
8091 In response to this call, the <jvmti/> event
8092 <eventlink id="ClassFileLoadHook">Class File Load Hook</eventlink>
8093 will be sent (if enabled), but no other <jvmti/> events will be sent.
8094 <p/>
8095 The redefinition may change method bodies, the constant pool and attributes
8096 (unless explicitly prohibited).
8097 The redefinition must not add, remove or rename fields or methods, change the
8098 signatures of methods, change modifiers, or change inheritance.
8099 The redefinition must not change the <code>NestHost</code>,
8100 <code>NestMembers</code>, <code>Record</code>, or <code>PermittedSubclasses</code>
8101 attributes.
8102 These restrictions may be lifted in future versions.
8103 See the error return description below for information on error codes
8104 returned if an unsupported redefinition is attempted.
8105 The class file bytes are not verified or installed until they have passed
8106 through the chain of <eventlink id="ClassFileLoadHook"/> events, thus the
8107 returned error code reflects the result of the transformations applied
8108 to the bytes passed into <paramlink id="class_definitions"/>.
8109 If any error code is returned other than <code>JVMTI_ERROR_NONE</code>,
8110 none of the classes to be redefined will have a new definition installed.
8111 When this function returns (with the error code of <code>JVMTI_ERROR_NONE</code>)
8112 all of the classes to be redefined will have their new definitions installed.
8113 </description>
8114 <origin>jvmdi</origin>
8115 <capabilities>
8116 <required id="can_redefine_classes"></required>
8117 <capability id="can_redefine_any_class"></capability>
8118 </capabilities>
8119 <parameters>
8120 <param id="class_count">
8121 <jint min="0"/>
8122 <description>
8123 The number of classes specified in <code>class_definitions</code>
8124 </description>
8125 </param>
8126 <param id="class_definitions">
8127 <inbuf incount="class_count"><struct>jvmtiClassDefinition</struct></inbuf>
8128 <description>
8129 The array of new class definitions
8130 </description>
8131 </param>
8132 </parameters>
8133 <errors>
8134 <error id="JVMTI_ERROR_NULL_POINTER">
8135 One of <code>class_bytes</code> is null.
8136 </error>
8137 <error id="JVMTI_ERROR_UNMODIFIABLE_CLASS">
8138 An element of <code>class_definitions</code> cannot be modified.
8139 See <functionlink id="IsModifiableClass"/>.
8140 </error>
8141 <error id="JVMTI_ERROR_INVALID_CLASS">
8142 An element of <code>class_definitions</code> is not a valid class.
8143 </error>
8144 <error id="JVMTI_ERROR_UNSUPPORTED_VERSION">
8145 A new class file has a version number not supported by this VM.
8146 </error>
8147 <error id="JVMTI_ERROR_INVALID_CLASS_FORMAT">
8148 A new class file is malformed (The VM would return a <code>ClassFormatError</code>).
8149 </error>
8150 <error id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION">
8151 The new class file definitions would lead to a circular definition
8152 (the VM would return a <code>ClassCircularityError</code>).
8153 </error>
8154 <error id="JVMTI_ERROR_FAILS_VERIFICATION">
8155 The class bytes fail verification.
8156 </error>
8157 <error id="JVMTI_ERROR_NAMES_DONT_MATCH">
8158 The class name defined in a new class file is
8159 different from the name in the old class object.
8160 </error>
8161 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED">
8162 A new class file would require adding a method.
8163 </error>
8164 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED">
8165 A new class version changes a field.
8166 </error>
8167 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED">
8168 A direct superclass is different for a new class
8169 version, or the set of directly implemented
8170 interfaces is different.
8171 </error>
8172 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED">
8173 A new class version does not declare a method
8174 declared in the old class version.
8175 </error>
8176 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED">
8177 A new class version has unsupported differences in class attributes.
8178 </error>
8179 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED">
8180 A new class version has different modifiers.
8181 </error>
8182 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED">
8183 A method in the new class version has different modifiers
8184 than its counterpart in the old class version.
8185 </error>
8186 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">
8187 A module cannot be modified.
8188 See <functionlink id="IsModifiableModule"/>.
8189 </error>
8190 </errors>
8191 </function>
8192
8193 </category>
8194
8195 <category id="object" label="Object">
8196
8197 <function id="GetObjectSize" jkernel="yes" phase="start" num="154">
8198 <synopsis>Get Object Size</synopsis>
8199 <description>
8200 For the object indicated by <code>object</code>,
8201 return via <code>size_ptr</code> the size of the object.
8202 This size is an implementation-specific approximation of
8203 the amount of storage consumed by this object.
8204 It may include some or all of the object's overhead, and thus
8205 is useful for comparison within an implementation but not
8206 between implementations.
8207 The estimate may change during a single invocation of the JVM.
8208 </description>
8209 <origin>new</origin>
8210 <capabilities>
8211 </capabilities>
8212 <parameters>
8213 <param id="object">
8214 <jobject/>
8215 <description>
8216 The object to query.
8217 </description>
8218 </param>
8219 <param id="size_ptr">
8220 <outptr><jlong/></outptr>
8221 <description>
8222 On return, points to the object's size in bytes.
8223 </description>
8224 </param>
8225 </parameters>
8226 <errors>
8227 </errors>
8228 </function>
8229
8230 <function id="GetObjectHashCode" phase="start" num="58">
8231 <synopsis>Get Object Hash Code</synopsis>
8232 <description>
8233 For the object indicated by <code>object</code>,
8234 return via <code>hash_code_ptr</code> a hash code.
8235 This hash code could be used to maintain a hash table of object references,
8236 however, on some implementations this can cause significant performance
8237 impacts--in most cases
8238 <internallink id="Heap">tags</internallink>
8239 will be a more efficient means of associating information with objects.
8240 This function guarantees
8241 the same hash code value for a particular object throughout its life
8242 </description>
8243 <origin>jvmdi</origin>
8244 <capabilities>
8245 </capabilities>
8246 <parameters>
8247 <param id="object">
8248 <jobject/>
8249 <description>
8250 The object to query.
8251 </description>
8252 </param>
8253 <param id="hash_code_ptr">
8254 <outptr><jint/></outptr>
8255 <description>
8256 On return, points to the object's hash code.
8257 </description>
8258 </param>
8259 </parameters>
8260 <errors>
8261 </errors>
8262 </function>
8263
8264 <function id="GetObjectMonitorUsage" num="59">
8265 <synopsis>Get Object Monitor Usage</synopsis>
8266 <typedef id="jvmtiMonitorUsage" label="Object monitor usage information">
8267 <field id="owner">
8268 <jthread/>
8269 <description>
8270 The platform thread owning this monitor, or null if owned
8271 by a virtual thread or not owned
8272 </description>
8273 </field>
8274 <field id="entry_count">
8275 <jint/>
8276 <description>
8277 The number of times the platform thread owning this monitor has entered it,
8278 or <code>0</code> if owned by a virtual thread or not owned
8279 </description>
8280 </field>
8281 <field id="waiter_count">
8282 <jint/>
8283 <description>
8284 The number of platform threads waiting to own this monitor, or <code>0</code>
8285 if only virtual threads are waiting or no threads are waiting
8286 </description>
8287 </field>
8288 <field id="waiters">
8289 <allocfieldbuf><jthread/></allocfieldbuf>
8290 <description>
8291 The <code>waiter_count</code> waiting platform threads
8292 </description>
8293 </field>
8294 <field id="notify_waiter_count">
8295 <jint/>
8296 <description>
8297 The number of platform threads waiting to own this monitor, or <code>0</code>
8298 if only virtual threads are waiting to be notified or no threads are waiting
8299 to be notified
8300 </description>
8301 </field>
8302 <field id="notify_waiters">
8303 <allocfieldbuf><jthread/></allocfieldbuf>
8304 <description>
8305 The <code>notify_waiter_count</code> platform threads waiting to be notified
8306 </description>
8307 </field>
8308 </typedef>
8309 <description>
8310 Get information about the object's monitor.
8311 The fields of the <functionlink id="jvmtiMonitorUsage"></functionlink> structure
8312 are filled in with information about usage of the monitor.
8313 <p/>
8314 <b> This function does not support getting information about an object's monitor
8315 when it is owned by a virtual thread. It also does not support returning a
8316 reference to virtual threads that are waiting to own a monitor or waiting to
8317 be notified.
8318 </b>
8319 <todo>
8320 Decide and then clarify suspend requirements.
8321 </todo>
8322 </description>
8323 <origin>jvmdi</origin>
8324 <capabilities>
8325 <required id="can_get_monitor_info"></required>
8326 </capabilities>
8327 <parameters>
8328 <param id="object">
8329 <jobject/>
8330 <description>
8331 The object to query.
8332 </description>
8333 </param>
8334 <param id="info_ptr">
8335 <outptr><struct>jvmtiMonitorUsage</struct></outptr>
8336 <description>
8337 On return, filled with monitor information for the
8338 specified object.
8339 </description>
8340 </param>
8341 </parameters>
8342 <errors>
8343 </errors>
8344 </function>
8345
8346 <elide>
8347 <function id="GetObjectMonitors" num="116">
8348 <synopsis>Get Object Monitors</synopsis>
8349 <description>
8350 Return the list of object monitors.
8351 <p/>
8352 Note: details about each monitor can be examined with
8353 <functionlink id="GetObjectMonitorUsage"></functionlink>.
8354 </description>
8355 <origin>new</origin>
8356 <capabilities>
8357 <required id="can_get_monitor_info"></required>
8358 </capabilities>
8359 <parameters>
8360 <param id="monitorCnt">
8361 <outptr><jint/></outptr>
8362 <description>
8363 On return, pointer to the number
8364 of monitors returned in <code>monitors_ptr</code>.
8365 </description>
8366 </param>
8367 <param id="monitors_ptr">
8368 <allocbuf outcount="monitorCnt"><jobject/></allocbuf>
8369 <description>
8370 On return, pointer to the monitor list.
8371 </description>
8372 </param>
8373 </parameters>
8374 <errors>
8375 </errors>
8376 </function>
8377 </elide>
8378
8379 </category>
8380
8381 <category id="fieldCategory" label="Field">
8382
8383 <intro>
8384 </intro>
8385
8386 <function id="GetFieldName" phase="start" num="60">
8387 <synopsis>Get Field Name (and Signature)</synopsis>
8388 <description>
8389 For the field indicated by <paramlink id="klass"/> and <paramlink id="field"/>,
8390 return the field name via <paramlink id="name_ptr"/> and field signature via
8391 <paramlink id="signature_ptr"/>.
8392 <p/>
8393 Field signatures are defined in the
8394 <externallink id="jni/index.html">JNI Specification</externallink>
8395 and are referred to as <code>field descriptors</code> in
8396 <vmspec chapter="4.3.2"/>.
8397 </description>
8398 <origin>jvmdiClone</origin>
8399 <capabilities>
8400 </capabilities>
8401 <parameters>
8402 <param id="klass">
8403 <jclass field="field"/>
8404 <description>
8405 The class of the field to query.
8406 </description>
8407 </param>
8408 <param id="field">
8409 <jfieldID class="klass"/>
8410 <description>
8411 The field to query.
8412 </description>
8413 </param>
8414 <param id="name_ptr">
8415 <allocbuf>
8416 <char/>
8417 <nullok>the name is not returned</nullok>
8418 </allocbuf>
8419 <description>
8420 On return, points to the field name, encoded as a
8421 <internallink id="mUTF">modified UTF-8</internallink> string.
8422 </description>
8423 </param>
8424 <param id="signature_ptr">
8425 <allocbuf>
8426 <char/>
8427 <nullok>the signature is not returned</nullok>
8428 </allocbuf>
8429 <description>
8430 On return, points to the field signature, encoded as a
8431 <internallink id="mUTF">modified UTF-8</internallink> string.
8432 </description>
8433 </param>
8434 <param id="generic_ptr">
8435 <allocbuf>
8436 <char/>
8437 <nullok>the generic signature is not returned</nullok>
8438 </allocbuf>
8439 <description>
8440 On return, points to the generic signature of the field, encoded as a
8441 <internallink id="mUTF">modified UTF-8</internallink> string.
8442 If there is no generic signature attribute for the field, then,
8443 on return, points to null.
8444 </description>
8445 </param>
8446 </parameters>
8447 <errors>
8448 </errors>
8449 </function>
8450
8451 <function id="GetFieldDeclaringClass" phase="start" num="61">
8452 <synopsis>Get Field Declaring Class</synopsis>
8453 <description>
8454 For the field indicated by <code>klass</code> and <code>field</code>
8455 return the class that defined it via <code>declaring_class_ptr</code>.
8456 The declaring class will either be <code>klass</code>, a superclass, or
8457 an implemented interface.
8458 </description>
8459 <origin>jvmdi</origin>
8460 <capabilities>
8461 </capabilities>
8462 <parameters>
8463 <param id="klass">
8464 <jclass field="field"/>
8465 <description>
8466 The class to query.
8467 </description>
8468 </param>
8469 <param id="field">
8470 <jfieldID class="klass"/>
8471 <description>
8472 The field to query.
8473 </description>
8474 </param>
8475 <param id="declaring_class_ptr">
8476 <outptr><jclass/></outptr>
8477 <description>
8478 On return, points to the declaring class
8479 </description>
8480 </param>
8481 </parameters>
8482 <errors>
8483 </errors>
8484 </function>
8485
8486 <function id="GetFieldModifiers" phase="start" num="62">
8487 <synopsis>Get Field Modifiers</synopsis>
8488 <description>
8489 For the field indicated by <code>klass</code> and <code>field</code>
8490 return the access flags via <code>modifiers_ptr</code>.
8491 Access flags are defined in <vmspec chapter="4"/>.
8492 </description>
8493 <origin>jvmdi</origin>
8494 <capabilities>
8495 </capabilities>
8496 <parameters>
8497 <param id="klass">
8498 <jclass field="field"/>
8499 <description>
8500 The class to query.
8501 </description>
8502 </param>
8503 <param id="field">
8504 <jfieldID class="klass"/>
8505 <description>
8506 The field to query.
8507 </description>
8508 </param>
8509 <param id="modifiers_ptr">
8510 <outptr><jint/></outptr>
8511 <description>
8512 On return, points to the access flags.
8513 </description>
8514 </param>
8515 </parameters>
8516 <errors>
8517 </errors>
8518 </function>
8519
8520 <function id="IsFieldSynthetic" phase="start" num="63">
8521 <synopsis>Is Field Synthetic</synopsis>
8522 <description>
8523 For the field indicated by <code>klass</code> and <code>field</code>, return a
8524 value indicating whether the field is synthetic via <code>is_synthetic_ptr</code>.
8525 Synthetic fields are generated by the compiler but not present in the
8526 original source code.
8527 </description>
8528 <origin>jvmdi</origin>
8529 <capabilities>
8530 <required id="can_get_synthetic_attribute"></required>
8531 </capabilities>
8532 <parameters>
8533 <param id="klass">
8534 <jclass field="field"/>
8535 <description>
8536 The class of the field to query.
8537 </description>
8538 </param>
8539 <param id="field">
8540 <jfieldID class="klass"/>
8541 <description>
8542 The field to query.
8543 </description>
8544 </param>
8545 <param id="is_synthetic_ptr">
8546 <outptr><jboolean/></outptr>
8547 <description>
8548 On return, points to the boolean result of this function.
8549 </description>
8550 </param>
8551 </parameters>
8552 <errors>
8553 </errors>
8554 </function>
8555
8556 </category>
8557
8558 <category id="method" label="Method">
8559
8560 <intro>
8561 These functions provide information about a method (represented as a
8562 <typelink id="jmethodID"/>) and set how methods are processed.
8563 </intro>
8564
8565 <intro id="obsoleteMethods" label="Obsolete Methods">
8566 The functions <functionlink id="RetransformClasses"/> and
8567 <functionlink id="RedefineClasses"/> can cause new versions
8568 of methods to be installed.
8569 An original version of a method is considered equivalent
8570 to the new version if:
8571 <ul>
8572 <li>their bytecodes are the same except for indices into the
8573 constant pool and </li>
8574 <li>the referenced constants are equal.</li>
8575 </ul>
8576 An original method version which is not equivalent to the
8577 new method version is called obsolete and is assigned a new method ID;
8578 the original method ID now refers to the new method version.
8579 A method ID can be tested for obsolescence with
8580 <functionlink id="IsMethodObsolete"/>.
8581 </intro>
8582
8583 <function id="GetMethodName" phase="start" num="64">
8584 <synopsis>Get Method Name (and Signature)</synopsis>
8585 <description>
8586 For the method indicated by <code>method</code>,
8587 return the method name via <code>name_ptr</code> and method signature via
8588 <code>signature_ptr</code>.
8589 <p/>
8590 Method signatures are defined in the
8591 <externallink id="jni/index.html">JNI Specification</externallink>
8592 and are referred to as <code>method descriptors</code> in
8593 <vmspec chapter="4.3.3"/>.
8594 Note this is different
8595 than method signatures as defined in the <i>Java Language Specification</i>.
8596 </description>
8597 <origin>jvmdiClone</origin>
8598 <capabilities>
8599 </capabilities>
8600 <parameters>
8601 <param id="method">
8602 <jmethodID/>
8603 <description>
8604 The method to query.
8605 </description>
8606 </param>
8607 <param id="name_ptr">
8608 <allocbuf>
8609 <char/>
8610 <nullok>the name is not returned</nullok>
8611 </allocbuf>
8612 <description>
8613 On return, points to the method name, encoded as a
8614 <internallink id="mUTF">modified UTF-8</internallink> string.
8615 </description>
8616 </param>
8617 <param id="signature_ptr">
8618 <allocbuf>
8619 <char/>
8620 <nullok>the signature is not returned</nullok>
8621 </allocbuf>
8622 <description>
8623 On return, points to the method signature, encoded as a
8624 <internallink id="mUTF">modified UTF-8</internallink> string.
8625 </description>
8626 </param>
8627 <param id="generic_ptr">
8628 <allocbuf>
8629 <char/>
8630 <nullok>the generic signature is not returned</nullok>
8631 </allocbuf>
8632 <description>
8633 On return, points to the generic signature of the method, encoded as a
8634 <internallink id="mUTF">modified UTF-8</internallink> string.
8635 If there is no generic signature attribute for the method, then,
8636 on return, points to null.
8637 </description>
8638 </param>
8639 </parameters>
8640 <errors>
8641 </errors>
8642 </function>
8643
8644 <function id="GetMethodDeclaringClass" phase="start" num="65">
8645 <synopsis>Get Method Declaring Class</synopsis>
8646 <description>
8647 For the method indicated by <code>method</code>,
8648 return the class that defined it via <code>declaring_class_ptr</code>.
8649 </description>
8650 <origin>jvmdi</origin>
8651 <capabilities>
8652 </capabilities>
8653 <parameters>
8654 <param id="klass">
8655 <jclass method="method"/>
8656 <description>
8657 The class to query.
8658 </description>
8659 </param>
8660 <param id="method">
8661 <jmethodID class="klass"/>
8662 <description>
8663 The method to query.
8664 </description>
8665 </param>
8666 <param id="declaring_class_ptr">
8667 <outptr><jclass/></outptr>
8668 <description>
8669 On return, points to the declaring class
8670 </description>
8671 </param>
8672 </parameters>
8673 <errors>
8674 </errors>
8675 </function>
8676
8677 <function id="GetMethodModifiers" phase="start" num="66">
8678 <synopsis>Get Method Modifiers</synopsis>
8679 <description>
8680 For the method indicated by <code>method</code>,
8681 return the access flags via <code>modifiers_ptr</code>.
8682 Access flags are defined in <vmspec chapter="4"/>.
8683 </description>
8684 <origin>jvmdi</origin>
8685 <capabilities>
8686 </capabilities>
8687 <parameters>
8688 <param id="klass">
8689 <jclass method="method"/>
8690 <description>
8691 The class to query.
8692 </description>
8693 </param>
8694 <param id="method">
8695 <jmethodID class="klass"/>
8696 <description>
8697 The method to query.
8698 </description>
8699 </param>
8700 <param id="modifiers_ptr">
8701 <outptr><jint/></outptr>
8702 <description>
8703 On return, points to the access flags.
8704 </description>
8705 </param>
8706 </parameters>
8707 <errors>
8708 </errors>
8709 </function>
8710
8711 <function id="GetMaxLocals" phase="start" num="68">
8712 <synopsis>Get Max Locals</synopsis>
8713 <description>
8714 For the method indicated by <code>method</code>,
8715 return the number of local variable slots used by the method,
8716 including the local variables used to pass parameters to the
8717 method on its invocation.
8718 <p/>
8719 See <code>max_locals</code> in <vmspec chapter="4.7.3"/>.
8720 </description>
8721 <origin>jvmdi</origin>
8722 <capabilities>
8723 </capabilities>
8724 <parameters>
8725 <param id="klass">
8726 <jclass method="method"/>
8727 <description>
8728 The class to query.
8729 </description>
8730 </param>
8731 <param id="method">
8732 <jmethodID class="klass" native="error"/>
8733 <description>
8734 The method to query.
8735 </description>
8736 </param>
8737 <param id="max_ptr">
8738 <outptr><jint/></outptr>
8739 <description>
8740 On return, points to the maximum number of local slots
8741 </description>
8742 </param>
8743 </parameters>
8744 <errors>
8745 </errors>
8746 </function>
8747
8748 <function id="GetArgumentsSize" phase="start" num="69">
8749 <synopsis>Get Arguments Size</synopsis>
8750 <description>
8751 For the method indicated by <code>method</code>,
8752 return via <code>max_ptr</code> the number of local variable slots used
8753 by the method's arguments.
8754 Note that two-word arguments use two slots.
8755 </description>
8756 <origin>jvmdi</origin>
8757 <capabilities>
8758 </capabilities>
8759 <parameters>
8760 <param id="klass">
8761 <jclass method="method"/>
8762 <description>
8763 The class to query.
8764 </description>
8765 </param>
8766 <param id="method">
8767 <jmethodID class="klass" native="error"/>
8768 <description>
8769 The method to query.
8770 </description>
8771 </param>
8772 <param id="size_ptr">
8773 <outptr><jint/></outptr>
8774 <description>
8775 On return, points to the number of argument slots
8776 </description>
8777 </param>
8778 </parameters>
8779 <errors>
8780 </errors>
8781 </function>
8782
8783 <function id="GetLineNumberTable" phase="start" num="70">
8784 <synopsis>Get Line Number Table</synopsis>
8785 <typedef id="jvmtiLineNumberEntry" label="Line number table entry">
8786 <field id="start_location">
8787 <jlocation/>
8788 <description>
8789 the <datalink id="jlocation"></datalink> where the line begins
8790 </description>
8791 </field>
8792 <field id="line_number">
8793 <jint/>
8794 <description>
8795 the line number
8796 </description>
8797 </field>
8798 </typedef>
8799 <description>
8800 For the method indicated by <code>method</code>,
8801 return a table of source line number entries. The size of the table is
8802 returned via <code>entry_count_ptr</code> and the table itself is
8803 returned via <code>table_ptr</code>.
8804 </description>
8805 <origin>jvmdi</origin>
8806 <capabilities>
8807 <required id="can_get_line_numbers"></required>
8808 </capabilities>
8809 <parameters>
8810 <param id="klass">
8811 <jclass method="method"/>
8812 <description>
8813 The class to query.
8814 </description>
8815 </param>
8816 <param id="method">
8817 <jmethodID class="klass" native="error"/>
8818 <description>
8819 The method to query.
8820 </description>
8821 </param>
8822 <param id="entry_count_ptr">
8823 <outptr><jint/></outptr>
8824 <description>
8825 On return, points to the number of entries in the table
8826 </description>
8827 </param>
8828 <param id="table_ptr">
8829 <allocbuf outcount="entry_count_ptr"><struct>jvmtiLineNumberEntry</struct></allocbuf>
8830 <description>
8831 On return, points to the line number table pointer.
8832 </description>
8833 </param>
8834 </parameters>
8835 <errors>
8836 <error id="JVMTI_ERROR_ABSENT_INFORMATION">
8837 Class information does not include line numbers.
8838 </error>
8839 </errors>
8840 </function>
8841
8842 <function id="GetMethodLocation" phase="start" num="71">
8843 <synopsis>Get Method Location</synopsis>
8844 <description>
8845 For the method indicated by <code>method</code>,
8846 return the beginning and ending addresses through
8847 <code>start_location_ptr</code> and <code>end_location_ptr</code>. In a
8848 conventional bytecode indexing scheme,
8849 <code>start_location_ptr</code> will always point to zero
8850 and <code>end_location_ptr</code>
8851 will always point to the bytecode count minus one.
8852 </description>
8853 <origin>jvmdi</origin>
8854 <capabilities>
8855 </capabilities>
8856 <parameters>
8857 <param id="klass">
8858 <jclass method="method"/>
8859 <description>
8860 The class to query.
8861 </description>
8862 </param>
8863 <param id="method">
8864 <jmethodID class="klass" native="error"/>
8865 <description>
8866 The method to query.
8867 </description>
8868 </param>
8869 <param id="start_location_ptr">
8870 <outptr><jlocation/></outptr>
8871 <description>
8872 On return, points to the first location, or
8873 <code>-1</code> if location information is not available.
8874 If the information is available and
8875 <functionlink id="GetJLocationFormat"></functionlink>
8876 returns <datalink id="JVMTI_JLOCATION_JVMBCI"></datalink>
8877 then this will always be zero.
8878 </description>
8879 </param>
8880 <param id="end_location_ptr">
8881 <outptr><jlocation/></outptr>
8882 <description>
8883 On return, points to the last location,
8884 or <code>-1</code> if location information is not available.
8885 </description>
8886 </param>
8887 </parameters>
8888 <errors>
8889 <error id="JVMTI_ERROR_ABSENT_INFORMATION">
8890 Class information does not include method sizes.
8891 </error>
8892 </errors>
8893 </function>
8894
8895 <function id="GetLocalVariableTable" num="72">
8896 <synopsis>Get Local Variable Table</synopsis>
8897 <typedef id="jvmtiLocalVariableEntry" label="Local variable table entry">
8898 <field id="start_location">
8899 <jlocation/>
8900 <description>
8901 The code array index where the local variable is first valid
8902 (that is, where it must have a value).
8903 </description>
8904 </field>
8905 <field id="length">
8906 <jint/>
8907 <description>
8908 The length of the valid section for this local variable.
8909 The last code array index where the local variable is valid
8910 is <code>start_location + length</code>.
8911 </description>
8912 </field>
8913 <field id="name">
8914 <allocfieldbuf><char/></allocfieldbuf>
8915 <description>
8916 The local variable name, encoded as a
8917 <internallink id="mUTF">modified UTF-8</internallink> string.
8918 </description>
8919 </field>
8920 <field id="signature">
8921 <allocfieldbuf><char/></allocfieldbuf>
8922 <description>
8923 The local variable's type signature, encoded as a
8924 <internallink id="mUTF">modified UTF-8</internallink> string.
8925 The signature format is the same as that defined in
8926 <vmspec chapter="4.3.2"/>.
8927 </description>
8928 </field>
8929 <field id="generic_signature">
8930 <allocfieldbuf><char/></allocfieldbuf>
8931 <description>
8932 The local variable's generic signature, encoded as a
8933 <internallink id="mUTF">modified UTF-8</internallink> string.
8934 The value of this field will be null for any local
8935 variable which does not have a generic type.
8936 </description>
8937 </field>
8938 <field id="slot">
8939 <jint/>
8940 <description>
8941 The local variable's slot. See <internallink id="local">Local Variables</internallink>.
8942 </description>
8943 </field>
8944 </typedef>
8945 <description>
8946 Return local variable information.
8947 </description>
8948 <origin>jvmdiClone</origin>
8949 <capabilities>
8950 <required id="can_access_local_variables"></required>
8951 </capabilities>
8952 <parameters>
8953 <param id="method">
8954 <jmethodID native="error"/>
8955 <description>
8956 The method to query.
8957 </description>
8958 </param>
8959 <param id="entry_count_ptr">
8960 <outptr><jint/></outptr>
8961 <description>
8962 On return, points to the number of entries in the table
8963 </description>
8964 </param>
8965 <param id="table_ptr">
8966 <allocbuf outcount="entry_count_ptr"><struct>jvmtiLocalVariableEntry</struct></allocbuf>
8967 <description>
8968 On return, points to an array of local variable table entries.
8969 </description>
8970 </param>
8971 </parameters>
8972 <errors>
8973 <error id="JVMTI_ERROR_ABSENT_INFORMATION">
8974 Class information does not include local variable
8975 information.
8976 </error>
8977 </errors>
8978 </function>
8979
8980 <function id="GetBytecodes" phase="start" num="75">
8981 <synopsis>Get Bytecodes</synopsis>
8982 <description>
8983 For the method indicated by <code>method</code>,
8984 return the bytecodes that implement the method. The number of
8985 bytecodes is returned via <code>bytecode_count_ptr</code>. The bytecodes
8986 themselves are returned via <code>bytecodes_ptr</code>.
8987 </description>
8988 <origin>jvmdi</origin>
8989 <capabilities>
8990 <required id="can_get_bytecodes"></required>
8991 </capabilities>
8992 <parameters>
8993 <param id="klass">
8994 <jclass method="method"/>
8995 <description>
8996 The class to query.
8997 </description>
8998 </param>
8999 <param id="method">
9000 <jmethodID class="klass" native="error"/>
9001 <description>
9002 The method to query.
9003 </description>
9004 </param>
9005 <param id="bytecode_count_ptr">
9006 <outptr><jint/></outptr>
9007 <description>
9008 On return, points to the length of the bytecode array
9009 </description>
9010 </param>
9011 <param id="bytecodes_ptr">
9012 <allocbuf outcount="bytecode_count_ptr"><uchar/></allocbuf>
9013 <description>
9014 On return, points to the pointer to the bytecode array
9015 </description>
9016 </param>
9017 </parameters>
9018 <errors>
9019 </errors>
9020 </function>
9021
9022 <function id="IsMethodNative" phase="start" num="76">
9023 <synopsis>Is Method Native</synopsis>
9024 <description>
9025 For the method indicated by <code>method</code>, return a
9026 value indicating whether the method is native via <code>is_native_ptr</code>
9027 </description>
9028 <origin>jvmdi</origin>
9029 <capabilities>
9030 </capabilities>
9031 <parameters>
9032 <param id="klass">
9033 <jclass method="method"/>
9034 <description>
9035 The class to query.
9036 </description>
9037 </param>
9038 <param id="method">
9039 <jmethodID class="klass"/>
9040 <description>
9041 The method to query.
9042 </description>
9043 </param>
9044 <param id="is_native_ptr">
9045 <outptr><jboolean/></outptr>
9046 <description>
9047 On return, points to the boolean result of this function.
9048 </description>
9049 </param>
9050 </parameters>
9051 <errors>
9052 </errors>
9053 </function>
9054
9055 <function id="IsMethodSynthetic" phase="start" num="77">
9056 <synopsis>Is Method Synthetic</synopsis>
9057 <description>
9058 For the method indicated by <code>method</code>, return a
9059 value indicating whether the method is synthetic via <code>is_synthetic_ptr</code>.
9060 Synthetic methods are generated by the compiler but not present in the
9061 original source code.
9062 </description>
9063 <origin>jvmdi</origin>
9064 <capabilities>
9065 <required id="can_get_synthetic_attribute"></required>
9066 </capabilities>
9067 <parameters>
9068 <param id="klass">
9069 <jclass method="method"/>
9070 <description>
9071 The class to query.
9072 </description>
9073 </param>
9074 <param id="method">
9075 <jmethodID class="klass"/>
9076 <description>
9077 The method to query.
9078 </description>
9079 </param>
9080 <param id="is_synthetic_ptr">
9081 <outptr><jboolean/></outptr>
9082 <description>
9083 On return, points to the boolean result of this function.
9084 </description>
9085 </param>
9086 </parameters>
9087 <errors>
9088 </errors>
9089 </function>
9090
9091 <function id="IsMethodObsolete" phase="start" num="91">
9092 <synopsis>Is Method Obsolete</synopsis>
9093 <description>
9094 Determine if a method ID refers to an
9095 <internallink id="obsoleteMethods">obsolete</internallink>
9096 method version.
9097 </description>
9098 <origin>jvmdi</origin>
9099 <capabilities>
9100 </capabilities>
9101 <parameters>
9102 <param id="klass">
9103 <jclass method="method"/>
9104 <description>
9105 The class to query.
9106 </description>
9107 </param>
9108 <param id="method">
9109 <jmethodID class="klass"/>
9110 <description>
9111 The method ID to query.
9112 </description>
9113 </param>
9114 <param id="is_obsolete_ptr">
9115 <outptr><jboolean/></outptr>
9116 <description>
9117 On return, points to the boolean result of this function.
9118 </description>
9119 </param>
9120 </parameters>
9121 <errors>
9122 </errors>
9123 </function>
9124
9125 <function id="SetNativeMethodPrefix" jkernel="yes" phase="any" num="73" since="1.1">
9126 <synopsis>Set Native Method Prefix</synopsis>
9127 <description>
9128 This function modifies the failure handling of
9129 native method resolution by allowing retry
9130 with a prefix applied to the name.
9131 When used with the
9132 <eventlink id="ClassFileLoadHook">ClassFileLoadHook
9133 event</eventlink>, it enables native methods to be
9134 <internallink id="bci">instrumented</internallink>.
9135 <p/>
9136 Since native methods cannot be directly instrumented
9137 (they have no bytecodes), they must be wrapped with
9138 a non-native method which can be instrumented.
9139 For example, if we had:
9140 <example>
9141 native boolean foo(int x);</example>
9142 <p/>
9143 We could transform the class file (with the
9144 ClassFileLoadHook event) so that this becomes:
9145 <example>
9146 boolean foo(int x) {
9147 <i>... record entry to foo ...</i>
9148 return wrapped_foo(x);
9149 }
9150
9151 native boolean wrapped_foo(int x);</example>
9152 <p/>
9153 Where foo becomes a wrapper for the actual native method
9154 with the appended prefix "wrapped_". Note that
9155 "wrapped_" would be a poor choice of prefix since it
9156 might conceivably form the name of an existing method
9157 thus something like "$$$MyAgentWrapped$$$_" would be
9158 better but would make these examples less readable.
9159 <p/>
9160 The wrapper will allow data to be collected on the native
9161 method call, but now the problem becomes linking up the
9162 wrapped method with the native implementation.
9163 That is, the method <code>wrapped_foo</code> needs to be
9164 resolved to the native implementation of <code>foo</code>,
9165 which might be:
9166 <example>
9167 Java_somePackage_someClass_foo(JNIEnv* env, jint x)</example>
9168 <p/>
9169 This function allows the prefix to be specified and the
9170 proper resolution to occur.
9171 Specifically, when the standard resolution fails, the
9172 resolution is retried taking the prefix into consideration.
9173 There are two ways that resolution occurs, explicit
9174 resolution with the JNI function <code>RegisterNatives</code>
9175 and the normal automatic resolution. For
9176 <code>RegisterNatives</code>, the VM will attempt this
9177 association:
9178 <example>
9179 method(foo) -> nativeImplementation(foo)</example>
9180 <p/>
9181 When this fails, the resolution will be retried with
9182 the specified prefix prepended to the method name,
9183 yielding the correct resolution:
9184 <example>
9185 method(wrapped_foo) -> nativeImplementation(foo)</example>
9186 <p/>
9187 For automatic resolution, the VM will attempt:
9188 <example>
9189 method(wrapped_foo) -> nativeImplementation(wrapped_foo)</example>
9190 <p/>
9191 When this fails, the resolution will be retried with
9192 the specified prefix deleted from the implementation name,
9193 yielding the correct resolution:
9194 <example>
9195 method(wrapped_foo) -> nativeImplementation(foo)</example>
9196 <p/>
9197 Note that since the prefix is only used when standard
9198 resolution fails, native methods can be wrapped selectively.
9199 <p/>
9200 Since each <jvmti/> environment is independent and
9201 can do its own transformation of the bytecodes, more
9202 than one layer of wrappers may be applied. Thus each
9203 environment needs its own prefix. Since transformations
9204 are applied in order, the prefixes, if applied, will
9205 be applied in the same order.
9206 The order of transformation application is described in
9207 the <eventlink id="ClassFileLoadHook"/> event.
9208 Thus if three environments applied
9209 wrappers, <code>foo</code> might become
9210 <code>$env3_$env2_$env1_foo</code>. But if, say,
9211 the second environment did not apply a wrapper to
9212 <code>foo</code> it would be just
9213 <code>$env3_$env1_foo</code>. To be able to
9214 efficiently determine the sequence of prefixes,
9215 an intermediate prefix is only applied if its non-native
9216 wrapper exists. Thus, in the last example, even though
9217 <code>$env1_foo</code> is not a native method, the
9218 <code>$env1_</code> prefix is applied since
9219 <code>$env1_foo</code> exists.
9220 <p/>
9221 Since the prefixes are used at resolution time
9222 and since resolution may be arbitrarily delayed, a
9223 native method prefix must remain set as long as there
9224 are corresponding prefixed native methods.
9225 </description>
9226 <origin>new</origin>
9227 <capabilities>
9228 <required id="can_set_native_method_prefix"></required>
9229 </capabilities>
9230 <parameters>
9231 <param id="prefix">
9232 <inbuf>
9233 <char/>
9234 <nullok>
9235 any existing prefix in this environment is cancelled
9236 </nullok>
9237 </inbuf>
9238 <description>
9239 The prefix to apply, encoded as a
9240 <internallink id="mUTF">modified UTF-8</internallink> string.
9241 </description>
9242 </param>
9243 </parameters>
9244 <errors>
9245 </errors>
9246 </function>
9247
9248 <function id="SetNativeMethodPrefixes" jkernel="yes" phase="any" num="74" since="1.1">
9249 <synopsis>Set Native Method Prefixes</synopsis>
9250 <description>
9251 For a normal agent, <functionlink id="SetNativeMethodPrefix"/>
9252 will provide all needed native method prefixing.
9253 For a meta-agent that performs multiple independent class
9254 file transformations (for example as a proxy for another
9255 layer of agents) this function allows each transformation
9256 to have its own prefix.
9257 The prefixes are applied in the order supplied and are
9258 processed in the same manner as described for the
9259 application of prefixes from multiple <jvmti/> environments
9260 in <functionlink id="SetNativeMethodPrefix"/>.
9261 <p/>
9262 Any previous prefixes are replaced. Thus, calling this
9263 function with a <paramlink id="prefix_count"/> of <code>0</code>
9264 disables prefixing in this environment.
9265 <p/>
9266 <functionlink id="SetNativeMethodPrefix"/> and this function
9267 are the two ways to set the prefixes.
9268 Calling <code>SetNativeMethodPrefix</code> with
9269 a prefix is the same as calling this function with
9270 <paramlink id="prefix_count"/> of <code>1</code>.
9271 Calling <code>SetNativeMethodPrefix</code> with
9272 a null pointer is the same as calling this function with
9273 <paramlink id="prefix_count"/> of <code>0</code>.
9274 </description>
9275 <origin>new</origin>
9276 <capabilities>
9277 <required id="can_set_native_method_prefix"></required>
9278 </capabilities>
9279 <parameters>
9280 <param id="prefix_count">
9281 <jint min="0"/>
9282 <description>
9283 The number of prefixes to apply.
9284 </description>
9285 </param>
9286 <param id="prefixes">
9287 <agentbuf>
9288 <char/>
9289 </agentbuf>
9290 <description>
9291 The prefixes to apply for this environment, each encoded as a
9292 <internallink id="mUTF">modified UTF-8</internallink> string.
9293 </description>
9294 </param>
9295 </parameters>
9296 <errors>
9297 </errors>
9298 </function>
9299
9300 </category>
9301
9302 <category id="RawMonitors" label="Raw Monitor">
9303
9304 <function id="CreateRawMonitor" phase="onload" callbacksafe="safe" num="31">
9305 <synopsis>Create Raw Monitor</synopsis>
9306 <description>
9307 Create a raw monitor.
9308 </description>
9309 <origin>jvmdi</origin>
9310 <capabilities>
9311 </capabilities>
9312 <parameters>
9313 <param id="name">
9314 <inbuf><char/></inbuf>
9315 <description>
9316 A name to identify the monitor, encoded as a
9317 <internallink id="mUTF">modified UTF-8</internallink> string.
9318 </description>
9319 </param>
9320 <param id="monitor_ptr">
9321 <outptr><jrawMonitorID/></outptr>
9322 <description>
9323 On return, points to the created monitor.
9324 </description>
9325 </param>
9326 </parameters>
9327 <errors>
9328 </errors>
9329 </function>
9330
9331 <function id="DestroyRawMonitor" phase="onload" callbacksafe="safe" num="32">
9332 <synopsis>Destroy Raw Monitor</synopsis>
9333 <description>
9334 Destroy the raw monitor.
9335 If the monitor being destroyed has been entered by this thread, it will be
9336 exited before it is destroyed.
9337 If the monitor being destroyed has been entered by another thread,
9338 an error will be returned and the monitor will not be destroyed.
9339 </description>
9340 <origin>jvmdi</origin>
9341 <capabilities>
9342 </capabilities>
9343 <parameters>
9344 <param id="monitor">
9345 <jrawMonitorID/>
9346 <description>
9347 The monitor
9348 </description>
9349 </param>
9350 </parameters>
9351 <errors>
9352 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER">
9353 Not monitor owner
9354 </error>
9355 </errors>
9356 </function>
9357
9358 <function id="RawMonitorEnter" phase="any" callbacksafe="safe" impl="innative notrace" num="33">
9359 <synopsis>Raw Monitor Enter</synopsis>
9360 <description>
9361 Gain exclusive ownership of a raw monitor.
9362 The same thread may enter a monitor more then once.
9363 The thread must
9364 <functionlink id="RawMonitorExit">exit</functionlink>
9365 the monitor the same number of times as it is entered.
9366 If a monitor is entered during <code>OnLoad</code> (before attached threads exist)
9367 and has not exited when attached threads come into existence, the enter
9368 is considered to have occurred on the main thread.
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 </errors>
9383 </function>
9384
9385 <function id="RawMonitorExit" phase="any" callbacksafe="safe" impl="innative notrace" num="34">
9386 <synopsis>Raw Monitor Exit</synopsis>
9387 <description>
9388 Release exclusive ownership of a raw monitor.
9389 </description>
9390 <origin>jvmdi</origin>
9391 <capabilities>
9392 </capabilities>
9393 <parameters>
9394 <param id="monitor">
9395 <jrawMonitorID/>
9396 <description>
9397 The monitor
9398 </description>
9399 </param>
9400 </parameters>
9401 <errors>
9402 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER">
9403 Not monitor owner
9404 </error>
9405 </errors>
9406 </function>
9407
9408 <function id="RawMonitorWait" phase="any" callbacksafe="safe" impl="innative notrace" num="35">
9409 <synopsis>Raw Monitor Wait</synopsis>
9410 <description>
9411 Wait for notification of the raw monitor.
9412 <p/>
9413 Causes the current thread to wait until either another thread calls
9414 <functionlink id="RawMonitorNotify"/> or
9415 <functionlink id="RawMonitorNotifyAll"/>
9416 for the specified raw monitor, or the specified
9417 <paramlink id="millis">timeout</paramlink>
9418 has elapsed.
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 <param id="millis">
9431 <jlong/>
9432 <description>
9433 The timeout, in milliseconds. If the timeout is
9434 zero, then real time is not taken into consideration
9435 and the thread simply waits until notified.
9436 </description>
9437 </param>
9438 </parameters>
9439 <errors>
9440 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER">
9441 Not monitor owner
9442 </error>
9443 <error id="JVMTI_ERROR_INTERRUPT">
9444 Wait was interrupted, try again
9445 </error>
9446 </errors>
9447 </function>
9448
9449 <function id="RawMonitorNotify" phase="any" callbacksafe="safe" impl="notrace" num="36">
9450 <synopsis>Raw Monitor Notify</synopsis>
9451 <description>
9452 Notify a single thread waiting on the raw monitor.
9453 </description>
9454 <origin>jvmdi</origin>
9455 <capabilities>
9456 </capabilities>
9457 <parameters>
9458 <param id="monitor">
9459 <jrawMonitorID/>
9460 <description>
9461 The monitor
9462 </description>
9463 </param>
9464 </parameters>
9465 <errors>
9466 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER">
9467 Not monitor owner
9468 </error>
9469 </errors>
9470 </function>
9471
9472 <function id="RawMonitorNotifyAll" phase="any" callbacksafe="safe" impl="notrace" num="37">
9473 <synopsis>Raw Monitor Notify All</synopsis>
9474 <description>
9475 Notify all threads waiting on the raw monitor.
9476 </description>
9477 <origin>jvmdi</origin>
9478 <capabilities>
9479 </capabilities>
9480 <parameters>
9481 <param id="monitor">
9482 <jrawMonitorID/>
9483 <description>
9484 The monitor
9485 </description>
9486 </param>
9487 </parameters>
9488 <errors>
9489 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER">
9490 Not monitor owner
9491 </error>
9492 </errors>
9493 </function>
9494
9495 <elide>
9496 <function id="GetRawMonitorUse" num="118">
9497 <synopsis>Get Raw Monitor Use</synopsis>
9498 <description>
9499 The fields of the <functionlink id="jvmtiMonitorUsage"></functionlink> structure
9500 are filled in with information about usage of the raw monitor.
9501 </description>
9502 <origin>new</origin>
9503 <capabilities>
9504 <required id="can_get_raw_monitor_usage"></required>
9505 </capabilities>
9506 <parameters>
9507 <param id="monitor">
9508 <jrawMonitorID/>
9509 <description>
9510 the raw monitor to query.
9511 </description>
9512 </param>
9513 <param id="info_ptr">
9514 <outptr><struct>jvmtiMonitorUsage</struct></outptr>
9515 <description>
9516 On return, filled with monitor information for the
9517 specified raw monitor.
9518 </description>
9519 </param>
9520 </parameters>
9521 <errors>
9522 </errors>
9523 </function>
9524
9525 <function id="GetRawMonitors" num="119">
9526 <synopsis>Get Raw Monitors</synopsis>
9527 <description>
9528 Return the list of raw monitors.
9529 <p/>
9530 Note: details about each monitor can be examined with
9531 <functionlink id="GetRawMonitorUse"></functionlink>.
9532 </description>
9533 <origin>new</origin>
9534 <capabilities>
9535 <required id="can_get_raw_monitor_usage"></required>
9536 </capabilities>
9537 <parameters>
9538 <param id="monitorCnt">
9539 <outptr><jint/></outptr>
9540 <description>
9541 On return, pointer to the number
9542 of monitors returned in <code>monitors_ptr</code>.
9543 </description>
9544 </param>
9545 <param id="monitors_ptr">
9546 <allocbuf outcount="monitorCnt"><jrawMonitorID/></allocbuf>
9547 <description>
9548 On return, pointer to the monitor list.
9549 </description>
9550 </param>
9551 </parameters>
9552 <errors>
9553 </errors>
9554 </function>
9555 </elide>
9556 </category>
9557
9558 <category id="jniIntercept" label="JNI Function Interception">
9559
9560 <intro>
9561 Provides the ability to intercept and resend
9562 Java Native Interface (JNI) function calls
9563 by manipulating the JNI function table.
9564 See <externallink id="jni/functions.html">JNI
9565 Functions</externallink> in the <i>Java Native Interface Specification</i>.
9566 <p/>
9567 The following example illustrates intercepting the
9568 <code>NewGlobalRef</code> JNI call in order to count reference
9569 creation.
9570 <example>
9571 JNIEnv original_jni_Functions;
9572 JNIEnv redirected_jni_Functions;
9573 int my_global_ref_count = 0;
9574
9575 jobject
9576 MyNewGlobalRef(JNIEnv *jni_env, jobject lobj) {
9577 ++my_global_ref_count;
9578 return originalJNIFunctions->NewGlobalRef(env, lobj);
9579 }
9580
9581 void
9582 myInit() {
9583 jvmtiError err;
9584
9585 err = (*jvmti_env)->GetJNIFunctionTable(jvmti_env, &original_jni_Functions);
9586 if (err != JVMTI_ERROR_NONE) {
9587 die();
9588 }
9589 err = (*jvmti_env)->GetJNIFunctionTable(jvmti_env, &redirected_jni_Functions);
9590 if (err != JVMTI_ERROR_NONE) {
9591 die();
9592 }
9593 redirectedJNIFunctions->NewGlobalRef = MyNewGlobalRef;
9594 err = (*jvmti_env)->SetJNIFunctionTable(jvmti_env, redirected_jni_Functions);
9595 if (err != JVMTI_ERROR_NONE) {
9596 die();
9597 }
9598 }
9599 </example>
9600 Sometime after <code>myInit</code> is called the user's JNI
9601 code is executed which makes the call to create a new global
9602 reference. Instead of going to the normal JNI implementation
9603 the call goes to <code>myNewGlobalRef</code>. Note that a
9604 copy of the original function table is kept so that the normal
9605 JNI function can be called after the data is collected.
9606 Note also that any JNI functions which are not overwritten
9607 will behave normally.
9608 <todo>
9609 check that the example compiles and executes.
9610 </todo>
9611 </intro>
9612
9613 <function id="SetJNIFunctionTable" phase="start" num="120">
9614 <synopsis>Set JNI Function Table</synopsis>
9615 <description>
9616 Set the JNI function table
9617 in all current and future JNI environments.
9618 As a result, all future JNI calls are directed to the specified functions.
9619 Use <functionlink id="GetJNIFunctionTable"></functionlink> to get the
9620 function table to pass to this function.
9621 For this function to take effect the updated table entries must be
9622 used by the JNI clients.
9623 Since the table is defined <code>const</code> some compilers may optimize
9624 away the access to the table, thus preventing this function from taking
9625 effect.
9626 The table is copied--changes to the local copy of the
9627 table have no effect.
9628 This function affects only the function table, all other aspects of the environment are
9629 unaffected.
9630 See the examples <internallink id="jniIntercept">above</internallink>.
9631 </description>
9632 <origin>new</origin>
9633 <capabilities>
9634 </capabilities>
9635 <parameters>
9636 <param id="function_table">
9637 <inptr>
9638 <struct>jniNativeInterface</struct>
9639 </inptr>
9640 <description>
9641 Points to the new JNI function table.
9642 </description>
9643 </param>
9644 </parameters>
9645 <errors>
9646 </errors>
9647 </function>
9648
9649 <function id="GetJNIFunctionTable" phase="start" num="121">
9650 <synopsis>Get JNI Function Table</synopsis>
9651 <description>
9652 Get the JNI function table.
9653 The JNI function table is copied into allocated memory.
9654 If <functionlink id="SetJNIFunctionTable"></functionlink>
9655 has been called, the modified (not the original) function
9656 table is returned.
9657 Only the function table is copied, no other aspects of the environment
9658 are copied.
9659 See the examples <internallink id="jniIntercept">above</internallink>.
9660 </description>
9661 <origin>new</origin>
9662 <capabilities>
9663 </capabilities>
9664 <parameters>
9665 <param id="function_table">
9666 <allocbuf>
9667 <struct>jniNativeInterface</struct>
9668 </allocbuf>
9669 <description>
9670 On return, <code>*function_table</code>
9671 points a newly allocated copy of the JNI function table.
9672 </description>
9673 </param>
9674 </parameters>
9675 <errors>
9676 </errors>
9677 </function>
9678
9679 </category>
9680
9681 <category id="eventManagement" label="Event Management">
9682
9683 <function id="SetEventCallbacks" jkernel="yes" phase="onload" num="122">
9684 <synopsis>Set Event Callbacks</synopsis>
9685 <description>
9686 Set the functions to be called for each event.
9687 The callbacks are specified by supplying a replacement function table.
9688 The function table is copied--changes to the local copy of the
9689 table have no effect.
9690 This is an atomic action, all callbacks are set at once.
9691 No events are sent before this function is called.
9692 When an entry is null or when the event is beyond
9693 <paramlink id="size_of_callbacks"></paramlink> no event is sent.
9694 Details on events are
9695 described <internallink id="EventSection">later</internallink> in this document.
9696 An event must be enabled and have a callback in order to be
9697 sent--the order in which this function and
9698 <functionlink id="SetEventNotificationMode"></functionlink>
9699 are called does not affect the result.
9700 </description>
9701 <origin>new</origin>
9702 <capabilities>
9703 </capabilities>
9704 <parameters>
9705 <param id="callbacks">
9706 <inptr>
9707 <struct>jvmtiEventCallbacks</struct>
9708 <nullok>remove the existing callbacks</nullok>
9709 </inptr>
9710 <description>
9711 The new event callbacks.
9712 </description>
9713 </param>
9714 <param id="size_of_callbacks">
9715 <jint min="0"/>
9716 <description>
9717 <code>sizeof(jvmtiEventCallbacks)</code>--for version
9718 compatibility.
9719 </description>
9720 </param>
9721 </parameters>
9722 <errors>
9723 </errors>
9724 </function>
9725
9726 <function id="SetEventNotificationMode" jkernel="yes" phase="onload" num="2">
9727 <synopsis>Set Event Notification Mode</synopsis>
9728 <description>
9729 Control the generation of events.
9730 <constants id="jvmtiEventMode" label="Event Enable/Disable" kind="enum">
9731 <constant id="JVMTI_ENABLE" num="1">
9732 If <paramlink id="mode"></paramlink> is <code>JVMTI_ENABLE</code>,
9733 the event <paramlink id="event_type"></paramlink> will be enabled
9734 </constant>
9735 <constant id="JVMTI_DISABLE" num="0">
9736 If <paramlink id="mode"></paramlink> is <code>JVMTI_DISABLE</code>,
9737 the event <paramlink id="event_type"></paramlink> will be disabled
9738 </constant>
9739 </constants>
9740 If <code>event_thread</code> is null,
9741 the event is enabled or disabled globally; otherwise, it is
9742 enabled or disabled for a particular thread.
9743 An event is generated for
9744 a particular thread if it is enabled either at the thread or global
9745 levels.
9746 <p/>
9747 See <internallink id="EventIndex">below</internallink> for information on specific events.
9748 <p/>
9749 The following events cannot be controlled at the thread
9750 level through this function.
9751 <ul>
9752 <li><eventlink id="VMInit"></eventlink></li>
9753 <li><eventlink id="VMStart"></eventlink></li>
9754 <li><eventlink id="VMDeath"></eventlink></li>
9755 <li><eventlink id="ThreadStart"></eventlink></li>
9756 <li><eventlink id="VirtualThreadStart"></eventlink></li>
9757 <li><eventlink id="CompiledMethodLoad"></eventlink></li>
9758 <li><eventlink id="CompiledMethodUnload"></eventlink></li>
9759 <li><eventlink id="DynamicCodeGenerated"></eventlink></li>
9760 <li><eventlink id="DataDumpRequest"></eventlink></li>
9761 </ul>
9762 <p/>
9763 Initially, no events are enabled at either the thread level
9764 or the global level.
9765 <p/>
9766 Any needed capabilities (see Event Enabling Capabilities below) must be possessed
9767 before calling this function.
9768 <p/>
9769 Details on events are
9770 described <internallink id="EventSection">below</internallink>.
9771 </description>
9772 <origin>jvmdiClone</origin>
9773 <eventcapabilities></eventcapabilities>
9774 <parameters>
9775 <param id="mode">
9776 <enum>jvmtiEventMode</enum>
9777 <description>
9778 <code>JVMTI_ENABLE</code> or <code>JVMTI_DISABLE</code>
9779 </description>
9780 </param>
9781 <param id="event_type">
9782 <enum>jvmtiEvent</enum>
9783 <description>
9784 the event to control
9785 </description>
9786 </param>
9787 <param id="event_thread">
9788 <ptrtype>
9789 <jthread impl="noconvert"/>
9790 <nullok>event is controlled at the global level</nullok>
9791 </ptrtype>
9792 <description>
9793 The thread to control
9794 </description>
9795 </param>
9796 <param id="...">
9797 <varargs/>
9798 <description>
9799 for future expansion
9800 </description>
9801 </param>
9802 </parameters>
9803 <errors>
9804 <error id="JVMTI_ERROR_INVALID_THREAD">
9805 <paramlink id="event_thread"/> is non-null and is not a valid thread.
9806 </error>
9807 <error id="JVMTI_ERROR_THREAD_NOT_ALIVE">
9808 <paramlink id="event_thread"/> is non-null and is not alive
9809 (has not been started or has terminated).
9810 </error>
9811 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
9812 thread level control was attempted on events which do not
9813 permit thread level control.
9814 </error>
9815 <error id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY">
9816 The Required Event Enabling Capability is not possessed.
9817 </error>
9818 </errors>
9819 </function>
9820
9821 <function id="GenerateEvents" num="123">
9822 <synopsis>Generate Events</synopsis>
9823 <description>
9824 Generate events to represent the current state of the VM.
9825 For example, if <paramlink id="event_type"/> is
9826 <code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code>,
9827 a <eventlink id="CompiledMethodLoad"></eventlink> event will be
9828 sent for each currently compiled method.
9829 Methods that were loaded and now have been unloaded are not sent.
9830 The history of what events have previously been sent does not
9831 effect what events are sent by this function--for example,
9832 all currently compiled methods
9833 will be sent each time this function is called.
9834 <p/>
9835 This function is useful when
9836 events may have been missed due to the agent attaching after program
9837 execution begins; this function generates the missed events.
9838 <p/>
9839 Attempts to execute Java programming language code or
9840 JNI functions may be paused until this function returns -
9841 so neither should be called from the thread sending the event.
9842 This function returns only after the missed events have been
9843 sent, processed and have returned.
9844 The event may be sent on a different thread than the thread
9845 on which the event occurred.
9846 The callback for the event must be set with
9847 <functionlink id="SetEventCallbacks"></functionlink>
9848 and the event must be enabled with
9849 <functionlink id="SetEventNotificationMode"></functionlink>
9850 or the events will not occur.
9851 If the VM no longer has the information to generate some or
9852 all of the requested events, the events are simply not sent -
9853 no error is returned.
9854 <p/>
9855 Only the following events are supported:
9856 <ul>
9857 <li><eventlink id="CompiledMethodLoad"></eventlink></li>
9858 <li><eventlink id="DynamicCodeGenerated"></eventlink></li>
9859 </ul>
9860 </description>
9861 <origin>new</origin>
9862 <capabilities>
9863 <capability id="can_generate_compiled_method_load_events"></capability>
9864 </capabilities>
9865 <parameters>
9866 <param id="event_type">
9867 <enum>jvmtiEvent</enum>
9868 <description>
9869 The type of event to generate. Must be one of these:
9870 <ul>
9871 <li><eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink></li>
9872 <li><eventlink id="DynamicCodeGenerated"><code>JVMTI_EVENT_DYNAMIC_CODE_GENERATED</code></eventlink></li>
9873 </ul>
9874 </description>
9875 </param>
9876 </parameters>
9877 <errors>
9878 <error id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY">
9879 <paramlink id="event_type"/> is
9880 <eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink>
9881 and <fieldlink id="can_generate_compiled_method_load_events" struct="jvmtiCapabilities"></fieldlink>
9882 is <code>false</code>.
9883 </error>
9884 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
9885 <paramlink id="event_type"/> is other than
9886 <eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink>
9887 or <eventlink id="DynamicCodeGenerated"><code>JVMTI_EVENT_DYNAMIC_CODE_GENERATED</code></eventlink>.
9888 </error>
9889 </errors>
9890 </function>
9891
9892 </category>
9893
9894 <category id="extension" label="Extension Mechanism">
9895
9896 <intro>
9897 These functions
9898 allow a <jvmti/> implementation to provide functions and events
9899 beyond those defined in this specification.
9900 <p/>
9901 Both extension functions and extension events have parameters
9902 each of which has a 'type' and 'kind' chosen from the following tables:
9903
9904 <constants id="jvmtiParamTypes" label="Extension Function/Event Parameter Types" kind="enum">
9905 <constant id="JVMTI_TYPE_JBYTE" num="101">
9906 Java programming language primitive type - <code>byte</code>.
9907 JNI type <code>jbyte</code>.
9908 </constant>
9909 <constant id="JVMTI_TYPE_JCHAR" num="102">
9910 Java programming language primitive type - <code>char</code>.
9911 JNI type <code>jchar</code>.
9912 </constant>
9913 <constant id="JVMTI_TYPE_JSHORT" num="103">
9914 Java programming language primitive type - <code>short</code>.
9915 JNI type <code>jshort</code>.
9916 </constant>
9917 <constant id="JVMTI_TYPE_JINT" num="104">
9918 Java programming language primitive type - <code>int</code>.
9919 JNI type <datalink id="jint"></datalink>.
9920 </constant>
9921 <constant id="JVMTI_TYPE_JLONG" num="105">
9922 Java programming language primitive type - <code>long</code>.
9923 JNI type <datalink id="jlong"></datalink>.
9924 </constant>
9925 <constant id="JVMTI_TYPE_JFLOAT" num="106">
9926 Java programming language primitive type - <code>float</code>.
9927 JNI type <datalink id="jfloat"></datalink>.
9928 </constant>
9929 <constant id="JVMTI_TYPE_JDOUBLE" num="107">
9930 Java programming language primitive type - <code>double</code>.
9931 JNI type <datalink id="jdouble"></datalink>.
9932 </constant>
9933 <constant id="JVMTI_TYPE_JBOOLEAN" num="108">
9934 Java programming language primitive type - <code>boolean</code>.
9935 JNI type <datalink id="jboolean"></datalink>.
9936 </constant>
9937 <constant id="JVMTI_TYPE_JOBJECT" num="109">
9938 Java programming language object type - <code>java.lang.Object</code>.
9939 JNI type <datalink id="jobject"></datalink>.
9940 Returned values are JNI local references and must be managed.
9941 </constant>
9942 <constant id="JVMTI_TYPE_JTHREAD" num="110">
9943 Java programming language object type - <code>java.lang.Thread</code>.
9944 <jvmti/> type <datalink id="jthread"></datalink>.
9945 Returned values are JNI local references and must be managed.
9946 </constant>
9947 <constant id="JVMTI_TYPE_JCLASS" num="111">
9948 Java programming language object type - <code>java.lang.Class</code>.
9949 JNI type <datalink id="jclass"></datalink>.
9950 Returned values are JNI local references and must be managed.
9951 </constant>
9952 <constant id="JVMTI_TYPE_JVALUE" num="112">
9953 Union of all Java programming language primitive and object types -
9954 JNI type <datalink id="jvalue"></datalink>.
9955 Returned values which represent object types are JNI local references and must be managed.
9956 </constant>
9957 <constant id="JVMTI_TYPE_JFIELDID" num="113">
9958 Java programming language field identifier -
9959 JNI type <datalink id="jfieldID"></datalink>.
9960 </constant>
9961 <constant id="JVMTI_TYPE_JMETHODID" num="114">
9962 Java programming language method identifier -
9963 JNI type <datalink id="jmethodID"></datalink>.
9964 </constant>
9965 <constant id="JVMTI_TYPE_CCHAR" num="115">
9966 C programming language type - <code>char</code>.
9967 </constant>
9968 <constant id="JVMTI_TYPE_CVOID" num="116">
9969 C programming language type - <code>void</code>.
9970 </constant>
9971 <constant id="JVMTI_TYPE_JNIENV" num="117">
9972 JNI environment - <code>JNIEnv</code>.
9973 Should be used with the correct <datalink id="jvmtiParamKind"/> to make it a pointer type.
9974 </constant>
9975 </constants>
9976
9977 <constants id="jvmtiParamKind" label="Extension Function/Event Parameter Kinds" kind="enum">
9978 <constant id="JVMTI_KIND_IN" num="91">
9979 Ingoing argument - <code>foo</code>.
9980 </constant>
9981 <constant id="JVMTI_KIND_IN_PTR" num="92">
9982 Ingoing pointer argument - <code>const foo*</code>.
9983 </constant>
9984 <constant id="JVMTI_KIND_IN_BUF" num="93">
9985 Ingoing array argument - <code>const foo*</code>.
9986 </constant>
9987 <constant id="JVMTI_KIND_ALLOC_BUF" num="94">
9988 Outgoing allocated array argument - <code>foo**</code>.
9989 Free with <code>Deallocate</code>.
9990 </constant>
9991 <constant id="JVMTI_KIND_ALLOC_ALLOC_BUF" num="95">
9992 Outgoing allocated array of allocated arrays argument - <code>foo***</code>.
9993 Free with <code>Deallocate</code>.
9994 </constant>
9995 <constant id="JVMTI_KIND_OUT" num="96">
9996 Outgoing argument - <code>foo*</code>.
9997 </constant>
9998 <constant id="JVMTI_KIND_OUT_BUF" num="97">
9999 Outgoing array argument (pre-allocated by agent) - <code>foo*</code>.
10000 Do not <code>Deallocate</code>.
10001 </constant>
10002 </constants>
10003
10004 </intro>
10005
10006 <typedef id="jvmtiParamInfo" label="Extension Function/Event Parameter Info">
10007 <field id="name">
10008 <allocfieldbuf><char/></allocfieldbuf>
10009 <description>
10010 The parameter name, encoded as a
10011 <internallink id="mUTF">modified UTF-8</internallink> string
10012 </description>
10013 </field>
10014 <field id="kind">
10015 <enum>jvmtiParamKind</enum>
10016 <description>
10017 The kind of the parameter - type modifiers
10018 </description>
10019 </field>
10020 <field id="base_type">
10021 <enum>jvmtiParamTypes</enum>
10022 <description>
10023 The base type of the parameter - modified by <code>kind</code>
10024 </description>
10025 </field>
10026 <field id="null_ok">
10027 <jboolean/>
10028 <description>
10029 Is a null pointer argument permitted? Applies only to pointer and object types.
10030 </description>
10031 </field>
10032 </typedef>
10033
10034 <callback id="jvmtiExtensionFunction">
10035 <enum>jvmtiError</enum>
10036 <synopsis>Extension Function</synopsis>
10037 <description>
10038 This is the implementation-specific extension function.
10039 </description>
10040 <parameters>
10041 <param id="jvmti_env">
10042 <outptr>
10043 <struct>jvmtiEnv</struct>
10044 </outptr>
10045 <description>
10046 The <jvmti/> environment is the only fixed parameter for extension functions.
10047 </description>
10048 </param>
10049 <param id="...">
10050 <varargs/>
10051 <description>
10052 The extension function-specific parameters
10053 </description>
10054 </param>
10055 </parameters>
10056 </callback>
10057
10058 <function id="GetExtensionFunctions" phase="onload" num="124">
10059 <synopsis>Get Extension Functions</synopsis>
10060
10061 <typedef id="jvmtiExtensionFunctionInfo" label="Extension Function Info">
10062 <field id="func">
10063 <ptrtype>
10064 <struct>jvmtiExtensionFunction</struct>
10065 </ptrtype>
10066 <description>
10067 The actual function to call
10068 </description>
10069 </field>
10070 <field id="id">
10071 <allocfieldbuf><char/></allocfieldbuf>
10072 <description>
10073 The identifier for the extension function, encoded as a
10074 <internallink id="mUTF">modified UTF-8</internallink> string.
10075 Uses package name conventions.
10076 For example, <code>com.sun.hotspot.bar</code>
10077 </description>
10078 </field>
10079 <field id="short_description">
10080 <allocfieldbuf><char/></allocfieldbuf>
10081 <description>
10082 A one sentence description of the function, encoded as a
10083 <internallink id="mUTF">modified UTF-8</internallink> string.
10084 </description>
10085 </field>
10086 <field id="param_count">
10087 <jint/>
10088 <description>
10089 The number of parameters excluding <code>jvmtiEnv *jvmti_env</code>
10090 </description>
10091 </field>
10092 <field id="params">
10093 <allocfieldbuf outcount="param_count">
10094 <struct>jvmtiParamInfo</struct>
10095 </allocfieldbuf>
10096 <description>
10097 Array of
10098 <fieldlink id="param_count" struct="jvmtiExtensionFunctionInfo"></fieldlink>
10099 parameters (<code>jvmtiEnv *jvmti_env</code> excluded)
10100 </description>
10101 </field>
10102 <field id="error_count">
10103 <jint/>
10104 <description>
10105 The number of possible error returns (excluding universal errors)
10106 </description>
10107 </field>
10108 <field id="errors">
10109 <allocfieldbuf outcount="error_count">
10110 <enum>jvmtiError</enum>
10111 </allocfieldbuf>
10112 <description>
10113 Array of <fieldlink id="error_count" struct="jvmtiExtensionFunctionInfo"></fieldlink>
10114 possible errors
10115 </description>
10116 </field>
10117 </typedef>
10118
10119 <description>
10120 Returns the set of extension functions.
10121 </description>
10122 <origin>new</origin>
10123 <capabilities>
10124 </capabilities>
10125 <parameters>
10126 <param id="extension_count_ptr">
10127 <outptr><jint/></outptr>
10128 <description>
10129 On return, points to the number of extension functions
10130 </description>
10131 </param>
10132 <param id="extensions">
10133 <allocbuf outcount="extension_count_ptr"><struct>jvmtiExtensionFunctionInfo</struct></allocbuf>
10134 <description>
10135 Returns an array of extension function info, one per function
10136 </description>
10137 </param>
10138 </parameters>
10139 <errors>
10140 </errors>
10141 </function>
10142
10143 <function id="GetExtensionEvents" phase="onload" num="125">
10144 <synopsis>Get Extension Events</synopsis>
10145
10146 <typedef id="jvmtiExtensionEventInfo" label="Extension Event Info">
10147 <field id="extension_event_index">
10148 <jint/>
10149 <description>
10150 The identifying index of the event
10151 </description>
10152 </field>
10153 <field id="id">
10154 <allocfieldbuf><char/></allocfieldbuf>
10155 <description>
10156 The identifier for the extension event, encoded as a
10157 <internallink id="mUTF">modified UTF-8</internallink> string.
10158 Uses package name conventions.
10159 For example, <code>com.sun.hotspot.bar</code>
10160 </description>
10161 </field>
10162 <field id="short_description">
10163 <allocfieldbuf><char/></allocfieldbuf>
10164 <description>
10165 A one sentence description of the event, encoded as a
10166 <internallink id="mUTF">modified UTF-8</internallink> string.
10167 </description>
10168 </field>
10169 <field id="param_count">
10170 <jint/>
10171 <description>
10172 The number of parameters excluding <code>jvmtiEnv *jvmti_env</code>
10173 </description>
10174 </field>
10175 <field id="params">
10176 <allocfieldbuf outcount="param_count">
10177 <struct>jvmtiParamInfo</struct>
10178 </allocfieldbuf>
10179 <description>
10180 Array of
10181 <fieldlink id="param_count" struct="jvmtiExtensionEventInfo"></fieldlink>
10182 parameters (<code>jvmtiEnv *jvmti_env</code> excluded)
10183 </description>
10184 </field>
10185 </typedef>
10186
10187 <description>
10188 Returns the set of extension events.
10189 </description>
10190 <origin>new</origin>
10191 <capabilities>
10192 </capabilities>
10193 <parameters>
10194 <param id="extension_count_ptr">
10195 <outptr><jint/></outptr>
10196 <description>
10197 On return, points to the number of extension events
10198 </description>
10199 </param>
10200 <param id="extensions">
10201 <allocbuf outcount="extension_count_ptr"><struct>jvmtiExtensionEventInfo</struct></allocbuf>
10202 <description>
10203 Returns an array of extension event info, one per event
10204 </description>
10205 </param>
10206 </parameters>
10207 <errors>
10208 </errors>
10209 </function>
10210
10211 <callback id="jvmtiExtensionEvent">
10212 <void/>
10213 <synopsis>Extension Event</synopsis>
10214 <description>
10215 This is the implementation-specific event.
10216 The event handler is set with
10217 <functionlink id="SetExtensionEventCallback"/>.
10218 <p/>
10219 Event handlers for extension events must be declared varargs to match this definition.
10220 Failure to do so could result in calling convention mismatch and undefined behavior
10221 on some platforms.
10222 <p/>
10223 For example, if the <code>jvmtiParamInfo</code>
10224 returned by <functionlink id="GetExtensionEvents"/> indicates that
10225 there is a <code>jint</code> parameter, the event handler should be
10226 declared:
10227 <example>
10228 void JNICALL myHandler(jvmtiEnv* jvmti_env, ...)
10229 </example>
10230 Note the terminal "<code>...</code>" which indicates varargs.
10231 The <code>jint</code> argument inside <code>myHandler</code> needs to be extracted using
10232 the <code>va_*</code> syntax of the C programming language.
10233 </description>
10234 <parameters>
10235 <param id="jvmti_env">
10236 <outptr>
10237 <struct>jvmtiEnv</struct>
10238 </outptr>
10239 <description>
10240 The <jvmti/> environment is the only fixed parameter for extension events.
10241 </description>
10242 </param>
10243 <param id="...">
10244 <varargs/>
10245 <description>
10246 The extension event-specific parameters
10247 </description>
10248 </param>
10249 </parameters>
10250 </callback>
10251
10252 <function id="SetExtensionEventCallback" phase="onload" num="126">
10253 <synopsis>Set Extension Event Callback</synopsis>
10254
10255 <description>
10256 Sets the callback function for an extension event and
10257 enables the event. Or, if the callback is null, disables
10258 the event. Note that unlike standard events, setting
10259 the callback and enabling the event are a single operation.
10260 </description>
10261 <origin>new</origin>
10262 <capabilities>
10263 </capabilities>
10264 <parameters>
10265 <param id="extension_event_index">
10266 <jint/>
10267 <description>
10268 Identifies which callback to set.
10269 This index is the
10270 <fieldlink id="extension_event_index" struct="jvmtiExtensionEventInfo"></fieldlink>
10271 field of
10272 <datalink id="jvmtiExtensionEventInfo"/>.
10273 </description>
10274 </param>
10275 <param id="callback">
10276 <ptrtype>
10277 <struct>jvmtiExtensionEvent</struct>
10278 <nullok>disable the event</nullok>
10279 </ptrtype>
10280 <description>
10281 If <code>callback</code> is non-null,
10282 set <code>callback</code> to be the event callback function
10283 and enable the event.
10284 </description>
10285 </param>
10286 </parameters>
10287 <errors>
10288 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
10289 <paramlink id="extension_event_index"/> is not an
10290 <fieldlink id="extension_event_index"
10291 struct="jvmtiExtensionEventInfo"/>
10292 returned by
10293 <functionlink id="GetExtensionEvents"/>
10294 </error>
10295 </errors>
10296 </function>
10297
10298 </category>
10299
10300 <category id="capability" label="Capability">
10301
10302 <intro>
10303 The capabilities functions allow you to change the
10304 functionality available to <jvmti/>--that is,
10305 which <jvmti/>
10306 functions can be called, what events can be generated,
10307 and what functionality these events and functions can
10308 provide.
10309 <p/>
10310 The "Capabilities" section of each function and event describe which
10311 capabilities, if any, they are associated with. "Required Functionality"
10312 means it is available for use and no capabilities must be added to use it.
10313 "Optional Functionality" means the agent must possess the capability
10314 before it can be used.
10315 To possess a capability, the agent must
10316 <functionlink id="AddCapabilities">add the capability</functionlink>.
10317 "Optional Features" describe capabilities which,
10318 if added, extend the feature set.
10319 <p/>
10320 The potentially available capabilities of each <jvmti/> implementation are different.
10321 Depending on the implementation, a capability:
10322 <ul>
10323 <li>may never be added</li>
10324 <li>may be added in either the <code>OnLoad</code> or live phase in any environment</li>
10325 <li>may be added only during the <code>OnLoad</code> phase</li>
10326 <li>may be possessed by only one environment at a time</li>
10327 <li>may be possessed by only one environment at a time,
10328 and only during the <code>OnLoad</code> phase</li>
10329 <li>and so on ...</li>
10330 </ul>
10331 Frequently, the addition of a capability may incur a cost in execution speed, start up
10332 time, and/or memory footprint. Note that the overhead of using a capability
10333 is completely different than the overhead of possessing a capability.
10334 Take single stepping as an example. When single stepping is on (that
10335 is, when the event is enabled and thus actively sending events)
10336 the overhead of sending and processing an event
10337 on each instruction is huge in any implementation.
10338 However, the overhead of possessing the capability may be small or large,
10339 depending on the implementation. Also, when and if a capability is potentially
10340 available depends on the implementation. Some examples:
10341 <ul>
10342 <li>One VM might perform all execution by compiling bytecodes into
10343 native code and be unable to generate single step instructions.
10344 In this implementation the capability can not be added.</li>
10345 <li>Another VM may be able to switch execution to a single stepping
10346 interpreter at any time. In this implementation, having the capability has no
10347 overhead and could be added at any time.</li>
10348 <li>Yet another VM might be able to choose a bytecode compiling or single stepping capable interpreted
10349 execution engine at start up, but be unable to switch between them.
10350 In this implementation the capability would need to be added
10351 during the <code>OnLoad</code> phase (before bytecode
10352 execution begins) and would have a large impact on execution speed
10353 even if single stepping was never used.</li>
10354 <li>Still another VM might be able to add an "is single stepping on" check
10355 into compiled bytecodes or a generated interpreter. Again in this implementation
10356 the capability would need to be added during the <code>OnLoad</code> phase but the overhead (a test
10357 and branch on each instruction) would be considerably less.</li>
10358 </ul>
10359 <p/>
10360 Each <jvmti/> <internallink id="environments">environment</internallink>
10361 has its own set of capabilities.
10362 Initially, that set is empty.
10363 Any desired capability must be added.
10364 If possible, capabilities should be added during the <code>OnLoad</code> phase. For most
10365 virtual machines certain capabilities require special set up for
10366 the virtual machine and this set up must happen
10367 during the <code>OnLoad</code> phase, before the virtual machine begins execution.
10368 Once a capability is added, it can
10369 only be removed if explicitly relinquished by the environment.
10370 <p/>
10371 The agent can,
10372 <functionlink id="GetPotentialCapabilities">determine what
10373 capabilities this VM can potentially provide</functionlink>,
10374 <functionlink id="AddCapabilities">add the capabilities
10375 to be used</functionlink>,
10376 <functionlink id="RelinquishCapabilities">release capabilities
10377 which are no longer needed</functionlink>, and
10378 <functionlink id="GetCapabilities">examine the currently available
10379 capabilities</functionlink>.
10380 </intro>
10381
10382 <intro id="capabilityExamples" label="Capability Examples">
10383 For example, a freshly started agent (in the <code>OnLoad</code> function)
10384 wants to enable all possible capabilities.
10385 Note that, in general, this is not advisable as the agent may suffer
10386 a performance penalty for functionality it is not using.
10387 The code might look like this in C:
10388 <example>
10389 jvmtiCapabilities capa;
10390 jvmtiError err;
10391
10392 err = (*jvmti)->GetPotentialCapabilities(jvmti, &capa);
10393 if (err == JVMTI_ERROR_NONE) {
10394 err = (*jvmti)->AddCapabilities(jvmti, &capa);
10395 </example>
10396 For example, if an agent wants to check if it can get
10397 the bytecodes of a method (that is, it wants to check
10398 if it previously added this capability and has not
10399 relinquished it), the code might
10400 look like this in C:
10401 <example>
10402 jvmtiCapabilities capa;
10403 jvmtiError err;
10404
10405 err = (*jvmti)->GetCapabilities(jvmti, &capa);
10406 if (err == JVMTI_ERROR_NONE) {
10407 if (capa.can_get_bytecodes) { ... } }
10408 </example>
10409 </intro>
10410
10411 <capabilitiestypedef id="jvmtiCapabilities" label="The Capabilities Structure">
10412 <description>
10413 The functions in this category use this capabilities structure
10414 which contains boolean flags corresponding to each capability:
10415 </description>
10416 <capabilityfield id="can_tag_objects">
10417 <description>
10418 Can set and get tags, as described in the
10419 <internallink id="Heap">Heap category</internallink>.
10420 </description>
10421 </capabilityfield>
10422 <capabilityfield id="can_generate_field_modification_events">
10423 <description>
10424 Can set watchpoints on field modification -
10425 <functionlink id="SetFieldModificationWatch"></functionlink>
10426 </description>
10427 </capabilityfield>
10428 <capabilityfield id="can_generate_field_access_events">
10429 <description>
10430 Can set watchpoints on field access -
10431 <functionlink id="SetFieldAccessWatch"></functionlink>
10432 </description>
10433 </capabilityfield>
10434 <capabilityfield id="can_get_bytecodes">
10435 <description>
10436 Can get bytecodes of a method <functionlink id="GetBytecodes"></functionlink>
10437 </description>
10438 </capabilityfield>
10439 <capabilityfield id="can_get_synthetic_attribute">
10440 <description>
10441 Can test if a field or method is synthetic -
10442 <functionlink id="IsFieldSynthetic"></functionlink> and
10443 <functionlink id="IsMethodSynthetic"></functionlink>
10444 </description>
10445 </capabilityfield>
10446 <capabilityfield id="can_get_owned_monitor_info">
10447 <description>
10448 Can get information about ownership of monitors -
10449 <functionlink id="GetOwnedMonitorInfo"></functionlink>
10450 </description>
10451 </capabilityfield>
10452 <capabilityfield id="can_get_current_contended_monitor">
10453 <description>
10454 Can <functionlink id="GetCurrentContendedMonitor"></functionlink>
10455 </description>
10456 </capabilityfield>
10457 <capabilityfield id="can_get_monitor_info">
10458 <description>
10459 Can <functionlink id="GetObjectMonitorUsage"></functionlink>
10460 </description>
10461 </capabilityfield>
10462 <capabilityfield id="can_pop_frame">
10463 <description>
10464 Can pop frames off the stack - <functionlink id="PopFrame"></functionlink>
10465 </description>
10466 </capabilityfield>
10467 <capabilityfield id="can_redefine_classes">
10468 <description>
10469 Can redefine classes with <functionlink id="RedefineClasses"/>.
10470 </description>
10471 </capabilityfield>
10472 <capabilityfield id="can_signal_thread">
10473 <description>
10474 Can send stop or interrupt to threads
10475 </description>
10476 </capabilityfield>
10477 <capabilityfield id="can_get_source_file_name">
10478 <description>
10479 Can get the source file name of a class
10480 </description>
10481 </capabilityfield>
10482 <capabilityfield id="can_get_line_numbers">
10483 <description>
10484 Can get the line number table of a method
10485 </description>
10486 </capabilityfield>
10487 <capabilityfield id="can_get_source_debug_extension">
10488 <description>
10489 Can get the source debug extension of a class
10490 </description>
10491 </capabilityfield>
10492 <capabilityfield id="can_access_local_variables">
10493 <description>
10494 Can set and get local variables
10495 </description>
10496 </capabilityfield>
10497 <capabilityfield id="can_maintain_original_method_order">
10498 <description>
10499 Can return methods in the order they occur in the class file
10500 </description>
10501 </capabilityfield>
10502 <capabilityfield id="can_generate_single_step_events">
10503 <description>
10504 Can get <eventlink id="SingleStep">single step</eventlink> events
10505 </description>
10506 </capabilityfield>
10507 <capabilityfield id="can_generate_exception_events">
10508 <description>
10509 Can get <eventlink id="Exception">exception thrown</eventlink> and
10510 <eventlink id="ExceptionCatch">exception catch</eventlink> events
10511 </description>
10512 </capabilityfield>
10513 <capabilityfield id="can_generate_frame_pop_events">
10514 <description>
10515 Can <functionlink id="NotifyFramePop">set</functionlink> and thus get
10516 <eventlink id="FramePop"></eventlink> events
10517 </description>
10518 </capabilityfield>
10519 <capabilityfield id="can_generate_breakpoint_events">
10520 <description>
10521 Can <functionlink id="SetBreakpoint">set</functionlink> and thus get
10522 <eventlink id="Breakpoint"></eventlink> events
10523 </description>
10524 </capabilityfield>
10525 <capabilityfield id="can_suspend">
10526 <description>
10527 Can suspend and resume threads
10528 </description>
10529 </capabilityfield>
10530 <capabilityfield id="can_redefine_any_class">
10531 <description>
10532 <functionlink id="RedefineClasses"/> can be called on any modifiable class.
10533 See <functionlink id="IsModifiableClass"/>.
10534 (<fieldlink id="can_redefine_classes" struct="jvmtiCapabilities"/>
10535 must also be set)
10536 </description>
10537 </capabilityfield>
10538 <capabilityfield id="can_get_current_thread_cpu_time">
10539 <description>
10540 Can <functionlink id="GetCurrentThreadCpuTime">get</functionlink>
10541 current thread CPU time
10542 </description>
10543 </capabilityfield>
10544 <capabilityfield id="can_get_thread_cpu_time">
10545 <description>
10546 Can <functionlink id="GetThreadCpuTime">get</functionlink>
10547 thread CPU time
10548 </description>
10549 </capabilityfield>
10550 <capabilityfield id="can_generate_method_entry_events"
10551 disp1="can_generate" disp2="_method_entry_events"
10552 >
10553 <description>
10554 Can generate method entry events on entering a method
10555 </description>
10556 </capabilityfield>
10557 <capabilityfield id="can_generate_method_exit_events"
10558 disp1="can_generate" disp2="_method_exit_events"
10559 >
10560 <description>
10561 Can generate method exit events on leaving a method
10562 </description>
10563 </capabilityfield>
10564 <capabilityfield id="can_generate_all_class_hook_events"
10565 disp1="can_generate" disp2="_all_class_hook_events"
10566 >
10567 <description>
10568 Can generate ClassFileLoadHook events for every loaded class.
10569 </description>
10570 </capabilityfield>
10571 <capabilityfield id="can_generate_compiled_method_load_events"
10572 disp1="can_generate" disp2="_compiled_method_load_events"
10573 >
10574 <description>
10575 Can generate events when a method is compiled or unloaded
10576 </description>
10577 </capabilityfield>
10578 <capabilityfield id="can_generate_monitor_events"
10579 disp1="can_generate" disp2="_monitor_events"
10580 >
10581 <description>
10582 Can generate events on monitor activity
10583 </description>
10584 </capabilityfield>
10585 <capabilityfield id="can_generate_vm_object_alloc_events"
10586 disp1="can_generate" disp2="_vm_object_alloc_events"
10587 >
10588 <description>
10589 Can generate events on VM allocation of an object
10590 </description>
10591 </capabilityfield>
10592 <capabilityfield id="can_generate_native_method_bind_events"
10593 disp1="can_generate" disp2="_native_method_bind_events"
10594 >
10595 <description>
10596 Can generate events when a native method is bound to its
10597 implementation
10598 </description>
10599 </capabilityfield>
10600 <capabilityfield id="can_generate_garbage_collection_events"
10601 disp1="can_generate" disp2="_garbage_collection_events"
10602 >
10603 <description>
10604 Can generate events when garbage collection begins or ends
10605 </description>
10606 </capabilityfield>
10607 <capabilityfield id="can_generate_object_free_events"
10608 disp1="can_generate" disp2="_object_free_events"
10609 >
10610 <description>
10611 Can generate events when the garbage collector frees an object
10612 </description>
10613 </capabilityfield>
10614 <capabilityfield id="can_force_early_return" since="1.1">
10615 <description>
10616 Can return early from a method, as described in the
10617 <internallink id="ForceEarlyReturn">Force Early Return category</internallink>.
10618 </description>
10619 </capabilityfield>
10620 <capabilityfield id="can_get_owned_monitor_stack_depth_info" since="1.1">
10621 <description>
10622 Can get information about owned monitors with stack depth -
10623 <functionlink id="GetOwnedMonitorStackDepthInfo"></functionlink>
10624 </description>
10625 </capabilityfield>
10626 <capabilityfield id="can_get_constant_pool" since="1.1">
10627 <description>
10628 Can get the constant pool of a class -
10629 <functionlink id="GetConstantPool"></functionlink>
10630 </description>
10631 </capabilityfield>
10632 <capabilityfield id="can_set_native_method_prefix" since="1.1">
10633 <description>
10634 Can set prefix to be applied when native method cannot be resolved -
10635 <functionlink id="SetNativeMethodPrefix"/> and
10636 <functionlink id="SetNativeMethodPrefixes"/>
10637 </description>
10638 </capabilityfield>
10639 <capabilityfield id="can_retransform_classes" since="1.1">
10640 <description>
10641 Can retransform classes with <functionlink id="RetransformClasses"/>.
10642 In addition to the restrictions imposed by the specific
10643 implementation on this capability (see the
10644 <internallink id="capability">Capability</internallink> section),
10645 this capability must be set before the
10646 <eventlink id="ClassFileLoadHook"/> event is enabled for the
10647 first time in this environment.
10648 An environment that possesses this capability at the time that
10649 <code>ClassFileLoadHook</code> is enabled for the first time is
10650 said to be <i>retransformation capable</i>.
10651 An environment that does not possess this capability at the time that
10652 <code>ClassFileLoadHook</code> is enabled for the first time is
10653 said to be <i>retransformation incapable</i>.
10654 </description>
10655 </capabilityfield>
10656 <capabilityfield id="can_retransform_any_class" since="1.1">
10657 <description>
10658 <functionlink id="RetransformClasses"/> can be called on any modifiable class.
10659 See <functionlink id="IsModifiableClass"/>.
10660 (<fieldlink id="can_retransform_classes" struct="jvmtiCapabilities"/>
10661 must also be set)
10662 </description>
10663 </capabilityfield>
10664 <capabilityfield id="can_generate_resource_exhaustion_heap_events" since="1.1">
10665 <description>
10666 Can generate events when the VM is unable to allocate memory from
10667 the <tm>Java</tm> platform heap.
10668 See <eventlink id="ResourceExhausted"/>.
10669 </description>
10670 </capabilityfield>
10671 <capabilityfield id="can_generate_resource_exhaustion_threads_events" since="1.1">
10672 <description>
10673 Can generate events when the VM is unable to create a thread.
10674 See <eventlink id="ResourceExhausted"/>.
10675 </description>
10676 </capabilityfield>
10677 <capabilityfield id="can_generate_early_vmstart" since="9">
10678 <description>
10679 Can generate the <code>VMStart</code> event early.
10680 See <eventlink id="VMStart"/>.
10681 </description>
10682 </capabilityfield>
10683 <capabilityfield id="can_generate_early_class_hook_events" since="9">
10684 <description>
10685 Can generate the <eventlink id="ClassFileLoadHook"/> events
10686 in the primordial phase. If this capability and
10687 <internallink id="jvmtiCapabilities.can_generate_all_class_hook_events">
10688 <code>can_generate_all_class_hook_events</code></internallink>
10689 are enabled then the <eventlink id="ClassFileLoadHook"/> events
10690 can be posted for classes loaded in the primordial phase.
10691 See <eventlink id="ClassFileLoadHook"/>.
10692 </description>
10693 </capabilityfield>
10694 <capabilityfield id="can_generate_sampled_object_alloc_events" since="11">
10695 <description>
10696 Can generate sampled allocation events.
10697 If this capability is enabled then the heap sampling method
10698 <functionlink id="SetHeapSamplingInterval"></functionlink> can be
10699 called and <eventlink id="SampledObjectAlloc"></eventlink> events can be generated.
10700 </description>
10701 </capabilityfield>
10702 <capabilityfield id="can_support_virtual_threads" since="21">
10703 <description>
10704 Can support virtual threads.
10705 If this capability is enabled then the following functions can be called:
10706 <functionlink id="SuspendAllVirtualThreads"></functionlink>,
10707 <functionlink id="ResumeAllVirtualThreads"></functionlink>,
10708 and the following events can be enabled:
10709 <eventlink id="VirtualThreadStart"></eventlink>,
10710 <eventlink id="VirtualThreadEnd"></eventlink>.
10711 </description>
10712 </capabilityfield>
10713 </capabilitiestypedef>
10714
10715 <function id="GetPotentialCapabilities" jkernel="yes" phase="onload" num="140">
10716 <synopsis>Get Potential Capabilities</synopsis>
10717 <description>
10718 Returns via <paramlink id="capabilities_ptr"></paramlink> the <jvmti/>
10719 features that can potentially be possessed by this environment
10720 at this time.
10721 The returned capabilities differ from the complete set of capabilities
10722 implemented by the VM in two cases: another environment possesses
10723 capabilities that can only be possessed by one environment, or the
10724 current <functionlink id="GetPhase">phase</functionlink> is live,
10725 and certain capabilities can only be added during the <code>OnLoad</code> phase.
10726 The <functionlink id="AddCapabilities"></functionlink> function
10727 may be used to set any or all or these capabilities.
10728 Currently possessed capabilities are included.
10729 <p/>
10730 Typically this function is used in the <code>OnLoad</code> function.
10731 Some virtual machines may allow a limited set of capabilities to be
10732 added in the live phase.
10733 In this case, the set of potentially available capabilities
10734 will likely differ from the <code>OnLoad</code> phase set.
10735 <p/>
10736 See the
10737 <internallink id="capabilityExamples">Capability Examples</internallink>.
10738 </description>
10739 <origin>new</origin>
10740 <capabilities>
10741 </capabilities>
10742 <parameters>
10743 <param id="capabilities_ptr">
10744 <outptr><struct>jvmtiCapabilities</struct></outptr>
10745 <description>
10746 On return, points to the <jvmti/> capabilities that may be added.
10747 </description>
10748 </param>
10749 </parameters>
10750 <errors>
10751 </errors>
10752 </function>
10753
10754 <elide>
10755 <function id="EstimateCostOfCapabilities" phase="onload" num="141">
10756 <synopsis>Estimate Cost Of Capabilities</synopsis>
10757 <description>
10758 <issue>There is strong opposition to this function. The concern is
10759 that it would be difficult or impossible to provide meaningful
10760 numbers, as the amount of impact is conditional on many factors
10761 that a single number could not represent. There is doubt that
10762 conditional implementations would be used or are even a good idea.
10763 The thought is that release documentation for the implementation
10764 would be the best means of exposing this information.
10765 Unless new arguments are presented, I intend to remove this
10766 function in the next revision.
10767 </issue>
10768 <p/>
10769 Return via the <paramlink id="time_impact_ptr"></paramlink> and
10770 <paramlink id="space_impact_ptr"></paramlink> an estimate of the impact
10771 of adding the capabilities pointed to by
10772 <paramlink id="capabilities_ptr"></paramlink>.
10773 The returned estimates are in percentage of additional overhead, thus
10774 a time impact of 100 mean the application might run
10775 at half the speed.
10776 The estimates are very rough approximations and are not guaranteed.
10777 Note also, that the estimates are of the impact of having the
10778 capability available--when and if it is used the impact may be
10779 much greater.
10780 Estimates can be for a single capability or for a set of
10781 capabilities. Note that the costs are not necessarily additive,
10782 adding support for one capability might make another available
10783 for free or conversely having two capabilities at once may
10784 have multiplicative impact.
10785 Estimates are relative to the current set of capabilities -
10786 that is, how much more impact given the currently possessed capabilities.
10787 <p/>
10788 Typically this function is used in the OnLoad function,
10789 some virtual machines may allow a limited set of capabilities to be
10790 added in the live phase.
10791 In this case, the set of potentially available capabilities
10792 will likely differ from the OnLoad phase set.
10793 <p/>
10794 See the
10795 <internallink id="capabilityExamples">Capability Examples</internallink>.
10796 </description>
10797 <origin>new</origin>
10798 <capabilities>
10799 </capabilities>
10800 <parameters>
10801 <param id="capabilities_ptr">
10802 <inptr><struct>jvmtiCapabilities</struct></inptr>
10803 <description>
10804 points to the <jvmti/> capabilities to evaluate.
10805 </description>
10806 </param>
10807 <param id="time_impact_ptr">
10808 <outptr><jint/></outptr>
10809 <description>
10810 On return, points to the estimated percentage increase in
10811 run time if this capability was added.
10812 </description>
10813 </param>
10814 <param id="space_impact_ptr">
10815 <outptr><jint/></outptr>
10816 <description>
10817 On return, points to the estimated percentage increase in
10818 memory space used if this capability was added.
10819 </description>
10820 </param>
10821 </parameters>
10822 <errors>
10823 <error id="JVMTI_ERROR_NOT_AVAILABLE">
10824 The desired capabilities are not even potentially available.
10825 </error>
10826 </errors>
10827 </function>
10828 </elide>
10829
10830 <function id="AddCapabilities" jkernel="yes" phase="onload" num="142">
10831 <synopsis>Add Capabilities</synopsis>
10832 <description>
10833 Set new capabilities by adding the capabilities
10834 whose values are set to one (<code>1</code>) in
10835 <code>*</code><paramlink id="capabilities_ptr"></paramlink>.
10836 All previous capabilities are retained.
10837 Typically this function is used in the <code>OnLoad</code> function.
10838 Some virtual machines may allow a limited set of capabilities to be
10839 added in the live phase.
10840 <p/>
10841 See the
10842 <internallink id="capabilityExamples">Capability Examples</internallink>.
10843 </description>
10844 <origin>new</origin>
10845 <capabilities>
10846 </capabilities>
10847 <parameters>
10848 <param id="capabilities_ptr">
10849 <inptr><struct>jvmtiCapabilities</struct></inptr>
10850 <description>
10851 Points to the <jvmti/> capabilities to add.
10852 </description>
10853 </param>
10854 </parameters>
10855 <errors>
10856 <error id="JVMTI_ERROR_NOT_AVAILABLE">
10857 The desired capabilities are not even potentially available.
10858 </error>
10859 </errors>
10860 </function>
10861
10862
10863 <function id="RelinquishCapabilities" phase="onload" num="143">
10864 <synopsis>Relinquish Capabilities</synopsis>
10865 <description>
10866 Relinquish the capabilities
10867 whose values are set to one (<code>1</code>) in
10868 <code>*</code><paramlink id="capabilities_ptr"></paramlink>.
10869 Some implementations may allow only one environment to have a capability
10870 (see the <internallink id="capability">capability introduction</internallink>).
10871 This function releases capabilities
10872 so that they may be used by other agents.
10873 All other capabilities are retained.
10874 The capability will no longer be present in <functionlink id="GetCapabilities"></functionlink>.
10875 Attempting to relinquish a capability that the agent does not possess is not an error.
10876 <issue>
10877 It is possible for the agent to be actively using capabilities
10878 which are being relinquished. For example, a thread is currently
10879 suspended and can_suspend is being relinquished or an event is currently
10880 enabled and can_generate_whatever is being relinquished.
10881 There are three possible ways we could spec this:
10882 <ul>
10883 <li>relinquish automatically releases them</li>
10884 <li>relinquish checks and returns some error code if held</li>
10885 <li>it is the agent's responsibility and it is not checked</li>
10886 </ul>
10887 One of these should be chosen.
10888 </issue>
10889 </description>
10890 <origin>new</origin>
10891 <capabilities>
10892 </capabilities>
10893 <parameters>
10894 <param id="capabilities_ptr">
10895 <inptr><struct>jvmtiCapabilities</struct></inptr>
10896 <description>
10897 Points to the <jvmti/> capabilities to relinquish.
10898 </description>
10899 </param>
10900 </parameters>
10901 <errors>
10902 </errors>
10903 </function>
10904
10905
10906
10907 <function id="GetCapabilities" jkernel="yes" phase="any" num="89">
10908 <synopsis>Get Capabilities</synopsis>
10909 <description>
10910 Returns via <paramlink id="capabilities_ptr"></paramlink> the optional <jvmti/>
10911 features which this environment currently possesses.
10912 Each possessed capability is indicated by a one (<code>1</code>) in the
10913 corresponding field of the <internallink id="jvmtiCapabilities">capabilities
10914 structure</internallink>.
10915 An environment does not possess a capability unless it has been successfully added with
10916 <functionlink id="AddCapabilities"/>.
10917 An environment only loses possession of a capability if it has been relinquished with
10918 <functionlink id="RelinquishCapabilities"/>. Thus, this function returns the net result
10919 of the <code>AddCapabilities</code> and <code>RelinquishCapabilities</code> calls which
10920 have been made.
10921 <p/>
10922 See the
10923 <internallink id="capabilityExamples">Capability Examples</internallink>.
10924 </description>
10925 <origin>jvmdiClone</origin>
10926 <capabilities>
10927 </capabilities>
10928 <parameters>
10929 <param id="capabilities_ptr">
10930 <outptr><struct>jvmtiCapabilities</struct></outptr>
10931 <description>
10932 On return, points to the <jvmti/> capabilities.
10933 </description>
10934 </param>
10935 </parameters>
10936 <errors>
10937 </errors>
10938 </function>
10939
10940 </category>
10941
10942
10943 <category id="timers" label="Timers">
10944
10945 <intro>
10946 These functions provide timing information.
10947 The resolution at which the time is updated is not specified.
10948 They provides nanosecond precision, but not necessarily nanosecond accuracy.
10949 Details about the timers, such as their maximum values, can be accessed with
10950 the timer information functions.
10951 </intro>
10952
10953 <typedef id="jvmtiTimerInfo" label="Timer Info">
10954 <description>
10955 The information function for each timer returns this data structure.
10956 </description>
10957 <field id="max_value">
10958 <jlong/>
10959 <description>
10960 The maximum value the timer can reach.
10961 After this value is reached the timer wraps back to zero.
10962 This is an unsigned value. If tested or printed as a jlong (signed value)
10963 it may appear to be a negative number.
10964 </description>
10965 </field>
10966 <field id="may_skip_forward">
10967 <jboolean/>
10968 <description>
10969 If true, the timer can be externally adjusted and as a result skip forward.
10970 If false, the timer value will never increase faster than real time.
10971 </description>
10972 </field>
10973 <field id="may_skip_backward">
10974 <jboolean/>
10975 <description>
10976 If true, the timer can be externally adjusted and as a result skip backward.
10977 If false, the timer value will be monotonically increasing.
10978 </description>
10979 </field>
10980 <field id="kind">
10981 <enum>jvmtiTimerKind</enum>
10982 <description>
10983 The kind of timer.
10984 On a platform that does not distinguish between user and system time, <datalink
10985 id="JVMTI_TIMER_TOTAL_CPU"><code>JVMTI_TIMER_TOTAL_CPU</code></datalink>
10986 is returned.
10987 </description>
10988 </field>
10989 <field id="reserved1">
10990 <jlong/>
10991 <description>
10992 Reserved for future use.
10993 </description>
10994 </field>
10995 <field id="reserved2">
10996 <jlong/>
10997 <description>
10998 Reserved for future use.
10999 </description>
11000 </field>
11001 </typedef>
11002
11003 <intro>
11004 Where the timer kind is --
11005
11006 <constants id="jvmtiTimerKind" label="Timer Kinds" kind="enum">
11007 <constant id="JVMTI_TIMER_USER_CPU" num="30">
11008 CPU time that a thread is in user mode.
11009 </constant>
11010 <constant id="JVMTI_TIMER_TOTAL_CPU" num="31">
11011 CPU time that a thread is in user or system mode.
11012 </constant>
11013 <constant id="JVMTI_TIMER_ELAPSED" num="32">
11014 Elapsed time.
11015 </constant>
11016 </constants>
11017 </intro>
11018
11019 <function id="GetCurrentThreadCpuTimerInfo" callbacksafe="safe" impl="innative notrace" phase="start" num="134">
11020 <synopsis>Get Current Thread CPU Timer Information</synopsis>
11021 <description>
11022 Get information about the
11023 <functionlink id="GetCurrentThreadCpuTime"/> timer.
11024 The fields of the <datalink id="jvmtiTimerInfo"/> structure
11025 are filled in with details about the timer.
11026 This information is specific to the platform and the implementation of
11027 <functionlink id="GetCurrentThreadCpuTime"/> and thus
11028 does not vary by thread nor does it vary
11029 during a particular invocation of the VM.
11030 <p/>
11031 Note that the implementations of <functionlink id="GetCurrentThreadCpuTime"/>
11032 and <functionlink id="GetThreadCpuTime"/> may differ, and thus the values
11033 returned by <code>GetCurrentThreadCpuTimerInfo</code>
11034 and <functionlink id="GetThreadCpuTimerInfo"/>
11035 may differ -- see <functionlink id="GetCurrentThreadCpuTime"/> for more information.
11036 </description>
11037 <origin>new</origin>
11038 <capabilities>
11039 <required id="can_get_current_thread_cpu_time">
11040 Can get current thread CPU time.
11041 </required>
11042 </capabilities>
11043 <parameters>
11044 <param id="info_ptr">
11045 <outptr><struct>jvmtiTimerInfo</struct></outptr>
11046 <description>
11047 On return, filled with information describing the time
11048 returned by <functionlink id="GetCurrentThreadCpuTime"/>.
11049 </description>
11050 </param>
11051 </parameters>
11052 <errors>
11053 </errors>
11054 </function>
11055
11056 <function id="GetCurrentThreadCpuTime" callbacksafe="safe" impl="innative notrace" phase="start" num="135">
11057 <synopsis>Get Current Thread CPU Time</synopsis>
11058 <description>
11059 Return the CPU time utilized by the current thread.
11060 <p/>
11061 Note that the <functionlink id="GetThreadCpuTime"/>
11062 function provides CPU time for any thread, including
11063 the current thread. <code>GetCurrentThreadCpuTime</code>
11064 exists to support platforms which cannot
11065 supply CPU time for threads other than the current
11066 thread or which have more accurate information for
11067 the current thread (see
11068 <functionlink id="GetCurrentThreadCpuTimerInfo"/> vs
11069 <functionlink id="GetThreadCpuTimerInfo"/>).
11070 An implementation is not required to support this function
11071 when the current thread is a virtual thread, in which case
11072 <errorlink id="JVMTI_ERROR_UNSUPPORTED_OPERATION"></errorlink> will be returned.
11073 On many platforms this call will be equivalent to:
11074 <example>
11075 GetThreadCpuTime(env, NULL, nanos_ptr)
11076 </example>
11077 </description>
11078 <origin>new</origin>
11079 <capabilities>
11080 <required id="can_get_current_thread_cpu_time">
11081 Can get current thread CPU time.
11082 <p/>
11083 If this capability is enabled after threads have started,
11084 the implementation may choose any time up
11085 to and including the time that the capability is enabled
11086 as the point where CPU time collection starts.
11087 <p/>
11088 This capability must be potentially available on any
11089 platform where
11090 <internallink id="jvmtiCapabilities.can_get_thread_cpu_time"><code>can_get_thread_cpu_time</code></internallink>
11091 is potentially available.
11092 </required>
11093 </capabilities>
11094 <parameters>
11095 <param id="nanos_ptr">
11096 <outptr><jlong/></outptr>
11097 <description>
11098 On return, points to the CPU time used by this thread
11099 in nanoseconds.
11100 This is an unsigned value. If tested or printed as a jlong (signed value)
11101 it may appear to be a negative number.
11102 </description>
11103 </param>
11104 </parameters>
11105 <errors>
11106 <error id="JVMTI_ERROR_UNSUPPORTED_OPERATION">
11107 The current thread is a virtual thread and the implementation does not support
11108 getting the current thread CPU time when the current thread is a virtual thread.
11109 </error>
11110 </errors>
11111 </function>
11112
11113 <function id="GetThreadCpuTimerInfo" num="136">
11114 <synopsis>Get Thread CPU Timer Information</synopsis>
11115 <description>
11116 Get information about the
11117 <functionlink id="GetThreadCpuTime"/> timer.
11118 The fields of the <datalink id="jvmtiTimerInfo"/> structure
11119 are filled in with details about the timer.
11120 This information is specific to the platform and the implementation of
11121 <functionlink id="GetThreadCpuTime"/> and thus
11122 does not vary by thread nor does it vary
11123 during a particular invocation of the VM.
11124 <p/>
11125 Note that the implementations of <functionlink id="GetCurrentThreadCpuTime"/>
11126 and <functionlink id="GetThreadCpuTime"/> may differ, and thus the values
11127 returned by <functionlink id="GetCurrentThreadCpuTimerInfo"/>
11128 and <code>GetThreadCpuTimerInfo</code>
11129 may differ -- see <functionlink id="GetCurrentThreadCpuTime"/> for more information.
11130 </description>
11131 <origin>new</origin>
11132 <capabilities>
11133 <required id="can_get_thread_cpu_time">
11134 Can get thread CPU time.
11135 </required>
11136 </capabilities>
11137 <parameters>
11138 <param id="info_ptr">
11139 <outptr><struct>jvmtiTimerInfo</struct></outptr>
11140 <description>
11141 On return, filled with information describing the time
11142 returned by <functionlink id="GetThreadCpuTime"/>.
11143 </description>
11144 </param>
11145 </parameters>
11146 <errors>
11147 </errors>
11148 </function>
11149
11150 <function id="GetThreadCpuTime" num="137">
11151 <synopsis>Get Thread CPU Time</synopsis>
11152 <description>
11153 Return the CPU time utilized by the specified thread.
11154 <p/>
11155 Get information about this timer with
11156 <functionlink id="GetThreadCpuTimerInfo"/>.
11157 </description>
11158 <origin>new</origin>
11159 <capabilities>
11160 <required id="can_get_thread_cpu_time">
11161 Can get thread CPU time.
11162 <p/>
11163 If this capability is enabled after threads have started,
11164 the implementation may choose any time up
11165 to and including the time that the capability is enabled
11166 as the point where CPU time collection starts.
11167 </required>
11168 </capabilities>
11169 <parameters>
11170 <param id="thread">
11171 <jthread null="current" impl="noconvert"/>
11172 <description>
11173 The thread to query.
11174 An implementation is not required to support this function
11175 when the given thread is a virtual thread, in which case
11176 <errorlink id="JVMTI_ERROR_UNSUPPORTED_OPERATION"></errorlink> will be returned.
11177 </description>
11178 </param>
11179 <param id="nanos_ptr">
11180 <outptr impl="nonullcheck"><jlong/></outptr>
11181 <description>
11182 On return, points to the CPU time used by the specified thread
11183 in nanoseconds.
11184 This is an unsigned value. If tested or printed as a jlong (signed value)
11185 it may appear to be a negative number.
11186 </description>
11187 </param>
11188 </parameters>
11189 <errors>
11190 <error id="JVMTI_ERROR_UNSUPPORTED_OPERATION">
11191 <paramlink id="thread"/> is a virtual thread and the implementation does not
11192 support getting the thread CPU time of a virtual thread.
11193 </error>
11194 </errors>
11195 </function>
11196
11197 <function id="GetTimerInfo" phase="any" callbacksafe="safe" num="138">
11198 <synopsis>Get Timer Information</synopsis>
11199 <description>
11200 Get information about the
11201 <functionlink id="GetTime"/> timer.
11202 The fields of the <datalink id="jvmtiTimerInfo"/> structure
11203 are filled in with details about the timer.
11204 This information will not change during a particular invocation of the VM.
11205 </description>
11206 <origin>new</origin>
11207 <capabilities>
11208 </capabilities>
11209 <parameters>
11210 <param id="info_ptr">
11211 <outptr><struct>jvmtiTimerInfo</struct></outptr>
11212 <description>
11213 On return, filled with information describing the time
11214 returned by <functionlink id="GetTime"/>.
11215 </description>
11216 </param>
11217 </parameters>
11218 <errors>
11219 </errors>
11220 </function>
11221
11222 <function id="GetTime" phase="any" callbacksafe="safe" num="139">
11223 <synopsis>Get Time</synopsis>
11224 <description>
11225 Return the current value of the system timer, in nanoseconds.
11226 <p/>
11227 The value returned represents nanoseconds since some fixed but
11228 arbitrary time (perhaps in the future, so values may be
11229 negative). This function provides nanosecond precision, but not
11230 necessarily nanosecond accuracy. No guarantees are made about
11231 how frequently values change.
11232 <p/>
11233 Get information about this timer with
11234 <functionlink id="GetTimerInfo"/>.
11235 </description>
11236 <origin>new</origin>
11237 <capabilities>
11238 </capabilities>
11239 <parameters>
11240 <param id="nanos_ptr">
11241 <outptr><jlong/></outptr>
11242 <description>
11243 On return, points to the time in nanoseconds.
11244 This is an unsigned value. If tested or printed as a jlong (signed value)
11245 it may appear to be a negative number.
11246 </description>
11247 </param>
11248 </parameters>
11249 <errors>
11250 </errors>
11251 </function>
11252
11253 <function id="GetAvailableProcessors" phase="any" num="144">
11254 <synopsis>Get Available Processors</synopsis>
11255 <description>
11256 Returns the number of processors available to the Java virtual machine.
11257 <p/>
11258 This value may change during a particular invocation of the virtual machine.
11259 Applications that are sensitive to the number of available processors should
11260 therefore occasionally poll this property.
11261 </description>
11262 <origin>new</origin>
11263 <capabilities>
11264 </capabilities>
11265 <parameters>
11266 <param id="processor_count_ptr">
11267 <outptr><jint/></outptr>
11268 <description>
11269 On return, points to the maximum number of processors available to the
11270 virtual machine; never smaller than one.
11271 </description>
11272 </param>
11273 </parameters>
11274 <errors>
11275 </errors>
11276 </function>
11277
11278 </category>
11279
11280
11281 <category id="classLoaderSearch" label="Class Loader Search">
11282
11283 <intro>
11284 These functions allow the agent to add to the locations that a class loader searches for a class.
11285 This is useful for installing instrumentation under the correct class loader.
11286 </intro>
11287
11288 <function id="AddToBootstrapClassLoaderSearch" jkernel="yes" phase="onload" num="149">
11289 <synopsis>Add To Bootstrap Class Loader Search</synopsis>
11290 <description>
11291 This function can be used to cause instrumentation classes to be defined by the
11292 bootstrap class loader. See <vmspec chapter="5.3.1"/>.
11293 After the bootstrap
11294 class loader unsuccessfully searches for a class, the specified platform-dependent
11295 search path <paramlink id="segment"/> will be searched as well. Only one segment may be specified in
11296 the <paramlink id="segment"/>. This function may be called multiple times to add multiple segments,
11297 the segments will be searched in the order that this function was called.
11298 <p/>
11299 In the <code>OnLoad</code> phase the function may be used to specify any platform-dependent
11300 search path segment to be searched after the bootstrap class loader unsuccessfully searches
11301 for a class. The segment is typically a directory or JAR file.
11302 <p/>
11303 In the live phase the <paramlink id="segment"/> may be used to specify any platform-dependent
11304 path to a <externallink id="jar/jar.html">
11305 JAR file</externallink>. The agent should take care that the JAR file does not
11306 contain any classes or resources other than those to be defined by the bootstrap
11307 class loader for the purposes of instrumentation.
11308 <p/>
11309 <vmspec/> specifies that a subsequent attempt to resolve a symbolic
11310 reference that the Java virtual machine has previously unsuccessfully attempted
11311 to resolve always fails with the same error that was thrown as a result of the
11312 initial resolution attempt. Consequently, if the JAR file contains an entry
11313 that corresponds to a class for which the Java virtual machine has
11314 unsuccessfully attempted to resolve a reference, then subsequent attempts to
11315 resolve that reference will fail with the same error as the initial attempt.
11316 </description>
11317 <origin>new</origin>
11318 <capabilities>
11319 </capabilities>
11320 <parameters>
11321 <param id="segment">
11322 <inbuf><char/></inbuf>
11323 <description>
11324 The platform-dependent search path segment, encoded as a
11325 <internallink id="mUTF">modified UTF-8</internallink> string.
11326 </description>
11327 </param>
11328 </parameters>
11329 <errors>
11330 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
11331 <paramlink id="segment"/> is an invalid path. In the live phase, anything other than an
11332 existing JAR file is an invalid path.
11333 </error>
11334 </errors>
11335 </function>
11336
11337 <function id="AddToSystemClassLoaderSearch" jkernel="yes" phase="onload" num="151" since="1.1">
11338 <synopsis>Add To System Class Loader Search</synopsis>
11339 <description>
11340 This function can be used to cause instrumentation classes to be
11341 defined by the system class loader. See <vmspec chapter="5.3.2"/>.
11342 After the class loader unsuccessfully searches for a class, the specified platform-dependent search
11343 path <paramlink id="segment"/> will be searched as well. Only one segment may be specified in the
11344 <paramlink id="segment"/>. This function may be called multiple times to add multiple segments, the
11345 segments will be searched in the order that this function was called.
11346 <p/>
11347 In the <code>OnLoad</code> phase the function may be used to specify any platform-dependent
11348 search path segment to be searched after the system class loader unsuccessfully searches
11349 for a class. The segment is typically a directory or JAR file.
11350 <p/>
11351 In the live phase the <paramlink id="segment"/> is a platform-dependent path to a
11352 <externallink id="jar/jar.html">JAR file</externallink> to be
11353 searched after the system class loader unsuccessfully searches for a class. The agent should
11354 take care that the JAR file does not contain any classes or resources other than those to be
11355 defined by the system class loader for the purposes of instrumentation.
11356 <p/>
11357 In the live phase the system class loader supports adding a JAR file to be searched if
11358 the system class loader implements a method name <code>appendToClassPathForInstrumentation</code>
11359 which takes a single parameter of type <code>java.lang.String</code>. The method is not required
11360 to have <code>public</code> access.
11361 <p/>
11362 <vmspec/> specifies that a subsequent attempt to resolve a symbolic
11363 reference that the Java virtual machine has previously unsuccessfully attempted
11364 to resolve always fails with the same error that was thrown as a result of the
11365 initial resolution attempt. Consequently, if the JAR file contains an entry
11366 that corresponds to a class for which the Java virtual machine has
11367 unsuccessfully attempted to resolve a reference, then subsequent attempts to
11368 resolve that reference will fail with the same error as the initial attempt.
11369 </description>
11370 <origin>new</origin>
11371 <capabilities>
11372 </capabilities>
11373 <parameters>
11374 <param id="segment">
11375 <inbuf><char/></inbuf>
11376 <description>
11377 The platform-dependent search path segment, encoded as a
11378 <internallink id="mUTF">modified UTF-8</internallink> string.
11379 </description>
11380 </param>
11381 </parameters>
11382 <errors>
11383 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
11384 <paramlink id="segment"/> is an invalid path. In the live phase, anything other than an
11385 existing JAR file is an invalid path.
11386 </error>
11387 <error id="JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED">
11388 Operation not supported by the system class loader.
11389 </error>
11390 </errors>
11391 </function>
11392
11393 </category>
11394
11395
11396 <category id="props" label="System Properties">
11397
11398 <intro>
11399 These functions get and set system properties.
11400 </intro>
11401
11402 <function id="GetSystemProperties" phase="onload" num="130">
11403 <synopsis>Get System Properties</synopsis>
11404 <description>
11405 The list of VM system property keys which may be used with
11406 <functionlink id="GetSystemProperty"/> is returned.
11407 It is strongly recommended that virtual machines provide the
11408 following property keys:
11409 <ul>
11410 <li><code>java.vm.vendor</code></li>
11411 <li><code>java.vm.version</code></li>
11412 <li><code>java.vm.name</code></li>
11413 <li><code>java.vm.info</code></li>
11414 <li><code>java.library.path</code></li>
11415 <li><code>java.class.path</code></li>
11416 </ul>
11417 Provides access to system properties defined by and used
11418 by the VM.
11419 Properties set on the command-line are included.
11420 This allows getting and setting of these properties
11421 before the VM even begins executing bytecodes.
11422 Since this is a VM view of system properties, the set of available
11423 properties will usually be different than that
11424 in <code>java.lang.System.getProperties</code>.
11425 JNI method invocation may be used to access
11426 <code>java.lang.System.getProperties</code>.
11427 <p/>
11428 The set of properties may grow during execution.
11429 </description>
11430 <origin>new</origin>
11431 <capabilities>
11432 </capabilities>
11433 <parameters>
11434 <param id="count_ptr">
11435 <outptr><jint/></outptr>
11436 <description>
11437 On return, points to the number of property keys returned.
11438 </description>
11439 </param>
11440 <param id="property_ptr">
11441 <allocallocbuf outcount="count_ptr"><char/></allocallocbuf>
11442 <description>
11443 On return, points to an array of property keys, encoded as
11444 <internallink id="mUTF">modified UTF-8</internallink> strings.
11445 </description>
11446 </param>
11447 </parameters>
11448 <errors>
11449 </errors>
11450 </function>
11451
11452 <function id="GetSystemProperty" phase="onload" num="131">
11453 <synopsis>Get System Property</synopsis>
11454 <description>
11455 Return a VM system property value given the property key.
11456 <p/>
11457 The function <functionlink id="GetSystemProperties"/>
11458 returns the set of property keys which may be used.
11459 The properties which can be retrieved may grow during
11460 execution.
11461 <p/>
11462 Since this is a VM view of system properties, the values
11463 of properties may differ from that returned by
11464 <code>java.lang.System.getProperty(String)</code>.
11465 A typical VM might copy the values of the VM system
11466 properties into the <code>Properties</code> held by
11467 <code>java.lang.System</code> during the initialization
11468 of that class. Thereafter any changes to the VM system
11469 properties (with <functionlink id="SetSystemProperty"/>)
11470 or the <code>java.lang.System</code> system properties
11471 (with <code>java.lang.System.setProperty(String,String)</code>)
11472 would cause the values to diverge.
11473 JNI method invocation may be used to access
11474 <code>java.lang.System.getProperty(String)</code>.
11475 </description>
11476 <origin>new</origin>
11477 <capabilities>
11478 </capabilities>
11479 <parameters>
11480 <param id="property">
11481 <inbuf><char/></inbuf>
11482 <description>
11483 The key of the property to retrieve, encoded as a
11484 <internallink id="mUTF">modified UTF-8</internallink> string.
11485 </description>
11486 </param>
11487 <param id="value_ptr">
11488 <allocbuf><char/></allocbuf>
11489 <description>
11490 On return, points to the property value, encoded as a
11491 <internallink id="mUTF">modified UTF-8</internallink> string.
11492 </description>
11493 </param>
11494 </parameters>
11495 <errors>
11496 <error id="JVMTI_ERROR_NOT_AVAILABLE">
11497 This property is not available.
11498 Use <functionlink id="GetSystemProperties"/> to find available properties.
11499 </error>
11500 </errors>
11501 </function>
11502
11503 <function id="SetSystemProperty" phase="onloadOnly" num="132">
11504 <synopsis>Set System Property</synopsis>
11505 <description>
11506 Set a VM system property value.
11507 <p/>
11508 The function <functionlink id="GetSystemProperties"/>
11509 returns the set of property keys, some of these may be settable.
11510 See <functionlink id="GetSystemProperty"/>.
11511 </description>
11512 <origin>new</origin>
11513 <capabilities>
11514 </capabilities>
11515 <parameters>
11516 <param id="property">
11517 <inbuf><char/></inbuf>
11518 <description>
11519 The key of the property, encoded as a
11520 <internallink id="mUTF">modified UTF-8</internallink> string.
11521 </description>
11522 </param>
11523 <param id="value_ptr">
11524 <inbuf>
11525 <char/>
11526 <nullok>
11527 do not set the value, but return <errorlink id="JVMTI_ERROR_NOT_AVAILABLE"/>
11528 if the property is not writeable
11529 </nullok>
11530 </inbuf>
11531 <description>
11532 The property value to set, 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 or is not writeable.
11540 </error>
11541 </errors>
11542 </function>
11543
11544 </category>
11545
11546 <category id="general" label="General">
11547
11548 <intro>
11549 </intro>
11550
11551 <function id="GetPhase" jkernel="yes" phase="any" num="133">
11552 <synopsis>Get Phase</synopsis>
11553 <description>
11554 Return the current phase of VM execution.
11555 The phases proceed in sequence:
11556 <constants id="jvmtiPhase" label="Phases of execution" kind="enum">
11557 <constant id="JVMTI_PHASE_ONLOAD" num="1">
11558 <code>OnLoad</code> phase: while in the
11559 <internallink id="onload"><code>Agent_OnLoad</code></internallink>
11560 or, for statically linked agents, the <internallink id="onload">
11561 <code>Agent_OnLoad_<agent-lib-name>
11562 </code></internallink> function.
11563 </constant>
11564 <constant id="JVMTI_PHASE_PRIMORDIAL" num="2">
11565 Primordial phase: between return from <code>Agent_OnLoad</code>
11566 or <code>Agent_OnLoad_<agent-lib-name></code> and the
11567 <code>VMStart</code> event.
11568 </constant>
11569 <constant id="JVMTI_PHASE_START" num="6">
11570 Start phase: when the <eventlink id="VMStart"><code>VMStart</code></eventlink> event
11571 is sent and until the <code>VMInit</code> event is sent.
11572 </constant>
11573 <constant id="JVMTI_PHASE_LIVE" num="4">
11574 Live phase: when the <eventlink id="VMInit"><code>VMInit</code></eventlink> event is sent
11575 and until the <eventlink id="VMDeath"></eventlink> event returns.
11576 </constant>
11577 <constant id="JVMTI_PHASE_DEAD" num="8">
11578 Dead phase: after the <eventlink id="VMDeath"></eventlink> event returns or after
11579 start-up failure.
11580 </constant>
11581 </constants>
11582 In the case of start-up failure the VM will proceed directly to the dead
11583 phase skipping intermediate phases and neither a <code>VMInit</code> nor
11584 <code>VMDeath</code> event will be sent.
11585 <p/>
11586 Most <jvmti/> functions operate only in the live phase.
11587 The following functions operate in either the <code>OnLoad</code> or live phases:
11588 <functionphaselist phase="onload"/>
11589 The following functions operate in only the <code>OnLoad</code> phase:
11590 <functionphaselist phase="onloadOnly"/>
11591 The following functions operate in the start or live phases:
11592 <functionphaselist phase="start"/>
11593 The following functions operate in any phase:
11594 <functionphaselist phase="any"/>
11595 JNI functions (except the Invocation API) must only be used in the start or live phases.
11596 <p/>
11597 Most <jvmti/> events are sent only in the live phase.
11598 The following events operate in others phases:
11599 <eventphaselist phase="start"/>
11600 <eventphaselist phase="any"/>
11601 </description>
11602 <origin>new</origin>
11603 <capabilities>
11604 </capabilities>
11605 <parameters>
11606 <param id="phase_ptr">
11607 <outptr><enum>jvmtiPhase</enum></outptr>
11608 <description>
11609 On return, points to the phase.
11610 </description>
11611 </param>
11612 </parameters>
11613 <errors>
11614 </errors>
11615 </function>
11616
11617 <function id="DisposeEnvironment" jkernel="yes" phase="any" num="127">
11618 <synopsis>Dispose Environment</synopsis>
11619 <description>
11620 Shutdown a <jvmti/> connection created with JNI <code>GetEnv</code>
11621 (see <internallink id="environments"><jvmti/> Environments</internallink>).
11622 Dispose of any resources held by the environment.
11623 <issue>
11624 What resources are reclaimed? What is undone?
11625 Breakpoints,watchpoints removed?
11626 </issue>
11627 Threads suspended by this environment are not resumed by this call,
11628 this must be done explicitly by the agent.
11629 Memory allocated by this environment via calls to <jvmti/> functions
11630 is not released, this can be done explicitly by the agent
11631 by calling <functionlink id="Deallocate"/>.
11632 Raw monitors created by this environment are not destroyed,
11633 this can be done explicitly by the agent
11634 by calling <functionlink id="DestroyRawMonitor"/>.
11635 The state of threads waiting on raw monitors created by this environment
11636 are not affected.
11637 <p/>
11638 Any <functionlink id="SetNativeMethodPrefix">native method
11639 prefixes</functionlink> for this environment will be unset;
11640 the agent must remove any prefixed native methods before
11641 dispose is called.
11642 <p/>
11643 Any <internallink id="capability">capabilities</internallink>
11644 held by this environment are relinquished.
11645 <p/>
11646 Events enabled by this environment will no longer be sent, however
11647 event handlers currently running will continue to run. Caution must
11648 be exercised in the design of event handlers whose environment may
11649 be disposed and thus become invalid during their execution.
11650 <p/>
11651 This environment may not be used after this call.
11652 This call returns to the caller.
11653 </description>
11654 <origin>new</origin>
11655 <capabilities>
11656 </capabilities>
11657 <parameters>
11658 </parameters>
11659 <errors>
11660 </errors>
11661 </function>
11662
11663 <function id="SetEnvironmentLocalStorage" jkernel="yes" phase="any" callbacksafe="safe" impl="innative notrace" num="148">
11664 <synopsis>Set Environment Local Storage</synopsis>
11665 <description>
11666 The VM stores a pointer value associated with each environment.
11667 This pointer value is called <i>environment-local storage</i>.
11668 This value is null unless set with this function.
11669 Agents can allocate memory in which they store environment specific
11670 information. By setting environment-local storage it can then be
11671 accessed with
11672 <functionlink id="GetEnvironmentLocalStorage"></functionlink>.
11673 <p/>
11674 Called by the agent to set the value of the <jvmti/>
11675 environment-local storage. <jvmti/> supplies to the agent a pointer-size
11676 environment-local storage that can be used to record per-environment
11677 information.
11678 </description>
11679 <origin>new</origin>
11680 <capabilities>
11681 </capabilities>
11682 <parameters>
11683 <param id="data">
11684 <inbuf>
11685 <void/>
11686 <nullok>value is set to null</nullok>
11687 </inbuf>
11688 <description>
11689 The value to be entered into the environment-local storage.
11690 </description>
11691 </param>
11692 </parameters>
11693 <errors>
11694 </errors>
11695 </function>
11696
11697 <function id="GetEnvironmentLocalStorage" jkernel="yes" phase="any" callbacksafe="safe" impl="innative notrace" num="147">
11698 <synopsis>Get Environment Local Storage</synopsis>
11699 <description>
11700 Called by the agent to get the value of the <jvmti/> environment-local
11701 storage.
11702 </description>
11703 <origin>new</origin>
11704 <capabilities>
11705 </capabilities>
11706 <parameters>
11707 <param id="data_ptr">
11708 <agentbuf><void/></agentbuf>
11709 <description>
11710 Pointer through which the value of the environment local
11711 storage is returned.
11712 If environment-local storage has not been set with
11713 <functionlink id="SetEnvironmentLocalStorage"></functionlink> returned
11714 pointer is null.
11715 </description>
11716 </param>
11717 </parameters>
11718 <errors>
11719 </errors>
11720 </function>
11721
11722 <function id="GetVersionNumber" jkernel="yes" phase="any" num="88">
11723 <synopsis>Get Version Number</synopsis>
11724 <description>
11725 Return the <jvmti/> version via <code>version_ptr</code>.
11726 The return value is the version identifier.
11727 The version identifier includes major, minor and micro
11728 version as well as the interface type.
11729 <constants id="jvmtiVersionInterfaceTypes" label="Version Interface Types" kind="bits">
11730 <constant id="JVMTI_VERSION_INTERFACE_JNI" num="0x00000000">
11731 Value of <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> for JNI.
11732 </constant>
11733 <constant id="JVMTI_VERSION_INTERFACE_JVMTI" num="0x30000000">
11734 Value of <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> for <jvmti/>.
11735 </constant>
11736 </constants>
11737 <constants id="jvmtiVersionMasks" label="Version Masks" kind="bits">
11738 <constant id="JVMTI_VERSION_MASK_INTERFACE_TYPE" num="0x70000000">
11739 Mask to extract interface type.
11740 The value of the version returned by this function masked with
11741 <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> is always
11742 <code>JVMTI_VERSION_INTERFACE_JVMTI</code>
11743 since this is a <jvmti/> function.
11744 </constant>
11745 <constant id="JVMTI_VERSION_MASK_MAJOR" num="0x0FFF0000">
11746 Mask to extract major version number.
11747 </constant>
11748 <constant id="JVMTI_VERSION_MASK_MINOR" num="0x0000FF00">
11749 Mask to extract minor version number.
11750 </constant>
11751 <constant id="JVMTI_VERSION_MASK_MICRO" num="0x000000FF">
11752 Mask to extract micro version number.
11753 </constant>
11754 </constants>
11755 <constants id="jvmtiVersionShifts" label="Version Shifts" kind="bits">
11756 <constant id="JVMTI_VERSION_SHIFT_MAJOR" num="16">
11757 Shift to extract major version number.
11758 </constant>
11759 <constant id="JVMTI_VERSION_SHIFT_MINOR" num="8">
11760 Shift to extract minor version number.
11761 </constant>
11762 <constant id="JVMTI_VERSION_SHIFT_MICRO" num="0">
11763 Shift to extract micro version number.
11764 </constant>
11765 </constants>
11766 </description>
11767 <origin>jvmdi</origin>
11768 <capabilities>
11769 </capabilities>
11770 <parameters>
11771 <param id="version_ptr">
11772 <outptr><jint/></outptr>
11773 <description>
11774 On return, points to the <jvmti/> version.
11775 </description>
11776 </param>
11777 </parameters>
11778 <errors>
11779 </errors>
11780 </function>
11781
11782
11783 <function id="GetErrorName" phase="any" num="128">
11784 <synopsis>Get Error Name</synopsis>
11785 <description>
11786 Return the symbolic name for an
11787 <internallink id="ErrorSection">error code</internallink>.
11788 <p/>
11789 For example
11790 <code>GetErrorName(env, JVMTI_ERROR_NONE, &err_name)</code>
11791 would return in <code>err_name</code> the string
11792 <code>"JVMTI_ERROR_NONE"</code>.
11793 </description>
11794 <origin>new</origin>
11795 <capabilities>
11796 </capabilities>
11797 <parameters>
11798 <param id="error">
11799 <enum>jvmtiError</enum>
11800 <description>
11801 The error code.
11802 </description>
11803 </param>
11804 <param id="name_ptr">
11805 <allocbuf><char/></allocbuf>
11806 <description>
11807 On return, points to the error name.
11808 The name is encoded as a
11809 <internallink id="mUTF">modified UTF-8</internallink> string,
11810 but is restricted to the ASCII subset.
11811 </description>
11812 </param>
11813 </parameters>
11814 <errors>
11815 </errors>
11816 </function>
11817
11818 <function id="SetVerboseFlag" phase="any" num="150">
11819 <synopsis>Set Verbose Flag</synopsis>
11820 <description>
11821 <constants id="jvmtiVerboseFlag" label="Verbose Flag Enumeration" kind="enum">
11822 <constant id="JVMTI_VERBOSE_OTHER" num="0">
11823 Verbose output other than the below.
11824 </constant>
11825 <constant id="JVMTI_VERBOSE_GC" num="1">
11826 Verbose garbage collector output, like that specified with <code>-verbose:gc</code>.
11827 </constant>
11828 <constant id="JVMTI_VERBOSE_CLASS" num="2">
11829 Verbose class loading output, like that specified with <code>-verbose:class</code>.
11830 </constant>
11831 <constant id="JVMTI_VERBOSE_JNI" num="4">
11832 Verbose JNI output, like that specified with <code>-verbose:jni</code>.
11833 </constant>
11834 </constants>
11835 Control verbose output.
11836 This is the output which typically is sent to <code>stderr</code>.
11837 </description>
11838 <origin>new</origin>
11839 <capabilities>
11840 </capabilities>
11841 <parameters>
11842 <param id="flag">
11843 <enum>jvmtiVerboseFlag</enum>
11844 <description>
11845 Which verbose flag to set.
11846 </description>
11847 </param>
11848 <param id="value">
11849 <jboolean/>
11850 <description>
11851 New value of the flag.
11852 </description>
11853 </param>
11854 </parameters>
11855 <errors>
11856 </errors>
11857 </function>
11858
11859
11860 <function id="GetJLocationFormat" phase="any" num="129">
11861 <synopsis>Get JLocation Format</synopsis>
11862 <description>
11863 Although the greatest functionality is achieved with location information
11864 referencing the virtual machine bytecode index, the definition of
11865 <code>jlocation</code> has intentionally been left unconstrained to allow VM
11866 implementations that do not have this information.
11867 <p/>
11868 This function describes the representation of <code>jlocation</code> used in this VM.
11869 If the returned format is <datalink id="JVMTI_JLOCATION_JVMBCI"></datalink>,
11870 <code>jlocation</code>s can
11871 be used as in indices into the array returned by
11872 <functionlink id="GetBytecodes"></functionlink>.
11873 <constants id="jvmtiJlocationFormat" label="JLocation Format Enumeration" kind="enum">
11874 <constant id="JVMTI_JLOCATION_JVMBCI" num="1">
11875 <code>jlocation</code> values represent virtual machine
11876 bytecode indices--that is, offsets into the
11877 virtual machine code for a method.
11878 </constant>
11879 <constant id="JVMTI_JLOCATION_MACHINEPC" num="2">
11880 <code>jlocation</code> values represent native machine
11881 program counter values.
11882 </constant>
11883 <constant id="JVMTI_JLOCATION_OTHER" num="0">
11884 <code>jlocation</code> values have some other representation.
11885 </constant>
11886 </constants>
11887 </description>
11888 <origin>new</origin>
11889 <capabilities>
11890 </capabilities>
11891 <parameters>
11892 <param id="format_ptr">
11893 <outptr><enum>jvmtiJlocationFormat</enum></outptr>
11894 <description>
11895 On return, points to the format identifier for <code>jlocation</code> values.
11896 </description>
11897 </param>
11898 </parameters>
11899 <errors>
11900 </errors>
11901 </function>
11902
11903 </category>
11904
11905 <category id="heap_monitoring" label="Heap Monitoring">
11906 <function id="SetHeapSamplingInterval" phase="onload" num="156" since="11">
11907 <synopsis>Set Heap Sampling Interval</synopsis>
11908 <description>
11909 Generate a <eventlink id="SampledObjectAlloc"/> event when objects are allocated.
11910 Each thread keeps a counter of bytes allocated. The event will only be generated
11911 when that counter exceeds an average of <paramlink id="sampling_interval"></paramlink>
11912 since the last sample.
11913 <p/>
11914 Setting <paramlink id="sampling_interval"></paramlink> to 0 will cause an event to be
11915 generated by each allocation supported by the system once the new interval is taken into account.
11916 <p/>
11917 Note that updating the new sampling interval might take various number of allocations
11918 to provoke internal data structure updates. Therefore it is important to
11919 consider the sampling interval as an average. This includes the interval 0, where events
11920 might not be generated straight away for each allocation.
11921 </description>
11922 <origin>new</origin>
11923 <capabilities>
11924 <required id="can_generate_sampled_object_alloc_events"></required>
11925 </capabilities>
11926 <parameters>
11927 <param id="sampling_interval">
11928 <jint/>
11929 <description>
11930 The sampling interval in bytes. The sampler uses a statistical approach to
11931 generate an event, on average, once for every <paramlink id="sampling_interval"/> bytes of
11932 memory allocated by a given thread.
11933 <p/>
11934 Once the new sampling interval is taken into account, 0 as a sampling interval will generate
11935 a sample for every allocation.
11936 <p/>
11937 Note: The overhead of this feature is directly correlated with the sampling interval.
11938 A high sampling interval, such as 1024 bytes, will incur a high overhead.
11939 A lower interval, such as 1024KB, will have a much lower overhead. Sampling should only
11940 be used with an understanding that it may impact performance.
11941 </description>
11942 </param>
11943 </parameters>
11944 <errors>
11945 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
11946 <paramlink id="sampling_interval"></paramlink> is less than zero.
11947 </error>
11948 </errors>
11949 </function>
11950 </category>
11951
11952 </functionsection>
11953
11954 <errorsection label="Error Reference">
11955 <intro>
11956 Every <jvmti/> function returns a <b><code>jvmtiError</code></b> error code.
11957 <p/>
11958 It is the responsibility of the agent to call <jvmti/> functions with
11959 valid parameters and in the proper context (calling thread is attached,
11960 phase is correct, etc.).
11961 Detecting some error conditions may be difficult, inefficient, or
11962 impossible for an implementation.
11963 The errors listed in
11964 <internallink id="reqerrors">Function Specific Required Errors</internallink>
11965 must be detected by the implementation.
11966 All other errors represent the recommended response to the error
11967 condition.
11968 </intro>
11969
11970 <errorcategory id="universal-error" label="Universal Errors">
11971 <intro>
11972 The following errors may be returned by any function
11973 </intro>
11974
11975 <errorid id="JVMTI_ERROR_NONE" num="0">
11976 No error has occurred. This is the error code that is returned
11977 on successful completion of the function.
11978 </errorid>
11979 <errorid id="JVMTI_ERROR_NULL_POINTER" num="100">
11980 Pointer is unexpectedly null.
11981 </errorid>
11982 <errorid id="JVMTI_ERROR_OUT_OF_MEMORY" num="110">
11983 The function attempted to allocate memory and no more memory was
11984 available for allocation.
11985 </errorid>
11986 <errorid id="JVMTI_ERROR_ACCESS_DENIED" num="111">
11987 The desired functionality has not been enabled in this virtual machine.
11988 </errorid>
11989 <errorid id="JVMTI_ERROR_UNATTACHED_THREAD" num="115">
11990 The thread being used to call this function is not attached
11991 to the virtual machine. Calls must be made from attached threads.
11992 See <code>AttachCurrentThread</code> in the JNI invocation API.
11993 </errorid>
11994 <errorid id="JVMTI_ERROR_INVALID_ENVIRONMENT" num="116">
11995 The <jvmti/> environment provided is no longer connected or is
11996 not an environment.
11997 </errorid>
11998 <errorid id="JVMTI_ERROR_WRONG_PHASE" num="112">
11999 The desired functionality is not available in the current
12000 <functionlink id="GetPhase">phase</functionlink>.
12001 Always returned if the virtual machine has completed running.
12002 </errorid>
12003 <errorid id="JVMTI_ERROR_INTERNAL" num="113">
12004 An unexpected internal error has occurred.
12005 </errorid>
12006 </errorcategory>
12007
12008 <errorcategory id="reqerrors" label="Function Specific Required Errors">
12009 <intro>
12010 The following errors are returned by some <jvmti/> functions and must
12011 be returned by the implementation when the condition occurs.
12012 </intro>
12013
12014 <errorid id="JVMTI_ERROR_INVALID_PRIORITY" num="12">
12015 Invalid priority.
12016 </errorid>
12017 <errorid id="JVMTI_ERROR_THREAD_NOT_SUSPENDED" num="13">
12018 Thread was not suspended.
12019 </errorid>
12020 <errorid id="JVMTI_ERROR_THREAD_SUSPENDED" num="14">
12021 Thread already suspended.
12022 </errorid>
12023 <errorid id="JVMTI_ERROR_THREAD_NOT_ALIVE" num="15">
12024 This operation requires the thread to be alive--that is,
12025 it must be started and not yet terminated.
12026 </errorid>
12027 <errorid id="JVMTI_ERROR_CLASS_NOT_PREPARED" num="22">
12028 The class has been loaded but not yet prepared.
12029 </errorid>
12030 <errorid id="JVMTI_ERROR_NO_MORE_FRAMES" num="31">
12031 There are no Java programming language or JNI stack frames at the specified depth.
12032 </errorid>
12033 <errorid id="JVMTI_ERROR_OPAQUE_FRAME" num="32">
12034 Information about the frame is not available (e.g. for native frames),
12035 or the implementation is unable to provide this functionality on this frame.
12036 </errorid>
12037 <errorid id="JVMTI_ERROR_DUPLICATE" num="40">
12038 Item already set.
12039 </errorid>
12040 <errorid id="JVMTI_ERROR_NOT_FOUND" num="41">
12041 Desired element (e.g. field or breakpoint) not found
12042 </errorid>
12043 <errorid id="JVMTI_ERROR_NOT_MONITOR_OWNER" num="51">
12044 This thread doesn't own the raw monitor.
12045 </errorid>
12046 <errorid id="JVMTI_ERROR_INTERRUPT" num="52">
12047 The call has been interrupted before completion.
12048 </errorid>
12049 <errorid id="JVMTI_ERROR_UNMODIFIABLE_CLASS" num="79">
12050 The class cannot be modified.
12051 </errorid>
12052 <errorid id="JVMTI_ERROR_UNMODIFIABLE_MODULE" num="80">
12053 The module cannot be modified.
12054 </errorid>
12055 <errorid id="JVMTI_ERROR_NOT_AVAILABLE" num="98">
12056 The functionality is not available in this virtual machine.
12057 </errorid>
12058 <errorid id="JVMTI_ERROR_ABSENT_INFORMATION" num="101">
12059 The requested information is not available.
12060 </errorid>
12061 <errorid id="JVMTI_ERROR_INVALID_EVENT_TYPE" num="102">
12062 The specified event type ID is not recognized.
12063 </errorid>
12064 <errorid id="JVMTI_ERROR_NATIVE_METHOD" num="104">
12065 The requested information is not available for native method.
12066 </errorid>
12067 <errorid id="JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED" num="106">
12068 The class loader does not support this operation.
12069 </errorid>
12070 </errorcategory>
12071
12072 <errorcategory id="function-specific-errors" label="Function Specific Agent Errors">
12073 <intro>
12074 The following errors are returned by some <jvmti/> functions.
12075 They are returned in the event of invalid parameters passed by the
12076 agent or usage in an invalid context.
12077 An implementation is not required to detect these errors.
12078 </intro>
12079
12080 <errorid id="JVMTI_ERROR_INVALID_THREAD" num="10">
12081 The passed thread is not a valid thread.
12082 </errorid>
12083 <errorid id="JVMTI_ERROR_INVALID_FIELDID" num="25">
12084 Invalid field.
12085 </errorid>
12086 <errorid id="JVMTI_ERROR_INVALID_MODULE" num="26">
12087 Invalid module.
12088 </errorid>
12089 <errorid id="JVMTI_ERROR_INVALID_METHODID" num="23">
12090 Invalid method.
12091 </errorid>
12092 <errorid id="JVMTI_ERROR_INVALID_LOCATION" num="24">
12093 Invalid location.
12094 </errorid>
12095 <errorid id="JVMTI_ERROR_INVALID_OBJECT" num="20">
12096 Invalid object.
12097 </errorid>
12098 <errorid id="JVMTI_ERROR_INVALID_CLASS" num="21">
12099 Invalid class.
12100 </errorid>
12101 <errorid id="JVMTI_ERROR_TYPE_MISMATCH" num="34">
12102 The variable is not an appropriate type for the function used.
12103 </errorid>
12104 <errorid id="JVMTI_ERROR_INVALID_SLOT" num="35">
12105 Invalid slot.
12106 </errorid>
12107 <errorid id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY" num="99">
12108 The capability being used is false in this environment.
12109 </errorid>
12110 <errorid id="JVMTI_ERROR_INVALID_THREAD_GROUP" num="11">
12111 Thread group invalid.
12112 </errorid>
12113 <errorid id="JVMTI_ERROR_INVALID_MONITOR" num="50">
12114 Invalid raw monitor.
12115 </errorid>
12116 <errorid id="JVMTI_ERROR_ILLEGAL_ARGUMENT" num="103">
12117 Illegal argument.
12118 </errorid>
12119 <errorid id="JVMTI_ERROR_INVALID_TYPESTATE" num="65">
12120 The state of the thread has been modified, and is now inconsistent.
12121 </errorid>
12122 <errorid id="JVMTI_ERROR_UNSUPPORTED_VERSION" num="68">
12123 A new class file has a version number not supported by this VM.
12124 </errorid>
12125 <errorid id="JVMTI_ERROR_INVALID_CLASS_FORMAT" num="60">
12126 A new class file is malformed (the VM would return a <code>ClassFormatError</code>).
12127 </errorid>
12128 <errorid id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION" num="61">
12129 The new class file definitions would lead to a circular
12130 definition (the VM would return a <code>ClassCircularityError</code>).
12131 </errorid>
12132 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED" num="63">
12133 A new class file would require adding a method.
12134 </errorid>
12135 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED" num="64">
12136 A new class version changes a field.
12137 </errorid>
12138 <errorid id="JVMTI_ERROR_FAILS_VERIFICATION" num="62">
12139 The class bytes fail verification.
12140 </errorid>
12141 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED" num="66">
12142 A direct superclass is different for the new class
12143 version, or the set of directly implemented
12144 interfaces is different.
12145 </errorid>
12146 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED" num="67">
12147 A new class version does not declare a method
12148 declared in the old class version.
12149 </errorid>
12150 <errorid id="JVMTI_ERROR_NAMES_DONT_MATCH" num="69">
12151 The class name defined in the new class file is
12152 different from the name in the old class object.
12153 </errorid>
12154 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED" num="70">
12155 A new class version has different modifiers.
12156 </errorid>
12157 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED" num="71">
12158 A method in the new class version has different modifiers
12159 than its counterpart in the old class version.
12160 </errorid>
12161 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED" num="72">
12162 A new class version has unsupported differences in class attributes.
12163 </errorid>
12164 <errorid id="JVMTI_ERROR_UNSUPPORTED_OPERATION" num="73">
12165 Functionality is unsupported in this implementation.
12166 </errorid>
12167 </errorcategory>
12168 </errorsection>
12169
12170 <eventsection label="Events">
12171 <intro label="Handling Events" id="eventIntro">
12172 Agents can be informed of many events that occur in application
12173 programs.
12174 <p/>
12175 To handle events, designate a set of callback functions with
12176 <functionlink id="SetEventCallbacks"></functionlink>.
12177 For each event the corresponding callback function will be
12178 called.
12179 Arguments to the callback function provide additional
12180 information about the event.
12181 <p/>
12182 The callback function is usually called from within an application
12183 thread. The <jvmti/> implementation does not
12184 queue events in any way. This means
12185 that event callback functions must be written
12186 carefully. Here are some general guidelines. See
12187 the individual event descriptions for further
12188 suggestions.
12189 <p/>
12190 <ul>
12191 <li>Any exception thrown during the execution of an event callback can
12192 overwrite any current pending exception in the current application thread.
12193 Care must be taken to preserve a pending exception
12194 when an event callback makes a JNI call that might generate an exception.
12195 </li>
12196 <li>Event callback functions must be re-entrant. The <jvmti/> implementation does
12197 not queue events. If an agent needs to process events one at a time, it
12198 can use a raw monitor inside the
12199 event callback functions to serialize event processing.
12200 </li>
12201 <li>Event callback functions that execute JNI's FindClass function to load
12202 classes need to note that FindClass locates the class loader associated
12203 with the current native method. For the purposes of class loading, an
12204 event callback that includes a JNI environment as a parameter to the
12205 callback will treated as if it is a native call, where the native method
12206 is in the class of the event thread's current frame.
12207 </li>
12208 </ul>
12209 <p/>
12210 Some <jvmti/> events identify objects with JNI references.
12211 All references
12212 in <jvmti/> events are JNI local references and will become invalid
12213 after the event callback returns.
12214 Unless stated otherwise, memory referenced by pointers sent in event
12215 callbacks may not be referenced after the event callback returns.
12216 <p/>
12217 Except where stated otherwise, events are delivered on the thread
12218 that caused the event.
12219 Events are sent at the time they occur.
12220 The specification for each event includes the set of
12221 <functionlink id="GetPhase">phases</functionlink> in which it can be sent;
12222 if an event triggering activity occurs during another phase, no event
12223 is sent.
12224 <p/>
12225 A thread that generates an event does not change its execution status
12226 (for example, the event does not cause the thread to be suspended).
12227 If an agent wishes the event to result in suspension, then the agent
12228 is responsible for explicitly suspending the thread with
12229 <functionlink id="SuspendThread"></functionlink>.
12230 <p/>
12231 If an event is enabled in multiple environments, the event will be sent
12232 to each agent in the order that the environments were created.
12233 </intro>
12234
12235 <intro label="Enabling Events" id="enablingevents">
12236 All events are initially disabled. In order to receive any
12237 event:
12238 <ul>
12239 <li>
12240 If the event requires a capability, that capability must
12241 be added with
12242 <functionlink id="AddCapabilities"></functionlink>.
12243 </li>
12244 <li>
12245 A callback for the event must be set with
12246 <functionlink id="SetEventCallbacks"></functionlink>.
12247 </li>
12248 <li>
12249 The event must be enabled with
12250 <functionlink id="SetEventNotificationMode"></functionlink>.
12251 </li>
12252 </ul>
12253 </intro>
12254
12255 <intro label="Multiple Co-located Events" id="eventorder">
12256 In many situations it is possible for multiple events to occur
12257 at the same location in one thread. When this happens, all the events
12258 are reported through the event callbacks in the order specified in this section.
12259 <p/>
12260 If the current location is at the entry point of a method, the
12261 <eventlink id="MethodEntry"></eventlink> event is reported before
12262 any other event at the current location in the same thread.
12263 <p/>
12264 If an exception catch has been detected at the current location,
12265 either because it is the beginning of a catch clause or a native method
12266 that cleared a pending exception has returned, the
12267 <code>exceptionCatch</code> event is reported before
12268 any other event at the current location in the same thread.
12269 <p/>
12270 If a <code>singleStep</code> event or
12271 <code>breakpoint</code> event is triggered at the
12272 current location, the event is defined to occur
12273 immediately before the code at the current location is executed.
12274 These events are reported before any events which are triggered
12275 by the execution of code at the current location in the same
12276 thread (specifically:
12277 <code>exception</code>,
12278 <code>fieldAccess</code>, and
12279 <code>fieldModification</code>).
12280 If both a step and breakpoint event are triggered for the same thread and
12281 location, the step event is reported before the breakpoint event.
12282 <p/>
12283 If the current location is the exit point of a method (that is, the last
12284 location before returning to the caller), the
12285 <eventlink id="MethodExit"></eventlink> event and
12286 the <eventlink id="FramePop"></eventlink> event (if requested)
12287 are reported after all other events at the current location in the same
12288 thread. There is no specified ordering of these two events
12289 with respect to each other.
12290 <p/>
12291 Co-located events can be triggered during the processing of some other
12292 event by the agent at the same location in the same thread.
12293 If such an event, of type <i>y</i>, is triggered during the processing of
12294 an event of type <i>x</i>, and if <i>x</i>
12295 precedes <i>y</i> in the ordering specified above, the co-located event
12296 <i>y</i> is reported for the current thread and location. If <i>x</i> does not precede
12297 <i>y</i>, <i>y</i> is not reported for the current thread and location.
12298 For example, if a breakpoint is set at the current location
12299 during the processing of <eventlink id="SingleStep"></eventlink>,
12300 that breakpoint will be reported before the thread moves off the current
12301 location.
12302 <p/>The following events are never considered to be co-located with
12303 other events.
12304 <ul>
12305 <li><eventlink id="VMStart"></eventlink></li>
12306 <li><eventlink id="VMInit"></eventlink></li>
12307 <li><eventlink id="VMDeath"></eventlink></li>
12308 <li><eventlink id="ThreadStart"></eventlink></li>
12309 <li><eventlink id="ThreadEnd"></eventlink></li>
12310 <li><eventlink id="VirtualThreadStart"></eventlink></li>
12311 <li><eventlink id="VirtualThreadEnd"></eventlink></li>
12312 <li><eventlink id="ClassLoad"></eventlink></li>
12313 <li><eventlink id="ClassPrepare"></eventlink></li>
12314 </ul>
12315 </intro>
12316
12317 <intro label="Event Callbacks" id="jvmtiEventCallbacks">
12318 The event callback structure below is used to specify the handler function
12319 for events. It is set with the
12320 <functionlink id="SetEventCallbacks"></functionlink> function.
12321 </intro>
12322
12323 <event label="Single Step"
12324 id="SingleStep" const="JVMTI_EVENT_SINGLE_STEP" filtered="thread" num="60">
12325 <description>
12326 Single step events allow the agent to trace thread execution
12327 at the finest granularity allowed by the VM. A single step event is
12328 generated whenever a thread reaches a new location.
12329 Typically, single step events represent the completion of one VM
12330 instruction as defined in <vmspec/>. However, some implementations
12331 may define locations differently. In any case the
12332 <code>method</code> and <code>location</code>
12333 parameters uniquely identify the current location and allow
12334 the mapping to source file and line number when that information is
12335 available.
12336 <p/>
12337 No single step events are generated from within native methods.
12338 </description>
12339 <origin>jvmdi</origin>
12340 <capabilities>
12341 <required id="can_generate_single_step_events"></required>
12342 </capabilities>
12343 <parameters>
12344 <param id="jni_env">
12345 <outptr>
12346 <struct>JNIEnv</struct>
12347 </outptr>
12348 <description>
12349 The JNI environment of the event (current) thread
12350 </description>
12351 </param>
12352 <param id="thread">
12353 <jthread/>
12354 <description>
12355 Thread about to execution a new instruction
12356 </description>
12357 </param>
12358 <param id="klass">
12359 <jclass method="method"/>
12360 <description>
12361 Class of the method about to execute a new instruction
12362 </description>
12363 </param>
12364 <param id="method">
12365 <jmethodID class="klass"/>
12366 <description>
12367 Method about to execute a new instruction
12368 </description>
12369 </param>
12370 <param id="location">
12371 <jlocation/>
12372 <description>
12373 Location of the new instruction
12374 </description>
12375 </param>
12376 </parameters>
12377 </event>
12378
12379 <event label="Breakpoint"
12380 id="Breakpoint" const="JVMTI_EVENT_BREAKPOINT" filtered="thread" num="62">
12381 <description>
12382 Breakpoint events are generated whenever a thread reaches a location
12383 designated as a breakpoint with <functionlink id="SetBreakpoint"></functionlink>.
12384 The <code>method</code> and <code>location</code>
12385 parameters uniquely identify the current location and allow
12386 the mapping to source file and line number when that information is
12387 available.
12388 </description>
12389 <origin>jvmdi</origin>
12390 <capabilities>
12391 <required id="can_generate_breakpoint_events"></required>
12392 </capabilities>
12393 <parameters>
12394 <param id="jni_env">
12395 <outptr>
12396 <struct>JNIEnv</struct>
12397 </outptr>
12398 <description>
12399 The JNI environment of the event (current) thread.
12400 </description>
12401 </param>
12402 <param id="thread">
12403 <jthread/>
12404 <description>
12405 Thread that hit the breakpoint
12406 </description>
12407 </param>
12408 <param id="klass">
12409 <jclass method="method"/>
12410 <description>
12411 Class of the method that hit the breakpoint
12412 </description>
12413 </param>
12414 <param id="method">
12415 <jmethodID class="klass"/>
12416 <description>
12417 Method that hit the breakpoint
12418 </description>
12419 </param>
12420 <param id="location">
12421 <jlocation/>
12422 <description>
12423 location of the breakpoint
12424 </description>
12425 </param>
12426 </parameters>
12427 </event>
12428
12429 <event label="Field Access"
12430 id="FieldAccess" const="JVMTI_EVENT_FIELD_ACCESS" filtered="thread" num="63">
12431 <description>
12432 Field access events are generated whenever a thread accesses
12433 a field that was designated as a watchpoint
12434 with <functionlink id="SetFieldAccessWatch"></functionlink>.
12435 The <code>method</code> and <code>location</code>
12436 parameters uniquely identify the current location and allow
12437 the mapping to source file and line number when that information is
12438 available.
12439 </description>
12440 <origin>jvmdi</origin>
12441 <capabilities>
12442 <required id="can_generate_field_access_events"></required>
12443 </capabilities>
12444 <parameters>
12445 <param id="jni_env">
12446 <outptr>
12447 <struct>JNIEnv</struct>
12448 </outptr>
12449 <description>
12450 The JNI environment of the event (current) thread
12451 </description>
12452 </param>
12453 <param id="thread">
12454 <jthread/>
12455 <description>
12456 Thread accessing the field
12457 </description>
12458 </param>
12459 <param id="klass">
12460 <jclass method="method"/>
12461 <description>
12462 Class of the method where the access is occurring
12463 </description>
12464 </param>
12465 <param id="method">
12466 <jmethodID class="klass"/>
12467 <description>
12468 Method where the access is occurring
12469 </description>
12470 </param>
12471 <param id="location">
12472 <jlocation/>
12473 <description>
12474 Location where the access is occurring
12475 </description>
12476 </param>
12477 <param id="field_klass">
12478 <jclass field="field"/>
12479 <description>
12480 Class of the field being accessed
12481 </description>
12482 </param>
12483 <param id="object">
12484 <jobject/>
12485 <description>
12486 Object with the field being accessed if the field is an
12487 instance field; a null pointer otherwise
12488 </description>
12489 </param>
12490 <param id="field">
12491 <jfieldID class="field_klass"/>
12492 <description>
12493 Field being accessed
12494 </description>
12495 </param>
12496 </parameters>
12497 </event>
12498
12499 <event label="Field Modification"
12500 id="FieldModification" const="JVMTI_EVENT_FIELD_MODIFICATION" filtered="thread" num="64">
12501 <description>
12502 Field modification events are generated whenever a thread modifies
12503 a field that was designated as a watchpoint
12504 with <functionlink id="SetFieldModificationWatch"></functionlink>.
12505 The <code>method</code> and <code>location</code>
12506 parameters uniquely identify the current location and allow
12507 the mapping to source file and line number when that information is
12508 available.
12509 </description>
12510 <origin>jvmdi</origin>
12511 <capabilities>
12512 <required id="can_generate_field_modification_events"></required>
12513 </capabilities>
12514 <parameters>
12515 <param id="jni_env">
12516 <outptr>
12517 <struct>JNIEnv</struct>
12518 </outptr>
12519 <description>
12520 The JNI environment of the event (current) thread
12521 </description>
12522 </param>
12523 <param id="thread">
12524 <jthread/>
12525 <description>
12526 Thread modifying the field
12527 </description>
12528 </param>
12529 <param id="klass">
12530 <jclass method="method"/>
12531 <description>
12532 Class of the method where the modification is occurring
12533 </description>
12534 </param>
12535 <param id="method">
12536 <jmethodID class="klass"/>
12537 <description>
12538 Method where the modification is occurring
12539 </description>
12540 </param>
12541 <param id="location">
12542 <jlocation/>
12543 <description>
12544 Location where the modification is occurring
12545 </description>
12546 </param>
12547 <param id="field_klass">
12548 <jclass field="field"/>
12549 <description>
12550 Class of the field being modified
12551 </description>
12552 </param>
12553 <param id="object">
12554 <jobject/>
12555 <description>
12556 Object with the field being modified if the field is an
12557 instance field; a null pointer otherwise
12558 </description>
12559 </param>
12560 <param id="field">
12561 <jfieldID class="field_klass"/>
12562 <description>
12563 Field being modified
12564 </description>
12565 </param>
12566 <param id="signature_type">
12567 <char/>
12568 <description>
12569 Signature type of the new value
12570 </description>
12571 </param>
12572 <param id="new_value">
12573 <jvalue/>
12574 <description>
12575 The new value
12576 </description>
12577 </param>
12578 </parameters>
12579 </event>
12580
12581 <event label="Frame Pop"
12582 id="FramePop" const="JVMTI_EVENT_FRAME_POP" filtered="thread" num="61">
12583 <description>
12584 Frame pop events are generated upon exit from a single method
12585 in a single frame as specified
12586 in a call to <functionlink id="NotifyFramePop"></functionlink>.
12587 This is true whether termination is caused by
12588 executing its return instruction
12589 or by throwing an exception to its caller
12590 (see <paramlink id="was_popped_by_exception"></paramlink>).
12591 However, frame pops caused by the <functionlink id="PopFrame"/>
12592 function are not reported.
12593 <p/>
12594 The location reported by <functionlink id="GetFrameLocation"></functionlink>
12595 for the depth 0 identifies the executable location in the returning method,
12596 immediately prior to the return.
12597 </description>
12598 <origin>jvmdi</origin>
12599 <capabilities>
12600 <required id="can_generate_frame_pop_events"></required>
12601 </capabilities>
12602 <parameters>
12603 <param id="jni_env">
12604 <outptr>
12605 <struct>JNIEnv</struct>
12606 </outptr>
12607 <description>
12608 The JNI environment of the event (current) thread
12609 </description>
12610 </param>
12611 <param id="thread">
12612 <jthread/>
12613 <description>
12614 Thread that is popping the frame
12615 </description>
12616 </param>
12617 <param id="klass">
12618 <jclass method="method"/>
12619 <description>
12620 Class of the method being popped
12621 </description>
12622 </param>
12623 <param id="method">
12624 <jmethodID class="klass"/>
12625 <description>
12626 Method being popped
12627 </description>
12628 </param>
12629 <param id="was_popped_by_exception">
12630 <jboolean/>
12631 <description>
12632 True if frame was popped by a thrown exception.
12633 False if method exited through its return instruction.
12634 </description>
12635 </param>
12636 </parameters>
12637 </event>
12638
12639 <event label="Method Entry"
12640 id="MethodEntry" const="JVMTI_EVENT_METHOD_ENTRY" filtered="thread" num="65">
12641 <description>
12642 Method entry events are generated upon entry of Java
12643 programming language methods (including native methods).
12644 <p/>
12645 The location reported by <functionlink id="GetFrameLocation"></functionlink>
12646 for the depth 0 identifies the initial executable location in the method.
12647 <p/>
12648 Enabling method
12649 entry or exit events will significantly degrade performance on many platforms and is thus
12650 not advised for performance critical usage (such as profiling).
12651 <internallink id="bci">Bytecode instrumentation</internallink> should be
12652 used in these cases.
12653 </description>
12654 <origin>jvmdi</origin>
12655 <capabilities>
12656 <required id="can_generate_method_entry_events"></required>
12657 </capabilities>
12658 <parameters>
12659 <param id="jni_env">
12660 <outptr>
12661 <struct>JNIEnv</struct>
12662 </outptr>
12663 <description>
12664 The JNI environment of the event (current) thread
12665 </description>
12666 </param>
12667 <param id="thread">
12668 <jthread/>
12669 <description>
12670 Thread entering the method
12671 </description>
12672 </param>
12673 <param id="klass">
12674 <jclass method="method"/>
12675 <description>
12676 Class of the method being entered
12677 </description>
12678 </param>
12679 <param id="method">
12680 <jmethodID class="klass"/>
12681 <description>
12682 Method being entered
12683 </description>
12684 </param>
12685 </parameters>
12686 </event>
12687
12688 <event label="Method Exit"
12689 id="MethodExit" const="JVMTI_EVENT_METHOD_EXIT" filtered="thread" num="66">
12690 <description>
12691 Method exit events are generated upon exit from Java
12692 programming language methods (including native methods).
12693 This is true whether termination is caused by
12694 executing its return instruction
12695 or by throwing an exception to its caller
12696 (see <paramlink id="was_popped_by_exception"></paramlink>).
12697 <p/>
12698 The location reported by <functionlink id="GetFrameLocation"></functionlink>
12699 for the depth 0 identifies the executable location in the returning method
12700 immediately prior to the return.
12701 <p/>
12702 Enabling method
12703 entry or exit events will significantly degrade performance on many platforms and is thus
12704 not advised for performance critical usage (such as profiling).
12705 <internallink id="bci">Bytecode instrumentation</internallink> should be
12706 used in these cases.
12707 </description>
12708 <origin>jvmdi</origin>
12709 <capabilities>
12710 <required id="can_generate_method_exit_events"></required>
12711 </capabilities>
12712 <parameters>
12713 <param id="jni_env">
12714 <outptr>
12715 <struct>JNIEnv</struct>
12716 </outptr>
12717 <description>
12718 The JNI environment of the event (current) thread
12719 </description>
12720 </param>
12721 <param id="thread">
12722 <jthread/>
12723 <description>
12724 Thread exiting the method
12725 </description>
12726 </param>
12727 <param id="klass">
12728 <jclass method="method"/>
12729 <description>
12730 Class of the method being exited
12731 </description>
12732 </param>
12733 <param id="method">
12734 <jmethodID class="klass"/>
12735 <description>
12736 Method being exited
12737 </description>
12738 </param>
12739 <param id="was_popped_by_exception">
12740 <jboolean/>
12741 <description>
12742 True if frame was popped by a thrown exception.
12743 False if method exited through its return instruction.
12744 </description>
12745 </param>
12746 <param id="return_value">
12747 <jvalue/>
12748 <description>
12749 The return value of the method being exited.
12750 Undefined and should not be used if
12751 <paramlink id="was_popped_by_exception"></paramlink>
12752 is true.
12753 </description>
12754 </param>
12755 </parameters>
12756 </event>
12757
12758 <event label="Native Method Bind" phase="any"
12759 id="NativeMethodBind" const="JVMTI_EVENT_NATIVE_METHOD_BIND" num="67">
12760 <description>
12761 A Native Method Bind event is sent when a VM binds a
12762 Java programming language native method
12763 to the address of a function that implements the native method.
12764 This will occur when the native method is called for the first time
12765 and also occurs when the JNI function <code>RegisterNatives</code> is called.
12766 This event allows the bind to be redirected to an agent-specified
12767 proxy function.
12768 This event is not sent when the native method is unbound.
12769 Typically, this proxy function will need to be specific to a
12770 particular method or, to handle the general case, automatically
12771 generated assembly code, since after instrumentation code is
12772 executed the function at the original binding
12773 address will usually be invoked.
12774 The original binding can be restored or the redirection changed
12775 by use of the JNI function <code>RegisterNatives</code>.
12776 Some events may be sent during the primordial phase, JNI and
12777 most of <jvmti/> cannot be used at this time but the method and
12778 address can be saved for use later.
12779 </description>
12780 <origin>new</origin>
12781 <capabilities>
12782 <required id="can_generate_native_method_bind_events"></required>
12783 </capabilities>
12784 <parameters>
12785 <param id="jni_env">
12786 <outptr>
12787 <struct>JNIEnv</struct>
12788 </outptr>
12789 <description>
12790 The JNI environment of the event (current) thread
12791 Will be null if sent during the primordial
12792 <functionlink id="GetPhase">phase</functionlink>.
12793 </description>
12794 </param>
12795 <param id="thread">
12796 <jthread/>
12797 <description>
12798 Thread requesting the bind
12799 </description>
12800 </param>
12801 <param id="klass">
12802 <jclass method="method"/>
12803 <description>
12804 Class of the method being bound
12805 </description>
12806 </param>
12807 <param id="method">
12808 <jmethodID class="klass"/>
12809 <description>
12810 Native method being bound
12811 </description>
12812 </param>
12813 <param id="address">
12814 <outptr><void/></outptr>
12815 <description>
12816 The address the VM is about to bind to--that is, the
12817 address of the implementation of the native method
12818 </description>
12819 </param>
12820 <param id="new_address_ptr">
12821 <agentbuf><void/></agentbuf>
12822 <description>
12823 if the referenced address is changed (that is, if
12824 <code>*new_address_ptr</code> is set), the binding
12825 will instead be made to the supplied address.
12826 </description>
12827 </param>
12828 </parameters>
12829 </event>
12830
12831 <event label="Exception"
12832 id="Exception" const="JVMTI_EVENT_EXCEPTION" filtered="thread" num="58">
12833 <description>
12834 Exception events are generated whenever an exception is first detected
12835 in a Java programming language method.
12836 Where "exception" means any <code>java.lang.Throwable</code>.
12837 The exception may have been thrown by a Java programming language or native
12838 method, but in the case of native methods, the event is not generated
12839 until the exception is first seen by a Java programming language method. If an exception is
12840 set and cleared in a native method (and thus is never visible to Java programming language code),
12841 no exception event is generated.
12842 <p/>
12843 The <code>method</code> and <code>location</code>
12844 parameters uniquely identify the current location
12845 (where the exception was detected) and allow
12846 the mapping to source file and line number when that information is
12847 available. The <code>exception</code> parameter identifies the thrown
12848 exception object. The <code>catch_method</code>
12849 and <code>catch_location</code> identify the location of the catch clause,
12850 if any, that handles the thrown exception. If there is no such catch clause,
12851 the <code>catch_method</code> is set to null and the <code>catch_location</code>is set to 0.
12852 There is no guarantee that the thread will ever
12853 reach this catch clause. If there are native methods on the call stack
12854 between the throw location and the catch clause, the exception may
12855 be reset by one of those native methods.
12856 Similarly, exceptions that are reported as uncaught (<code>catch_method</code>
12857 set to null) may in fact be caught by native code.
12858 Agents can check for these occurrences by monitoring
12859 <eventlink id="ExceptionCatch"></eventlink> events.
12860 Note that finally clauses are implemented as catch and re-throw. Therefore they
12861 will be reported in the catch location.
12862 </description>
12863 <origin>jvmdi</origin>
12864 <capabilities>
12865 <required id="can_generate_exception_events"></required>
12866 </capabilities>
12867 <parameters>
12868 <param id="jni_env">
12869 <outptr>
12870 <struct>JNIEnv</struct>
12871 </outptr>
12872 <description>
12873 The JNI environment of the event (current) thread
12874 </description>
12875 </param>
12876 <param id="thread">
12877 <jthread/>
12878 <description>
12879 Thread generating the exception
12880 </description>
12881 </param>
12882 <param id="klass">
12883 <jclass method="method"/>
12884 <description>
12885 Class generating the exception
12886 </description>
12887 </param>
12888 <param id="method">
12889 <jmethodID class="klass"/>
12890 <description>
12891 Method generating the exception
12892 </description>
12893 </param>
12894 <param id="location">
12895 <jlocation/>
12896 <description>
12897 Location where exception occurred
12898 </description>
12899 </param>
12900 <param id="exception">
12901 <jobject/>
12902 <description>
12903 The exception being thrown
12904 </description>
12905 </param>
12906 <param id="catch_klass">
12907 <jclass method="catch_method"/>
12908 <description>
12909 Class that will catch the exception, or null if no known catch
12910 </description>
12911 </param>
12912 <param id="catch_method">
12913 <jmethodID class="catch_klass"/>
12914 <description>
12915 Method that will catch the exception, or null if no known catch
12916 </description>
12917 </param>
12918 <param id="catch_location">
12919 <jlocation/>
12920 <description>
12921 location which will catch the exception or zero if no known catch
12922 </description>
12923 </param>
12924 </parameters>
12925 </event>
12926
12927 <event label="Exception Catch"
12928 id="ExceptionCatch" const="JVMTI_EVENT_EXCEPTION_CATCH" filtered="thread" num="59">
12929 <description>
12930 Exception catch events are generated whenever a thrown exception is caught.
12931 Where "exception" means any <code>java.lang.Throwable</code>.
12932 If the exception is caught in a Java programming language method, the event is generated
12933 when the catch clause is reached. If the exception is caught in a native
12934 method, the event is generated as soon as control is returned to a Java programming language
12935 method. Exception catch events are generated for any exception for which
12936 a throw was detected in a Java programming language method.
12937 Note that finally clauses are implemented as catch and re-throw. Therefore they
12938 will generate exception catch events.
12939 <p/>
12940 The <code>method</code> and <code>location</code>
12941 parameters uniquely identify the current location
12942 and allow the mapping to source file and line number when that information is
12943 available. For exceptions caught in a Java programming language method, the
12944 <code>exception</code> object identifies the exception object. Exceptions
12945 caught in native methods are not necessarily available by the time the
12946 exception catch is reported, so the <code>exception</code> parameter is set
12947 to null.
12948 </description>
12949 <origin>jvmdi</origin>
12950 <capabilities>
12951 <required id="can_generate_exception_events"></required>
12952 </capabilities>
12953 <parameters>
12954 <param id="jni_env">
12955 <outptr>
12956 <struct>JNIEnv</struct>
12957 </outptr>
12958 <description>
12959 The JNI environment of the event (current) thread
12960 </description>
12961 </param>
12962 <param id="thread">
12963 <jthread/>
12964 <description>
12965 Thread catching the exception
12966 </description>
12967 </param>
12968 <param id="klass">
12969 <jclass method="method"/>
12970 <description>
12971 Class catching the exception
12972 </description>
12973 </param>
12974 <param id="method">
12975 <jmethodID class="klass"/>
12976 <description>
12977 Method catching the exception
12978 </description>
12979 </param>
12980 <param id="location">
12981 <jlocation/>
12982 <description>
12983 Location where exception is being caught
12984 </description>
12985 </param>
12986 <param id="exception">
12987 <jobject/>
12988 <description>
12989 Exception being caught
12990 </description>
12991 </param>
12992 </parameters>
12993 </event>
12994
12995 <event label="Thread Start"
12996 id="ThreadStart" const="JVMTI_EVENT_THREAD_START" num="52" phase="start">
12997 <description>
12998 A thread start event is generated by a new thread before its initial
12999 method executes.
13000 <p/>
13001 This event is generated by platform thread. It is not generated by virtual threads.
13002 <p/>
13003 Agents with the <code>can_support_virtual_threads</code> capability
13004 can enable the <eventlink id="VirtualThreadStart"></eventlink> event
13005 to be notified by newly started virtual threads.
13006 <p/>
13007 A platform thread may be listed in the array returned by
13008 <functionlink id="GetAllThreads"></functionlink>
13009 before its thread start event is generated.
13010 It is possible for other events to be generated
13011 on a thread before its thread start event.
13012 <p/>
13013 The event is sent on the newly started <paramlink id="thread"></paramlink>.
13014 </description>
13015 <origin>jvmdi</origin>
13016 <capabilities>
13017 </capabilities>
13018 <parameters>
13019 <param id="jni_env">
13020 <outptr>
13021 <struct>JNIEnv</struct>
13022 </outptr>
13023 <description>
13024 The JNI environment of the event (current) thread.
13025 </description>
13026 </param>
13027 <param id="thread">
13028 <jthread/>
13029 <description>
13030 Thread starting
13031 </description>
13032 </param>
13033 </parameters>
13034 </event>
13035
13036 <event label="Thread End"
13037 id="ThreadEnd" const="JVMTI_EVENT_THREAD_END" filtered="thread" num="53" phase="start">
13038 <description>
13039 A thread end event is generated by a terminating thread after its
13040 initial method has finished execution.
13041 <p/>
13042 This event is generated by platform thread. It is not generated by virtual threads.
13043 <p/>
13044 Agents with the <code>can_support_virtual_threads</code> capability
13045 can enable the <eventlink id="VirtualThreadEnd"></eventlink> event
13046 to be notified by terminating virtual threads.
13047 <p/>
13048 A platform thread may be listed in the array returned by
13049 <functionlink id="GetAllThreads"></functionlink>
13050 after its thread end event is generated.
13051 No events are generated on a thread
13052 after its thread end event.
13053 <p/>
13054 The event is sent on the terminating <paramlink id="thread"></paramlink>.
13055 </description>
13056 <origin>jvmdi</origin>
13057 <capabilities>
13058 </capabilities>
13059 <parameters>
13060 <param id="jni_env">
13061 <outptr>
13062 <struct>JNIEnv</struct>
13063 </outptr>
13064 <description>
13065 The JNI environment of the event (current) thread.
13066 </description>
13067 </param>
13068 <param id="thread">
13069 <jthread/>
13070 <description>
13071 Thread ending
13072 </description>
13073 </param>
13074 </parameters>
13075 </event>
13076
13077 <event label="Virtual Thread Start"
13078 id="VirtualThreadStart" const="JVMTI_EVENT_VIRTUAL_THREAD_START" num="87" phase="start" since="21">
13079 <description>
13080 A virtual thread start event is generated before its initial method executes.
13081 <p/>
13082 The event is sent on the newly started <paramlink id="virtual_thread"></paramlink>.
13083 </description>
13084 <origin>new</origin>
13085 <capabilities>
13086 <required id="can_support_virtual_threads">Can support virtual threads</required>
13087 </capabilities>
13088 <parameters>
13089 <param id="jni_env">
13090 <outptr>
13091 <struct>JNIEnv</struct>
13092 </outptr>
13093 <description>
13094 The JNI environment of the event (current) thread.
13095 </description>
13096 </param>
13097 <param id="virtual_thread">
13098 <jthread/>
13099 <description>
13100 Virtual thread started for execution.
13101 </description>
13102 </param>
13103 </parameters>
13104 </event>
13105
13106 <event label="Virtual Thread End"
13107 id="VirtualThreadEnd" const="JVMTI_EVENT_VIRTUAL_THREAD_END" filtered="thread" num="88" phase="start" since="21">
13108 <description>
13109 A virtual thread end event is generated after its initial method has finished execution.
13110 <p/>
13111 The event is sent on the terminating <paramlink id="virtual_thread"></paramlink>.
13112 </description>
13113 <origin>new</origin>
13114 <capabilities>
13115 <required id="can_support_virtual_threads">Can support virtual threads</required>
13116 </capabilities>
13117 <parameters>
13118 <param id="jni_env">
13119 <outptr>
13120 <struct>JNIEnv</struct>
13121 </outptr>
13122 <description>
13123 The JNI environment of the event (current) thread.
13124 </description>
13125 </param>
13126 <param id="virtual_thread">
13127 <jthread/>
13128 <description>
13129 Virtual thread being ended.
13130 </description>
13131 </param>
13132 </parameters>
13133 </event>
13134
13135 <elide>
13136 <event label="Virtual Thread Mount"
13137 id="VirtualThreadMount" const="JVMTI_EVENT_VIRTUAL_THREAD_MOUNT" filtered="thread" num="89" phase="start" since="99">
13138 <description>
13139 A virtual thread mount event is generated before its method continue to execute on the mounted thread.
13140 <p/>
13141 The event is sent on the <paramlink id="thread"></paramlink> the virtual thread is mounted to.
13142 </description>
13143 <origin>new</origin>
13144 <capabilities>
13145 <required id="can_support_virtual_threads">Can support virtual threads</required>
13146 </capabilities>
13147 <parameters>
13148 <param id="jni_env">
13149 <outptr>
13150 <struct>JNIEnv</struct>
13151 </outptr>
13152 <description>
13153 The JNI environment of the event (current) thread.
13154 </description>
13155 </param>
13156 <param id="virtual_thread">
13157 <jthread/>
13158 <description>
13159 Virtual thread that is mounted.
13160 </description>
13161 </param>
13162 </parameters>
13163 </event>
13164 </elide>
13165
13166 <elide>
13167 <event label="Virtual Thread Unmount"
13168 id="VirtualThreadUnmount" const="JVMTI_EVENT_VIRTUAL_THREAD_UNMOUNT" filtered="thread" num="90" phase="start" since="99">
13169 <description>
13170 A virtual thread unmount event is generated when the virtual thread is about to be unmounted from the carrier thread.
13171 <p/>
13172 The event is sent on the <paramlink id="thread"></paramlink> the virtual thread is unmounted from.
13173 </description>
13174 <origin>new</origin>
13175 <capabilities>
13176 <required id="can_support_virtual_threads">Can support virtual threads</required>
13177 </capabilities>
13178 <parameters>
13179 <param id="jni_env">
13180 <outptr>
13181 <struct>JNIEnv</struct>
13182 </outptr>
13183 <description>
13184 The JNI environment of the event (current) thread.
13185 </description>
13186 </param>
13187 <param id="virtual_thread">
13188 <jthread/>
13189 <description>
13190 Virtual thread that is unmounted.
13191 </description>
13192 </param>
13193 </parameters>
13194 </event>
13195 </elide>
13196
13197 <event label="Class Load"
13198 id="ClassLoad" const="JVMTI_EVENT_CLASS_LOAD" filtered="thread" phase="start" num="55">
13199 <description>
13200 A class load event is generated
13201 <functionlink id="GetLoadedClasses">when a class or interface is created</functionlink>.
13202 <p/>
13203 Array class creation does not generate a class load event.
13204 The creation of a primitive class (for example, java.lang.Integer.TYPE)
13205 does not generate a class load event.
13206 <p/>
13207 The order of class load events generated by a particular thread is guaranteed
13208 to match the order of class loading within that thread.
13209 <p/>
13210 This event is sent at an early stage in loading the class. As
13211 a result the class should be used carefully. Note, for example,
13212 that methods and fields are not yet loaded, so queries for methods,
13213 fields, subclasses, and so on will not give correct results.
13214 See "Loading of Classes and Interfaces" in the <i>Java Language
13215 Specification</i>. For most
13216 purposes the <eventlink id="ClassPrepare"></eventlink> event will
13217 be more useful.
13218 </description>
13219 <origin>jvmdi</origin>
13220 <capabilities>
13221 </capabilities>
13222 <parameters>
13223 <param id="jni_env">
13224 <outptr>
13225 <struct>JNIEnv</struct>
13226 </outptr>
13227 <description>
13228 The JNI environment of the event (current) thread
13229 </description>
13230 </param>
13231 <param id="thread">
13232 <jthread/>
13233 <description>
13234 Thread loading the class
13235 </description>
13236 </param>
13237 <param id="klass">
13238 <jclass/>
13239 <description>
13240 Class being loaded
13241 </description>
13242 </param>
13243 </parameters>
13244 </event>
13245
13246 <elide>
13247 <event label="Class Unload"
13248 id="ClassUnload" const="JVMTI_EVENT_CLASS_UNLOAD" num="57">
13249 <description>
13250 A class unload event is generated when the class is about to be unloaded.
13251 Class unload events take place during garbage collection and must be
13252 handled extremely carefully. The garbage collector holds many locks
13253 and has suspended all other threads, so the event handler cannot depend
13254 on the ability to acquire any locks. The class unload event handler should
13255 do as little as possible, perhaps by queuing information to be processed
13256 later. In particular, the <code>jclass</code> should be used only in
13257 the JNI function <code>isSameObject</code> or in the following <jvmti/> functions:
13258 <ul>
13259 <li><functionlink id="GetClassSignature"></functionlink></li>
13260 <li><functionlink id="GetSourceFileName"></functionlink></li>
13261 <li><functionlink id="IsInterface"></functionlink></li>
13262 <li><functionlink id="IsArrayClass"></functionlink></li>
13263 </ul>
13264 </description>
13265 <origin>jvmdi</origin>
13266 <capabilities>
13267 </capabilities>
13268 <parameters>
13269 <param id="jni_env">
13270 <outptr>
13271 <struct>JNIEnv</struct>
13272 </outptr>
13273 <description>
13274 The JNI environment of the event (current) thread
13275 </description>
13276 </param>
13277 <param id="thread">
13278 <jthread/>
13279 <description>
13280 Thread generating the class unload
13281 </description>
13282 </param>
13283 <param id="klass">
13284 <jclass/>
13285 <description>
13286 Class being unloaded
13287 </description>
13288 </param>
13289 </parameters>
13290 </event>
13291 </elide>
13292
13293 <event label="Class Prepare"
13294 id="ClassPrepare" const="JVMTI_EVENT_CLASS_PREPARE" filtered="thread" phase="start" num="56">
13295 <description>
13296 A class prepare event is generated when class preparation is complete.
13297 At this point, class fields, methods, and implemented interfaces are
13298 available, and no code from the class has been executed. Since array
13299 classes never have fields or methods, class prepare events are not
13300 generated for them. Class prepare events are not generated for
13301 primitive classes (for example, <code>java.lang.Integer.TYPE</code>).
13302 </description>
13303 <origin>jvmdi</origin>
13304 <capabilities>
13305 </capabilities>
13306 <parameters>
13307 <param id="jni_env">
13308 <outptr>
13309 <struct>JNIEnv</struct>
13310 </outptr>
13311 <description>
13312 The JNI environment of the event (current) thread
13313 </description>
13314 </param>
13315 <param id="thread">
13316 <jthread/>
13317 <description>
13318 Thread generating the class prepare
13319 </description>
13320 </param>
13321 <param id="klass">
13322 <jclass/>
13323 <description>
13324 Class being prepared
13325 </description>
13326 </param>
13327 </parameters>
13328 </event>
13329
13330 <event label="Class File Load Hook" phase="any"
13331 id="ClassFileLoadHook" const="JVMTI_EVENT_CLASS_FILE_LOAD_HOOK" num="54">
13332 <description>
13333 This event is sent when the VM obtains class file data,
13334 but before it constructs
13335 the in-memory representation for that class.
13336 This event is also sent when the class is being modified by the
13337 <functionlink id="RetransformClasses"/> function or
13338 the <functionlink id="RedefineClasses"/> function,
13339 called in any <jvmti/> environment.
13340 The agent can instrument
13341 the existing class file data sent by the VM to include profiling/debugging hooks.
13342 See the description of
13343 <internallink id="bci">bytecode instrumentation</internallink>
13344 for usage information.
13345 <p/>
13346 When the capabilities
13347 <internallink id="jvmtiCapabilities.can_generate_early_class_hook_events">
13348 <code>can_generate_early_class_hook_events</code></internallink> and
13349 <internallink id="jvmtiCapabilities.can_generate_all_class_hook_events">
13350 <code>can_generate_all_class_hook_events</code></internallink>
13351 are enabled then this event may be sent in the primordial phase.
13352 Otherwise, this event may be sent before the VM is initialized (the start
13353 <functionlink id="GetPhase">phase</functionlink>).
13354 Some classes might not be compatible
13355 with the function (eg. ROMized classes or implementation defined classes) and this event will
13356 not be generated for these classes.
13357 <p/>
13358 The agent must allocate the space for the modified
13359 class file data buffer
13360 using the memory allocation function
13361 <functionlink id="Allocate"></functionlink> because the
13362 VM is responsible for freeing the new class file data buffer
13363 using <functionlink id="Deallocate"></functionlink>.
13364 <p/>
13365 If the agent wishes to modify the class file, it must set
13366 <code>new_class_data</code> to point
13367 to the newly instrumented class file data buffer and set
13368 <code>new_class_data_len</code> to the length of that
13369 buffer before returning
13370 from this call. If no modification is desired, the agent simply
13371 does not set <code>new_class_data</code>. If multiple agents
13372 have enabled this event the results are chained. That is, if
13373 <code>new_class_data</code> has been set, it becomes the
13374 <code>class_data</code> for the next agent.
13375 <p/>
13376 When handling a class load in the live phase, then the
13377 <functionlink id="GetNamedModule"></functionlink>
13378 function can be used to map class loader and a package name to a module.
13379 When a class is being redefined or retransformed then
13380 <code>class_being_redefined</code> is non-null and so
13381 the JNI <code>GetModule</code> function can also be used
13382 to obtain the Module.
13383 <p/>
13384 The order that this event is sent to each environment differs
13385 from other events.
13386 This event is sent to environments in the following order:
13387 <ul>
13388 <li><fieldlink id="can_retransform_classes"
13389 struct="jvmtiCapabilities">retransformation
13390 incapable</fieldlink>
13391 environments, in the
13392 order in which they were created
13393 </li>
13394 <li><fieldlink id="can_retransform_classes"
13395 struct="jvmtiCapabilities">retransformation
13396 capable</fieldlink>
13397 environments, in the
13398 order in which they were created
13399 </li>
13400 </ul>
13401 When triggered by <functionlink id="RetransformClasses"/>,
13402 this event is sent only to <fieldlink id="can_retransform_classes"
13403 struct="jvmtiCapabilities">retransformation
13404 capable</fieldlink>
13405 environments.
13406 </description>
13407 <origin>jvmpi</origin>
13408 <capabilities>
13409 <capability id="can_generate_all_class_hook_events"></capability>
13410 <capability id="can_generate_early_class_hook_events"></capability>
13411 </capabilities>
13412 <parameters>
13413 <param id="jni_env">
13414 <outptr>
13415 <struct>JNIEnv</struct>
13416 </outptr>
13417 <description>
13418 The JNI environment of the event (current) thread.
13419 </description>
13420 </param>
13421 <param id="class_being_redefined">
13422 <jclass/>
13423 <description>
13424 The class being
13425 <functionlink id="RedefineClasses">redefined</functionlink> or
13426 <functionlink id="RetransformClasses">retransformed</functionlink>.
13427 A null pointer if sent by class load.
13428 </description>
13429 </param>
13430 <param id="loader">
13431 <jobject/>
13432 <description>
13433 The class loader loading the class.
13434 A null pointer if the bootstrap class loader.
13435 </description>
13436 </param>
13437 <param id="name">
13438 <vmbuf><char/></vmbuf>
13439 <description>
13440 Name of class being loaded as a VM internal qualified name
13441 (for example, "java/util/List"), encoded as a
13442 <internallink id="mUTF">modified UTF-8</internallink> string.
13443 Note: if the class is defined with a null pointer name,
13444 <code>name</code> will be null.
13445 </description>
13446 </param>
13447 <param id="protection_domain">
13448 <jobject/>
13449 <description>
13450 The <code>ProtectionDomain</code> of the class.
13451 </description>
13452 </param>
13453 <param id="class_data_len">
13454 <jint/>
13455 <description>
13456 Length of current class file data buffer.
13457 </description>
13458 </param>
13459 <param id="class_data">
13460 <vmbuf><uchar/></vmbuf>
13461 <description>
13462 Pointer to the current class file data buffer.
13463 </description>
13464 </param>
13465 <param id="new_class_data_len">
13466 <outptr><jint/></outptr>
13467 <description>
13468 Pointer to the length of the new class file data buffer.
13469 </description>
13470 </param>
13471 <param id="new_class_data">
13472 <agentbuf incount="new_class_data_len"><uchar/></agentbuf>
13473 <description>
13474 Pointer to the pointer to the instrumented class file data buffer.
13475 </description>
13476 </param>
13477 </parameters>
13478 </event>
13479
13480 <event label="VM Start Event"
13481 id="VMStart" const="JVMTI_EVENT_VM_START" num="57" phase="start">
13482 <description>
13483 The VM start event signals the start of the VM.
13484 At this time JNI is live but the VM is not yet fully initialized.
13485 Once this event is generated, the agent is free to call any JNI function.
13486 This event signals the beginning of the start phase,
13487 <jvmti/> functions permitted in the start phase may be called.
13488 <p/>
13489 The timing of this event may depend on whether the agent has added the
13490 <internallink id="jvmtiCapabilities.can_generate_early_vmstart">
13491 <code>can_generate_early_vmstart</code></internallink> capability or not.
13492 If the capability has been added then the VM posts the event as early
13493 as possible. The VM is capable of executing bytecode but it may not have
13494 initialized to the point where it can load classes in modules other than
13495 <code>java.base</code>, or even arbitrary classes in <code>java.base</code>.
13496 Agents that do load-time instrumentation in this
13497 phase must take great care when instrumenting code that potentially
13498 executes in this phase. Extreme care should also be taken with JNI
13499 <code>FindClass</code> as it may not be possible to load classes and attempts
13500 to do so may result in unpredictable behavior, maybe even stability issues
13501 on some VM implementations.
13502 If the capability has not been added then the VM delays posting this
13503 event until it is capable of loading classes in modules other than
13504 <code>java.base</code> or the VM has completed its initialization.
13505 Agents that create more than one JVM TI environment, where the
13506 capability is added to some but not all environments, may observe the
13507 start phase beginning earlier in the JVM TI environments that possess
13508 the capability.
13509 <p/>
13510 In the case of VM start-up failure, this event will not be sent.
13511 </description>
13512 <origin>jvmdi</origin>
13513 <capabilities>
13514 </capabilities>
13515 <parameters>
13516 <param id="jni_env">
13517 <outptr>
13518 <struct>JNIEnv</struct>
13519 </outptr>
13520 <description>
13521 The JNI environment of the event (current) thread.
13522 </description>
13523 </param>
13524 </parameters>
13525 </event>
13526
13527 <event label="VM Initialization Event"
13528 id="VMInit" const="JVMTI_EVENT_VM_INIT" num="50">
13529 <description>
13530 The VM initialization event signals the completion of VM initialization. Once
13531 this event is generated, the agent is free to call any JNI or <jvmti/>
13532 function. The VM initialization event can be preceded by or can be concurrent
13533 with other events, but
13534 the preceding events should be handled carefully, if at all, because the
13535 VM has not completed its initialization. The thread start event for the
13536 main application thread is guaranteed not to occur until after the
13537 handler for the VM initialization event returns.
13538 <p/>
13539 In the case of VM start-up failure, this event will not be sent.
13540 </description>
13541 <origin>jvmdi</origin>
13542 <capabilities>
13543 </capabilities>
13544 <parameters>
13545 <param id="jni_env">
13546 <outptr>
13547 <struct>JNIEnv</struct>
13548 </outptr>
13549 <description>
13550 The JNI environment of the event (current) thread.
13551 </description>
13552 </param>
13553 <param id="thread">
13554 <jthread/>
13555 <description>
13556 The initial thread
13557 </description>
13558 </param>
13559 </parameters>
13560 </event>
13561
13562 <event label="VM Death Event"
13563 id="VMDeath" const="JVMTI_EVENT_VM_DEATH" num="51">
13564 <description>
13565 The VM death event notifies the agent of the termination of the VM.
13566 No events will occur after the VMDeath event.
13567 <p/>
13568 In the case of VM start-up failure, this event will not be sent.
13569 Note that <internallink id="onunload">Agent_OnUnload</internallink>
13570 will still be called in these cases.
13571 </description>
13572 <origin>jvmdi</origin>
13573 <capabilities>
13574 </capabilities>
13575 <parameters>
13576 <param id="jni_env">
13577 <outptr>
13578 <struct>JNIEnv</struct>
13579 </outptr>
13580 <description>
13581 The JNI environment of the event (current) thread
13582 </description>
13583 </param>
13584 </parameters>
13585 </event>
13586
13587 <event label="Compiled Method Load" phase="start"
13588 id="CompiledMethodLoad" const="JVMTI_EVENT_COMPILED_METHOD_LOAD" num="68">
13589 <description>
13590 Sent when a method is compiled and loaded into memory by the VM.
13591 If it is unloaded, the <eventlink id="CompiledMethodUnload"/> event is sent.
13592 If it is moved, the <eventlink id="CompiledMethodUnload"/> event is sent,
13593 followed by a new <code>CompiledMethodLoad</code> event.
13594 Note that a single method may have multiple compiled forms, and that
13595 this event will be sent for each form.
13596 Note also that several methods may be inlined into a single
13597 address range, and that this event will be sent for each method.
13598 <p/>
13599 These events can be sent after their initial occurrence with
13600 <functionlink id="GenerateEvents"></functionlink>.
13601 </description>
13602 <origin>jvmpi</origin>
13603 <typedef id="jvmtiAddrLocationMap" label="Native address to location entry">
13604 <field id="start_address">
13605 <vmbuf><void/></vmbuf>
13606 <description>
13607 Starting native address of code corresponding to a location
13608 </description>
13609 </field>
13610 <field id="location">
13611 <jlocation/>
13612 <description>
13613 Corresponding location. See
13614 <functionlink id="GetJLocationFormat"></functionlink>
13615 for the meaning of location.
13616 </description>
13617 </field>
13618 </typedef>
13619 <capabilities>
13620 <required id="can_generate_compiled_method_load_events"></required>
13621 </capabilities>
13622 <parameters>
13623 <param id="klass">
13624 <jclass method="method"/>
13625 <description>
13626 Class of the method being compiled and loaded
13627 </description>
13628 </param>
13629 <param id="method">
13630 <jmethodID class="klass"/>
13631 <description>
13632 Method being compiled and loaded
13633 </description>
13634 </param>
13635 <param id="code_size">
13636 <jint/>
13637 <description>
13638 Size of compiled code
13639 </description>
13640 </param>
13641 <param id="code_addr">
13642 <vmbuf><void/></vmbuf>
13643 <description>
13644 Address where compiled method code is loaded
13645 </description>
13646 </param>
13647 <param id="map_length">
13648 <jint/>
13649 <description>
13650 Number of <typelink id="jvmtiAddrLocationMap"></typelink>
13651 entries in the address map.
13652 Zero if mapping information cannot be supplied.
13653 </description>
13654 </param>
13655 <param id="map">
13656 <vmbuf><struct>jvmtiAddrLocationMap</struct></vmbuf>
13657 <description>
13658 Map from native addresses to location.
13659 The native address range of each entry is from
13660 <fieldlink id="start_address" struct="jvmtiAddrLocationMap"></fieldlink>
13661 to <code>start_address-1</code> of the next entry.
13662 A null pointer if mapping information cannot be supplied.
13663 </description>
13664 </param>
13665 <param id="compile_info">
13666 <vmbuf><void/></vmbuf>
13667 <description>
13668 VM-specific compilation information.
13669 The referenced compile information is managed by the VM
13670 and must not depend on the agent for collection.
13671 A VM implementation defines the content and lifetime
13672 of the information.
13673 </description>
13674 </param>
13675 </parameters>
13676 </event>
13677
13678 <event label="Compiled Method Unload" phase="start"
13679 id="CompiledMethodUnload" const="JVMTI_EVENT_COMPILED_METHOD_UNLOAD" num="69">
13680 <description>
13681 Sent when a compiled method is unloaded from memory.
13682 This event might not be sent on the thread which performed the unload.
13683 This event may be sent sometime after the unload occurs, but
13684 will be sent before the memory is reused
13685 by a newly generated compiled method. This event may be sent after
13686 the class is unloaded.
13687 </description>
13688 <origin>jvmpi</origin>
13689 <capabilities>
13690 <required id="can_generate_compiled_method_load_events"></required>
13691 </capabilities>
13692 <parameters>
13693 <param id="klass">
13694 <jclass method="method"/>
13695 <description>
13696 Class of the compiled method being unloaded.
13697 </description>
13698 </param>
13699 <param id="method">
13700 <jmethodID class="klass"/>
13701 <description>
13702 Compiled method being unloaded.
13703 For identification of the compiled method only -- the class
13704 may be unloaded and therefore the method should not be used
13705 as an argument to further JNI or <jvmti/> functions.
13706 </description>
13707 </param>
13708 <param id="code_addr">
13709 <vmbuf><void/></vmbuf>
13710 <description>
13711 Address where compiled method code was loaded.
13712 For identification of the compiled method only --
13713 the space may have been reclaimed.
13714 </description>
13715 </param>
13716 </parameters>
13717 </event>
13718
13719 <event label="Dynamic Code Generated" phase="any"
13720 id="DynamicCodeGenerated" const="JVMTI_EVENT_DYNAMIC_CODE_GENERATED" num="70">
13721 <description>
13722 Sent when a component of the virtual machine is generated dynamically.
13723 This does not correspond to Java programming language code that is
13724 compiled--see <eventlink id="CompiledMethodLoad"></eventlink>.
13725 This is for native code--for example, an interpreter that is generated
13726 differently depending on command-line options.
13727 <p/>
13728 Note that this event has no controlling capability.
13729 If a VM cannot generate these events, it simply does not send any.
13730 <p/>
13731 These events can be sent after their initial occurrence with
13732 <functionlink id="GenerateEvents"></functionlink>.
13733 </description>
13734 <origin>jvmpi</origin>
13735 <capabilities>
13736 </capabilities>
13737 <parameters>
13738 <param id="name">
13739 <vmbuf><char/></vmbuf>
13740 <description>
13741 Name of the code, encoded as a
13742 <internallink id="mUTF">modified UTF-8</internallink> string.
13743 Intended for display to an end-user.
13744 The name might not be unique.
13745 </description>
13746 </param>
13747 <param id="address">
13748 <vmbuf><void/></vmbuf>
13749 <description>
13750 Native address of the code
13751 </description>
13752 </param>
13753 <param id="length">
13754 <jint/>
13755 <description>
13756 Length in bytes of the code
13757 </description>
13758 </param>
13759 </parameters>
13760 </event>
13761
13762 <event label="Data Dump Request"
13763 id="DataDumpRequest" const="JVMTI_EVENT_DATA_DUMP_REQUEST" num="71">
13764 <description>
13765 Sent by the VM to request the agent to dump its data. This
13766 is just a hint and the agent need not react to this event.
13767 This is useful for processing command-line signals from users. For
13768 example, in the Java 2 SDK a CTRL-Break on Win32 and a CTRL-\ on Linux
13769 causes the VM to send this event to the agent.
13770 </description>
13771 <origin>jvmpi</origin>
13772 <capabilities>
13773 </capabilities>
13774 <parameters>
13775 </parameters>
13776 </event>
13777
13778 <event label="Monitor Contended Enter"
13779 id="MonitorContendedEnter" const="JVMTI_EVENT_MONITOR_CONTENDED_ENTER" filtered="thread" num="75">
13780 <description>
13781 Sent when a thread is attempting to enter a Java programming language
13782 monitor already acquired by another thread.
13783 </description>
13784 <origin>jvmpi</origin>
13785 <capabilities>
13786 <required id="can_generate_monitor_events"></required>
13787 </capabilities>
13788 <parameters>
13789 <param id="jni_env">
13790 <outptr>
13791 <struct>JNIEnv</struct>
13792 </outptr>
13793 <description>
13794 The JNI environment of the event (current) thread
13795 </description>
13796 </param>
13797 <param id="thread">
13798 <jthread/>
13799 <description>
13800 JNI local reference to the thread
13801 attempting to enter the monitor
13802 </description>
13803 </param>
13804 <param id="object">
13805 <jobject/>
13806 <description>
13807 JNI local reference to the monitor
13808 </description>
13809 </param>
13810 </parameters>
13811 </event>
13812
13813 <event label="Monitor Contended Entered"
13814 id="MonitorContendedEntered" const="JVMTI_EVENT_MONITOR_CONTENDED_ENTERED" filtered="thread" num="76">
13815 <description>
13816 Sent when a thread enters a Java programming language
13817 monitor after waiting for it to be released by another thread.
13818 </description>
13819 <origin>jvmpi</origin>
13820 <capabilities>
13821 <required id="can_generate_monitor_events"></required>
13822 </capabilities>
13823 <parameters>
13824 <param id="jni_env">
13825 <outptr>
13826 <struct>JNIEnv</struct>
13827 </outptr>
13828 <description>
13829 The JNI environment of the event (current) thread
13830 </description>
13831 </param>
13832 <param id="thread">
13833 <jthread/>
13834 <description>
13835 JNI local reference to the thread entering
13836 the monitor
13837 </description>
13838 </param>
13839 <param id="object">
13840 <jobject/>
13841 <description>
13842 JNI local reference to the monitor
13843 </description>
13844 </param>
13845 </parameters>
13846 </event>
13847
13848 <event label="Monitor Wait"
13849 id="MonitorWait" const="JVMTI_EVENT_MONITOR_WAIT" filtered="thread" num="73">
13850 <description>
13851 Sent when a thread is about to wait on an object.
13852 </description>
13853 <origin>jvmpi</origin>
13854 <capabilities>
13855 <required id="can_generate_monitor_events"></required>
13856 </capabilities>
13857 <parameters>
13858 <param id="jni_env">
13859 <outptr>
13860 <struct>JNIEnv</struct>
13861 </outptr>
13862 <description>
13863 The JNI environment of the event (current) thread
13864 </description>
13865 </param>
13866 <param id="thread">
13867 <jthread/>
13868 <description>
13869 JNI local reference to the thread about to wait
13870 </description>
13871 </param>
13872 <param id="object">
13873 <jobject/>
13874 <description>
13875 JNI local reference to the monitor
13876 </description>
13877 </param>
13878 <param id="timeout">
13879 <jlong/>
13880 <description>
13881 The number of milliseconds the thread will wait
13882 </description>
13883 </param>
13884 </parameters>
13885 </event>
13886
13887 <event label="Monitor Waited"
13888 id="MonitorWaited" const="JVMTI_EVENT_MONITOR_WAITED" filtered="thread" num="74">
13889 <description>
13890 Sent when a thread finishes waiting on an object.
13891 </description>
13892 <origin>jvmpi</origin>
13893 <capabilities>
13894 <required id="can_generate_monitor_events"></required>
13895 </capabilities>
13896 <parameters>
13897 <param id="jni_env">
13898 <outptr>
13899 <struct>JNIEnv</struct>
13900 </outptr>
13901 <description>
13902 The JNI environment of the event (current) thread
13903 </description>
13904 </param>
13905 <param id="thread">
13906 <jthread/>
13907 <description>
13908 JNI local reference to the thread that was finished waiting
13909 </description>
13910 </param>
13911 <param id="object">
13912 <jobject/>
13913 <description>
13914 JNI local reference to the monitor.
13915 </description>
13916 </param>
13917 <param id="timed_out">
13918 <jboolean/>
13919 <description>
13920 True if the monitor timed out
13921 </description>
13922 </param>
13923 </parameters>
13924 </event>
13925
13926 <event label="Resource Exhausted"
13927 id="ResourceExhausted" const="JVMTI_EVENT_RESOURCE_EXHAUSTED" num="80"
13928 since="1.1">
13929 <description>
13930 Sent when a VM resource needed by a running application has been exhausted.
13931 Except as required by the optional capabilities, the set of resources
13932 which report exhaustion is implementation dependent.
13933 <p/>
13934 The following bit flags define the properties of the resource exhaustion:
13935 <constants id="jvmtiResourceExhaustionFlags"
13936 label="Resource Exhaustion Flags"
13937 kind="bits"
13938 since="1.1">
13939 <constant id="JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR" num="0x0001">
13940 After this event returns, the VM will throw a
13941 <code>java.lang.OutOfMemoryError</code>.
13942 </constant>
13943 <constant id="JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP" num="0x0002">
13944 The VM was unable to allocate memory from the <tm>Java</tm>
13945 platform <i>heap</i>.
13946 The <i>heap</i> is the runtime
13947 data area from which memory for all class instances and
13948 arrays are allocated.
13949 </constant>
13950 <constant id="JVMTI_RESOURCE_EXHAUSTED_THREADS" num="0x0004">
13951 The VM was unable to create a thread.
13952 </constant>
13953 </constants>
13954 </description>
13955 <origin>new</origin>
13956 <capabilities>
13957 <capability id="can_generate_resource_exhaustion_heap_events">
13958 Can generate events when the VM is unable to allocate memory from the
13959 <internallink id="JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP">heap</internallink>.
13960 </capability>
13961 <capability id="can_generate_resource_exhaustion_threads_events">
13962 Can generate events when the VM is unable to
13963 <internallink id="JVMTI_RESOURCE_EXHAUSTED_THREADS">create
13964 a thread</internallink>.
13965 </capability>
13966 </capabilities>
13967 <parameters>
13968 <param id="jni_env">
13969 <outptr>
13970 <struct>JNIEnv</struct>
13971 </outptr>
13972 <description>
13973 The JNI environment of the event (current) thread
13974 </description>
13975 </param>
13976 <param id="flags">
13977 <jint/>
13978 <description>
13979 Flags defining the properties of the of resource exhaustion
13980 as specified by the
13981 <internallink id="jvmtiResourceExhaustionFlags">Resource
13982 Exhaustion Flags</internallink>.
13983 </description>
13984 </param>
13985 <param id="reserved">
13986 <vmbuf><void/></vmbuf>
13987 <description>
13988 Reserved.
13989 </description>
13990 </param>
13991 <param id="description">
13992 <vmbuf><char/></vmbuf>
13993 <description>
13994 Description of the resource exhaustion, encoded as a
13995 <internallink id="mUTF">modified UTF-8</internallink> string.
13996 </description>
13997 </param>
13998 </parameters>
13999 </event>
14000
14001 <event label="VM Object Allocation"
14002 id="VMObjectAlloc" const="JVMTI_EVENT_VM_OBJECT_ALLOC" num="84">
14003 <description>
14004 Sent when a method causes the virtual machine to directly allocate an
14005 Object visible to Java programming language code.
14006 Generally object allocation should be detected by instrumenting
14007 the bytecodes of allocating methods.
14008 Object allocation generated in native code by JNI function
14009 calls should be detected using
14010 <internallink id="jniIntercept">JNI function interception</internallink>.
14011 Some methods might not have associated bytecodes and are not
14012 native methods, they instead are executed directly by the
14013 VM. These methods should send this event.
14014 Virtual machines which are incapable of bytecode instrumentation
14015 for some or all of their methods can send this event.
14016 When preview features are enabled and the allocated object has no identity,
14017 <code>null</code> is passed for the <paramlink id="object"></paramlink> parameter.
14018
14019 Note that the <internallink
14020 id="SampledObjectAlloc">SampledObjectAlloc</internallink>
14021 event is triggered on all Java object allocations, including those
14022 caused by bytecode method execution, JNI method execution, and
14023 directly by VM methods.
14024 <p/>
14025 Typical examples where this event might be sent:
14026 <ul>
14027 <li>Reflection -- for example, <code>java.lang.Class.newInstance()</code></li>
14028 <li>Methods not represented by bytecodes -- for example, VM intrinsics and
14029 J2ME preloaded classes</li>
14030 </ul>
14031 Cases where this event would not be generated:
14032 <ul>
14033 <li>Allocation due to bytecodes -- for example, the <code>new</code>
14034 and <code>newarray</code> VM instructions</li>
14035 <li>Allocation due to JNI function calls -- for example,
14036 <code>AllocObject</code></li>
14037 <li>Allocations during VM initialization</li>
14038 <li>VM internal objects</li>
14039 </ul>
14040 </description>
14041 <origin>new</origin>
14042 <capabilities>
14043 <required id="can_generate_vm_object_alloc_events"></required>
14044 </capabilities>
14045 <parameters>
14046 <param id="jni_env">
14047 <outptr>
14048 <struct>JNIEnv</struct>
14049 </outptr>
14050 <description>
14051 The JNI environment of the event (current) thread
14052 </description>
14053 </param>
14054 <param id="thread">
14055 <jthread/>
14056 <description>
14057 Thread allocating the object.
14058 </description>
14059 </param>
14060 <param id="object">
14061 <jobject/>
14062 <description>
14063 JNI local reference to the object that was allocated.
14064 Null when preview features are enabled and the allocated object has no identity.
14065 </description>
14066 </param>
14067 <param id="object_klass">
14068 <jclass/>
14069 <description>
14070 JNI local reference to the class of the object.
14071 </description>
14072 </param>
14073 <param id="size">
14074 <jlong/>
14075 <description>
14076 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>.
14077 </description>
14078 </param>
14079 </parameters>
14080 </event>
14081
14082 <event label="Sampled Object Allocation"
14083 id="SampledObjectAlloc" const="JVMTI_EVENT_SAMPLED_OBJECT_ALLOC" filtered="thread" num="86" since="11">
14084 <description>
14085 Sent when an allocated object is sampled.
14086 By default, the sampling interval is set to 512KB. The sampling is semi-random to avoid
14087 pattern-based bias and provides an approximate overall average interval over long periods of
14088 sampling.
14089 <p/>
14090 Each thread tracks how many bytes it has allocated since it sent the last event.
14091 When the number of bytes exceeds the sampling interval, it will send another event.
14092 This implies that, on average, one object will be sampled every time a thread has
14093 allocated 512KB bytes since the last sample.
14094 <p/>
14095 Note that the sampler is pseudo-random: it will not sample every 512KB precisely.
14096 The goal of this is to ensure high quality sampling even if allocation is
14097 happening in a fixed pattern (i.e., the same set of objects are being allocated
14098 every 512KB).
14099 <p/>
14100 If another sampling interval is required, the user can call
14101 <functionlink id="SetHeapSamplingInterval"></functionlink> with a strictly positive integer value,
14102 representing the new sampling interval.
14103 <p/>
14104 This event is sent once the sampled allocation has been performed. It provides the object, stack trace
14105 of the allocation, the thread allocating, the size of allocation, and the object's class.
14106 <p/>
14107 A typical use case of this system is to determine where heap allocations originate.
14108 In conjunction with weak references and the function
14109 <functionlink id="GetStackTrace"></functionlink>, a user can track which objects were allocated from which
14110 stack trace, and which are still live during the execution of the program.
14111 When preview features are enabled and the allocated object has no identity,
14112 <code>null</code> is passed for the <paramlink id="object"></paramlink> parameter.
14113 Note that weak references support identity objects only.
14114 </description>
14115 <origin>new</origin>
14116 <capabilities>
14117 <required id="can_generate_sampled_object_alloc_events"></required>
14118 </capabilities>
14119 <parameters>
14120 <param id="jni_env">
14121 <outptr>
14122 <struct>JNIEnv</struct>
14123 </outptr>
14124 <description>
14125 The JNI environment of the event (current) thread.
14126 </description>
14127 </param>
14128 <param id="thread">
14129 <jthread/>
14130 <description>
14131 Thread allocating the object.
14132 </description>
14133 </param>
14134 <param id="object">
14135 <jobject/>
14136 <description>
14137 JNI local reference to the object that was allocated.
14138 Null when preview features are enabled and the allocated object has no identity.
14139 </description>
14140 </param>
14141 <param id="object_klass">
14142 <jclass/>
14143 <description>
14144 JNI local reference to the class of the object
14145 </description>
14146 </param>
14147 <param id="size">
14148 <jlong/>
14149 <description>
14150 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>.
14151 </description>
14152 </param>
14153 </parameters>
14154 </event>
14155
14156 <event label="Object Free"
14157 id="ObjectFree" const="JVMTI_EVENT_OBJECT_FREE" num="83">
14158 <description>
14159 An Object Free event is sent when the garbage collector frees an object.
14160 Events are only sent for tagged objects--see
14161 <internallink id="Heap">heap functions</internallink>.
14162 <p/>
14163 The event handler must not use JNI functions and
14164 must not use <jvmti/> functions except those which
14165 specifically allow such use (see the raw monitor, memory management,
14166 and environment local storage functions).
14167 When preview features are enabled, this event does not support value object allocations.
14168 </description>
14169 <origin>new</origin>
14170 <capabilities>
14171 <required id="can_generate_object_free_events"></required>
14172 </capabilities>
14173 <parameters>
14174 <param id="tag">
14175 <jlong/>
14176 <description>
14177 The freed object's tag
14178 </description>
14179 </param>
14180 </parameters>
14181 </event>
14182
14183 <event label="Garbage Collection Start"
14184 id="GarbageCollectionStart" const="JVMTI_EVENT_GARBAGE_COLLECTION_START" num="81">
14185 <description>
14186 A Garbage Collection Start event is sent when a
14187 garbage collection pause begins.
14188 Only stop-the-world collections are reported--that is, collections during
14189 which all threads cease to modify the state of the Java virtual machine.
14190 This means that some collectors will never generate these events.
14191 This event is sent while the VM is still stopped, thus
14192 the event handler must not use JNI functions and
14193 must not use <jvmti/> functions except those which
14194 specifically allow such use (see the raw monitor, memory management,
14195 and environment local storage functions).
14196 <p/>
14197 This event is always sent as a matched pair with
14198 <eventlink id="GarbageCollectionFinish"/>
14199 (assuming both events are enabled) and no garbage collection
14200 events will occur between them.
14201 </description>
14202 <origin>new</origin>
14203 <capabilities>
14204 <required id="can_generate_garbage_collection_events"></required>
14205 </capabilities>
14206 <parameters>
14207 </parameters>
14208 </event>
14209
14210 <event label="Garbage Collection Finish"
14211 id="GarbageCollectionFinish" const="JVMTI_EVENT_GARBAGE_COLLECTION_FINISH" num="82">
14212 <description>
14213 A Garbage Collection Finish event is sent when a
14214 garbage collection pause ends.
14215 This event is sent while the VM is still stopped, thus
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 <p/>
14221 Some agents may need to do post garbage collection operations that
14222 require the use of the disallowed <jvmti/> or JNI functions. For these
14223 cases an agent thread can be created which waits on a raw monitor,
14224 and the handler for the Garbage Collection Finish event simply
14225 notifies the raw monitor
14226 <p/>
14227 This event is always sent as a matched pair with
14228 <eventlink id="GarbageCollectionStart"/> (assuming both events are enabled).
14229 <issue>
14230 The most important use of this event is to provide timing information,
14231 and thus additional information is not required. However,
14232 information about the collection which is "free" should be included -
14233 what that information is needs to be determined.
14234 </issue>
14235 </description>
14236 <origin>new</origin>
14237 <capabilities>
14238 <required id="can_generate_garbage_collection_events"></required>
14239 </capabilities>
14240 <parameters>
14241 </parameters>
14242 </event>
14243
14244 <elide>
14245 <event label="Verbose Output" phase="any"
14246 id="VerboseOutput" const="JVMTI_EVENT_VERBOSE_OUTPUT" num="85">
14247 <description>
14248 Send verbose messages as strings.
14249 <issue>
14250 This format is extremely fragile, as it can change with each
14251 platform, collector and version. Alternatives include:
14252 <ul>
14253 <li>building off Java programming language M and M APIs</li>
14254 <li>XML</li>
14255 <li>key/value pairs</li>
14256 <li>removing it</li>
14257 </ul>
14258 </issue>
14259 <issue>
14260 Though this seemed trivial to implement.
14261 In the RI it appears this will be quite complex.
14262 </issue>
14263 </description>
14264 <origin>new</origin>
14265 <capabilities>
14266 </capabilities>
14267 <parameters>
14268 <param id="flag">
14269 <enum>jvmtiVerboseFlag</enum>
14270 <description>
14271 Which verbose output is being sent.
14272 </description>
14273 </param>
14274 <param id="message">
14275 <vmbuf><char/></vmbuf>
14276 <description>
14277 Message text, encoded as a
14278 <internallink id="mUTF">modified UTF-8</internallink> string.
14279 </description>
14280 </param>
14281 </parameters>
14282 </event>
14283 </elide>
14284
14285 </eventsection>
14286
14287 <datasection>
14288 <intro>
14289 <jvmti/> extends the data types defined by JNI.
14290 </intro>
14291 <basetypes id="jniTypes" label="JNI Types Used in the JVM Tool Interface">
14292 <basetype id="jboolean">
14293 <description>
14294 Holds a Java programming language <code>boolean</code>.
14295 Unsigned 8 bits.
14296 </description>
14297 </basetype>
14298 <basetype id="jchar">
14299 <description>
14300 Holds a Java programming language <code>char</code>.
14301 Unsigned 16 bits.
14302 </description>
14303 </basetype>
14304 <basetype id="jint">
14305 <description>
14306 Holds a Java programming language <code>int</code>.
14307 Signed 32 bits.
14308 </description>
14309 </basetype>
14310 <basetype id="jlong">
14311 <description>
14312 Holds a Java programming language <code>long</code>.
14313 Signed 64 bits.
14314 </description>
14315 </basetype>
14316 <basetype id="jfloat">
14317 <description>
14318 Holds a Java programming language <code>float</code>.
14319 32 bits.
14320 </description>
14321 </basetype>
14322 <basetype id="jdouble">
14323 <description>
14324 Holds a Java programming language <code>double</code>.
14325 64 bits.
14326 </description>
14327 </basetype>
14328 <basetype id="jobject">
14329 <description>
14330 Holds a Java programming language object.
14331 </description>
14332 </basetype>
14333 <basetype id="jclass">
14334 <description>
14335 Holds a Java programming language class.
14336 </description>
14337 </basetype>
14338 <basetype id="jvalue">
14339 <description>
14340 Is a union of all primitive types and <code>jobject</code>. Thus, holds any Java
14341 programming language value.
14342 </description>
14343 </basetype>
14344 <basetype id="jfieldID">
14345 <description>
14346 Identifies a Java programming language field.
14347 <code>jfieldID</code>s returned by <jvmti/> functions and events may be
14348 safely stored.
14349 </description>
14350 </basetype>
14351 <basetype id="jmethodID">
14352 <description>
14353 Identifies a Java programming language method, initializer, or constructor.
14354 <code>jmethodID</code>s returned by <jvmti/> functions and events may be
14355 safely stored. However, if the class is unloaded, they become invalid
14356 and must not be used.
14357 </description>
14358 </basetype>
14359 <basetype id="JNIEnv">
14360 <description>
14361 Pointer to the JNI function table. Pointer to this (<code>JNIEnv *</code>)
14362 is a JNI environment.
14363 </description>
14364 </basetype>
14365 </basetypes>
14366
14367 <basetypes id="jvmtiTypes" label="JVM Tool Interface Base Types">
14368 <basetype id="jvmtiEnv">
14369 <description>
14370 The <jvmti/> <internallink id="environments">environment</internallink> pointer.
14371 See the <internallink id="FunctionSection">Function Section</internallink>.
14372 <code>jvmtiEnv</code> points to the
14373 <internallink id="FunctionTable">function table</internallink> pointer.
14374 </description>
14375 </basetype>
14376 <basetype id="jthread">
14377 <definition>typedef jobject jthread;</definition>
14378 <description>
14379 Subtype of <datalink id="jobject"></datalink> that holds a thread.
14380 </description>
14381 </basetype>
14382 <basetype id="jthreadGroup">
14383 <definition>typedef jobject jthreadGroup;</definition>
14384 <description>
14385 Subtype of <datalink id="jobject"></datalink> that holds a thread group.
14386 </description>
14387 </basetype>
14388 <basetype id="jlocation">
14389 <definition>typedef jlong jlocation;</definition>
14390 <description>
14391 A 64 bit value, representing a monotonically increasing
14392 executable position within a method.
14393 <code>-1</code> indicates a native method.
14394 See <functionlink id="GetJLocationFormat"></functionlink> for the format on a
14395 given VM.
14396 </description>
14397 </basetype>
14398 <basetype id="jrawMonitorID">
14399 <definition>struct _jrawMonitorID;
14400 typedef struct _jrawMonitorID *jrawMonitorID;</definition>
14401 <description>
14402 A raw monitor.
14403 </description>
14404 </basetype>
14405 <basetype id="jvmtiError">
14406 <description>
14407 Holds an error return code.
14408 See the <internallink id="ErrorSection">Error section</internallink> for possible values.
14409 <example>
14410 typedef enum {
14411 JVMTI_ERROR_NONE = 0,
14412 JVMTI_ERROR_INVALID_THREAD = 10,
14413 ...
14414 } jvmtiError;
14415 </example>
14416 </description>
14417 </basetype>
14418 <basetype id="jvmtiEvent">
14419 <description>
14420 An identifier for an event type.
14421 See the <internallink id="EventSection">Event section</internallink> for possible values.
14422 It is guaranteed that future versions of this specification will
14423 never assign zero as an event type identifier.
14424 <example>
14425 typedef enum {
14426 JVMTI_EVENT_SINGLE_STEP = 1,
14427 JVMTI_EVENT_BREAKPOINT = 2,
14428 ...
14429 } jvmtiEvent;
14430 </example>
14431 </description>
14432 </basetype>
14433 <basetype id="jvmtiEventCallbacks" name="eventCallbacks">
14434 <description>
14435 The callbacks used for events.
14436 <example>
14437 typedef struct {
14438 jvmtiEventVMInit VMInit;
14439 jvmtiEventVMDeath VMDeath;
14440 ...
14441 } jvmtiEventCallbacks;
14442 </example>
14443 See <internallink id="jvmtiEventCallbacks">event callbacks</internallink>
14444 for the complete structure.
14445 <p/>
14446 Where, for example, the VM initialization callback is defined:
14447 <example>
14448 typedef void (JNICALL *jvmtiEventVMInit)
14449 (jvmtiEnv *jvmti_env,
14450 JNIEnv* jni_env,
14451 jthread thread);
14452 </example>
14453 See the individual events for the callback function definition.
14454 </description>
14455 </basetype>
14456 <basetype id="jniNativeInterface">
14457 <definition>typedef struct JNINativeInterface_ jniNativeInterface;</definition>
14458 <description>
14459 Typedef for the JNI function table <code>JNINativeInterface</code>
14460 defined in the
14461 <externallink id="jni/functions.html#interface-function-table">
14462 JNI Specification</externallink>.
14463 The JNI reference implementation defines this with an underscore.
14464 </description>
14465 </basetype>
14466 </basetypes>
14467
14468 </datasection>
14469
14470 <issuessection label="Issues">
14471 <intro id="suspendRequired" label="Resolved Issue: Suspend - Required or Automatic">
14472 JVMDI requires that the agent suspend threads before calling
14473 certain sensitive functions. JVMPI requires garbage collection to be
14474 disabled before calling certain sensitive functions.
14475 It was suggested that rather than have this requirement, that
14476 VM place itself in a suitable state before performing an
14477 operation. This makes considerable sense since each VM
14478 knows its requirements and can most easily arrange a
14479 safe state.
14480 <p/>
14481 The ability to externally suspend/resume threads will, of
14482 course, remain. The ability to enable/disable garbage collection will not.
14483 <p/>
14484 This issue is resolved--suspend will not
14485 be required. The spec has been updated to reflect this.
14486 </intro>
14487
14488 <intro id="stackSampling" label="Resolved Issue: Call Stack Sampling">
14489 There are a variety of approaches to sampling call stacks.
14490 The biggest bifurcation is between VM controlled and agent
14491 controlled.
14492 <p/>
14493 This issue is resolved--agent controlled
14494 sampling will be the approach.
14495 </intro>
14496
14497 <intro id="threadRepresentation" label="Resolved Issue: Thread Representation">
14498 JVMDI represents threads as jthread. JVMPI primarily
14499 uses JNIEnv* to represent threads.
14500 <p/>
14501 The Expert Group has chosen jthread as the representation
14502 for threads in <jvmti/>.
14503 JNIEnv* is sent by
14504 events since it is needed to JNI functions. JNIEnv, per the
14505 JNI spec, are not supposed to be used outside their thread.
14506 </intro>
14507
14508 <intro id="design" label="Resolved Issue: Method Representation">
14509 The JNI spec allows an implementation to depend on jclass/jmethodID
14510 pairs, rather than simply a jmethodID, to reference a method.
14511 JVMDI, for consistency, choose the same representation.
14512 JVMPI, however, specifies that a jmethodID alone maps to a
14513 method. Both of the Sun <tm>J2SE</tm> virtual machines (Classic and <tm>HotSpot</tm>) store
14514 pointers in jmethodIDs, and as a result, a jmethodID is sufficient.
14515 In fact, any JVM implementation that supports JVMPI must have
14516 such a representation.
14517 <jvmti/> will use jmethodID as a unique representation of a method
14518 (no jclass is used).
14519 There should be efficiency gains, particularly in
14520 functionality like stack dumping, to this representation.
14521 <p/>
14522 Note that fields were not used in JVMPI and that the access profile
14523 of fields differs from methods--for implementation efficiency
14524 reasons, a jclass/jfieldID pair will still be needed for field
14525 reference.
14526 </intro>
14527
14528 <intro id="localReferenceIssue" label="Resolved Issue: Local References">
14529 Functions return local references.
14530 </intro>
14531
14532 <intro id="frameRep" label="Resolved Issue: Representation of frames">
14533 In JVMDI, a frame ID is used to represent a frame. Problem with this
14534 is that a VM must track when a frame becomes invalid, a far better
14535 approach, and the one used in <jvmti/>, is to reference frames by depth.
14536 </intro>
14537
14538 <intro id="requiredCapabilities" label="Issue: Required Capabilities">
14539 Currently, having a required capabilities means that the functionality
14540 is optional. Capabilities are useful even for required functionality
14541 since they can inform the VM is needed set-up. Thus, there should be
14542 a set of capabilities that a conformant implementation must provide
14543 (if requested during Agent_OnLoad).
14544 </intro>
14545
14546 <intro id="taghint" label="Proposal: add tag hint function">
14547 A hint of the percentage of objects that will be tagged would
14548 help the VM pick a good implementation.
14549 </intro>
14550
14551 <intro id="moreMonitorQueries" label="Request: More Monitor Quires">
14552 How difficult or easy would be to extend the monitor_info category to include
14553 <pre>
14554 - current number of monitors
14555 - enumeration of monitors
14556 - enumeration of threads waiting on a given monitor
14557 </pre>
14558 The reason for my question is the fact that current get_monitor_info support
14559 requires the agent to specify a given thread to get the info which is probably
14560 OK in the profiling/debugging space, while in the monitoring space the agent
14561 could be watching the monitor list and then decide which thread to ask for
14562 the info. You might ask why is this important for monitoring .... I think it
14563 can aid in the detection/prediction of application contention caused by hot-locks.
14564 </intro>
14565 </issuessection>
14566
14567 <changehistory id="ChangeHistory" update="09/05/07">
14568 <intro>
14569 The <jvmti/> specification is an evolving document with major, minor,
14570 and micro version numbers.
14571 A released version of the specification is uniquely identified
14572 by its major and minor version.
14573 The functions, events, and capabilities in this specification
14574 indicate a "Since" value which is the major and minor version in
14575 which it was introduced.
14576 The version of the specification implemented by the VM can
14577 be retrieved at runtime with the <functionlink id="GetVersionNumber"/>
14578 function.
14579 </intro>
14580 <change date="14 Nov 2002">
14581 Converted to XML document.
14582 </change>
14583 <change date="14 Nov 2002">
14584 Elided heap dump functions (for now) since what was there
14585 was wrong.
14586 </change>
14587 <change date="18 Nov 2002">
14588 Added detail throughout.
14589 </change>
14590 <change date="18 Nov 2002">
14591 Changed JVMTI_THREAD_STATUS_RUNNING to JVMTI_THREAD_STATUS_RUNNABLE.
14592 </change>
14593 <change date="19 Nov 2002">
14594 Added AsyncGetStackTrace.
14595 </change>
14596 <change date="19 Nov 2002">
14597 Added jframeID return to GetStackTrace.
14598 </change>
14599 <change date="19 Nov 2002">
14600 Elided GetCurrentFrame and GetCallingFrame functions (for now) since what was there
14601 since they are redundant with GetStackTrace.
14602 </change>
14603 <change date="19 Nov 2002">
14604 Elided ClearAllBreakpoints since it has always been redundant.
14605 </change>
14606 <change date="19 Nov 2002">
14607 Added GetSystemProperties.
14608 </change>
14609 <change date="19 Nov 2002">
14610 Changed the thread local storage functions to use jthread.
14611 </change>
14612 <change date="20 Nov 2002">
14613 Added GetJLocationFormat.
14614 </change>
14615 <change date="22 Nov 2002">
14616 Added events and introductory text.
14617 </change>
14618 <change date="22 Nov 2002">
14619 Cross reference type and constant definitions.
14620 </change>
14621 <change date="24 Nov 2002">
14622 Added DTD.
14623 </change>
14624 <change date="24 Nov 2002">
14625 Added capabilities function section.
14626 </change>
14627 <change date="29 Nov 2002">
14628 Assign capabilities to each function and event.
14629 </change>
14630 <change date="29 Nov 2002">
14631 Add <internallink id="jniIntercept">JNI interception functions</internallink>.
14632 </change>
14633 <change date="30 Nov 2002">
14634 Auto generate SetEventNotificationMode capabilities.
14635 </change>
14636 <change date="30 Nov 2002">
14637 Add <eventlink id="VMObjectAlloc"></eventlink> event.
14638 </change>
14639 <change date="30 Nov 2002">
14640 Add <eventlink id="DynamicCodeGenerated"></eventlink> event.
14641 </change>
14642 <change date="30 Nov 2002">
14643 Add const to declarations.
14644 </change>
14645 <change date="30 Nov 2002">
14646 Change method exit and frame pop to send on exception.
14647 </change>
14648 <change date="1 Dec 2002">
14649 Add ForceGarbageCollection.
14650 </change>
14651 <change date="2 Dec 2002">
14652 Redo Xrun section; clarify GetStackTrace and add example;
14653 Fix width problems; use "agent" consistently.
14654 </change>
14655 <change date="8 Dec 2002">
14656 Remove previous start-up intro.
14657 Add <internallink id="environments"><jvmti/> Environments</internallink>
14658 section.
14659 </change>
14660 <change date="8 Dec 2002">
14661 Add <functionlink id="DisposeEnvironment"></functionlink>.
14662 </change>
14663 <change date="9 Dec 2002">
14664 Numerous minor updates.
14665 </change>
14666 <change date="15 Dec 2002">
14667 Add heap profiling functions added:
14668 get/set annotation, iterate live objects/heap.
14669 Add heap profiling functions place holder added:
14670 heap roots.
14671 Heap profiling event added: object free.
14672 Heap profiling event redesigned: vm object allocation.
14673 Heap profiling event placeholders added: garbage collection start/finish.
14674 Native method bind event added.
14675 </change>
14676 <change date="19 Dec 2002">
14677 Revamp suspend/resume functions.
14678 Add origin information with jvmdi tag.
14679 Misc fixes.
14680 </change>
14681 <change date="24 Dec 2002">
14682 Add semantics to types.
14683 </change>
14684 <change date="27 Dec 2002">
14685 Add local reference section.
14686 Autogenerate parameter descriptions from types.
14687 </change>
14688 <change date="28 Dec 2002">
14689 Document that RunAgentThread sends threadStart.
14690 </change>
14691 <change date="29 Dec 2002">
14692 Remove redundant local ref and dealloc warning.
14693 Convert GetRawMonitorName to allocated buffer.
14694 Add GenerateEvents.
14695 </change>
14696 <change date="30 Dec 2002">
14697 Make raw monitors a type and rename to "jrawMonitorID".
14698 </change>
14699 <change date="1 Jan 2003">
14700 Include origin information.
14701 Clean-up JVMDI issue references.
14702 Remove Deallocate warnings which are now automatically generated.
14703 </change>
14704 <change date="2 Jan 2003">
14705 Fix representation issues for jthread.
14706 </change>
14707 <change date="3 Jan 2003">
14708 Make capabilities buffered out to 64 bits - and do it automatically.
14709 </change>
14710 <change date="4 Jan 2003">
14711 Make constants which are enumeration into enum types.
14712 Parameters now of enum type.
14713 Clean-up and index type section.
14714 Replace remaining datadef entities with callback.
14715 </change>
14716 <change date="7 Jan 2003">
14717 Correct GenerateEvents description.
14718 More internal semantics work.
14719 </change>
14720 <change date="9 Jan 2003">
14721 Replace previous GetSystemProperties with two functions
14722 which use allocated information instead fixed.
14723 Add SetSystemProperty.
14724 More internal semantics work.
14725 </change>
14726 <change date="12 Jan 2003">
14727 Add varargs to end of SetEventNotificationMode.
14728 </change>
14729 <change date="20 Jan 2003">
14730 Finish fixing spec to reflect that alloc sizes are jlong.
14731 </change>
14732 <change date="22 Jan 2003">
14733 Allow null as RunAgentThread arg.
14734 </change>
14735 <change date="22 Jan 2003">
14736 Fixed names to standardized naming convention
14737 Removed AsyncGetStackTrace.
14738 </change>
14739 <change date="29 Jan 2003">
14740 Since we are using jthread, removed GetThread.
14741 </change>
14742 <change date="31 Jan 2003">
14743 Change GetFieldName to allow null like GetMethodName.
14744 </change>
14745 <change date="29 Feb 2003" version="v40">
14746 Rewrite the introductory text, adding sections on
14747 start-up, environments and bytecode instrumentation.
14748 Change the command line arguments per EG discussions.
14749 Add an introduction to the capabilities section.
14750 Add the extension mechanism category and functions.
14751 Mark for deletion, but clarified anyhow, SuspendAllThreads.
14752 Rename IterateOverLiveObjects to IterateOverReachableObjects and
14753 change the text accordingly.
14754 Clarify IterateOverHeap.
14755 Clarify CompiledMethodLoad.
14756 Discuss prerequisite state for Calling Functions.
14757 Clarify SetAllocationHooks.
14758 Added issues ("To be resolved:") through-out.
14759 And so on...
14760 </change>
14761 <change date="6 Mar 2003" version="v41">
14762 Remove struct from the call to GetOwnedMonitorInfo.
14763 Automatically generate most error documentation, remove
14764 (rather broken) hand written error doc.
14765 Better describe capability use (empty initial set).
14766 Add min value to jint params.
14767 Remove the capability can_access_thread_local_storage.
14768 Rename error JVMTI_ERROR_NOT_IMPLEMENTED to JVMTI_ERROR_MUST_POSSESS_CAPABILITY;
14769 same for *NOT_IMPLEMENTED.
14770 Description fixes.
14771 </change>
14772 <change date="8 Mar 2003" version="v42">
14773 Rename GetClassSignature to GetClassName.
14774 Rename IterateOverClassObjects to IterateOverInstancesOfClass.
14775 Remove GetMaxStack (operand stack isn't used in <jvmti/>).
14776 Description fixes: define launch-time, remove native frame pop
14777 from PopFrame, and assorted clarifications.
14778 </change>
14779 <change date="8 Mar 2003" version="v43">
14780 Fix minor editing problem.
14781 </change>
14782 <change date="10 Mar 2003" version="v44">
14783 Add phase information.
14784 Remap (compact) event numbers.
14785 </change>
14786 <change date="11 Mar 2003" version="v45">
14787 More phase information - allow "any".
14788 Elide raw monitor queries and events.
14789 Minor description fixes.
14790 </change>
14791 <change date="12 Mar 2003" version="v46">
14792 Add GetPhase.
14793 Use "phase" through document.
14794 Elide GetRawMonitorName.
14795 Elide GetObjectMonitors.
14796 </change>
14797 <change date="12 Mar 2003" version="v47">
14798 Fixes from link, XML, and spell checking.
14799 Auto-generate the callback structure.
14800 </change>
14801 <change date="13 Mar 2003" version="v48">
14802 One character XML fix.
14803 </change>
14804 <change date="13 Mar 2003" version="v49">
14805 Change function parameter names to be consistent with
14806 event parameters (fooBarBaz becomes foo_bar_baz).
14807 </change>
14808 <change date="14 Mar 2003" version="v50">
14809 Fix broken link. Fix thread markers.
14810 </change>
14811 <change date="14 Mar 2003" version="v51">
14812 Change constants so they are under 128 to workaround
14813 compiler problems.
14814 </change>
14815 <change date="23 Mar 2003" version="v52">
14816 Overhaul capabilities. Separate GetStackTrace into
14817 GetStackTrace and GetStackFrames.
14818 </change>
14819 <change date="8 Apr 2003" version="v54">
14820 Use depth instead of jframeID to reference frames.
14821 Remove the now irrelevant GetCurrentFrame, GetCallerFrame and GetStackFrames.
14822 Remove frame arg from events.
14823 </change>
14824 <change date="9 Apr 2003" version="v55">
14825 Remove GetObjectWithAnnotation since tests show buffered approach more efficient.
14826 Add missing annotation_count to GetObjectsWithAnnotations
14827 </change>
14828 <change date="10 Apr 2003" version="v56">
14829 Remove confusing parenthetical statement in GetObjectsWithAnnotations
14830 </change>
14831 <change date="13 Apr 2003" version="v58">
14832 Replace jclass/jmethodID representation of method with simply jmethodID;
14833 Pass JvmtiEnv* as first arg of every event; remove JNIEnv* where inappropriate.
14834 Replace can_access_frames with can_access_local_variables; remove from purely stack access.
14835 Use can_get_synthetic_attribute; fix description.
14836 Clarify that zero length arrays must be deallocated.
14837 Clarify RelinquishCapabilities.
14838 Generalize JVMTI_ERROR_VM_DEAD to JVMTI_ERROR_WRONG_PHASE.
14839 </change>
14840 <change date="27 Apr 2003" version="v59">
14841 Remove lingering indirect references to OBSOLETE_METHOD_ID.
14842 </change>
14843 <change date="4 May 2003" version="v60">
14844 Allow DestroyRawMonitor during OnLoad.
14845 </change>
14846 <change date="7 May 2003" version="v61">
14847 Added not monitor owner error return to DestroyRawMonitor.
14848 </change>
14849 <change date="13 May 2003" version="v62">
14850 Clarify semantics of raw monitors.
14851 Change flags on <code>GetThreadStatus</code>.
14852 <code>GetClassLoader</code> return a null pointer for the bootstrap class loader.
14853 Add <code>GetClassName</code> issue.
14854 Define local variable signature.
14855 Disallow zero in annotations array of <code>GetObjectsWithAnnotations</code>.
14856 Remove over specification in <code>GetObjectsWithAnnotations</code>.
14857 Elide <code>SetAllocationHooks</code>.
14858 Elide <code>SuspendAllThreads</code>.
14859 </change>
14860 <change date="14 May 2003" version="v63">
14861 Define the data type <code>jvmtiEventCallbacks</code>.
14862 Zero length allocations return a null pointer.
14863 Keep SetAllocationHooks in JVMDI, but remove from <jvmti/>.
14864 Add JVMTI_THREAD_STATUS_FLAG_INTERRUPTED.
14865 </change>
14866 <change date="15 May 2003" version="v64">
14867 Better wording, per review.
14868 </change>
14869 <change date="15 May 2003" version="v65">
14870 First Alpha.
14871 Make jmethodID and jfieldID unique, jclass not used.
14872 </change>
14873 <change date="27 May 2003" version="v66">
14874 Fix minor XSLT errors.
14875 </change>
14876 <change date="13 June 2003" version="v67">
14877 Undo making jfieldID unique (jmethodID still is).
14878 </change>
14879 <change date="17 June 2003" version="v68">
14880 Changes per June 11th Expert Group meeting --
14881 Overhaul Heap functionality: single callback,
14882 remove GetHeapRoots, add reachable iterators,
14883 and rename "annotation" to "tag".
14884 A null pointer thread parameter on most functions is current
14885 thread.
14886 Add timers.
14887 Remove ForceExit.
14888 Add GetEnvironmentLocalStorage.
14889 Add verbose flag and event.
14890 Add AddToBootstrapClassLoaderSearch.
14891 Update ClassFileLoadHook.
14892 </change>
14893 <change date="18 June 2003" version="v69">
14894 Clean up issues sections.
14895 Rename GetClassName back to GetClassSignature and
14896 fix description.
14897 Add generic signature to GetClassSignature,
14898 GetFieldSignature, GetMethodSignature, and
14899 GetLocalVariableTable.
14900 Elide EstimateCostOfCapabilities.
14901 Clarify that the system property functions operate
14902 on the VM view of system properties.
14903 Clarify Agent_OnLoad.
14904 Remove "const" from JNIEnv* in events.
14905 Add metadata accessors.
14906 </change>
14907 <change date="18 June 2003" version="v70">
14908 Add start_depth to GetStackTrace.
14909 Move system properties to a new category.
14910 Add GetObjectSize.
14911 Remove "X" from command line flags.
14912 XML, HTML, and spell check corrections.
14913 </change>
14914 <change date="19 June 2003" version="v71">
14915 Fix JVMTI_HEAP_ROOT_THREAD to be 6.
14916 Make each synopsis match the function name.
14917 Fix unclear wording.
14918 </change>
14919 <change date="26 June 2003" version="v72">
14920 SetThreadLocalStorage and SetEnvironmentLocalStorage should allow value
14921 to be set to null pointer.
14922 NotifyFramePop, GetFrameLocationm and all the local variable operations
14923 needed to have their wording about frames fixed.
14924 Grammar and clarity need to be fixed throughout.
14925 Capitalization and puntuation need to be consistent.
14926 Need micro version number and masks for accessing major, minor, and micro.
14927 The error code lists should indicate which must be returned by
14928 an implementation.
14929 The command line properties should be visible in the properties functions.
14930 Disallow popping from the current thread.
14931 Allow implementations to return opaque frame error when they cannot pop.
14932 The NativeMethodBind event should be sent during any phase.
14933 The DynamicCodeGenerated event should be sent during any phase.
14934 The following functions should be allowed to operate before VMInit:
14935 Set/GetEnvironmentLocalStorage
14936 GetMethodDeclaringClass
14937 GetClassSignature
14938 GetClassModifiers
14939 IsInterface
14940 IsArrayClass
14941 GetMethodName
14942 GetMethodModifiers
14943 GetMaxLocals
14944 GetArgumentsSize
14945 GetLineNumberTable
14946 GetMethodLocation
14947 IsMethodNative
14948 IsMethodSynthetic.
14949 Other changes (to XSL):
14950 Argument description should show asterisk after not before pointers.
14951 NotifyFramePop, GetFrameLocationm and all the local variable operations
14952 should hsve the NO_MORE_FRAMES error added.
14953 Not alive threads should have a different error return than invalid thread.
14954 </change>
14955 <change date="7 July 2003" version="v73">
14956 VerboseOutput event was missing message parameter.
14957 Minor fix-ups.
14958 </change>
14959 <change date="14 July 2003" version="v74">
14960 Technical Publications Department corrections.
14961 Allow thread and environment local storage to be set to null pointer.
14962 </change>
14963 <change date="23 July 2003" version="v75">
14964 Use new Agent_OnLoad rather than overloaded JVM_OnLoad.
14965 Add JNICALL to callbacks (XSL).
14966 Document JNICALL requirement for both events and callbacks (XSL).
14967 Restrict RedefineClasses to methods and attributes.
14968 Elide the VerboseOutput event.
14969 VMObjectAlloc: restrict when event is sent and remove method parameter.
14970 Finish loose ends from Tech Pubs edit.
14971 </change>
14972 <change date="24 July 2003" version="v76">
14973 Change ClassFileLoadHook event to send the class instead of a boolean of redefine.
14974 </change>
14975 <change date="24 July 2003" version="v77">
14976 XML fixes.
14977 Minor text clarifications and corrections.
14978 </change>
14979 <change date="24 July 2003" version="v78">
14980 Remove GetExceptionHandlerTable and GetThrownExceptions from <jvmti/>.
14981 Clarify that stack frames are JVM Spec frames.
14982 Split can_get_source_info into can_get_source_file_name, can_get_line_numbers,
14983 and can_get_source_debug_extension.
14984 PopFrame cannot have a native calling method.
14985 Removed incorrect statement in GetClassloaderClasses
14986 (see <vmspec chapter="4.4"/>).
14987 </change>
14988 <change date="24 July 2003" version="v79">
14989 XML and text fixes.
14990 Move stack frame description into Stack Frame category.
14991 </change>
14992 <change date="26 July 2003" version="v80">
14993 Allow null pointer (means bootstrap loader) for GetClassloaderClasses.
14994 Add new heap reference kinds for references from classes.
14995 Add timer information struct and query functions.
14996 Add AvailableProcessors.
14997 Rename GetOtherThreadCpuTime to GetThreadCpuTime.
14998 Explicitly add JVMTI_ERROR_INVALID_THREAD and JVMTI_ERROR_THREAD_NOT_ALIVE
14999 to SetEventNotification mode.
15000 Add initial thread to the VM_INIT event.
15001 Remove platform assumptions from AddToBootstrapClassLoaderSearch.
15002 </change>
15003 <change date="26 July 2003" version="v81">
15004 Grammar and clarity changes per review.
15005 </change>
15006 <change date="27 July 2003" version="v82">
15007 More grammar and clarity changes per review.
15008 Add Agent_OnUnload.
15009 </change>
15010 <change date="28 July 2003" version="v83">
15011 Change return type of Agent_OnUnload to void.
15012 </change>
15013 <change date="28 July 2003" version="v84">
15014 Rename JVMTI_REFERENCE_ARRAY to JVMTI_REFERENCE_ARRAY_ELEMENT.
15015 </change>
15016 <change date="28 July 2003" version="v85">
15017 Steal java.lang.Runtime.availableProcessors() wording for
15018 AvailableProcessors().
15019 Guarantee that zero will never be an event ID.
15020 Remove some issues which are no longer issues.
15021 Per review, rename and more completely document the timer
15022 information functions.
15023 </change>
15024 <change date="29 July 2003" version="v86">
15025 Non-spec visible change to XML controlled implementation:
15026 SetThreadLocalStorage must run in VM mode.
15027 </change>
15028 <change date="5 August 2003" version="0.1.87">
15029 Add GetErrorName.
15030 Add varargs warning to jvmtiExtensionEvent.
15031 Remove "const" on the jvmtiEnv* of jvmtiExtensionEvent.
15032 Remove unused can_get_exception_info capability.
15033 Pass jvmtiEnv* and JNIEnv* to the jvmtiStartFunction.
15034 Fix jvmtiExtensionFunctionInfo.func declared type.
15035 Extension function returns error code.
15036 Use new version numbering.
15037 </change>
15038 <change date="5 August 2003" version="0.2.88">
15039 Remove the ClassUnload event.
15040 </change>
15041 <change date="8 August 2003" version="0.2.89">
15042 Heap reference iterator callbacks return an enum that
15043 allows outgoing object references to be ignored.
15044 Allow JNIEnv as a param type to extension events/functions.
15045 </change>
15046 <change date="15 August 2003" version="0.2.90">
15047 Fix a typo.
15048 </change>
15049 <change date="2 September 2003" version="0.2.91">
15050 Remove all metadata functions: GetClassMetadata,
15051 GetFieldMetadata, and GetMethodMetadata.
15052 </change>
15053 <change date="1 October 2003" version="0.2.92">
15054 Mark the functions Allocate. Deallocate, RawMonitor*,
15055 SetEnvironmentLocalStorage, and GetEnvironmentLocalStorage
15056 as safe for use in heap callbacks and GC events.
15057 </change>
15058 <change date="24 November 2003" version="0.2.93">
15059 Add pass through opaque user data pointer to heap iterate
15060 functions and callbacks.
15061 In the CompiledMethodUnload event, send the code address.
15062 Add GarbageCollectionOccurred event.
15063 Add constant pool reference kind.
15064 Mark the functions CreateRawMonitor and DestroyRawMonitor
15065 as safe for use in heap callbacks and GC events.
15066 Clarify: VMDeath, GetCurrentThreadCpuTimerInfo,
15067 GetThreadCpuTimerInfo, IterateOverReachableObjects,
15068 IterateOverObjectsReachableFromObject, GetTime and
15069 JVMTI_ERROR_NULL_POINTER.
15070 Add missing errors to: GenerateEvents and
15071 AddToBootstrapClassLoaderSearch.
15072 Fix description of ClassFileLoadHook name parameter.
15073 In heap callbacks and GC/ObjectFree events, specify
15074 that only explicitly allowed functions can be called.
15075 Allow GetCurrentThreadCpuTimerInfo, GetCurrentThreadCpuTime,
15076 GetTimerInfo, and GetTime during callback.
15077 Allow calling SetTag/GetTag during the onload phase.
15078 SetEventNotificationMode, add: error attempted inappropriate
15079 thread level control.
15080 Remove jvmtiExceptionHandlerEntry.
15081 Fix handling of native methods on the stack --
15082 location_ptr param of GetFrameLocation, remove
15083 JVMTI_ERROR_OPAQUE_FRAME from GetFrameLocation,
15084 jvmtiFrameInfo.location, and jlocation.
15085 Remove typo (from JVMPI) implying that the MonitorWaited
15086 event is sent on sleep.
15087 </change>
15088 <change date="25 November 2003" version="0.2.94">
15089 Clarifications and typos.
15090 </change>
15091 <change date="3 December 2003" version="0.2.95">
15092 Allow null pointer user_data in heap iterators.
15093 </change>
15094 <change date="28 January 2004" version="0.2.97">
15095 Add GetThreadState, deprecate GetThreadStatus.
15096 </change>
15097 <change date="29 January 2004" version="0.2.98">
15098 INVALID_SLOT and TYPE_MISMATCH errors should be optional.
15099 </change>
15100 <change date="12 February 2004" version="0.2.102">
15101 Remove MonitorContendedExit.
15102 Added JNIEnv parameter to VMObjectAlloc.
15103 Clarified definition of class_tag and referrer_index
15104 parameters to heap callbacks.
15105 </change>
15106 <change date="16 February 2004" version="0.2.103">
15107 Document JAVA_TOOL_OPTIONS.
15108 </change>
15109 <change date="17 February 2004" version="0.2.105">
15110 Divide start phase into primordial and start.
15111 Add VMStart event
15112 Change phase associations of functions and events.
15113 </change>
15114 <change date="18 February 2004" version="0.3.6">
15115 Elide deprecated GetThreadStatus.
15116 Bump minor version, subtract 100 from micro version
15117 </change>
15118 <change date="18 February 2004" version="0.3.7">
15119 Document that timer nanosecond values are unsigned.
15120 Clarify text having to do with native methods.
15121 </change>
15122 <change date="19 February 2004" version="0.3.8">
15123 Fix typos.
15124 Remove elided deprecated GetThreadStatus.
15125 </change>
15126 <change date="23 February 2004" version="0.3.9">
15127 Require NotifyFramePop to act on suspended threads.
15128 </change>
15129 <change date="24 February 2004" version="0.3.10">
15130 Add capabilities
15131 (<internallink id="jvmtiCapabilities.can_redefine_any_class"
15132 ><code>can_redefine_any_class</code></internallink>
15133 and
15134 <internallink id="jvmtiCapabilities.can_generate_all_class_hook_events"
15135 ><code>can_generate_all_class_hook_events</code></internallink>)
15136 and an error (<errorlink id="JVMTI_ERROR_UNMODIFIABLE_CLASS"></errorlink>)
15137 which allow some classes to be unmodifiable.
15138 </change>
15139 <change date="28 February 2004" version="0.3.11">
15140 Add JVMTI_ERROR_MUST_POSSESS_CAPABILITY to SetEventNotificationMode.
15141 </change>
15142 <change date="8 March 2004" version="0.3.12">
15143 Clarified CompiledMethodUnload so that it is clear the event
15144 may be posted after the class has been unloaded.
15145 </change>
15146 <change date="5 March 2004" version="0.3.13">
15147 Change the size parameter of VMObjectAlloc to jlong to match GetObjectSize.
15148 </change>
15149 <change date="13 March 2004" version="0.3.14">
15150 Added guideline for the use of the JNI FindClass function in event
15151 callback functions.
15152 </change>
15153 <change date="15 March 2004" version="0.3.15">
15154 Add GetAllStackTraces and GetThreadListStackTraces.
15155 </change>
15156 <change date="19 March 2004" version="0.3.16">
15157 ClassLoad and ClassPrepare events can be posted during start phase.
15158 </change>
15159 <change date="25 March 2004" version="0.3.17">
15160 Add JVMTI_ERROR_NATIVE_METHOD to GetLineNumberTable, GetLocalVariableTable,
15161 GetMaxLocals, GetArgumentsSize, GetMethodLocation, GetBytecodes.
15162 </change>
15163 <change date="29 March 2004" version="0.3.18">
15164 Return the timer kind in the timer information structure.
15165 </change>
15166 <change date="31 March 2004" version="0.3.19">
15167 Spec clarifications:
15168 JVMTI_THREAD_STATE_IN_NATIVE might not include JNI or <jvmti/>.
15169 ForceGarbageCollection does not run finalizers.
15170 The context of the specification is the Java platform.
15171 Warn about early instrumentation.
15172 </change>
15173 <change date="1 April 2004" version="0.3.20">
15174 Refinements to the above clarifications and
15175 Clarify that an error returned by Agent_OnLoad terminates the VM.
15176 </change>
15177 <change date="1 April 2004" version="0.3.21">
15178 Array class creation does not generate a class load event.
15179 </change>
15180 <change date="7 April 2004" version="0.3.22">
15181 Align thread state hierarchy more closely with java.lang.Thread.State.
15182 </change>
15183 <change date="12 April 2004" version="0.3.23">
15184 Clarify the documentation of thread state.
15185 </change>
15186 <change date="19 April 2004" version="0.3.24">
15187 Remove GarbageCollectionOccurred event -- can be done by agent.
15188 </change>
15189 <change date="22 April 2004" version="0.3.25">
15190 Define "command-line option".
15191 </change>
15192 <change date="29 April 2004" version="0.3.26">
15193 Describe the intended use of bytecode instrumentation.
15194 Fix description of extension event first parameter.
15195 </change>
15196 <change date="30 April 2004" version="0.3.27">
15197 Clarification and typos.
15198 </change>
15199 <change date="18 May 2004" version="0.3.28">
15200 Remove DataDumpRequest event.
15201 </change>
15202 <change date="18 May 2004" version="0.3.29">
15203 Clarify RawMonitorWait with zero timeout.
15204 Clarify thread state after RunAgentThread.
15205 </change>
15206 <change date="24 May 2004" version="0.3.30">
15207 Clean-up: fix bad/old links, etc.
15208 </change>
15209 <change date="30 May 2004" version="0.3.31">
15210 Clarifications including:
15211 All character strings are modified UTF-8.
15212 Agent thread visibiity.
15213 Meaning of obsolete method version.
15214 Thread invoking heap callbacks,
15215 </change>
15216 <change date="1 June 2004" version="1.0.32">
15217 Bump major.minor version numbers to "1.0".
15218 </change>
15219 <change date="2 June 2004" version="1.0.33">
15220 Clarify interaction between ForceGarbageCollection
15221 and ObjectFree.
15222 </change>
15223 <change date="6 June 2004" version="1.0.34">
15224 Restrict AddToBootstrapClassLoaderSearch and
15225 SetSystemProperty to the OnLoad phase only.
15226 </change>
15227 <change date="11 June 2004" version="1.0.35">
15228 Fix typo in SetTag.
15229 </change>
15230 <change date="18 June 2004" version="1.0.36">
15231 Fix trademarks.
15232 Add missing parameter in example GetThreadState usage.
15233 </change>
15234 <change date="4 August 2004" version="1.0.37">
15235 Copyright updates.
15236 </change>
15237 <change date="5 November 2004" version="1.0.38">
15238 Add missing function table layout.
15239 Add missing description of C++ member function format of functions.
15240 Clarify that name in CFLH can be null pointer.
15241 Released as part of <tm>J2SE</tm> 5.0.
15242 </change>
15243 <change date="24 April 2005" version="1.1.47">
15244 Bump major.minor version numbers to "1.1".
15245 Add ForceEarlyReturn* functions.
15246 Add GetOwnedMonitorStackDepthInfo function.
15247 Add GetCurrentThread function.
15248 Add "since" version marker.
15249 Add AddToSystemClassLoaderSearch.
15250 Allow AddToBootstrapClassLoaderSearch be used in live phase.
15251 Fix historic rubbish in the descriptions of the heap_object_callback
15252 parameter of IterateOverHeap and IterateOverInstancesOfClass functions;
15253 disallow null pointer for this parameter.
15254 Clarify, correct and make consistent: wording about current thread,
15255 opaque frames and insufficient number of frames in PopFrame.
15256 Consistently use "current frame" rather than "topmost".
15257 Clarify the JVMTI_ERROR_TYPE_MISMATCH errors in GetLocal* and SetLocal*
15258 by making them compatible with those in ForceEarlyReturn*.
15259 Many other clarifications and wording clean ups.
15260 </change>
15261 <change date="25 April 2005" version="1.1.48">
15262 Add GetConstantPool.
15263 Switch references to the first edition of the VM Spec, to the seconds edition.
15264 </change>
15265 <change date="26 April 2005" version="1.1.49">
15266 Clarify minor/major version order in GetConstantPool.
15267 </change>
15268 <change date="26 April 2005" version="1.1.50">
15269 Add SetNativeMethodPrefix and SetNativeMethodPrefixes.
15270 Reassign GetOwnedMonitorStackDepthInfo to position 153.
15271 Break out Class Loader Search in its own documentation category.
15272 Deal with overly long lines in XML source.
15273 </change>
15274 <change date="29 April 2005" version="1.1.51">
15275 Allow agents be started in the live phase.
15276 Added paragraph about deploying agents.
15277 </change>
15278 <change date="30 April 2005" version="1.1.52">
15279 Add specification description to SetNativeMethodPrefix(es).
15280 Better define the conditions on GetConstantPool.
15281 </change>
15282 <change date="30 April 2005" version="1.1.53">
15283 Break out the GetClassVersionNumber function from GetConstantPool.
15284 Clean-up the references to the VM Spec.
15285 </change>
15286 <change date="1 May 2005" version="1.1.54">
15287 Allow SetNativeMethodPrefix(es) in any phase.
15288 Add clarifications about the impact of redefinition on GetConstantPool.
15289 </change>
15290 <change date="2 May 2005" version="1.1.56">
15291 Various clarifications to SetNativeMethodPrefix(es).
15292 </change>
15293 <change date="2 May 2005" version="1.1.57">
15294 Add missing performance warning to the method entry event.
15295 </change>
15296 <change date="5 May 2005" version="1.1.58">
15297 Remove internal JVMDI support.
15298 </change>
15299 <change date="8 May 2005" version="1.1.59">
15300 Add <functionlink id="RetransformClasses"/>.
15301 Revamp the bytecode instrumentation documentation.
15302 Change <functionlink id="IsMethodObsolete"/> to no longer
15303 require the can_redefine_classes capability.
15304 </change>
15305 <change date="11 May 2005" version="1.1.63">
15306 Clarifications for retransformation.
15307 </change>
15308 <change date="11 May 2005" version="1.1.64">
15309 Clarifications for retransformation, per review.
15310 Lock "retransformation (in)capable" at class load enable time.
15311 </change>
15312 <change date="4 June 2005" version="1.1.67">
15313 Add new heap functionity which supports reporting primitive values,
15314 allows setting the referrer tag, and has more powerful filtering:
15315 FollowReferences, IterateThroughHeap, and their associated
15316 callbacks, structs, enums, and constants.
15317 </change>
15318 <change date="4 June 2005" version="1.1.68">
15319 Clarification.
15320 </change>
15321 <change date="6 June 2005" version="1.1.69">
15322 FollowReferences, IterateThroughHeap: Put callbacks in a struct;
15323 Add missing error codes; reduce bits in the visit control flags.
15324 </change>
15325 <change date="14 June 2005" version="1.1.70">
15326 More on new heap functionity: spec clean-up per review.
15327 </change>
15328 <change date="15 June 2005" version="1.1.71">
15329 More on new heap functionity: Rename old heap section to Heap (1.0).
15330 </change>
15331 <change date="21 June 2005" version="1.1.72">
15332 Fix typos.
15333 </change>
15334 <change date="27 June 2005" version="1.1.73">
15335 Make referrer info structure a union.
15336 </change>
15337 <change date="9 September 2005" version="1.1.74">
15338 In new heap functions:
15339 Add missing superclass reference kind.
15340 Use a single scheme for computing field indexes.
15341 Remove outdated references to struct based referrer info.
15342 </change>
15343 <change date="12 September 2005" version="1.1.75">
15344 Don't callback during FollowReferences on frivolous java.lang.Object superclass.
15345 </change>
15346 <change date="13 September 2005" version="1.1.76">
15347 In string primitive callback, length now Unicode length.
15348 In array and string primitive callbacks, value now "const".
15349 Note possible compiler impacts on setting JNI function table.
15350 </change>
15351 <change date="13 September 2005" version="1.1.77">
15352 GetClassVersionNumbers() and GetConstantPool() should return
15353 error on array or primitive class.
15354 </change>
15355 <change date="14 September 2005" version="1.1.78">
15356 Grammar fixes.
15357 </change>
15358 <change date="26 September 2005" version="1.1.79">
15359 Add IsModifiableClass query.
15360 </change>
15361 <change date="9 February 2006" version="1.1.81">
15362 Add referrer_class_tag parameter to jvmtiHeapReferenceCallback.
15363 </change>
15364 <change date="13 February 2006" version="1.1.82">
15365 Doc fixes: update can_redefine_any_class to include retransform.
15366 Clarify that exception events cover all Throwables.
15367 In GetStackTrace, no test is done for start_depth too big if start_depth is zero,
15368 Clarify fields reported in Primitive Field Callback -- static vs instance.
15369 Repair confusing names of heap types, including callback names.
15370 Require consistent usage of stack depth in the face of thread launch methods.
15371 Note incompatibility of <jvmti/> memory management with other systems.
15372 </change>
15373 <change date="14 February 2006" version="1.1.85">
15374 Fix typos and missing renames.
15375 </change>
15376 <change date="13 March 2006" version="1.1.86">
15377 Clarify that jmethodIDs and jfieldIDs can be saved.
15378 Clarify that Iterate Over Instances Of Class includes subclasses.
15379 </change>
15380 <change date="14 March 2006" version="1.1.87">
15381 Better phrasing.
15382 </change>
15383 <change date="16 March 2006" version="1.1.88">
15384 Match the referrer_index for static fields in Object Reference Callback
15385 with the Reference Implementation (and all other known implementations);
15386 that is, make it match the definition for instance fields.
15387 In GetThreadListStackTraces, add JVMTI_ERROR_INVALID_THREAD to cover
15388 an invalid thread in the list; and specify that not started threads
15389 return empty stacks.
15390 </change>
15391 <change date="17 March 2006" version="1.1.89">
15392 Typo.
15393 </change>
15394 <change date="25 March 2006" version="1.1.90">
15395 Typo.
15396 </change>
15397 <change date="6 April 2006" version="1.1.91">
15398 Remove restrictions on AddToBootstrapClassLoaderSearch and
15399 AddToSystemClassLoaderSearch.
15400 </change>
15401 <change date="1 May 2006" version="1.1.93">
15402 Changed spec to return -1 for monitor stack depth for the
15403 implementation which can not determine stack depth.
15404 </change>
15405 <change date="3 May 2006" version="1.1.94">
15406 Corrections for readability and accuracy courtesy of Alan Pratt of IBM.
15407 List the object relationships reported in FollowReferences.
15408 </change>
15409 <change date="5 May 2006" version="1.1.95">
15410 Clarify the object relationships reported in FollowReferences.
15411 </change>
15412 <change date="28 June 2006" version="1.1.98">
15413 Clarify DisposeEnvironment; add warning.
15414 Fix typos in SetLocalXXX "retrieve" => "set".
15415 Clarify that native method prefixes must remain set while used.
15416 Clarify that exactly one Agent_OnXXX is called per agent.
15417 Clarify that library loading is independent from start-up.
15418 Remove ambiguous reference to Agent_OnLoad in the Agent_OnUnload spec.
15419 </change>
15420 <change date="31 July 2006" version="1.1.99">
15421 Clarify the interaction between functions and exceptions.
15422 Clarify and give examples of field indices.
15423 Remove confusing "That is" sentence from MonitorWait and MonitorWaited events.
15424 Update links to point to Java 6.
15425 </change>
15426 <change date="6 August 2006" version="1.1.102">
15427 Add ResourceExhaustedEvent.
15428 </change>
15429 <change date="11 October 2012" version="1.2.2">
15430 Fixed the "HTTP" and "Missing Anchor" errors reported by the LinkCheck tool.
15431 </change>
15432 <change date="19 June 2013" version="1.2.3">
15433 Added support for statically linked agents.
15434 </change>
15435 <change date="13 October 2016" version="9.0.0">
15436 Support for modules:
15437 The majorversion is 9 now.
15438 The ClassFileLoadHook events are not sent during the primordial phase anymore.
15439 Allow CompiledMethodLoad events at start phase.
15440 Add new capabilities: can_generate_early_vmstart, can_generate_early_class_hook_events.
15441 Add new functions: GetAllModules, AddModuleReads, AddModuleExports,
15442 AddModuleOpens, AddModuleUses, AddModuleProvides, IsModifiableModule.
15443 Clarified can_redefine_any_classes, can_retransform_any_classes and
15444 IsModifiableClass API to disallow some implementation defined classes.
15445 </change>
15446 <change date="12 February 2017" version="9.0.0">
15447 Minor update for GetCurrentThread function:
15448 The function may return null pointer in the start phase if the
15449 can_generate_early_vmstart capability is enabled.
15450 </change>
15451 <change date="7 February 2018" version="11.0.0">
15452 Minor update for new class file NestHost and NestMembers attributes:
15453 Specify that RedefineClasses and RetransformClasses are not allowed
15454 to change the class file NestHost and NestMembers attributes;
15455 Add new error JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED
15456 that can be returned by RedefineClasses and RetransformClasses.
15457 </change>
15458 <change date="15 June 2018" version="11.0.0">
15459 Support for Low Overhead Heap Sampling:
15460 Add new capability: can_generate_sampled_object_alloc_events.
15461 Add new function: SetHeapSamplingInterval.
15462 Add new event type: JVMTI_EVENT_SAMPLED_OBJECT_ALLOC.
15463 </change>
15464 <change date="20 May 2019" version="13.0.0">
15465 Minor spec update for the capability "can_redefine_any_class".
15466 It now says: "RedefineClasses can be called on any modifiable class."
15467 See IsModifiableClass. (can_redefine_classes must also be set)
15468 </change>
15469 <change date="5 June 2019" version="13.0.0">
15470 Minor PopFrame spec update:
15471 The specified thread must be suspended or must be the current thread.
15472 (It was not allowed to be the current thread before.)
15473 </change>
15474 <change date="10 October 2019" version="14.0.0">
15475 Minor update for new class file Record attribute:
15476 Specify that RedefineClasses and RetransformClasses are not allowed
15477 to change the class file Record attribute.
15478 </change>
15479 <change date="13 May 2020" version="15.0.0">
15480 Minor update for new class file PermittedSubclasses attribute:
15481 Specify that RedefineClasses and RetransformClasses are not allowed
15482 to change the class file PermittedSubclasses attribute.
15483 </change>
15484 <change date="15 January 2021" version="17.0.0">
15485 Minor clarification in the section "Agent Shutdown" that says the
15486 implementation may choose to not call the Agent_OnUnload function
15487 if the Agent_OnAttach/Agent_OnAttach_L function reported an error.
15488 </change>
15489 <change date="8 June 2021" version="17.0.0">
15490 Minor update to deprecate Heap functions 1.0.
15491 </change>
15492 <change date="27 April 2022" version="19.0.0">
15493 Support for virtual threads (Preview):
15494 Add new capability: can_support_virtual_threads.
15495 Add new functions: SuspendAllVirtualThreads, ResumeAllVirtualThreads.
15496 Add new event types: JVMTI_EVENT_VIRTUAL_THREAD_START, JVMTI_EVENT_VIRTUAL_THREAD_END.
15497 Add new error code: JVMTI_ERROR_UNSUPPORTED_OPERATION.
15498 </change>
15499 <change date="7 June 2023" version="21.0.0">
15500 Virtual threads finalized to be a permanent feature.
15501 Agent start-up in the live phase now specified to print a warning.
15502 </change>
15503 <change date="10 January 2025" version="25.0.0">
15504 Add new function ClearAllFramePops. Needed to speedup debugger single stepping.
15505 </change>
15506 </changehistory>
15507
15508 </specification>
15509 <!-- Keep this comment at the end of the file
15510 Local variables:
15511 mode: sgml
15512 sgml-omittag:t
15513 sgml-shorttag:t
15514 sgml-namecase-general:t
15515 sgml-general-insert-case:lower
15516 sgml-minimize-attributes:nil
15517 sgml-always-quote-attributes:t
15518 sgml-indent-step:2
15519 sgml-indent-data:t
15520 sgml-parent-document:nil
15521 sgml-exposed-tags:nil
15522 sgml-local-catalogs:nil
15523 sgml-local-ecat-files:nil
15524 End:
15525 -->