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 access
7365 flags
7366 via <code>modifiers_ptr</code>.
7367 Access flags are defined in <vmspec chapter="4"/>.
7368 <p/>
7369 If the class is an array class, then its public, private, and protected
7370 modifiers are the same as those of its component type. For arrays of
7371 primitives, this component type is represented by one of the primitive
7372 classes (for example, <code>java.lang.Integer.TYPE</code>).
7373 <p/>
7374 If the class is a primitive class, its public modifier is always true,
7375 and its protected and private modifiers are always false.
7376 <p/>
7377 If the class is an array class or a primitive class then its final
7378 modifier is always true and its interface modifier is always false.
7379 The values of its other modifiers are not determined by this specification.
7380
7381 </description>
7382 <origin>jvmdi</origin>
7383 <capabilities>
7384 </capabilities>
7385 <parameters>
7386 <param id="klass">
7387 <jclass/>
7388 <description>
7389 The class to query.
7390 </description>
7391 </param>
7392 <param id="modifiers_ptr">
7393 <outptr><jint/></outptr>
7394 <description>
7395 On return, points to the current access flags of this class.
7396
7397 </description>
7398 </param>
7399 </parameters>
7400 <errors>
7401 </errors>
7402 </function>
7403
7404 <function id="GetClassMethods" phase="start" num="52">
7405 <synopsis>Get Class Methods</synopsis>
7406 <description>
7407 For the class indicated by <code>klass</code>, return a count of
7408 methods via <code>method_count_ptr</code> and a list of
7409 method IDs via <code>methods_ptr</code>. The method list contains
7410 constructors and static initializers as well as true methods.
7411 Only directly declared methods are returned (not inherited methods).
7412 An empty method list is returned for array classes and primitive classes
7413 (for example, <code>java.lang.Integer.TYPE</code>).
7414 </description>
7415 <origin>jvmdi</origin>
7416 <capabilities>
7417 <capability id="can_maintain_original_method_order"/>
7418 </capabilities>
7419 <parameters>
7420 <param id="klass">
7421 <jclass/>
7422 <description>
7423 The class to query.
7424 </description>
7425 </param>
7426 <param id="method_count_ptr">
7427 <outptr><jint/></outptr>
7428 <description>
7429 On return, points to the number of methods declared in this class.
7430 </description>
7431 </param>
7432 <param id="methods_ptr">
7433 <allocbuf outcount="method_count_ptr"><jmethodID class="klass"/></allocbuf>
7434 <description>
7435 On return, points to the method ID array.
7436 </description>
7437 </param>
7438 </parameters>
7439 <errors>
7440 <error id="JVMTI_ERROR_CLASS_NOT_PREPARED">
7441 <paramlink id="klass"></paramlink> is not prepared.
7442 </error>
7443 </errors>
7444 </function>
7445
7446 <function id="GetClassFields" phase="start" num="53">
7447 <synopsis>Get Class Fields</synopsis>
7448 <description>
7449 For the class indicated by <code>klass</code>, return a count of fields
7450 via <code>field_count_ptr</code> and a list of field IDs via
7451 <code>fields_ptr</code>.
7452 Only directly declared fields are returned (not inherited fields).
7453 Fields are returned in the order they occur in the class file.
7454 An empty field list is returned for array classes and primitive classes
7455 (for example, <code>java.lang.Integer.TYPE</code>).
7456 Use JNI to determine the length of an array.
7457 </description>
7458 <origin>jvmdi</origin>
7459 <capabilities>
7460 </capabilities>
7461 <parameters>
7462 <param id="klass">
7463 <jclass/>
7464 <description>
7465 The class to query.
7466 </description>
7467 </param>
7468 <param id="field_count_ptr">
7469 <outptr><jint/></outptr>
7470 <description>
7471 On return, points to the number of fields declared in this class.
7472 </description>
7473 </param>
7474 <param id="fields_ptr">
7475 <allocbuf outcount="field_count_ptr"><jfieldID/></allocbuf>
7476 <description>
7477 On return, points to the field ID array.
7478 </description>
7479 </param>
7480 </parameters>
7481 <errors>
7482 <error id="JVMTI_ERROR_CLASS_NOT_PREPARED">
7483 <paramlink id="klass"></paramlink> is not prepared.
7484 </error>
7485 </errors>
7486 </function>
7487
7488 <function id="GetImplementedInterfaces" phase="start" num="54">
7489 <synopsis>Get Implemented Interfaces</synopsis>
7490 <description>
7491 Return the direct super-interfaces of this class. For a class, this
7492 function returns the interfaces declared in its <code>implements</code>
7493 clause. For an interface, this function returns the interfaces declared in
7494 its <code>extends</code> clause.
7495 An empty interface list is returned for array classes and primitive classes
7496 (for example, <code>java.lang.Integer.TYPE</code>).
7497 </description>
7498 <origin>jvmdi</origin>
7499 <capabilities>
7500 </capabilities>
7501 <parameters>
7502 <param id="klass">
7503 <jclass/>
7504 <description>
7505 The class to query.
7506 </description>
7507 </param>
7508 <param id="interface_count_ptr">
7509 <outptr><jint/></outptr>
7510 <description>
7511 On return, points to the number of interfaces.
7512 </description>
7513 </param>
7514 <param id="interfaces_ptr">
7515 <allocbuf outcount="interface_count_ptr"><jclass/></allocbuf>
7516 <description>
7517 On return, points to the interface array.
7518 </description>
7519 </param>
7520 </parameters>
7521 <errors>
7522 <error id="JVMTI_ERROR_CLASS_NOT_PREPARED">
7523 <paramlink id="klass"></paramlink> is not prepared.
7524 </error>
7525 </errors>
7526 </function>
7527
7528 <function id="GetClassVersionNumbers" phase="start" num="145" since="1.1">
7529 <synopsis>Get Class Version Numbers</synopsis>
7530 <description>
7531 For the class indicated by <code>klass</code>,
7532 return the minor and major version numbers,
7533 as defined in
7534 <vmspec chapter="4"/>.
7535 </description>
7536 <origin>new</origin>
7537 <capabilities>
7538 </capabilities>
7539 <parameters>
7540 <param id="klass">
7541 <jclass/>
7542 <description>
7543 The class to query.
7544 </description>
7545 </param>
7546 <param id="minor_version_ptr">
7547 <outptr><jint/></outptr>
7548 <description>
7549 On return, points to the value of the
7550 <code>minor_version</code> item of the
7551 Class File Format.
7552 Note: to be consistent with the Class File Format,
7553 the minor version number is the first parameter.
7554 </description>
7555 </param>
7556 <param id="major_version_ptr">
7557 <outptr><jint/></outptr>
7558 <description>
7559 On return, points to the value of the
7560 <code>major_version</code> item of the
7561 Class File Format.
7562 </description>
7563 </param>
7564 </parameters>
7565 <errors>
7566 <error id="JVMTI_ERROR_ABSENT_INFORMATION">
7567 The class is a primitive or array class.
7568 </error>
7569 </errors>
7570 </function>
7571
7572 <function id="GetConstantPool" phase="start" num="146" since="1.1">
7573 <synopsis>Get Constant Pool</synopsis>
7574 <description>
7575 For the class indicated by <code>klass</code>,
7576 return the raw bytes of the constant pool in the format of the
7577 <code>constant_pool</code> item of
7578 <vmspec chapter="4"/>.
7579 The format of the constant pool may differ between versions
7580 of the Class File Format, so, the
7581 <functionlink id="GetClassVersionNumbers">minor and major
7582 class version numbers</functionlink> should be checked for
7583 compatibility.
7584 <p/>
7585 The returned constant pool might not have the same layout or
7586 contents as the constant pool in the defining class file.
7587 The constant pool returned by GetConstantPool() may have
7588 more or fewer entries than the defining constant pool.
7589 Entries may be in a different order.
7590 The constant pool returned by GetConstantPool() will match the
7591 constant pool used by
7592 <functionlink id="GetBytecodes">GetBytecodes()</functionlink>.
7593 That is, the bytecodes returned by GetBytecodes() will have
7594 constant pool indices which refer to constant pool entries returned
7595 by GetConstantPool().
7596 Note that since <functionlink id="RetransformClasses"/>
7597 and <functionlink id="RedefineClasses"/> can change
7598 the constant pool, the constant pool returned by this function
7599 can change accordingly. Thus, the correspondence between
7600 GetConstantPool() and GetBytecodes() does not hold if there
7601 is an intervening class retransformation or redefinition.
7602 The value of a constant pool entry used by a given bytecode will
7603 match that of the defining class file (even if the indices don't match).
7604 Constant pool entries which are not used directly or indirectly by
7605 bytecodes (for example, UTF-8 strings associated with annotations) are
7606 not required to exist in the returned constant pool.
7607 </description>
7608 <origin>new</origin>
7609 <capabilities>
7610 <required id="can_get_constant_pool"></required>
7611 </capabilities>
7612 <parameters>
7613 <param id="klass">
7614 <jclass/>
7615 <description>
7616 The class to query.
7617 </description>
7618 </param>
7619 <param id="constant_pool_count_ptr">
7620 <outptr><jint/></outptr>
7621 <description>
7622 On return, points to the number of entries
7623 in the constant pool table plus one.
7624 This corresponds to the <code>constant_pool_count</code>
7625 item of the Class File Format.
7626 </description>
7627 </param>
7628 <param id="constant_pool_byte_count_ptr">
7629 <outptr><jint/></outptr>
7630 <description>
7631 On return, points to the number of bytes
7632 in the returned raw constant pool.
7633 </description>
7634 </param>
7635 <param id="constant_pool_bytes_ptr">
7636 <allocbuf outcount="constant_pool_byte_count_ptr"><uchar/></allocbuf>
7637 <description>
7638 On return, points to the raw constant pool, that is the bytes
7639 defined by the <code>constant_pool</code> item of the
7640 Class File Format
7641 </description>
7642 </param>
7643 </parameters>
7644 <errors>
7645 <error id="JVMTI_ERROR_ABSENT_INFORMATION">
7646 The class is a primitive or array class.
7647 </error>
7648 </errors>
7649 </function>
7650
7651 <function id="IsInterface" phase="start" num="55">
7652 <synopsis>Is Interface</synopsis>
7653 <description>
7654 Determines whether a class object reference represents an interface.
7655 The <code>jboolean</code> result is
7656 <code>JNI_TRUE</code> if the "class" is actually an interface,
7657 <code>JNI_FALSE</code> otherwise.
7658 </description>
7659 <origin>jvmdi</origin>
7660 <capabilities>
7661 </capabilities>
7662 <parameters>
7663 <param id="klass">
7664 <jclass/>
7665 <description>
7666 The class to query.
7667 </description>
7668 </param>
7669 <param id="is_interface_ptr">
7670 <outptr><jboolean/></outptr>
7671 <description>
7672 On return, points to the boolean result of this function.
7673
7674 </description>
7675 </param>
7676 </parameters>
7677 <errors>
7678 </errors>
7679 </function>
7680
7681 <function id="IsArrayClass" phase="start" num="56">
7682 <synopsis>Is Array Class</synopsis>
7683 <description>
7684 Determines whether a class object reference represents an array.
7685 The <code>jboolean</code> result is
7686 <code>JNI_TRUE</code> if the class is an array,
7687 <code>JNI_FALSE</code> otherwise.
7688 </description>
7689 <origin>jvmdi</origin>
7690 <capabilities>
7691 </capabilities>
7692 <parameters>
7693 <param id="klass">
7694 <jclass/>
7695 <description>
7696 The class to query.
7697 </description>
7698 </param>
7699 <param id="is_array_class_ptr">
7700 <outptr><jboolean/></outptr>
7701 <description>
7702 On return, points to the boolean result of this function.
7703
7704 </description>
7705 </param>
7706 </parameters>
7707 <errors>
7708 </errors>
7709 </function>
7710
7711 <function id="IsModifiableClass" jkernel="yes" phase="start" num="45" since="1.1">
7712 <synopsis>Is Modifiable Class</synopsis>
7713 <description>
7714 Determines whether a class is modifiable.
7715 If a class is modifiable (<paramlink id="is_modifiable_class_ptr"/>
7716 returns <code>JNI_TRUE</code>) the class can be
7717 redefined with <functionlink id="RedefineClasses"/> (assuming
7718 the agent possesses the
7719 <fieldlink id="can_redefine_classes" struct="jvmtiCapabilities"/>
7720 capability) or
7721 retransformed with <functionlink id="RetransformClasses"/> (assuming
7722 the agent possesses the
7723 <fieldlink id="can_retransform_classes" struct="jvmtiCapabilities"/>
7724 capability).
7725 If a class is not modifiable (<paramlink id="is_modifiable_class_ptr"/>
7726 returns <code>JNI_FALSE</code>) the class can be neither
7727 redefined nor retransformed.
7728 <p/>
7729 Primitive classes (for example, <code>java.lang.Integer.TYPE</code>),
7730 array classes, and some implementation defined classes are never modifiable.
7731 <p/>
7732 </description>
7733 <origin>new</origin>
7734 <capabilities>
7735 <capability id="can_redefine_any_class">
7736 If possessed then all classes (except primitive, array, and some implementation defined
7737 classes) are modifiable with <functionlink id="RedefineClasses"/>.
7738 </capability>
7739 <capability id="can_retransform_any_class">
7740 If possessed then all classes (except primitive, array, and some implementation defined
7741 classes) are modifiable with <functionlink id="RetransformClasses"/>.
7742 </capability>
7743 <capability id="can_redefine_classes">
7744 No effect on the result of the function.
7745 But must additionally be possessed to modify the class with
7746 <functionlink id="RedefineClasses"/>.
7747 </capability>
7748 <capability id="can_retransform_classes">
7749 No effect on the result of the function.
7750 But must additionally be possessed to modify the class with
7751 <functionlink id="RetransformClasses"/>.
7752 </capability>
7753 </capabilities>
7754 <parameters>
7755 <param id="klass">
7756 <jclass/>
7757 <description>
7758 The class to query.
7759 </description>
7760 </param>
7761 <param id="is_modifiable_class_ptr">
7762 <outptr><jboolean/></outptr>
7763 <description>
7764 On return, points to the boolean result of this function.
7765 </description>
7766 </param>
7767 </parameters>
7768 <errors>
7769 </errors>
7770 </function>
7771
7772 <function id="GetClassLoader" phase="start" num="57">
7773 <synopsis>Get Class Loader</synopsis>
7774 <description>
7775 For the class indicated by <code>klass</code>, return via
7776 <code>classloader_ptr</code> a reference to the class loader for the
7777 class.
7778 </description>
7779 <origin>jvmdi</origin>
7780 <capabilities>
7781 </capabilities>
7782 <parameters>
7783 <param id="klass">
7784 <jclass/>
7785 <description>
7786 The class to query.
7787 </description>
7788 </param>
7789 <param id="classloader_ptr">
7790 <outptr><jobject/></outptr>
7791 <description>
7792 On return, points to the class loader that loaded
7793 this class.
7794 If the class was not created by a class loader
7795 or if the class loader is the bootstrap class loader,
7796 points to null.
7797 </description>
7798 </param>
7799 </parameters>
7800 <errors>
7801 </errors>
7802
7803 </function>
7804
7805 <function id="GetSourceDebugExtension" phase="start" num="90">
7806 <synopsis>Get Source Debug Extension</synopsis>
7807 <description>
7808 For the class indicated by <code>klass</code>, return the debug
7809 extension via <code>source_debug_extension_ptr</code>.
7810 The returned string
7811 contains exactly the debug extension information present in the
7812 class file of <code>klass</code>.
7813 </description>
7814 <origin>jvmdi</origin>
7815 <capabilities>
7816 <required id="can_get_source_debug_extension"></required>
7817 </capabilities>
7818 <parameters>
7819 <param id="klass">
7820 <jclass/>
7821 <description>
7822 The class to query.
7823 </description>
7824 </param>
7825 <param id="source_debug_extension_ptr">
7826 <allocbuf><char/></allocbuf>
7827 <description>
7828 On return, points to the class's debug extension, encoded as a
7829 <internallink id="mUTF">modified UTF-8</internallink> string.
7830 </description>
7831 </param>
7832 </parameters>
7833 <errors>
7834 <error id="JVMTI_ERROR_ABSENT_INFORMATION">
7835 Class information does not include a debug extension.
7836 </error>
7837 </errors>
7838 </function>
7839
7840 <function id="RetransformClasses" jkernel="yes" num="152" since="1.1">
7841 <synopsis>Retransform Classes</synopsis>
7842 <description>
7843 This function facilitates the
7844 <internallink id="bci">bytecode instrumentation</internallink>
7845 of already loaded classes.
7846 To replace the class definition without reference to the existing
7847 bytecodes, as one might do when recompiling from source for
7848 fix-and-continue debugging, <functionlink id="RedefineClasses"/>
7849 function should be used instead.
7850 <p/>
7851 When classes are initially loaded or when they are
7852 <functionlink id="RedefineClasses">redefined</functionlink>,
7853 the initial class file bytes can be transformed with the
7854 <eventlink id="ClassFileLoadHook"/> event.
7855 This function reruns the transformation process
7856 (whether or not a transformation has previously occurred).
7857 This retransformation follows these steps:
7858 <ul>
7859 <li>starting from the initial class file bytes
7860 </li>
7861 <li>for each <fieldlink id="can_retransform_classes"
7862 struct="jvmtiCapabilities">retransformation
7863 incapable</fieldlink>
7864 agent which received a
7865 <code>ClassFileLoadHook</code> event during the previous
7866 load or redefine, the bytes it returned
7867 (via the <code>new_class_data</code> parameter)
7868 are reused as the output of the transformation;
7869 note that this is equivalent to reapplying
7870 the previous transformation, unaltered. except that
7871 the <code>ClassFileLoadHook</code> event
7872 is <b>not</b> sent to these agents
7873 </li>
7874 <li>for each <fieldlink id="can_retransform_classes"
7875 struct="jvmtiCapabilities">retransformation
7876 capable</fieldlink>
7877 agent, the <code>ClassFileLoadHook</code> event is sent,
7878 allowing a new transformation to be applied
7879 </li>
7880 <li>the transformed class file bytes are installed as the new
7881 definition of the class
7882 </li>
7883 </ul>
7884 See the <eventlink id="ClassFileLoadHook"/> event for more details.
7885 <p/>
7886 The initial class file bytes represent the bytes passed to
7887 <code>ClassLoader.defineClass</code>
7888 or <code>RedefineClasses</code> (before any transformations
7889 were applied), however they may not exactly match them.
7890 The constant pool may differ in ways described in
7891 <functionlink id="GetConstantPool"/>.
7892 Constant pool indices in the bytecodes of methods will correspond.
7893 Some attributes may not be present.
7894 Where order is not meaningful, for example the order of methods,
7895 order may not be preserved.
7896 <p/>
7897 Retransformation can cause new versions of methods to be installed.
7898 Old method versions may become
7899 <internallink id="obsoleteMethods">obsolete</internallink>
7900 The new method version will be used on new invokes.
7901 If a method has active stack frames, those active frames continue to
7902 run the bytecodes of the original method version.
7903 <p/>
7904 This function does not cause any initialization except that which
7905 would occur under the customary JVM semantics.
7906 In other words, retransforming a class does not cause its initializers to be
7907 run. The values of static fields will remain as they were
7908 prior to the call.
7909 <p/>
7910 Threads need not be suspended.
7911 <p/>
7912 All breakpoints in the class are cleared.
7913 <p/>
7914 All attributes are updated.
7915 <p/>
7916 Instances of the retransformed class are not affected -- fields retain their
7917 previous values.
7918 <functionlink id="GetTag">Tags</functionlink> on the instances are
7919 also unaffected.
7920 <p/>
7921 In response to this call, no events other than the
7922 <eventlink id="ClassFileLoadHook"/> event
7923 will be sent.
7924 <p/>
7925 The retransformation may change method bodies, the constant pool and attributes
7926 (unless explicitly prohibited).
7927 The retransformation must not add, remove or rename fields or methods, change the
7928 signatures of methods, change modifiers, or change inheritance.
7929 The retransformation must not change the <code>NestHost</code>,
7930 <code>NestMembers</code>, <code>Record</code>, or <code>PermittedSubclasses</code>
7931 attributes.
7932 These restrictions may be lifted in future versions.
7933 See the error return description below for information on error codes
7934 returned if an unsupported retransformation is attempted.
7935 The class file bytes are not verified or installed until they have passed
7936 through the chain of <eventlink id="ClassFileLoadHook"/> events, thus the
7937 returned error code reflects the result of the transformations.
7938 If any error code is returned other than <code>JVMTI_ERROR_NONE</code>,
7939 none of the classes to be retransformed will have a new definition installed.
7940 When this function returns (with the error code of <code>JVMTI_ERROR_NONE</code>)
7941 all of the classes to be retransformed will have their new definitions installed.
7942 </description>
7943 <origin>new</origin>
7944 <capabilities>
7945 <required id="can_retransform_classes"></required>
7946 <capability id="can_retransform_any_class"></capability>
7947 </capabilities>
7948 <parameters>
7949 <param id="class_count">
7950 <jint min="0"/>
7951 <description>
7952 The number of classes to be retransformed.
7953 </description>
7954 </param>
7955 <param id="classes">
7956 <inbuf incount="class_count"><jclass/></inbuf>
7957 <description>
7958 The array of classes to be retransformed.
7959 </description>
7960 </param>
7961 </parameters>
7962 <errors>
7963 <error id="JVMTI_ERROR_UNMODIFIABLE_CLASS">
7964 One of the <paramlink id="classes"/> cannot be modified.
7965 See <functionlink id="IsModifiableClass"/>.
7966 </error>
7967 <error id="JVMTI_ERROR_INVALID_CLASS">
7968 One of the <paramlink id="classes"/> is not a valid class.
7969 </error>
7970 <error id="JVMTI_ERROR_UNSUPPORTED_VERSION">
7971 A retransformed class file has a version number not supported by this VM.
7972 </error>
7973 <error id="JVMTI_ERROR_INVALID_CLASS_FORMAT">
7974 A retransformed class file is malformed (The VM would return a <code>ClassFormatError</code>).
7975 </error>
7976 <error id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION">
7977 The retransformed class file definitions would lead to a circular definition
7978 (the VM would return a <code>ClassCircularityError</code>).
7979 </error>
7980 <error id="JVMTI_ERROR_FAILS_VERIFICATION">
7981 The retransformed class file bytes fail verification.
7982 </error>
7983 <error id="JVMTI_ERROR_NAMES_DONT_MATCH">
7984 The class name defined in a retransformed class file is
7985 different from the name in the old class object.
7986 </error>
7987 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED">
7988 A retransformed class file would require adding a method.
7989 </error>
7990 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED">
7991 A retransformed class file changes a field.
7992 </error>
7993 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED">
7994 A direct superclass is different for a retransformed class file,
7995 or the set of directly implemented
7996 interfaces is different.
7997 </error>
7998 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED">
7999 A retransformed class file does not declare a method
8000 declared in the old class version.
8001 </error>
8002 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED">
8003 A retransformed class file has unsupported differences in class attributes.
8004 </error>
8005 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED">
8006 A retransformed class file has different class modifiers.
8007 </error>
8008 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED">
8009 A method in the retransformed class file has different modifiers
8010 than its counterpart in the old class version.
8011 </error>
8012 </errors>
8013 </function>
8014
8015 <function id="RedefineClasses" jkernel="yes" num="87">
8016 <synopsis>Redefine Classes</synopsis>
8017 <typedef id="jvmtiClassDefinition" label="Class redefinition description">
8018 <field id="klass">
8019 <jclass/>
8020 <description>
8021 Class object for this class
8022 </description>
8023 </field>
8024 <field id="class_byte_count">
8025 <jint/>
8026 <description>
8027 Number of bytes defining class (below)
8028 </description>
8029 </field>
8030 <field id="class_bytes">
8031 <inbuf incount="class_byte_count"><uchar/></inbuf>
8032 <description>
8033 Bytes defining class (in <vmspec chapter="4"/>)
8034 </description>
8035 </field>
8036 </typedef>
8037 <description>
8038 All classes given are redefined according to the definitions
8039 supplied.
8040 This function is used to replace the definition of a class
8041 with a new definition, as might be needed in fix-and-continue
8042 debugging.
8043 Where the existing class file bytes are to be transformed, for
8044 example in
8045 <internallink id="bci">bytecode instrumentation</internallink>,
8046 <functionlink id="RetransformClasses"/> should be used.
8047 <p/>
8048 Redefinition can cause new versions of methods to be installed.
8049 Old method versions may become
8050 <internallink id="obsoleteMethods">obsolete</internallink>
8051 The new method version will be used on new invokes.
8052 If a method has active stack frames, those active frames continue to
8053 run the bytecodes of the original method version.
8054 If resetting of stack frames is desired, use
8055 <functionlink id="PopFrame"></functionlink>
8056 to pop frames with obsolete method versions.
8057 <p/>
8058 This function does not cause any initialization except that which
8059 would occur under the customary JVM semantics.
8060 In other words, redefining a class does not cause its initializers to be
8061 run. The values of static fields will remain as they were
8062 prior to the call.
8063 <p/>
8064 Threads need not be suspended.
8065 <p/>
8066 All breakpoints in the class are cleared.
8067 <p/>
8068 All attributes are updated.
8069 <p/>
8070 Instances of the redefined class are not affected -- fields retain their
8071 previous values.
8072 <functionlink id="GetTag">Tags</functionlink> on the instances are
8073 also unaffected.
8074 <p/>
8075 In response to this call, the <jvmti/> event
8076 <eventlink id="ClassFileLoadHook">Class File Load Hook</eventlink>
8077 will be sent (if enabled), but no other <jvmti/> events will be sent.
8078 <p/>
8079 The redefinition may change method bodies, the constant pool and attributes
8080 (unless explicitly prohibited).
8081 The redefinition must not add, remove or rename fields or methods, change the
8082 signatures of methods, change modifiers, or change inheritance.
8083 The redefinition must not change the <code>NestHost</code>,
8084 <code>NestMembers</code>, <code>Record</code>, or <code>PermittedSubclasses</code>
8085 attributes.
8086 These restrictions may be lifted in future versions.
8087 See the error return description below for information on error codes
8088 returned if an unsupported redefinition is attempted.
8089 The class file bytes are not verified or installed until they have passed
8090 through the chain of <eventlink id="ClassFileLoadHook"/> events, thus the
8091 returned error code reflects the result of the transformations applied
8092 to the bytes passed into <paramlink id="class_definitions"/>.
8093 If any error code is returned other than <code>JVMTI_ERROR_NONE</code>,
8094 none of the classes to be redefined will have a new definition installed.
8095 When this function returns (with the error code of <code>JVMTI_ERROR_NONE</code>)
8096 all of the classes to be redefined will have their new definitions installed.
8097 </description>
8098 <origin>jvmdi</origin>
8099 <capabilities>
8100 <required id="can_redefine_classes"></required>
8101 <capability id="can_redefine_any_class"></capability>
8102 </capabilities>
8103 <parameters>
8104 <param id="class_count">
8105 <jint min="0"/>
8106 <description>
8107 The number of classes specified in <code>class_definitions</code>
8108 </description>
8109 </param>
8110 <param id="class_definitions">
8111 <inbuf incount="class_count"><struct>jvmtiClassDefinition</struct></inbuf>
8112 <description>
8113 The array of new class definitions
8114 </description>
8115 </param>
8116 </parameters>
8117 <errors>
8118 <error id="JVMTI_ERROR_NULL_POINTER">
8119 One of <code>class_bytes</code> is null.
8120 </error>
8121 <error id="JVMTI_ERROR_UNMODIFIABLE_CLASS">
8122 An element of <code>class_definitions</code> cannot be modified.
8123 See <functionlink id="IsModifiableClass"/>.
8124 </error>
8125 <error id="JVMTI_ERROR_INVALID_CLASS">
8126 An element of <code>class_definitions</code> is not a valid class.
8127 </error>
8128 <error id="JVMTI_ERROR_UNSUPPORTED_VERSION">
8129 A new class file has a version number not supported by this VM.
8130 </error>
8131 <error id="JVMTI_ERROR_INVALID_CLASS_FORMAT">
8132 A new class file is malformed (The VM would return a <code>ClassFormatError</code>).
8133 </error>
8134 <error id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION">
8135 The new class file definitions would lead to a circular definition
8136 (the VM would return a <code>ClassCircularityError</code>).
8137 </error>
8138 <error id="JVMTI_ERROR_FAILS_VERIFICATION">
8139 The class bytes fail verification.
8140 </error>
8141 <error id="JVMTI_ERROR_NAMES_DONT_MATCH">
8142 The class name defined in a new class file is
8143 different from the name in the old class object.
8144 </error>
8145 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED">
8146 A new class file would require adding a method.
8147 </error>
8148 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED">
8149 A new class version changes a field.
8150 </error>
8151 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED">
8152 A direct superclass is different for a new class
8153 version, or the set of directly implemented
8154 interfaces is different.
8155 </error>
8156 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED">
8157 A new class version does not declare a method
8158 declared in the old class version.
8159 </error>
8160 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED">
8161 A new class version has unsupported differences in class attributes.
8162 </error>
8163 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED">
8164 A new class version has different modifiers.
8165 </error>
8166 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED">
8167 A method in the new class version has different modifiers
8168 than its counterpart in the old class version.
8169 </error>
8170 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">
8171 A module cannot be modified.
8172 See <functionlink id="IsModifiableModule"/>.
8173 </error>
8174 </errors>
8175 </function>
8176
8177 </category>
8178
8179 <category id="object" label="Object">
8180
8181 <function id="GetObjectSize" jkernel="yes" phase="start" num="154">
8182 <synopsis>Get Object Size</synopsis>
8183 <description>
8184 For the object indicated by <code>object</code>,
8185 return via <code>size_ptr</code> the size of the object.
8186 This size is an implementation-specific approximation of
8187 the amount of storage consumed by this object.
8188 It may include some or all of the object's overhead, and thus
8189 is useful for comparison within an implementation but not
8190 between implementations.
8191 The estimate may change during a single invocation of the JVM.
8192 </description>
8193 <origin>new</origin>
8194 <capabilities>
8195 </capabilities>
8196 <parameters>
8197 <param id="object">
8198 <jobject/>
8199 <description>
8200 The object to query.
8201 </description>
8202 </param>
8203 <param id="size_ptr">
8204 <outptr><jlong/></outptr>
8205 <description>
8206 On return, points to the object's size in bytes.
8207 </description>
8208 </param>
8209 </parameters>
8210 <errors>
8211 </errors>
8212 </function>
8213
8214 <function id="GetObjectHashCode" phase="start" num="58">
8215 <synopsis>Get Object Hash Code</synopsis>
8216 <description>
8217 For the object indicated by <code>object</code>,
8218 return via <code>hash_code_ptr</code> a hash code.
8219 This hash code could be used to maintain a hash table of object references,
8220 however, on some implementations this can cause significant performance
8221 impacts--in most cases
8222 <internallink id="Heap">tags</internallink>
8223 will be a more efficient means of associating information with objects.
8224 This function guarantees
8225 the same hash code value for a particular object throughout its life
8226 </description>
8227 <origin>jvmdi</origin>
8228 <capabilities>
8229 </capabilities>
8230 <parameters>
8231 <param id="object">
8232 <jobject/>
8233 <description>
8234 The object to query.
8235 </description>
8236 </param>
8237 <param id="hash_code_ptr">
8238 <outptr><jint/></outptr>
8239 <description>
8240 On return, points to the object's hash code.
8241 </description>
8242 </param>
8243 </parameters>
8244 <errors>
8245 </errors>
8246 </function>
8247
8248 <function id="GetObjectMonitorUsage" num="59">
8249 <synopsis>Get Object Monitor Usage</synopsis>
8250 <typedef id="jvmtiMonitorUsage" label="Object monitor usage information">
8251 <field id="owner">
8252 <jthread/>
8253 <description>
8254 The platform thread owning this monitor, or null if owned
8255 by a virtual thread or not owned
8256 </description>
8257 </field>
8258 <field id="entry_count">
8259 <jint/>
8260 <description>
8261 The number of times the platform thread owning this monitor has entered it,
8262 or <code>0</code> if owned by a virtual thread or not owned
8263 </description>
8264 </field>
8265 <field id="waiter_count">
8266 <jint/>
8267 <description>
8268 The number of platform threads waiting to own this monitor, or <code>0</code>
8269 if only virtual threads are waiting or no threads are waiting
8270 </description>
8271 </field>
8272 <field id="waiters">
8273 <allocfieldbuf><jthread/></allocfieldbuf>
8274 <description>
8275 The <code>waiter_count</code> waiting platform threads
8276 </description>
8277 </field>
8278 <field id="notify_waiter_count">
8279 <jint/>
8280 <description>
8281 The number of platform threads waiting to own this monitor, or <code>0</code>
8282 if only virtual threads are waiting to be notified or no threads are waiting
8283 to be notified
8284 </description>
8285 </field>
8286 <field id="notify_waiters">
8287 <allocfieldbuf><jthread/></allocfieldbuf>
8288 <description>
8289 The <code>notify_waiter_count</code> platform threads waiting to be notified
8290 </description>
8291 </field>
8292 </typedef>
8293 <description>
8294 Get information about the object's monitor.
8295 The fields of the <functionlink id="jvmtiMonitorUsage"></functionlink> structure
8296 are filled in with information about usage of the monitor.
8297 <p/>
8298 <b> This function does not support getting information about an object's monitor
8299 when it is owned by a virtual thread. It also does not support returning a
8300 reference to virtual threads that are waiting to own a monitor or waiting to
8301 be notified.
8302 </b>
8303 <todo>
8304 Decide and then clarify suspend requirements.
8305 </todo>
8306 </description>
8307 <origin>jvmdi</origin>
8308 <capabilities>
8309 <required id="can_get_monitor_info"></required>
8310 </capabilities>
8311 <parameters>
8312 <param id="object">
8313 <jobject/>
8314 <description>
8315 The object to query.
8316 </description>
8317 </param>
8318 <param id="info_ptr">
8319 <outptr><struct>jvmtiMonitorUsage</struct></outptr>
8320 <description>
8321 On return, filled with monitor information for the
8322 specified object.
8323 </description>
8324 </param>
8325 </parameters>
8326 <errors>
8327 </errors>
8328 </function>
8329
8330 <elide>
8331 <function id="GetObjectMonitors" num="116">
8332 <synopsis>Get Object Monitors</synopsis>
8333 <description>
8334 Return the list of object monitors.
8335 <p/>
8336 Note: details about each monitor can be examined with
8337 <functionlink id="GetObjectMonitorUsage"></functionlink>.
8338 </description>
8339 <origin>new</origin>
8340 <capabilities>
8341 <required id="can_get_monitor_info"></required>
8342 </capabilities>
8343 <parameters>
8344 <param id="monitorCnt">
8345 <outptr><jint/></outptr>
8346 <description>
8347 On return, pointer to the number
8348 of monitors returned in <code>monitors_ptr</code>.
8349 </description>
8350 </param>
8351 <param id="monitors_ptr">
8352 <allocbuf outcount="monitorCnt"><jobject/></allocbuf>
8353 <description>
8354 On return, pointer to the monitor list.
8355 </description>
8356 </param>
8357 </parameters>
8358 <errors>
8359 </errors>
8360 </function>
8361 </elide>
8362
8363 </category>
8364
8365 <category id="fieldCategory" label="Field">
8366
8367 <intro>
8368 </intro>
8369
8370 <function id="GetFieldName" phase="start" num="60">
8371 <synopsis>Get Field Name (and Signature)</synopsis>
8372 <description>
8373 For the field indicated by <paramlink id="klass"/> and <paramlink id="field"/>,
8374 return the field name via <paramlink id="name_ptr"/> and field signature via
8375 <paramlink id="signature_ptr"/>.
8376 <p/>
8377 Field signatures are defined in the
8378 <externallink id="jni/index.html">JNI Specification</externallink>
8379 and are referred to as <code>field descriptors</code> in
8380 <vmspec chapter="4.3.2"/>.
8381 </description>
8382 <origin>jvmdiClone</origin>
8383 <capabilities>
8384 </capabilities>
8385 <parameters>
8386 <param id="klass">
8387 <jclass field="field"/>
8388 <description>
8389 The class of the field to query.
8390 </description>
8391 </param>
8392 <param id="field">
8393 <jfieldID class="klass"/>
8394 <description>
8395 The field to query.
8396 </description>
8397 </param>
8398 <param id="name_ptr">
8399 <allocbuf>
8400 <char/>
8401 <nullok>the name is not returned</nullok>
8402 </allocbuf>
8403 <description>
8404 On return, points to the field name, encoded as a
8405 <internallink id="mUTF">modified UTF-8</internallink> string.
8406 </description>
8407 </param>
8408 <param id="signature_ptr">
8409 <allocbuf>
8410 <char/>
8411 <nullok>the signature is not returned</nullok>
8412 </allocbuf>
8413 <description>
8414 On return, points to the field signature, encoded as a
8415 <internallink id="mUTF">modified UTF-8</internallink> string.
8416 </description>
8417 </param>
8418 <param id="generic_ptr">
8419 <allocbuf>
8420 <char/>
8421 <nullok>the generic signature is not returned</nullok>
8422 </allocbuf>
8423 <description>
8424 On return, points to the generic signature of the field, encoded as a
8425 <internallink id="mUTF">modified UTF-8</internallink> string.
8426 If there is no generic signature attribute for the field, then,
8427 on return, points to null.
8428 </description>
8429 </param>
8430 </parameters>
8431 <errors>
8432 </errors>
8433 </function>
8434
8435 <function id="GetFieldDeclaringClass" phase="start" num="61">
8436 <synopsis>Get Field Declaring Class</synopsis>
8437 <description>
8438 For the field indicated by <code>klass</code> and <code>field</code>
8439 return the class that defined it via <code>declaring_class_ptr</code>.
8440 The declaring class will either be <code>klass</code>, a superclass, or
8441 an implemented interface.
8442 </description>
8443 <origin>jvmdi</origin>
8444 <capabilities>
8445 </capabilities>
8446 <parameters>
8447 <param id="klass">
8448 <jclass field="field"/>
8449 <description>
8450 The class to query.
8451 </description>
8452 </param>
8453 <param id="field">
8454 <jfieldID class="klass"/>
8455 <description>
8456 The field to query.
8457 </description>
8458 </param>
8459 <param id="declaring_class_ptr">
8460 <outptr><jclass/></outptr>
8461 <description>
8462 On return, points to the declaring class
8463 </description>
8464 </param>
8465 </parameters>
8466 <errors>
8467 </errors>
8468 </function>
8469
8470 <function id="GetFieldModifiers" phase="start" num="62">
8471 <synopsis>Get Field Modifiers</synopsis>
8472 <description>
8473 For the field indicated by <code>klass</code> and <code>field</code>
8474 return the access flags via <code>modifiers_ptr</code>.
8475 Access flags are defined in <vmspec chapter="4"/>.
8476 </description>
8477 <origin>jvmdi</origin>
8478 <capabilities>
8479 </capabilities>
8480 <parameters>
8481 <param id="klass">
8482 <jclass field="field"/>
8483 <description>
8484 The class to query.
8485 </description>
8486 </param>
8487 <param id="field">
8488 <jfieldID class="klass"/>
8489 <description>
8490 The field to query.
8491 </description>
8492 </param>
8493 <param id="modifiers_ptr">
8494 <outptr><jint/></outptr>
8495 <description>
8496 On return, points to the access flags.
8497 </description>
8498 </param>
8499 </parameters>
8500 <errors>
8501 </errors>
8502 </function>
8503
8504 <function id="IsFieldSynthetic" phase="start" num="63">
8505 <synopsis>Is Field Synthetic</synopsis>
8506 <description>
8507 For the field indicated by <code>klass</code> and <code>field</code>, return a
8508 value indicating whether the field is synthetic via <code>is_synthetic_ptr</code>.
8509 Synthetic fields are generated by the compiler but not present in the
8510 original source code.
8511 </description>
8512 <origin>jvmdi</origin>
8513 <capabilities>
8514 <required id="can_get_synthetic_attribute"></required>
8515 </capabilities>
8516 <parameters>
8517 <param id="klass">
8518 <jclass field="field"/>
8519 <description>
8520 The class of the field to query.
8521 </description>
8522 </param>
8523 <param id="field">
8524 <jfieldID class="klass"/>
8525 <description>
8526 The field to query.
8527 </description>
8528 </param>
8529 <param id="is_synthetic_ptr">
8530 <outptr><jboolean/></outptr>
8531 <description>
8532 On return, points to the boolean result of this function.
8533 </description>
8534 </param>
8535 </parameters>
8536 <errors>
8537 </errors>
8538 </function>
8539
8540 </category>
8541
8542 <category id="method" label="Method">
8543
8544 <intro>
8545 These functions provide information about a method (represented as a
8546 <typelink id="jmethodID"/>) and set how methods are processed.
8547 </intro>
8548
8549 <intro id="obsoleteMethods" label="Obsolete Methods">
8550 The functions <functionlink id="RetransformClasses"/> and
8551 <functionlink id="RedefineClasses"/> can cause new versions
8552 of methods to be installed.
8553 An original version of a method is considered equivalent
8554 to the new version if:
8555 <ul>
8556 <li>their bytecodes are the same except for indices into the
8557 constant pool and </li>
8558 <li>the referenced constants are equal.</li>
8559 </ul>
8560 An original method version which is not equivalent to the
8561 new method version is called obsolete and is assigned a new method ID;
8562 the original method ID now refers to the new method version.
8563 A method ID can be tested for obsolescence with
8564 <functionlink id="IsMethodObsolete"/>.
8565 </intro>
8566
8567 <function id="GetMethodName" phase="start" num="64">
8568 <synopsis>Get Method Name (and Signature)</synopsis>
8569 <description>
8570 For the method indicated by <code>method</code>,
8571 return the method name via <code>name_ptr</code> and method signature via
8572 <code>signature_ptr</code>.
8573 <p/>
8574 Method signatures are defined in the
8575 <externallink id="jni/index.html">JNI Specification</externallink>
8576 and are referred to as <code>method descriptors</code> in
8577 <vmspec chapter="4.3.3"/>.
8578 Note this is different
8579 than method signatures as defined in the <i>Java Language Specification</i>.
8580 </description>
8581 <origin>jvmdiClone</origin>
8582 <capabilities>
8583 </capabilities>
8584 <parameters>
8585 <param id="method">
8586 <jmethodID/>
8587 <description>
8588 The method to query.
8589 </description>
8590 </param>
8591 <param id="name_ptr">
8592 <allocbuf>
8593 <char/>
8594 <nullok>the name is not returned</nullok>
8595 </allocbuf>
8596 <description>
8597 On return, points to the method name, encoded as a
8598 <internallink id="mUTF">modified UTF-8</internallink> string.
8599 </description>
8600 </param>
8601 <param id="signature_ptr">
8602 <allocbuf>
8603 <char/>
8604 <nullok>the signature is not returned</nullok>
8605 </allocbuf>
8606 <description>
8607 On return, points to the method signature, encoded as a
8608 <internallink id="mUTF">modified UTF-8</internallink> string.
8609 </description>
8610 </param>
8611 <param id="generic_ptr">
8612 <allocbuf>
8613 <char/>
8614 <nullok>the generic signature is not returned</nullok>
8615 </allocbuf>
8616 <description>
8617 On return, points to the generic signature of the method, encoded as a
8618 <internallink id="mUTF">modified UTF-8</internallink> string.
8619 If there is no generic signature attribute for the method, then,
8620 on return, points to null.
8621 </description>
8622 </param>
8623 </parameters>
8624 <errors>
8625 </errors>
8626 </function>
8627
8628 <function id="GetMethodDeclaringClass" phase="start" num="65">
8629 <synopsis>Get Method Declaring Class</synopsis>
8630 <description>
8631 For the method indicated by <code>method</code>,
8632 return the class that defined it via <code>declaring_class_ptr</code>.
8633 </description>
8634 <origin>jvmdi</origin>
8635 <capabilities>
8636 </capabilities>
8637 <parameters>
8638 <param id="klass">
8639 <jclass method="method"/>
8640 <description>
8641 The class to query.
8642 </description>
8643 </param>
8644 <param id="method">
8645 <jmethodID class="klass"/>
8646 <description>
8647 The method to query.
8648 </description>
8649 </param>
8650 <param id="declaring_class_ptr">
8651 <outptr><jclass/></outptr>
8652 <description>
8653 On return, points to the declaring class
8654 </description>
8655 </param>
8656 </parameters>
8657 <errors>
8658 </errors>
8659 </function>
8660
8661 <function id="GetMethodModifiers" phase="start" num="66">
8662 <synopsis>Get Method Modifiers</synopsis>
8663 <description>
8664 For the method indicated by <code>method</code>,
8665 return the access flags via <code>modifiers_ptr</code>.
8666 Access flags are defined in <vmspec chapter="4"/>.
8667 </description>
8668 <origin>jvmdi</origin>
8669 <capabilities>
8670 </capabilities>
8671 <parameters>
8672 <param id="klass">
8673 <jclass method="method"/>
8674 <description>
8675 The class to query.
8676 </description>
8677 </param>
8678 <param id="method">
8679 <jmethodID class="klass"/>
8680 <description>
8681 The method to query.
8682 </description>
8683 </param>
8684 <param id="modifiers_ptr">
8685 <outptr><jint/></outptr>
8686 <description>
8687 On return, points to the access flags.
8688 </description>
8689 </param>
8690 </parameters>
8691 <errors>
8692 </errors>
8693 </function>
8694
8695 <function id="GetMaxLocals" phase="start" num="68">
8696 <synopsis>Get Max Locals</synopsis>
8697 <description>
8698 For the method indicated by <code>method</code>,
8699 return the number of local variable slots used by the method,
8700 including the local variables used to pass parameters to the
8701 method on its invocation.
8702 <p/>
8703 See <code>max_locals</code> in <vmspec chapter="4.7.3"/>.
8704 </description>
8705 <origin>jvmdi</origin>
8706 <capabilities>
8707 </capabilities>
8708 <parameters>
8709 <param id="klass">
8710 <jclass method="method"/>
8711 <description>
8712 The class to query.
8713 </description>
8714 </param>
8715 <param id="method">
8716 <jmethodID class="klass" native="error"/>
8717 <description>
8718 The method to query.
8719 </description>
8720 </param>
8721 <param id="max_ptr">
8722 <outptr><jint/></outptr>
8723 <description>
8724 On return, points to the maximum number of local slots
8725 </description>
8726 </param>
8727 </parameters>
8728 <errors>
8729 </errors>
8730 </function>
8731
8732 <function id="GetArgumentsSize" phase="start" num="69">
8733 <synopsis>Get Arguments Size</synopsis>
8734 <description>
8735 For the method indicated by <code>method</code>,
8736 return via <code>max_ptr</code> the number of local variable slots used
8737 by the method's arguments.
8738 Note that two-word arguments use two slots.
8739 </description>
8740 <origin>jvmdi</origin>
8741 <capabilities>
8742 </capabilities>
8743 <parameters>
8744 <param id="klass">
8745 <jclass method="method"/>
8746 <description>
8747 The class to query.
8748 </description>
8749 </param>
8750 <param id="method">
8751 <jmethodID class="klass" native="error"/>
8752 <description>
8753 The method to query.
8754 </description>
8755 </param>
8756 <param id="size_ptr">
8757 <outptr><jint/></outptr>
8758 <description>
8759 On return, points to the number of argument slots
8760 </description>
8761 </param>
8762 </parameters>
8763 <errors>
8764 </errors>
8765 </function>
8766
8767 <function id="GetLineNumberTable" phase="start" num="70">
8768 <synopsis>Get Line Number Table</synopsis>
8769 <typedef id="jvmtiLineNumberEntry" label="Line number table entry">
8770 <field id="start_location">
8771 <jlocation/>
8772 <description>
8773 the <datalink id="jlocation"></datalink> where the line begins
8774 </description>
8775 </field>
8776 <field id="line_number">
8777 <jint/>
8778 <description>
8779 the line number
8780 </description>
8781 </field>
8782 </typedef>
8783 <description>
8784 For the method indicated by <code>method</code>,
8785 return a table of source line number entries. The size of the table is
8786 returned via <code>entry_count_ptr</code> and the table itself is
8787 returned via <code>table_ptr</code>.
8788 </description>
8789 <origin>jvmdi</origin>
8790 <capabilities>
8791 <required id="can_get_line_numbers"></required>
8792 </capabilities>
8793 <parameters>
8794 <param id="klass">
8795 <jclass method="method"/>
8796 <description>
8797 The class to query.
8798 </description>
8799 </param>
8800 <param id="method">
8801 <jmethodID class="klass" native="error"/>
8802 <description>
8803 The method to query.
8804 </description>
8805 </param>
8806 <param id="entry_count_ptr">
8807 <outptr><jint/></outptr>
8808 <description>
8809 On return, points to the number of entries in the table
8810 </description>
8811 </param>
8812 <param id="table_ptr">
8813 <allocbuf outcount="entry_count_ptr"><struct>jvmtiLineNumberEntry</struct></allocbuf>
8814 <description>
8815 On return, points to the line number table pointer.
8816 </description>
8817 </param>
8818 </parameters>
8819 <errors>
8820 <error id="JVMTI_ERROR_ABSENT_INFORMATION">
8821 Class information does not include line numbers.
8822 </error>
8823 </errors>
8824 </function>
8825
8826 <function id="GetMethodLocation" phase="start" num="71">
8827 <synopsis>Get Method Location</synopsis>
8828 <description>
8829 For the method indicated by <code>method</code>,
8830 return the beginning and ending addresses through
8831 <code>start_location_ptr</code> and <code>end_location_ptr</code>. In a
8832 conventional bytecode indexing scheme,
8833 <code>start_location_ptr</code> will always point to zero
8834 and <code>end_location_ptr</code>
8835 will always point to the bytecode count minus one.
8836 </description>
8837 <origin>jvmdi</origin>
8838 <capabilities>
8839 </capabilities>
8840 <parameters>
8841 <param id="klass">
8842 <jclass method="method"/>
8843 <description>
8844 The class to query.
8845 </description>
8846 </param>
8847 <param id="method">
8848 <jmethodID class="klass" native="error"/>
8849 <description>
8850 The method to query.
8851 </description>
8852 </param>
8853 <param id="start_location_ptr">
8854 <outptr><jlocation/></outptr>
8855 <description>
8856 On return, points to the first location, or
8857 <code>-1</code> if location information is not available.
8858 If the information is available and
8859 <functionlink id="GetJLocationFormat"></functionlink>
8860 returns <datalink id="JVMTI_JLOCATION_JVMBCI"></datalink>
8861 then this will always be zero.
8862 </description>
8863 </param>
8864 <param id="end_location_ptr">
8865 <outptr><jlocation/></outptr>
8866 <description>
8867 On return, points to the last location,
8868 or <code>-1</code> if location information is not available.
8869 </description>
8870 </param>
8871 </parameters>
8872 <errors>
8873 <error id="JVMTI_ERROR_ABSENT_INFORMATION">
8874 Class information does not include method sizes.
8875 </error>
8876 </errors>
8877 </function>
8878
8879 <function id="GetLocalVariableTable" num="72">
8880 <synopsis>Get Local Variable Table</synopsis>
8881 <typedef id="jvmtiLocalVariableEntry" label="Local variable table entry">
8882 <field id="start_location">
8883 <jlocation/>
8884 <description>
8885 The code array index where the local variable is first valid
8886 (that is, where it must have a value).
8887 </description>
8888 </field>
8889 <field id="length">
8890 <jint/>
8891 <description>
8892 The length of the valid section for this local variable.
8893 The last code array index where the local variable is valid
8894 is <code>start_location + length</code>.
8895 </description>
8896 </field>
8897 <field id="name">
8898 <allocfieldbuf><char/></allocfieldbuf>
8899 <description>
8900 The local variable name, encoded as a
8901 <internallink id="mUTF">modified UTF-8</internallink> string.
8902 </description>
8903 </field>
8904 <field id="signature">
8905 <allocfieldbuf><char/></allocfieldbuf>
8906 <description>
8907 The local variable's type signature, encoded as a
8908 <internallink id="mUTF">modified UTF-8</internallink> string.
8909 The signature format is the same as that defined in
8910 <vmspec chapter="4.3.2"/>.
8911 </description>
8912 </field>
8913 <field id="generic_signature">
8914 <allocfieldbuf><char/></allocfieldbuf>
8915 <description>
8916 The local variable's generic signature, encoded as a
8917 <internallink id="mUTF">modified UTF-8</internallink> string.
8918 The value of this field will be null for any local
8919 variable which does not have a generic type.
8920 </description>
8921 </field>
8922 <field id="slot">
8923 <jint/>
8924 <description>
8925 The local variable's slot. See <internallink id="local">Local Variables</internallink>.
8926 </description>
8927 </field>
8928 </typedef>
8929 <description>
8930 Return local variable information.
8931 </description>
8932 <origin>jvmdiClone</origin>
8933 <capabilities>
8934 <required id="can_access_local_variables"></required>
8935 </capabilities>
8936 <parameters>
8937 <param id="method">
8938 <jmethodID native="error"/>
8939 <description>
8940 The method to query.
8941 </description>
8942 </param>
8943 <param id="entry_count_ptr">
8944 <outptr><jint/></outptr>
8945 <description>
8946 On return, points to the number of entries in the table
8947 </description>
8948 </param>
8949 <param id="table_ptr">
8950 <allocbuf outcount="entry_count_ptr"><struct>jvmtiLocalVariableEntry</struct></allocbuf>
8951 <description>
8952 On return, points to an array of local variable table entries.
8953 </description>
8954 </param>
8955 </parameters>
8956 <errors>
8957 <error id="JVMTI_ERROR_ABSENT_INFORMATION">
8958 Class information does not include local variable
8959 information.
8960 </error>
8961 </errors>
8962 </function>
8963
8964 <function id="GetBytecodes" phase="start" num="75">
8965 <synopsis>Get Bytecodes</synopsis>
8966 <description>
8967 For the method indicated by <code>method</code>,
8968 return the bytecodes that implement the method. The number of
8969 bytecodes is returned via <code>bytecode_count_ptr</code>. The bytecodes
8970 themselves are returned via <code>bytecodes_ptr</code>.
8971 </description>
8972 <origin>jvmdi</origin>
8973 <capabilities>
8974 <required id="can_get_bytecodes"></required>
8975 </capabilities>
8976 <parameters>
8977 <param id="klass">
8978 <jclass method="method"/>
8979 <description>
8980 The class to query.
8981 </description>
8982 </param>
8983 <param id="method">
8984 <jmethodID class="klass" native="error"/>
8985 <description>
8986 The method to query.
8987 </description>
8988 </param>
8989 <param id="bytecode_count_ptr">
8990 <outptr><jint/></outptr>
8991 <description>
8992 On return, points to the length of the bytecode array
8993 </description>
8994 </param>
8995 <param id="bytecodes_ptr">
8996 <allocbuf outcount="bytecode_count_ptr"><uchar/></allocbuf>
8997 <description>
8998 On return, points to the pointer to the bytecode array
8999 </description>
9000 </param>
9001 </parameters>
9002 <errors>
9003 </errors>
9004 </function>
9005
9006 <function id="IsMethodNative" phase="start" num="76">
9007 <synopsis>Is Method Native</synopsis>
9008 <description>
9009 For the method indicated by <code>method</code>, return a
9010 value indicating whether the method is native via <code>is_native_ptr</code>
9011 </description>
9012 <origin>jvmdi</origin>
9013 <capabilities>
9014 </capabilities>
9015 <parameters>
9016 <param id="klass">
9017 <jclass method="method"/>
9018 <description>
9019 The class to query.
9020 </description>
9021 </param>
9022 <param id="method">
9023 <jmethodID class="klass"/>
9024 <description>
9025 The method to query.
9026 </description>
9027 </param>
9028 <param id="is_native_ptr">
9029 <outptr><jboolean/></outptr>
9030 <description>
9031 On return, points to the boolean result of this function.
9032 </description>
9033 </param>
9034 </parameters>
9035 <errors>
9036 </errors>
9037 </function>
9038
9039 <function id="IsMethodSynthetic" phase="start" num="77">
9040 <synopsis>Is Method Synthetic</synopsis>
9041 <description>
9042 For the method indicated by <code>method</code>, return a
9043 value indicating whether the method is synthetic via <code>is_synthetic_ptr</code>.
9044 Synthetic methods are generated by the compiler but not present in the
9045 original source code.
9046 </description>
9047 <origin>jvmdi</origin>
9048 <capabilities>
9049 <required id="can_get_synthetic_attribute"></required>
9050 </capabilities>
9051 <parameters>
9052 <param id="klass">
9053 <jclass method="method"/>
9054 <description>
9055 The class to query.
9056 </description>
9057 </param>
9058 <param id="method">
9059 <jmethodID class="klass"/>
9060 <description>
9061 The method to query.
9062 </description>
9063 </param>
9064 <param id="is_synthetic_ptr">
9065 <outptr><jboolean/></outptr>
9066 <description>
9067 On return, points to the boolean result of this function.
9068 </description>
9069 </param>
9070 </parameters>
9071 <errors>
9072 </errors>
9073 </function>
9074
9075 <function id="IsMethodObsolete" phase="start" num="91">
9076 <synopsis>Is Method Obsolete</synopsis>
9077 <description>
9078 Determine if a method ID refers to an
9079 <internallink id="obsoleteMethods">obsolete</internallink>
9080 method version.
9081 </description>
9082 <origin>jvmdi</origin>
9083 <capabilities>
9084 </capabilities>
9085 <parameters>
9086 <param id="klass">
9087 <jclass method="method"/>
9088 <description>
9089 The class to query.
9090 </description>
9091 </param>
9092 <param id="method">
9093 <jmethodID class="klass"/>
9094 <description>
9095 The method ID to query.
9096 </description>
9097 </param>
9098 <param id="is_obsolete_ptr">
9099 <outptr><jboolean/></outptr>
9100 <description>
9101 On return, points to the boolean result of this function.
9102 </description>
9103 </param>
9104 </parameters>
9105 <errors>
9106 </errors>
9107 </function>
9108
9109 <function id="SetNativeMethodPrefix" jkernel="yes" phase="any" num="73" since="1.1">
9110 <synopsis>Set Native Method Prefix</synopsis>
9111 <description>
9112 This function modifies the failure handling of
9113 native method resolution by allowing retry
9114 with a prefix applied to the name.
9115 When used with the
9116 <eventlink id="ClassFileLoadHook">ClassFileLoadHook
9117 event</eventlink>, it enables native methods to be
9118 <internallink id="bci">instrumented</internallink>.
9119 <p/>
9120 Since native methods cannot be directly instrumented
9121 (they have no bytecodes), they must be wrapped with
9122 a non-native method which can be instrumented.
9123 For example, if we had:
9124 <example>
9125 native boolean foo(int x);</example>
9126 <p/>
9127 We could transform the class file (with the
9128 ClassFileLoadHook event) so that this becomes:
9129 <example>
9130 boolean foo(int x) {
9131 <i>... record entry to foo ...</i>
9132 return wrapped_foo(x);
9133 }
9134
9135 native boolean wrapped_foo(int x);</example>
9136 <p/>
9137 Where foo becomes a wrapper for the actual native method
9138 with the appended prefix "wrapped_". Note that
9139 "wrapped_" would be a poor choice of prefix since it
9140 might conceivably form the name of an existing method
9141 thus something like "$$$MyAgentWrapped$$$_" would be
9142 better but would make these examples less readable.
9143 <p/>
9144 The wrapper will allow data to be collected on the native
9145 method call, but now the problem becomes linking up the
9146 wrapped method with the native implementation.
9147 That is, the method <code>wrapped_foo</code> needs to be
9148 resolved to the native implementation of <code>foo</code>,
9149 which might be:
9150 <example>
9151 Java_somePackage_someClass_foo(JNIEnv* env, jint x)</example>
9152 <p/>
9153 This function allows the prefix to be specified and the
9154 proper resolution to occur.
9155 Specifically, when the standard resolution fails, the
9156 resolution is retried taking the prefix into consideration.
9157 There are two ways that resolution occurs, explicit
9158 resolution with the JNI function <code>RegisterNatives</code>
9159 and the normal automatic resolution. For
9160 <code>RegisterNatives</code>, the VM will attempt this
9161 association:
9162 <example>
9163 method(foo) -> nativeImplementation(foo)</example>
9164 <p/>
9165 When this fails, the resolution will be retried with
9166 the specified prefix prepended to the method name,
9167 yielding the correct resolution:
9168 <example>
9169 method(wrapped_foo) -> nativeImplementation(foo)</example>
9170 <p/>
9171 For automatic resolution, the VM will attempt:
9172 <example>
9173 method(wrapped_foo) -> nativeImplementation(wrapped_foo)</example>
9174 <p/>
9175 When this fails, the resolution will be retried with
9176 the specified prefix deleted from the implementation name,
9177 yielding the correct resolution:
9178 <example>
9179 method(wrapped_foo) -> nativeImplementation(foo)</example>
9180 <p/>
9181 Note that since the prefix is only used when standard
9182 resolution fails, native methods can be wrapped selectively.
9183 <p/>
9184 Since each <jvmti/> environment is independent and
9185 can do its own transformation of the bytecodes, more
9186 than one layer of wrappers may be applied. Thus each
9187 environment needs its own prefix. Since transformations
9188 are applied in order, the prefixes, if applied, will
9189 be applied in the same order.
9190 The order of transformation application is described in
9191 the <eventlink id="ClassFileLoadHook"/> event.
9192 Thus if three environments applied
9193 wrappers, <code>foo</code> might become
9194 <code>$env3_$env2_$env1_foo</code>. But if, say,
9195 the second environment did not apply a wrapper to
9196 <code>foo</code> it would be just
9197 <code>$env3_$env1_foo</code>. To be able to
9198 efficiently determine the sequence of prefixes,
9199 an intermediate prefix is only applied if its non-native
9200 wrapper exists. Thus, in the last example, even though
9201 <code>$env1_foo</code> is not a native method, the
9202 <code>$env1_</code> prefix is applied since
9203 <code>$env1_foo</code> exists.
9204 <p/>
9205 Since the prefixes are used at resolution time
9206 and since resolution may be arbitrarily delayed, a
9207 native method prefix must remain set as long as there
9208 are corresponding prefixed native methods.
9209 </description>
9210 <origin>new</origin>
9211 <capabilities>
9212 <required id="can_set_native_method_prefix"></required>
9213 </capabilities>
9214 <parameters>
9215 <param id="prefix">
9216 <inbuf>
9217 <char/>
9218 <nullok>
9219 any existing prefix in this environment is cancelled
9220 </nullok>
9221 </inbuf>
9222 <description>
9223 The prefix to apply, encoded as a
9224 <internallink id="mUTF">modified UTF-8</internallink> string.
9225 </description>
9226 </param>
9227 </parameters>
9228 <errors>
9229 </errors>
9230 </function>
9231
9232 <function id="SetNativeMethodPrefixes" jkernel="yes" phase="any" num="74" since="1.1">
9233 <synopsis>Set Native Method Prefixes</synopsis>
9234 <description>
9235 For a normal agent, <functionlink id="SetNativeMethodPrefix"/>
9236 will provide all needed native method prefixing.
9237 For a meta-agent that performs multiple independent class
9238 file transformations (for example as a proxy for another
9239 layer of agents) this function allows each transformation
9240 to have its own prefix.
9241 The prefixes are applied in the order supplied and are
9242 processed in the same manner as described for the
9243 application of prefixes from multiple <jvmti/> environments
9244 in <functionlink id="SetNativeMethodPrefix"/>.
9245 <p/>
9246 Any previous prefixes are replaced. Thus, calling this
9247 function with a <paramlink id="prefix_count"/> of <code>0</code>
9248 disables prefixing in this environment.
9249 <p/>
9250 <functionlink id="SetNativeMethodPrefix"/> and this function
9251 are the two ways to set the prefixes.
9252 Calling <code>SetNativeMethodPrefix</code> with
9253 a prefix is the same as calling this function with
9254 <paramlink id="prefix_count"/> of <code>1</code>.
9255 Calling <code>SetNativeMethodPrefix</code> with
9256 a null pointer is the same as calling this function with
9257 <paramlink id="prefix_count"/> of <code>0</code>.
9258 </description>
9259 <origin>new</origin>
9260 <capabilities>
9261 <required id="can_set_native_method_prefix"></required>
9262 </capabilities>
9263 <parameters>
9264 <param id="prefix_count">
9265 <jint min="0"/>
9266 <description>
9267 The number of prefixes to apply.
9268 </description>
9269 </param>
9270 <param id="prefixes">
9271 <agentbuf>
9272 <char/>
9273 </agentbuf>
9274 <description>
9275 The prefixes to apply for this environment, each encoded as a
9276 <internallink id="mUTF">modified UTF-8</internallink> string.
9277 </description>
9278 </param>
9279 </parameters>
9280 <errors>
9281 </errors>
9282 </function>
9283
9284 </category>
9285
9286 <category id="RawMonitors" label="Raw Monitor">
9287
9288 <function id="CreateRawMonitor" phase="onload" callbacksafe="safe" num="31">
9289 <synopsis>Create Raw Monitor</synopsis>
9290 <description>
9291 Create a raw monitor.
9292 </description>
9293 <origin>jvmdi</origin>
9294 <capabilities>
9295 </capabilities>
9296 <parameters>
9297 <param id="name">
9298 <inbuf><char/></inbuf>
9299 <description>
9300 A name to identify the monitor, encoded as a
9301 <internallink id="mUTF">modified UTF-8</internallink> string.
9302 </description>
9303 </param>
9304 <param id="monitor_ptr">
9305 <outptr><jrawMonitorID/></outptr>
9306 <description>
9307 On return, points to the created monitor.
9308 </description>
9309 </param>
9310 </parameters>
9311 <errors>
9312 </errors>
9313 </function>
9314
9315 <function id="DestroyRawMonitor" phase="onload" callbacksafe="safe" num="32">
9316 <synopsis>Destroy Raw Monitor</synopsis>
9317 <description>
9318 Destroy the raw monitor.
9319 If the monitor being destroyed has been entered by this thread, it will be
9320 exited before it is destroyed.
9321 If the monitor being destroyed has been entered by another thread,
9322 an error will be returned and the monitor will not be destroyed.
9323 </description>
9324 <origin>jvmdi</origin>
9325 <capabilities>
9326 </capabilities>
9327 <parameters>
9328 <param id="monitor">
9329 <jrawMonitorID/>
9330 <description>
9331 The monitor
9332 </description>
9333 </param>
9334 </parameters>
9335 <errors>
9336 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER">
9337 Not monitor owner
9338 </error>
9339 </errors>
9340 </function>
9341
9342 <function id="RawMonitorEnter" phase="any" callbacksafe="safe" impl="innative notrace" num="33">
9343 <synopsis>Raw Monitor Enter</synopsis>
9344 <description>
9345 Gain exclusive ownership of a raw monitor.
9346 The same thread may enter a monitor more then once.
9347 The thread must
9348 <functionlink id="RawMonitorExit">exit</functionlink>
9349 the monitor the same number of times as it is entered.
9350 If a monitor is entered during <code>OnLoad</code> (before attached threads exist)
9351 and has not exited when attached threads come into existence, the enter
9352 is considered to have occurred on the main thread.
9353 </description>
9354 <origin>jvmdi</origin>
9355 <capabilities>
9356 </capabilities>
9357 <parameters>
9358 <param id="monitor">
9359 <jrawMonitorID/>
9360 <description>
9361 The monitor
9362 </description>
9363 </param>
9364 </parameters>
9365 <errors>
9366 </errors>
9367 </function>
9368
9369 <function id="RawMonitorExit" phase="any" callbacksafe="safe" impl="innative notrace" num="34">
9370 <synopsis>Raw Monitor Exit</synopsis>
9371 <description>
9372 Release exclusive ownership of a raw monitor.
9373 </description>
9374 <origin>jvmdi</origin>
9375 <capabilities>
9376 </capabilities>
9377 <parameters>
9378 <param id="monitor">
9379 <jrawMonitorID/>
9380 <description>
9381 The monitor
9382 </description>
9383 </param>
9384 </parameters>
9385 <errors>
9386 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER">
9387 Not monitor owner
9388 </error>
9389 </errors>
9390 </function>
9391
9392 <function id="RawMonitorWait" phase="any" callbacksafe="safe" impl="innative notrace" num="35">
9393 <synopsis>Raw Monitor Wait</synopsis>
9394 <description>
9395 Wait for notification of the raw monitor.
9396 <p/>
9397 Causes the current thread to wait until either another thread calls
9398 <functionlink id="RawMonitorNotify"/> or
9399 <functionlink id="RawMonitorNotifyAll"/>
9400 for the specified raw monitor, or the specified
9401 <paramlink id="millis">timeout</paramlink>
9402 has elapsed.
9403 </description>
9404 <origin>jvmdi</origin>
9405 <capabilities>
9406 </capabilities>
9407 <parameters>
9408 <param id="monitor">
9409 <jrawMonitorID/>
9410 <description>
9411 The monitor
9412 </description>
9413 </param>
9414 <param id="millis">
9415 <jlong/>
9416 <description>
9417 The timeout, in milliseconds. If the timeout is
9418 zero, then real time is not taken into consideration
9419 and the thread simply waits until notified.
9420 </description>
9421 </param>
9422 </parameters>
9423 <errors>
9424 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER">
9425 Not monitor owner
9426 </error>
9427 <error id="JVMTI_ERROR_INTERRUPT">
9428 Wait was interrupted, try again
9429 </error>
9430 </errors>
9431 </function>
9432
9433 <function id="RawMonitorNotify" phase="any" callbacksafe="safe" impl="notrace" num="36">
9434 <synopsis>Raw Monitor Notify</synopsis>
9435 <description>
9436 Notify a single thread waiting on the raw monitor.
9437 </description>
9438 <origin>jvmdi</origin>
9439 <capabilities>
9440 </capabilities>
9441 <parameters>
9442 <param id="monitor">
9443 <jrawMonitorID/>
9444 <description>
9445 The monitor
9446 </description>
9447 </param>
9448 </parameters>
9449 <errors>
9450 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER">
9451 Not monitor owner
9452 </error>
9453 </errors>
9454 </function>
9455
9456 <function id="RawMonitorNotifyAll" phase="any" callbacksafe="safe" impl="notrace" num="37">
9457 <synopsis>Raw Monitor Notify All</synopsis>
9458 <description>
9459 Notify all threads waiting on the raw monitor.
9460 </description>
9461 <origin>jvmdi</origin>
9462 <capabilities>
9463 </capabilities>
9464 <parameters>
9465 <param id="monitor">
9466 <jrawMonitorID/>
9467 <description>
9468 The monitor
9469 </description>
9470 </param>
9471 </parameters>
9472 <errors>
9473 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER">
9474 Not monitor owner
9475 </error>
9476 </errors>
9477 </function>
9478
9479 <elide>
9480 <function id="GetRawMonitorUse" num="118">
9481 <synopsis>Get Raw Monitor Use</synopsis>
9482 <description>
9483 The fields of the <functionlink id="jvmtiMonitorUsage"></functionlink> structure
9484 are filled in with information about usage of the raw monitor.
9485 </description>
9486 <origin>new</origin>
9487 <capabilities>
9488 <required id="can_get_raw_monitor_usage"></required>
9489 </capabilities>
9490 <parameters>
9491 <param id="monitor">
9492 <jrawMonitorID/>
9493 <description>
9494 the raw monitor to query.
9495 </description>
9496 </param>
9497 <param id="info_ptr">
9498 <outptr><struct>jvmtiMonitorUsage</struct></outptr>
9499 <description>
9500 On return, filled with monitor information for the
9501 specified raw monitor.
9502 </description>
9503 </param>
9504 </parameters>
9505 <errors>
9506 </errors>
9507 </function>
9508
9509 <function id="GetRawMonitors" num="119">
9510 <synopsis>Get Raw Monitors</synopsis>
9511 <description>
9512 Return the list of raw monitors.
9513 <p/>
9514 Note: details about each monitor can be examined with
9515 <functionlink id="GetRawMonitorUse"></functionlink>.
9516 </description>
9517 <origin>new</origin>
9518 <capabilities>
9519 <required id="can_get_raw_monitor_usage"></required>
9520 </capabilities>
9521 <parameters>
9522 <param id="monitorCnt">
9523 <outptr><jint/></outptr>
9524 <description>
9525 On return, pointer to the number
9526 of monitors returned in <code>monitors_ptr</code>.
9527 </description>
9528 </param>
9529 <param id="monitors_ptr">
9530 <allocbuf outcount="monitorCnt"><jrawMonitorID/></allocbuf>
9531 <description>
9532 On return, pointer to the monitor list.
9533 </description>
9534 </param>
9535 </parameters>
9536 <errors>
9537 </errors>
9538 </function>
9539 </elide>
9540 </category>
9541
9542 <category id="jniIntercept" label="JNI Function Interception">
9543
9544 <intro>
9545 Provides the ability to intercept and resend
9546 Java Native Interface (JNI) function calls
9547 by manipulating the JNI function table.
9548 See <externallink id="jni/functions.html">JNI
9549 Functions</externallink> in the <i>Java Native Interface Specification</i>.
9550 <p/>
9551 The following example illustrates intercepting the
9552 <code>NewGlobalRef</code> JNI call in order to count reference
9553 creation.
9554 <example>
9555 JNIEnv original_jni_Functions;
9556 JNIEnv redirected_jni_Functions;
9557 int my_global_ref_count = 0;
9558
9559 jobject
9560 MyNewGlobalRef(JNIEnv *jni_env, jobject lobj) {
9561 ++my_global_ref_count;
9562 return originalJNIFunctions->NewGlobalRef(env, lobj);
9563 }
9564
9565 void
9566 myInit() {
9567 jvmtiError err;
9568
9569 err = (*jvmti_env)->GetJNIFunctionTable(jvmti_env, &original_jni_Functions);
9570 if (err != JVMTI_ERROR_NONE) {
9571 die();
9572 }
9573 err = (*jvmti_env)->GetJNIFunctionTable(jvmti_env, &redirected_jni_Functions);
9574 if (err != JVMTI_ERROR_NONE) {
9575 die();
9576 }
9577 redirectedJNIFunctions->NewGlobalRef = MyNewGlobalRef;
9578 err = (*jvmti_env)->SetJNIFunctionTable(jvmti_env, redirected_jni_Functions);
9579 if (err != JVMTI_ERROR_NONE) {
9580 die();
9581 }
9582 }
9583 </example>
9584 Sometime after <code>myInit</code> is called the user's JNI
9585 code is executed which makes the call to create a new global
9586 reference. Instead of going to the normal JNI implementation
9587 the call goes to <code>myNewGlobalRef</code>. Note that a
9588 copy of the original function table is kept so that the normal
9589 JNI function can be called after the data is collected.
9590 Note also that any JNI functions which are not overwritten
9591 will behave normally.
9592 <todo>
9593 check that the example compiles and executes.
9594 </todo>
9595 </intro>
9596
9597 <function id="SetJNIFunctionTable" phase="start" num="120">
9598 <synopsis>Set JNI Function Table</synopsis>
9599 <description>
9600 Set the JNI function table
9601 in all current and future JNI environments.
9602 As a result, all future JNI calls are directed to the specified functions.
9603 Use <functionlink id="GetJNIFunctionTable"></functionlink> to get the
9604 function table to pass to this function.
9605 For this function to take effect the updated table entries must be
9606 used by the JNI clients.
9607 Since the table is defined <code>const</code> some compilers may optimize
9608 away the access to the table, thus preventing this function from taking
9609 effect.
9610 The table is copied--changes to the local copy of the
9611 table have no effect.
9612 This function affects only the function table, all other aspects of the environment are
9613 unaffected.
9614 See the examples <internallink id="jniIntercept">above</internallink>.
9615 </description>
9616 <origin>new</origin>
9617 <capabilities>
9618 </capabilities>
9619 <parameters>
9620 <param id="function_table">
9621 <inptr>
9622 <struct>jniNativeInterface</struct>
9623 </inptr>
9624 <description>
9625 Points to the new JNI function table.
9626 </description>
9627 </param>
9628 </parameters>
9629 <errors>
9630 </errors>
9631 </function>
9632
9633 <function id="GetJNIFunctionTable" phase="start" num="121">
9634 <synopsis>Get JNI Function Table</synopsis>
9635 <description>
9636 Get the JNI function table.
9637 The JNI function table is copied into allocated memory.
9638 If <functionlink id="SetJNIFunctionTable"></functionlink>
9639 has been called, the modified (not the original) function
9640 table is returned.
9641 Only the function table is copied, no other aspects of the environment
9642 are copied.
9643 See the examples <internallink id="jniIntercept">above</internallink>.
9644 </description>
9645 <origin>new</origin>
9646 <capabilities>
9647 </capabilities>
9648 <parameters>
9649 <param id="function_table">
9650 <allocbuf>
9651 <struct>jniNativeInterface</struct>
9652 </allocbuf>
9653 <description>
9654 On return, <code>*function_table</code>
9655 points a newly allocated copy of the JNI function table.
9656 </description>
9657 </param>
9658 </parameters>
9659 <errors>
9660 </errors>
9661 </function>
9662
9663 </category>
9664
9665 <category id="eventManagement" label="Event Management">
9666
9667 <function id="SetEventCallbacks" jkernel="yes" phase="onload" num="122">
9668 <synopsis>Set Event Callbacks</synopsis>
9669 <description>
9670 Set the functions to be called for each event.
9671 The callbacks are specified by supplying a replacement function table.
9672 The function table is copied--changes to the local copy of the
9673 table have no effect.
9674 This is an atomic action, all callbacks are set at once.
9675 No events are sent before this function is called.
9676 When an entry is null or when the event is beyond
9677 <paramlink id="size_of_callbacks"></paramlink> no event is sent.
9678 Details on events are
9679 described <internallink id="EventSection">later</internallink> in this document.
9680 An event must be enabled and have a callback in order to be
9681 sent--the order in which this function and
9682 <functionlink id="SetEventNotificationMode"></functionlink>
9683 are called does not affect the result.
9684 </description>
9685 <origin>new</origin>
9686 <capabilities>
9687 </capabilities>
9688 <parameters>
9689 <param id="callbacks">
9690 <inptr>
9691 <struct>jvmtiEventCallbacks</struct>
9692 <nullok>remove the existing callbacks</nullok>
9693 </inptr>
9694 <description>
9695 The new event callbacks.
9696 </description>
9697 </param>
9698 <param id="size_of_callbacks">
9699 <jint min="0"/>
9700 <description>
9701 <code>sizeof(jvmtiEventCallbacks)</code>--for version
9702 compatibility.
9703 </description>
9704 </param>
9705 </parameters>
9706 <errors>
9707 </errors>
9708 </function>
9709
9710 <function id="SetEventNotificationMode" jkernel="yes" phase="onload" num="2">
9711 <synopsis>Set Event Notification Mode</synopsis>
9712 <description>
9713 Control the generation of events.
9714 <constants id="jvmtiEventMode" label="Event Enable/Disable" kind="enum">
9715 <constant id="JVMTI_ENABLE" num="1">
9716 If <paramlink id="mode"></paramlink> is <code>JVMTI_ENABLE</code>,
9717 the event <paramlink id="event_type"></paramlink> will be enabled
9718 </constant>
9719 <constant id="JVMTI_DISABLE" num="0">
9720 If <paramlink id="mode"></paramlink> is <code>JVMTI_DISABLE</code>,
9721 the event <paramlink id="event_type"></paramlink> will be disabled
9722 </constant>
9723 </constants>
9724 If <code>event_thread</code> is null,
9725 the event is enabled or disabled globally; otherwise, it is
9726 enabled or disabled for a particular thread.
9727 An event is generated for
9728 a particular thread if it is enabled either at the thread or global
9729 levels.
9730 <p/>
9731 See <internallink id="EventIndex">below</internallink> for information on specific events.
9732 <p/>
9733 The following events cannot be controlled at the thread
9734 level through this function.
9735 <ul>
9736 <li><eventlink id="VMInit"></eventlink></li>
9737 <li><eventlink id="VMStart"></eventlink></li>
9738 <li><eventlink id="VMDeath"></eventlink></li>
9739 <li><eventlink id="ThreadStart"></eventlink></li>
9740 <li><eventlink id="VirtualThreadStart"></eventlink></li>
9741 <li><eventlink id="CompiledMethodLoad"></eventlink></li>
9742 <li><eventlink id="CompiledMethodUnload"></eventlink></li>
9743 <li><eventlink id="DynamicCodeGenerated"></eventlink></li>
9744 <li><eventlink id="DataDumpRequest"></eventlink></li>
9745 </ul>
9746 <p/>
9747 Initially, no events are enabled at either the thread level
9748 or the global level.
9749 <p/>
9750 Any needed capabilities (see Event Enabling Capabilities below) must be possessed
9751 before calling this function.
9752 <p/>
9753 Details on events are
9754 described <internallink id="EventSection">below</internallink>.
9755 </description>
9756 <origin>jvmdiClone</origin>
9757 <eventcapabilities></eventcapabilities>
9758 <parameters>
9759 <param id="mode">
9760 <enum>jvmtiEventMode</enum>
9761 <description>
9762 <code>JVMTI_ENABLE</code> or <code>JVMTI_DISABLE</code>
9763 </description>
9764 </param>
9765 <param id="event_type">
9766 <enum>jvmtiEvent</enum>
9767 <description>
9768 the event to control
9769 </description>
9770 </param>
9771 <param id="event_thread">
9772 <ptrtype>
9773 <jthread impl="noconvert"/>
9774 <nullok>event is controlled at the global level</nullok>
9775 </ptrtype>
9776 <description>
9777 The thread to control
9778 </description>
9779 </param>
9780 <param id="...">
9781 <varargs/>
9782 <description>
9783 for future expansion
9784 </description>
9785 </param>
9786 </parameters>
9787 <errors>
9788 <error id="JVMTI_ERROR_INVALID_THREAD">
9789 <paramlink id="event_thread"/> is non-null and is not a valid thread.
9790 </error>
9791 <error id="JVMTI_ERROR_THREAD_NOT_ALIVE">
9792 <paramlink id="event_thread"/> is non-null and is not alive
9793 (has not been started or has terminated).
9794 </error>
9795 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
9796 thread level control was attempted on events which do not
9797 permit thread level control.
9798 </error>
9799 <error id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY">
9800 The Required Event Enabling Capability is not possessed.
9801 </error>
9802 </errors>
9803 </function>
9804
9805 <function id="GenerateEvents" num="123">
9806 <synopsis>Generate Events</synopsis>
9807 <description>
9808 Generate events to represent the current state of the VM.
9809 For example, if <paramlink id="event_type"/> is
9810 <code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code>,
9811 a <eventlink id="CompiledMethodLoad"></eventlink> event will be
9812 sent for each currently compiled method.
9813 Methods that were loaded and now have been unloaded are not sent.
9814 The history of what events have previously been sent does not
9815 effect what events are sent by this function--for example,
9816 all currently compiled methods
9817 will be sent each time this function is called.
9818 <p/>
9819 This function is useful when
9820 events may have been missed due to the agent attaching after program
9821 execution begins; this function generates the missed events.
9822 <p/>
9823 Attempts to execute Java programming language code or
9824 JNI functions may be paused until this function returns -
9825 so neither should be called from the thread sending the event.
9826 This function returns only after the missed events have been
9827 sent, processed and have returned.
9828 The event may be sent on a different thread than the thread
9829 on which the event occurred.
9830 The callback for the event must be set with
9831 <functionlink id="SetEventCallbacks"></functionlink>
9832 and the event must be enabled with
9833 <functionlink id="SetEventNotificationMode"></functionlink>
9834 or the events will not occur.
9835 If the VM no longer has the information to generate some or
9836 all of the requested events, the events are simply not sent -
9837 no error is returned.
9838 <p/>
9839 Only the following events are supported:
9840 <ul>
9841 <li><eventlink id="CompiledMethodLoad"></eventlink></li>
9842 <li><eventlink id="DynamicCodeGenerated"></eventlink></li>
9843 </ul>
9844 </description>
9845 <origin>new</origin>
9846 <capabilities>
9847 <capability id="can_generate_compiled_method_load_events"></capability>
9848 </capabilities>
9849 <parameters>
9850 <param id="event_type">
9851 <enum>jvmtiEvent</enum>
9852 <description>
9853 The type of event to generate. Must be one of these:
9854 <ul>
9855 <li><eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink></li>
9856 <li><eventlink id="DynamicCodeGenerated"><code>JVMTI_EVENT_DYNAMIC_CODE_GENERATED</code></eventlink></li>
9857 </ul>
9858 </description>
9859 </param>
9860 </parameters>
9861 <errors>
9862 <error id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY">
9863 <paramlink id="event_type"/> is
9864 <eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink>
9865 and <fieldlink id="can_generate_compiled_method_load_events" struct="jvmtiCapabilities"></fieldlink>
9866 is <code>false</code>.
9867 </error>
9868 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
9869 <paramlink id="event_type"/> is other than
9870 <eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink>
9871 or <eventlink id="DynamicCodeGenerated"><code>JVMTI_EVENT_DYNAMIC_CODE_GENERATED</code></eventlink>.
9872 </error>
9873 </errors>
9874 </function>
9875
9876 </category>
9877
9878 <category id="extension" label="Extension Mechanism">
9879
9880 <intro>
9881 These functions
9882 allow a <jvmti/> implementation to provide functions and events
9883 beyond those defined in this specification.
9884 <p/>
9885 Both extension functions and extension events have parameters
9886 each of which has a 'type' and 'kind' chosen from the following tables:
9887
9888 <constants id="jvmtiParamTypes" label="Extension Function/Event Parameter Types" kind="enum">
9889 <constant id="JVMTI_TYPE_JBYTE" num="101">
9890 Java programming language primitive type - <code>byte</code>.
9891 JNI type <code>jbyte</code>.
9892 </constant>
9893 <constant id="JVMTI_TYPE_JCHAR" num="102">
9894 Java programming language primitive type - <code>char</code>.
9895 JNI type <code>jchar</code>.
9896 </constant>
9897 <constant id="JVMTI_TYPE_JSHORT" num="103">
9898 Java programming language primitive type - <code>short</code>.
9899 JNI type <code>jshort</code>.
9900 </constant>
9901 <constant id="JVMTI_TYPE_JINT" num="104">
9902 Java programming language primitive type - <code>int</code>.
9903 JNI type <datalink id="jint"></datalink>.
9904 </constant>
9905 <constant id="JVMTI_TYPE_JLONG" num="105">
9906 Java programming language primitive type - <code>long</code>.
9907 JNI type <datalink id="jlong"></datalink>.
9908 </constant>
9909 <constant id="JVMTI_TYPE_JFLOAT" num="106">
9910 Java programming language primitive type - <code>float</code>.
9911 JNI type <datalink id="jfloat"></datalink>.
9912 </constant>
9913 <constant id="JVMTI_TYPE_JDOUBLE" num="107">
9914 Java programming language primitive type - <code>double</code>.
9915 JNI type <datalink id="jdouble"></datalink>.
9916 </constant>
9917 <constant id="JVMTI_TYPE_JBOOLEAN" num="108">
9918 Java programming language primitive type - <code>boolean</code>.
9919 JNI type <datalink id="jboolean"></datalink>.
9920 </constant>
9921 <constant id="JVMTI_TYPE_JOBJECT" num="109">
9922 Java programming language object type - <code>java.lang.Object</code>.
9923 JNI type <datalink id="jobject"></datalink>.
9924 Returned values are JNI local references and must be managed.
9925 </constant>
9926 <constant id="JVMTI_TYPE_JTHREAD" num="110">
9927 Java programming language object type - <code>java.lang.Thread</code>.
9928 <jvmti/> type <datalink id="jthread"></datalink>.
9929 Returned values are JNI local references and must be managed.
9930 </constant>
9931 <constant id="JVMTI_TYPE_JCLASS" num="111">
9932 Java programming language object type - <code>java.lang.Class</code>.
9933 JNI type <datalink id="jclass"></datalink>.
9934 Returned values are JNI local references and must be managed.
9935 </constant>
9936 <constant id="JVMTI_TYPE_JVALUE" num="112">
9937 Union of all Java programming language primitive and object types -
9938 JNI type <datalink id="jvalue"></datalink>.
9939 Returned values which represent object types are JNI local references and must be managed.
9940 </constant>
9941 <constant id="JVMTI_TYPE_JFIELDID" num="113">
9942 Java programming language field identifier -
9943 JNI type <datalink id="jfieldID"></datalink>.
9944 </constant>
9945 <constant id="JVMTI_TYPE_JMETHODID" num="114">
9946 Java programming language method identifier -
9947 JNI type <datalink id="jmethodID"></datalink>.
9948 </constant>
9949 <constant id="JVMTI_TYPE_CCHAR" num="115">
9950 C programming language type - <code>char</code>.
9951 </constant>
9952 <constant id="JVMTI_TYPE_CVOID" num="116">
9953 C programming language type - <code>void</code>.
9954 </constant>
9955 <constant id="JVMTI_TYPE_JNIENV" num="117">
9956 JNI environment - <code>JNIEnv</code>.
9957 Should be used with the correct <datalink id="jvmtiParamKind"/> to make it a pointer type.
9958 </constant>
9959 </constants>
9960
9961 <constants id="jvmtiParamKind" label="Extension Function/Event Parameter Kinds" kind="enum">
9962 <constant id="JVMTI_KIND_IN" num="91">
9963 Ingoing argument - <code>foo</code>.
9964 </constant>
9965 <constant id="JVMTI_KIND_IN_PTR" num="92">
9966 Ingoing pointer argument - <code>const foo*</code>.
9967 </constant>
9968 <constant id="JVMTI_KIND_IN_BUF" num="93">
9969 Ingoing array argument - <code>const foo*</code>.
9970 </constant>
9971 <constant id="JVMTI_KIND_ALLOC_BUF" num="94">
9972 Outgoing allocated array argument - <code>foo**</code>.
9973 Free with <code>Deallocate</code>.
9974 </constant>
9975 <constant id="JVMTI_KIND_ALLOC_ALLOC_BUF" num="95">
9976 Outgoing allocated array of allocated arrays argument - <code>foo***</code>.
9977 Free with <code>Deallocate</code>.
9978 </constant>
9979 <constant id="JVMTI_KIND_OUT" num="96">
9980 Outgoing argument - <code>foo*</code>.
9981 </constant>
9982 <constant id="JVMTI_KIND_OUT_BUF" num="97">
9983 Outgoing array argument (pre-allocated by agent) - <code>foo*</code>.
9984 Do not <code>Deallocate</code>.
9985 </constant>
9986 </constants>
9987
9988 </intro>
9989
9990 <typedef id="jvmtiParamInfo" label="Extension Function/Event Parameter Info">
9991 <field id="name">
9992 <allocfieldbuf><char/></allocfieldbuf>
9993 <description>
9994 The parameter name, encoded as a
9995 <internallink id="mUTF">modified UTF-8</internallink> string
9996 </description>
9997 </field>
9998 <field id="kind">
9999 <enum>jvmtiParamKind</enum>
10000 <description>
10001 The kind of the parameter - type modifiers
10002 </description>
10003 </field>
10004 <field id="base_type">
10005 <enum>jvmtiParamTypes</enum>
10006 <description>
10007 The base type of the parameter - modified by <code>kind</code>
10008 </description>
10009 </field>
10010 <field id="null_ok">
10011 <jboolean/>
10012 <description>
10013 Is a null pointer argument permitted? Applies only to pointer and object types.
10014 </description>
10015 </field>
10016 </typedef>
10017
10018 <callback id="jvmtiExtensionFunction">
10019 <enum>jvmtiError</enum>
10020 <synopsis>Extension Function</synopsis>
10021 <description>
10022 This is the implementation-specific extension function.
10023 </description>
10024 <parameters>
10025 <param id="jvmti_env">
10026 <outptr>
10027 <struct>jvmtiEnv</struct>
10028 </outptr>
10029 <description>
10030 The <jvmti/> environment is the only fixed parameter for extension functions.
10031 </description>
10032 </param>
10033 <param id="...">
10034 <varargs/>
10035 <description>
10036 The extension function-specific parameters
10037 </description>
10038 </param>
10039 </parameters>
10040 </callback>
10041
10042 <function id="GetExtensionFunctions" phase="onload" num="124">
10043 <synopsis>Get Extension Functions</synopsis>
10044
10045 <typedef id="jvmtiExtensionFunctionInfo" label="Extension Function Info">
10046 <field id="func">
10047 <ptrtype>
10048 <struct>jvmtiExtensionFunction</struct>
10049 </ptrtype>
10050 <description>
10051 The actual function to call
10052 </description>
10053 </field>
10054 <field id="id">
10055 <allocfieldbuf><char/></allocfieldbuf>
10056 <description>
10057 The identifier for the extension function, encoded as a
10058 <internallink id="mUTF">modified UTF-8</internallink> string.
10059 Uses package name conventions.
10060 For example, <code>com.sun.hotspot.bar</code>
10061 </description>
10062 </field>
10063 <field id="short_description">
10064 <allocfieldbuf><char/></allocfieldbuf>
10065 <description>
10066 A one sentence description of the function, encoded as a
10067 <internallink id="mUTF">modified UTF-8</internallink> string.
10068 </description>
10069 </field>
10070 <field id="param_count">
10071 <jint/>
10072 <description>
10073 The number of parameters excluding <code>jvmtiEnv *jvmti_env</code>
10074 </description>
10075 </field>
10076 <field id="params">
10077 <allocfieldbuf outcount="param_count">
10078 <struct>jvmtiParamInfo</struct>
10079 </allocfieldbuf>
10080 <description>
10081 Array of
10082 <fieldlink id="param_count" struct="jvmtiExtensionFunctionInfo"></fieldlink>
10083 parameters (<code>jvmtiEnv *jvmti_env</code> excluded)
10084 </description>
10085 </field>
10086 <field id="error_count">
10087 <jint/>
10088 <description>
10089 The number of possible error returns (excluding universal errors)
10090 </description>
10091 </field>
10092 <field id="errors">
10093 <allocfieldbuf outcount="error_count">
10094 <enum>jvmtiError</enum>
10095 </allocfieldbuf>
10096 <description>
10097 Array of <fieldlink id="error_count" struct="jvmtiExtensionFunctionInfo"></fieldlink>
10098 possible errors
10099 </description>
10100 </field>
10101 </typedef>
10102
10103 <description>
10104 Returns the set of extension functions.
10105 </description>
10106 <origin>new</origin>
10107 <capabilities>
10108 </capabilities>
10109 <parameters>
10110 <param id="extension_count_ptr">
10111 <outptr><jint/></outptr>
10112 <description>
10113 On return, points to the number of extension functions
10114 </description>
10115 </param>
10116 <param id="extensions">
10117 <allocbuf outcount="extension_count_ptr"><struct>jvmtiExtensionFunctionInfo</struct></allocbuf>
10118 <description>
10119 Returns an array of extension function info, one per function
10120 </description>
10121 </param>
10122 </parameters>
10123 <errors>
10124 </errors>
10125 </function>
10126
10127 <function id="GetExtensionEvents" phase="onload" num="125">
10128 <synopsis>Get Extension Events</synopsis>
10129
10130 <typedef id="jvmtiExtensionEventInfo" label="Extension Event Info">
10131 <field id="extension_event_index">
10132 <jint/>
10133 <description>
10134 The identifying index of the event
10135 </description>
10136 </field>
10137 <field id="id">
10138 <allocfieldbuf><char/></allocfieldbuf>
10139 <description>
10140 The identifier for the extension event, encoded as a
10141 <internallink id="mUTF">modified UTF-8</internallink> string.
10142 Uses package name conventions.
10143 For example, <code>com.sun.hotspot.bar</code>
10144 </description>
10145 </field>
10146 <field id="short_description">
10147 <allocfieldbuf><char/></allocfieldbuf>
10148 <description>
10149 A one sentence description of the event, encoded as a
10150 <internallink id="mUTF">modified UTF-8</internallink> string.
10151 </description>
10152 </field>
10153 <field id="param_count">
10154 <jint/>
10155 <description>
10156 The number of parameters excluding <code>jvmtiEnv *jvmti_env</code>
10157 </description>
10158 </field>
10159 <field id="params">
10160 <allocfieldbuf outcount="param_count">
10161 <struct>jvmtiParamInfo</struct>
10162 </allocfieldbuf>
10163 <description>
10164 Array of
10165 <fieldlink id="param_count" struct="jvmtiExtensionEventInfo"></fieldlink>
10166 parameters (<code>jvmtiEnv *jvmti_env</code> excluded)
10167 </description>
10168 </field>
10169 </typedef>
10170
10171 <description>
10172 Returns the set of extension events.
10173 </description>
10174 <origin>new</origin>
10175 <capabilities>
10176 </capabilities>
10177 <parameters>
10178 <param id="extension_count_ptr">
10179 <outptr><jint/></outptr>
10180 <description>
10181 On return, points to the number of extension events
10182 </description>
10183 </param>
10184 <param id="extensions">
10185 <allocbuf outcount="extension_count_ptr"><struct>jvmtiExtensionEventInfo</struct></allocbuf>
10186 <description>
10187 Returns an array of extension event info, one per event
10188 </description>
10189 </param>
10190 </parameters>
10191 <errors>
10192 </errors>
10193 </function>
10194
10195 <callback id="jvmtiExtensionEvent">
10196 <void/>
10197 <synopsis>Extension Event</synopsis>
10198 <description>
10199 This is the implementation-specific event.
10200 The event handler is set with
10201 <functionlink id="SetExtensionEventCallback"/>.
10202 <p/>
10203 Event handlers for extension events must be declared varargs to match this definition.
10204 Failure to do so could result in calling convention mismatch and undefined behavior
10205 on some platforms.
10206 <p/>
10207 For example, if the <code>jvmtiParamInfo</code>
10208 returned by <functionlink id="GetExtensionEvents"/> indicates that
10209 there is a <code>jint</code> parameter, the event handler should be
10210 declared:
10211 <example>
10212 void JNICALL myHandler(jvmtiEnv* jvmti_env, ...)
10213 </example>
10214 Note the terminal "<code>...</code>" which indicates varargs.
10215 The <code>jint</code> argument inside <code>myHandler</code> needs to be extracted using
10216 the <code>va_*</code> syntax of the C programming language.
10217 </description>
10218 <parameters>
10219 <param id="jvmti_env">
10220 <outptr>
10221 <struct>jvmtiEnv</struct>
10222 </outptr>
10223 <description>
10224 The <jvmti/> environment is the only fixed parameter for extension events.
10225 </description>
10226 </param>
10227 <param id="...">
10228 <varargs/>
10229 <description>
10230 The extension event-specific parameters
10231 </description>
10232 </param>
10233 </parameters>
10234 </callback>
10235
10236 <function id="SetExtensionEventCallback" phase="onload" num="126">
10237 <synopsis>Set Extension Event Callback</synopsis>
10238
10239 <description>
10240 Sets the callback function for an extension event and
10241 enables the event. Or, if the callback is null, disables
10242 the event. Note that unlike standard events, setting
10243 the callback and enabling the event are a single operation.
10244 </description>
10245 <origin>new</origin>
10246 <capabilities>
10247 </capabilities>
10248 <parameters>
10249 <param id="extension_event_index">
10250 <jint/>
10251 <description>
10252 Identifies which callback to set.
10253 This index is the
10254 <fieldlink id="extension_event_index" struct="jvmtiExtensionEventInfo"></fieldlink>
10255 field of
10256 <datalink id="jvmtiExtensionEventInfo"/>.
10257 </description>
10258 </param>
10259 <param id="callback">
10260 <ptrtype>
10261 <struct>jvmtiExtensionEvent</struct>
10262 <nullok>disable the event</nullok>
10263 </ptrtype>
10264 <description>
10265 If <code>callback</code> is non-null,
10266 set <code>callback</code> to be the event callback function
10267 and enable the event.
10268 </description>
10269 </param>
10270 </parameters>
10271 <errors>
10272 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
10273 <paramlink id="extension_event_index"/> is not an
10274 <fieldlink id="extension_event_index"
10275 struct="jvmtiExtensionEventInfo"/>
10276 returned by
10277 <functionlink id="GetExtensionEvents"/>
10278 </error>
10279 </errors>
10280 </function>
10281
10282 </category>
10283
10284 <category id="capability" label="Capability">
10285
10286 <intro>
10287 The capabilities functions allow you to change the
10288 functionality available to <jvmti/>--that is,
10289 which <jvmti/>
10290 functions can be called, what events can be generated,
10291 and what functionality these events and functions can
10292 provide.
10293 <p/>
10294 The "Capabilities" section of each function and event describe which
10295 capabilities, if any, they are associated with. "Required Functionality"
10296 means it is available for use and no capabilities must be added to use it.
10297 "Optional Functionality" means the agent must possess the capability
10298 before it can be used.
10299 To possess a capability, the agent must
10300 <functionlink id="AddCapabilities">add the capability</functionlink>.
10301 "Optional Features" describe capabilities which,
10302 if added, extend the feature set.
10303 <p/>
10304 The potentially available capabilities of each <jvmti/> implementation are different.
10305 Depending on the implementation, a capability:
10306 <ul>
10307 <li>may never be added</li>
10308 <li>may be added in either the <code>OnLoad</code> or live phase in any environment</li>
10309 <li>may be added only during the <code>OnLoad</code> phase</li>
10310 <li>may be possessed by only one environment at a time</li>
10311 <li>may be possessed by only one environment at a time,
10312 and only during the <code>OnLoad</code> phase</li>
10313 <li>and so on ...</li>
10314 </ul>
10315 Frequently, the addition of a capability may incur a cost in execution speed, start up
10316 time, and/or memory footprint. Note that the overhead of using a capability
10317 is completely different than the overhead of possessing a capability.
10318 Take single stepping as an example. When single stepping is on (that
10319 is, when the event is enabled and thus actively sending events)
10320 the overhead of sending and processing an event
10321 on each instruction is huge in any implementation.
10322 However, the overhead of possessing the capability may be small or large,
10323 depending on the implementation. Also, when and if a capability is potentially
10324 available depends on the implementation. Some examples:
10325 <ul>
10326 <li>One VM might perform all execution by compiling bytecodes into
10327 native code and be unable to generate single step instructions.
10328 In this implementation the capability can not be added.</li>
10329 <li>Another VM may be able to switch execution to a single stepping
10330 interpreter at any time. In this implementation, having the capability has no
10331 overhead and could be added at any time.</li>
10332 <li>Yet another VM might be able to choose a bytecode compiling or single stepping capable interpreted
10333 execution engine at start up, but be unable to switch between them.
10334 In this implementation the capability would need to be added
10335 during the <code>OnLoad</code> phase (before bytecode
10336 execution begins) and would have a large impact on execution speed
10337 even if single stepping was never used.</li>
10338 <li>Still another VM might be able to add an "is single stepping on" check
10339 into compiled bytecodes or a generated interpreter. Again in this implementation
10340 the capability would need to be added during the <code>OnLoad</code> phase but the overhead (a test
10341 and branch on each instruction) would be considerably less.</li>
10342 </ul>
10343 <p/>
10344 Each <jvmti/> <internallink id="environments">environment</internallink>
10345 has its own set of capabilities.
10346 Initially, that set is empty.
10347 Any desired capability must be added.
10348 If possible, capabilities should be added during the <code>OnLoad</code> phase. For most
10349 virtual machines certain capabilities require special set up for
10350 the virtual machine and this set up must happen
10351 during the <code>OnLoad</code> phase, before the virtual machine begins execution.
10352 Once a capability is added, it can
10353 only be removed if explicitly relinquished by the environment.
10354 <p/>
10355 The agent can,
10356 <functionlink id="GetPotentialCapabilities">determine what
10357 capabilities this VM can potentially provide</functionlink>,
10358 <functionlink id="AddCapabilities">add the capabilities
10359 to be used</functionlink>,
10360 <functionlink id="RelinquishCapabilities">release capabilities
10361 which are no longer needed</functionlink>, and
10362 <functionlink id="GetCapabilities">examine the currently available
10363 capabilities</functionlink>.
10364 </intro>
10365
10366 <intro id="capabilityExamples" label="Capability Examples">
10367 For example, a freshly started agent (in the <code>OnLoad</code> function)
10368 wants to enable all possible capabilities.
10369 Note that, in general, this is not advisable as the agent may suffer
10370 a performance penalty for functionality it is not using.
10371 The code might look like this in C:
10372 <example>
10373 jvmtiCapabilities capa;
10374 jvmtiError err;
10375
10376 err = (*jvmti)->GetPotentialCapabilities(jvmti, &capa);
10377 if (err == JVMTI_ERROR_NONE) {
10378 err = (*jvmti)->AddCapabilities(jvmti, &capa);
10379 </example>
10380 For example, if an agent wants to check if it can get
10381 the bytecodes of a method (that is, it wants to check
10382 if it previously added this capability and has not
10383 relinquished it), the code might
10384 look like this in C:
10385 <example>
10386 jvmtiCapabilities capa;
10387 jvmtiError err;
10388
10389 err = (*jvmti)->GetCapabilities(jvmti, &capa);
10390 if (err == JVMTI_ERROR_NONE) {
10391 if (capa.can_get_bytecodes) { ... } }
10392 </example>
10393 </intro>
10394
10395 <capabilitiestypedef id="jvmtiCapabilities" label="The Capabilities Structure">
10396 <description>
10397 The functions in this category use this capabilities structure
10398 which contains boolean flags corresponding to each capability:
10399 </description>
10400 <capabilityfield id="can_tag_objects">
10401 <description>
10402 Can set and get tags, as described in the
10403 <internallink id="Heap">Heap category</internallink>.
10404 </description>
10405 </capabilityfield>
10406 <capabilityfield id="can_generate_field_modification_events">
10407 <description>
10408 Can set watchpoints on field modification -
10409 <functionlink id="SetFieldModificationWatch"></functionlink>
10410 </description>
10411 </capabilityfield>
10412 <capabilityfield id="can_generate_field_access_events">
10413 <description>
10414 Can set watchpoints on field access -
10415 <functionlink id="SetFieldAccessWatch"></functionlink>
10416 </description>
10417 </capabilityfield>
10418 <capabilityfield id="can_get_bytecodes">
10419 <description>
10420 Can get bytecodes of a method <functionlink id="GetBytecodes"></functionlink>
10421 </description>
10422 </capabilityfield>
10423 <capabilityfield id="can_get_synthetic_attribute">
10424 <description>
10425 Can test if a field or method is synthetic -
10426 <functionlink id="IsFieldSynthetic"></functionlink> and
10427 <functionlink id="IsMethodSynthetic"></functionlink>
10428 </description>
10429 </capabilityfield>
10430 <capabilityfield id="can_get_owned_monitor_info">
10431 <description>
10432 Can get information about ownership of monitors -
10433 <functionlink id="GetOwnedMonitorInfo"></functionlink>
10434 </description>
10435 </capabilityfield>
10436 <capabilityfield id="can_get_current_contended_monitor">
10437 <description>
10438 Can <functionlink id="GetCurrentContendedMonitor"></functionlink>
10439 </description>
10440 </capabilityfield>
10441 <capabilityfield id="can_get_monitor_info">
10442 <description>
10443 Can <functionlink id="GetObjectMonitorUsage"></functionlink>
10444 </description>
10445 </capabilityfield>
10446 <capabilityfield id="can_pop_frame">
10447 <description>
10448 Can pop frames off the stack - <functionlink id="PopFrame"></functionlink>
10449 </description>
10450 </capabilityfield>
10451 <capabilityfield id="can_redefine_classes">
10452 <description>
10453 Can redefine classes with <functionlink id="RedefineClasses"/>.
10454 </description>
10455 </capabilityfield>
10456 <capabilityfield id="can_signal_thread">
10457 <description>
10458 Can send stop or interrupt to threads
10459 </description>
10460 </capabilityfield>
10461 <capabilityfield id="can_get_source_file_name">
10462 <description>
10463 Can get the source file name of a class
10464 </description>
10465 </capabilityfield>
10466 <capabilityfield id="can_get_line_numbers">
10467 <description>
10468 Can get the line number table of a method
10469 </description>
10470 </capabilityfield>
10471 <capabilityfield id="can_get_source_debug_extension">
10472 <description>
10473 Can get the source debug extension of a class
10474 </description>
10475 </capabilityfield>
10476 <capabilityfield id="can_access_local_variables">
10477 <description>
10478 Can set and get local variables
10479 </description>
10480 </capabilityfield>
10481 <capabilityfield id="can_maintain_original_method_order">
10482 <description>
10483 Can return methods in the order they occur in the class file
10484 </description>
10485 </capabilityfield>
10486 <capabilityfield id="can_generate_single_step_events">
10487 <description>
10488 Can get <eventlink id="SingleStep">single step</eventlink> events
10489 </description>
10490 </capabilityfield>
10491 <capabilityfield id="can_generate_exception_events">
10492 <description>
10493 Can get <eventlink id="Exception">exception thrown</eventlink> and
10494 <eventlink id="ExceptionCatch">exception catch</eventlink> events
10495 </description>
10496 </capabilityfield>
10497 <capabilityfield id="can_generate_frame_pop_events">
10498 <description>
10499 Can <functionlink id="NotifyFramePop">set</functionlink> and thus get
10500 <eventlink id="FramePop"></eventlink> events
10501 </description>
10502 </capabilityfield>
10503 <capabilityfield id="can_generate_breakpoint_events">
10504 <description>
10505 Can <functionlink id="SetBreakpoint">set</functionlink> and thus get
10506 <eventlink id="Breakpoint"></eventlink> events
10507 </description>
10508 </capabilityfield>
10509 <capabilityfield id="can_suspend">
10510 <description>
10511 Can suspend and resume threads
10512 </description>
10513 </capabilityfield>
10514 <capabilityfield id="can_redefine_any_class">
10515 <description>
10516 <functionlink id="RedefineClasses"/> can be called on any modifiable class.
10517 See <functionlink id="IsModifiableClass"/>.
10518 (<fieldlink id="can_redefine_classes" struct="jvmtiCapabilities"/>
10519 must also be set)
10520 </description>
10521 </capabilityfield>
10522 <capabilityfield id="can_get_current_thread_cpu_time">
10523 <description>
10524 Can <functionlink id="GetCurrentThreadCpuTime">get</functionlink>
10525 current thread CPU time
10526 </description>
10527 </capabilityfield>
10528 <capabilityfield id="can_get_thread_cpu_time">
10529 <description>
10530 Can <functionlink id="GetThreadCpuTime">get</functionlink>
10531 thread CPU time
10532 </description>
10533 </capabilityfield>
10534 <capabilityfield id="can_generate_method_entry_events"
10535 disp1="can_generate" disp2="_method_entry_events"
10536 >
10537 <description>
10538 Can generate method entry events on entering a method
10539 </description>
10540 </capabilityfield>
10541 <capabilityfield id="can_generate_method_exit_events"
10542 disp1="can_generate" disp2="_method_exit_events"
10543 >
10544 <description>
10545 Can generate method exit events on leaving a method
10546 </description>
10547 </capabilityfield>
10548 <capabilityfield id="can_generate_all_class_hook_events"
10549 disp1="can_generate" disp2="_all_class_hook_events"
10550 >
10551 <description>
10552 Can generate ClassFileLoadHook events for every loaded class.
10553 </description>
10554 </capabilityfield>
10555 <capabilityfield id="can_generate_compiled_method_load_events"
10556 disp1="can_generate" disp2="_compiled_method_load_events"
10557 >
10558 <description>
10559 Can generate events when a method is compiled or unloaded
10560 </description>
10561 </capabilityfield>
10562 <capabilityfield id="can_generate_monitor_events"
10563 disp1="can_generate" disp2="_monitor_events"
10564 >
10565 <description>
10566 Can generate events on monitor activity
10567 </description>
10568 </capabilityfield>
10569 <capabilityfield id="can_generate_vm_object_alloc_events"
10570 disp1="can_generate" disp2="_vm_object_alloc_events"
10571 >
10572 <description>
10573 Can generate events on VM allocation of an object
10574 </description>
10575 </capabilityfield>
10576 <capabilityfield id="can_generate_native_method_bind_events"
10577 disp1="can_generate" disp2="_native_method_bind_events"
10578 >
10579 <description>
10580 Can generate events when a native method is bound to its
10581 implementation
10582 </description>
10583 </capabilityfield>
10584 <capabilityfield id="can_generate_garbage_collection_events"
10585 disp1="can_generate" disp2="_garbage_collection_events"
10586 >
10587 <description>
10588 Can generate events when garbage collection begins or ends
10589 </description>
10590 </capabilityfield>
10591 <capabilityfield id="can_generate_object_free_events"
10592 disp1="can_generate" disp2="_object_free_events"
10593 >
10594 <description>
10595 Can generate events when the garbage collector frees an object
10596 </description>
10597 </capabilityfield>
10598 <capabilityfield id="can_force_early_return" since="1.1">
10599 <description>
10600 Can return early from a method, as described in the
10601 <internallink id="ForceEarlyReturn">Force Early Return category</internallink>.
10602 </description>
10603 </capabilityfield>
10604 <capabilityfield id="can_get_owned_monitor_stack_depth_info" since="1.1">
10605 <description>
10606 Can get information about owned monitors with stack depth -
10607 <functionlink id="GetOwnedMonitorStackDepthInfo"></functionlink>
10608 </description>
10609 </capabilityfield>
10610 <capabilityfield id="can_get_constant_pool" since="1.1">
10611 <description>
10612 Can get the constant pool of a class -
10613 <functionlink id="GetConstantPool"></functionlink>
10614 </description>
10615 </capabilityfield>
10616 <capabilityfield id="can_set_native_method_prefix" since="1.1">
10617 <description>
10618 Can set prefix to be applied when native method cannot be resolved -
10619 <functionlink id="SetNativeMethodPrefix"/> and
10620 <functionlink id="SetNativeMethodPrefixes"/>
10621 </description>
10622 </capabilityfield>
10623 <capabilityfield id="can_retransform_classes" since="1.1">
10624 <description>
10625 Can retransform classes with <functionlink id="RetransformClasses"/>.
10626 In addition to the restrictions imposed by the specific
10627 implementation on this capability (see the
10628 <internallink id="capability">Capability</internallink> section),
10629 this capability must be set before the
10630 <eventlink id="ClassFileLoadHook"/> event is enabled for the
10631 first time in this environment.
10632 An environment that possesses this capability at the time that
10633 <code>ClassFileLoadHook</code> is enabled for the first time is
10634 said to be <i>retransformation capable</i>.
10635 An environment that does not possess this capability at the time that
10636 <code>ClassFileLoadHook</code> is enabled for the first time is
10637 said to be <i>retransformation incapable</i>.
10638 </description>
10639 </capabilityfield>
10640 <capabilityfield id="can_retransform_any_class" since="1.1">
10641 <description>
10642 <functionlink id="RetransformClasses"/> can be called on any modifiable class.
10643 See <functionlink id="IsModifiableClass"/>.
10644 (<fieldlink id="can_retransform_classes" struct="jvmtiCapabilities"/>
10645 must also be set)
10646 </description>
10647 </capabilityfield>
10648 <capabilityfield id="can_generate_resource_exhaustion_heap_events" since="1.1">
10649 <description>
10650 Can generate events when the VM is unable to allocate memory from
10651 the <tm>Java</tm> platform heap.
10652 See <eventlink id="ResourceExhausted"/>.
10653 </description>
10654 </capabilityfield>
10655 <capabilityfield id="can_generate_resource_exhaustion_threads_events" since="1.1">
10656 <description>
10657 Can generate events when the VM is unable to create a thread.
10658 See <eventlink id="ResourceExhausted"/>.
10659 </description>
10660 </capabilityfield>
10661 <capabilityfield id="can_generate_early_vmstart" since="9">
10662 <description>
10663 Can generate the <code>VMStart</code> event early.
10664 See <eventlink id="VMStart"/>.
10665 </description>
10666 </capabilityfield>
10667 <capabilityfield id="can_generate_early_class_hook_events" since="9">
10668 <description>
10669 Can generate the <eventlink id="ClassFileLoadHook"/> events
10670 in the primordial phase. If this capability and
10671 <internallink id="jvmtiCapabilities.can_generate_all_class_hook_events">
10672 <code>can_generate_all_class_hook_events</code></internallink>
10673 are enabled then the <eventlink id="ClassFileLoadHook"/> events
10674 can be posted for classes loaded in the primordial phase.
10675 See <eventlink id="ClassFileLoadHook"/>.
10676 </description>
10677 </capabilityfield>
10678 <capabilityfield id="can_generate_sampled_object_alloc_events" since="11">
10679 <description>
10680 Can generate sampled allocation events.
10681 If this capability is enabled then the heap sampling method
10682 <functionlink id="SetHeapSamplingInterval"></functionlink> can be
10683 called and <eventlink id="SampledObjectAlloc"></eventlink> events can be generated.
10684 </description>
10685 </capabilityfield>
10686 <capabilityfield id="can_support_virtual_threads" since="21">
10687 <description>
10688 Can support virtual threads.
10689 If this capability is enabled then the following functions can be called:
10690 <functionlink id="SuspendAllVirtualThreads"></functionlink>,
10691 <functionlink id="ResumeAllVirtualThreads"></functionlink>,
10692 and the following events can be enabled:
10693 <eventlink id="VirtualThreadStart"></eventlink>,
10694 <eventlink id="VirtualThreadEnd"></eventlink>.
10695 </description>
10696 </capabilityfield>
10697 </capabilitiestypedef>
10698
10699 <function id="GetPotentialCapabilities" jkernel="yes" phase="onload" num="140">
10700 <synopsis>Get Potential Capabilities</synopsis>
10701 <description>
10702 Returns via <paramlink id="capabilities_ptr"></paramlink> the <jvmti/>
10703 features that can potentially be possessed by this environment
10704 at this time.
10705 The returned capabilities differ from the complete set of capabilities
10706 implemented by the VM in two cases: another environment possesses
10707 capabilities that can only be possessed by one environment, or the
10708 current <functionlink id="GetPhase">phase</functionlink> is live,
10709 and certain capabilities can only be added during the <code>OnLoad</code> phase.
10710 The <functionlink id="AddCapabilities"></functionlink> function
10711 may be used to set any or all or these capabilities.
10712 Currently possessed capabilities are included.
10713 <p/>
10714 Typically this function is used in the <code>OnLoad</code> function.
10715 Some virtual machines may allow a limited set of capabilities to be
10716 added in the live phase.
10717 In this case, the set of potentially available capabilities
10718 will likely differ from the <code>OnLoad</code> phase set.
10719 <p/>
10720 See the
10721 <internallink id="capabilityExamples">Capability Examples</internallink>.
10722 </description>
10723 <origin>new</origin>
10724 <capabilities>
10725 </capabilities>
10726 <parameters>
10727 <param id="capabilities_ptr">
10728 <outptr><struct>jvmtiCapabilities</struct></outptr>
10729 <description>
10730 On return, points to the <jvmti/> capabilities that may be added.
10731 </description>
10732 </param>
10733 </parameters>
10734 <errors>
10735 </errors>
10736 </function>
10737
10738 <elide>
10739 <function id="EstimateCostOfCapabilities" phase="onload" num="141">
10740 <synopsis>Estimate Cost Of Capabilities</synopsis>
10741 <description>
10742 <issue>There is strong opposition to this function. The concern is
10743 that it would be difficult or impossible to provide meaningful
10744 numbers, as the amount of impact is conditional on many factors
10745 that a single number could not represent. There is doubt that
10746 conditional implementations would be used or are even a good idea.
10747 The thought is that release documentation for the implementation
10748 would be the best means of exposing this information.
10749 Unless new arguments are presented, I intend to remove this
10750 function in the next revision.
10751 </issue>
10752 <p/>
10753 Return via the <paramlink id="time_impact_ptr"></paramlink> and
10754 <paramlink id="space_impact_ptr"></paramlink> an estimate of the impact
10755 of adding the capabilities pointed to by
10756 <paramlink id="capabilities_ptr"></paramlink>.
10757 The returned estimates are in percentage of additional overhead, thus
10758 a time impact of 100 mean the application might run
10759 at half the speed.
10760 The estimates are very rough approximations and are not guaranteed.
10761 Note also, that the estimates are of the impact of having the
10762 capability available--when and if it is used the impact may be
10763 much greater.
10764 Estimates can be for a single capability or for a set of
10765 capabilities. Note that the costs are not necessarily additive,
10766 adding support for one capability might make another available
10767 for free or conversely having two capabilities at once may
10768 have multiplicative impact.
10769 Estimates are relative to the current set of capabilities -
10770 that is, how much more impact given the currently possessed capabilities.
10771 <p/>
10772 Typically this function is used in the OnLoad function,
10773 some virtual machines may allow a limited set of capabilities to be
10774 added in the live phase.
10775 In this case, the set of potentially available capabilities
10776 will likely differ from the OnLoad phase set.
10777 <p/>
10778 See the
10779 <internallink id="capabilityExamples">Capability Examples</internallink>.
10780 </description>
10781 <origin>new</origin>
10782 <capabilities>
10783 </capabilities>
10784 <parameters>
10785 <param id="capabilities_ptr">
10786 <inptr><struct>jvmtiCapabilities</struct></inptr>
10787 <description>
10788 points to the <jvmti/> capabilities to evaluate.
10789 </description>
10790 </param>
10791 <param id="time_impact_ptr">
10792 <outptr><jint/></outptr>
10793 <description>
10794 On return, points to the estimated percentage increase in
10795 run time if this capability was added.
10796 </description>
10797 </param>
10798 <param id="space_impact_ptr">
10799 <outptr><jint/></outptr>
10800 <description>
10801 On return, points to the estimated percentage increase in
10802 memory space used if this capability was added.
10803 </description>
10804 </param>
10805 </parameters>
10806 <errors>
10807 <error id="JVMTI_ERROR_NOT_AVAILABLE">
10808 The desired capabilities are not even potentially available.
10809 </error>
10810 </errors>
10811 </function>
10812 </elide>
10813
10814 <function id="AddCapabilities" jkernel="yes" phase="onload" num="142">
10815 <synopsis>Add Capabilities</synopsis>
10816 <description>
10817 Set new capabilities by adding the capabilities
10818 whose values are set to one (<code>1</code>) in
10819 <code>*</code><paramlink id="capabilities_ptr"></paramlink>.
10820 All previous capabilities are retained.
10821 Typically this function is used in the <code>OnLoad</code> function.
10822 Some virtual machines may allow a limited set of capabilities to be
10823 added in the live phase.
10824 <p/>
10825 See the
10826 <internallink id="capabilityExamples">Capability Examples</internallink>.
10827 </description>
10828 <origin>new</origin>
10829 <capabilities>
10830 </capabilities>
10831 <parameters>
10832 <param id="capabilities_ptr">
10833 <inptr><struct>jvmtiCapabilities</struct></inptr>
10834 <description>
10835 Points to the <jvmti/> capabilities to add.
10836 </description>
10837 </param>
10838 </parameters>
10839 <errors>
10840 <error id="JVMTI_ERROR_NOT_AVAILABLE">
10841 The desired capabilities are not even potentially available.
10842 </error>
10843 </errors>
10844 </function>
10845
10846
10847 <function id="RelinquishCapabilities" phase="onload" num="143">
10848 <synopsis>Relinquish Capabilities</synopsis>
10849 <description>
10850 Relinquish the capabilities
10851 whose values are set to one (<code>1</code>) in
10852 <code>*</code><paramlink id="capabilities_ptr"></paramlink>.
10853 Some implementations may allow only one environment to have a capability
10854 (see the <internallink id="capability">capability introduction</internallink>).
10855 This function releases capabilities
10856 so that they may be used by other agents.
10857 All other capabilities are retained.
10858 The capability will no longer be present in <functionlink id="GetCapabilities"></functionlink>.
10859 Attempting to relinquish a capability that the agent does not possess is not an error.
10860 <issue>
10861 It is possible for the agent to be actively using capabilities
10862 which are being relinquished. For example, a thread is currently
10863 suspended and can_suspend is being relinquished or an event is currently
10864 enabled and can_generate_whatever is being relinquished.
10865 There are three possible ways we could spec this:
10866 <ul>
10867 <li>relinquish automatically releases them</li>
10868 <li>relinquish checks and returns some error code if held</li>
10869 <li>it is the agent's responsibility and it is not checked</li>
10870 </ul>
10871 One of these should be chosen.
10872 </issue>
10873 </description>
10874 <origin>new</origin>
10875 <capabilities>
10876 </capabilities>
10877 <parameters>
10878 <param id="capabilities_ptr">
10879 <inptr><struct>jvmtiCapabilities</struct></inptr>
10880 <description>
10881 Points to the <jvmti/> capabilities to relinquish.
10882 </description>
10883 </param>
10884 </parameters>
10885 <errors>
10886 </errors>
10887 </function>
10888
10889
10890
10891 <function id="GetCapabilities" jkernel="yes" phase="any" num="89">
10892 <synopsis>Get Capabilities</synopsis>
10893 <description>
10894 Returns via <paramlink id="capabilities_ptr"></paramlink> the optional <jvmti/>
10895 features which this environment currently possesses.
10896 Each possessed capability is indicated by a one (<code>1</code>) in the
10897 corresponding field of the <internallink id="jvmtiCapabilities">capabilities
10898 structure</internallink>.
10899 An environment does not possess a capability unless it has been successfully added with
10900 <functionlink id="AddCapabilities"/>.
10901 An environment only loses possession of a capability if it has been relinquished with
10902 <functionlink id="RelinquishCapabilities"/>. Thus, this function returns the net result
10903 of the <code>AddCapabilities</code> and <code>RelinquishCapabilities</code> calls which
10904 have been made.
10905 <p/>
10906 See the
10907 <internallink id="capabilityExamples">Capability Examples</internallink>.
10908 </description>
10909 <origin>jvmdiClone</origin>
10910 <capabilities>
10911 </capabilities>
10912 <parameters>
10913 <param id="capabilities_ptr">
10914 <outptr><struct>jvmtiCapabilities</struct></outptr>
10915 <description>
10916 On return, points to the <jvmti/> capabilities.
10917 </description>
10918 </param>
10919 </parameters>
10920 <errors>
10921 </errors>
10922 </function>
10923
10924 </category>
10925
10926
10927 <category id="timers" label="Timers">
10928
10929 <intro>
10930 These functions provide timing information.
10931 The resolution at which the time is updated is not specified.
10932 They provides nanosecond precision, but not necessarily nanosecond accuracy.
10933 Details about the timers, such as their maximum values, can be accessed with
10934 the timer information functions.
10935 </intro>
10936
10937 <typedef id="jvmtiTimerInfo" label="Timer Info">
10938 <description>
10939 The information function for each timer returns this data structure.
10940 </description>
10941 <field id="max_value">
10942 <jlong/>
10943 <description>
10944 The maximum value the timer can reach.
10945 After this value is reached the timer wraps back to zero.
10946 This is an unsigned value. If tested or printed as a jlong (signed value)
10947 it may appear to be a negative number.
10948 </description>
10949 </field>
10950 <field id="may_skip_forward">
10951 <jboolean/>
10952 <description>
10953 If true, the timer can be externally adjusted and as a result skip forward.
10954 If false, the timer value will never increase faster than real time.
10955 </description>
10956 </field>
10957 <field id="may_skip_backward">
10958 <jboolean/>
10959 <description>
10960 If true, the timer can be externally adjusted and as a result skip backward.
10961 If false, the timer value will be monotonically increasing.
10962 </description>
10963 </field>
10964 <field id="kind">
10965 <enum>jvmtiTimerKind</enum>
10966 <description>
10967 The kind of timer.
10968 On a platform that does not distinguish between user and system time, <datalink
10969 id="JVMTI_TIMER_TOTAL_CPU"><code>JVMTI_TIMER_TOTAL_CPU</code></datalink>
10970 is returned.
10971 </description>
10972 </field>
10973 <field id="reserved1">
10974 <jlong/>
10975 <description>
10976 Reserved for future use.
10977 </description>
10978 </field>
10979 <field id="reserved2">
10980 <jlong/>
10981 <description>
10982 Reserved for future use.
10983 </description>
10984 </field>
10985 </typedef>
10986
10987 <intro>
10988 Where the timer kind is --
10989
10990 <constants id="jvmtiTimerKind" label="Timer Kinds" kind="enum">
10991 <constant id="JVMTI_TIMER_USER_CPU" num="30">
10992 CPU time that a thread is in user mode.
10993 </constant>
10994 <constant id="JVMTI_TIMER_TOTAL_CPU" num="31">
10995 CPU time that a thread is in user or system mode.
10996 </constant>
10997 <constant id="JVMTI_TIMER_ELAPSED" num="32">
10998 Elapsed time.
10999 </constant>
11000 </constants>
11001 </intro>
11002
11003 <function id="GetCurrentThreadCpuTimerInfo" callbacksafe="safe" impl="innative notrace" phase="start" num="134">
11004 <synopsis>Get Current Thread CPU Timer Information</synopsis>
11005 <description>
11006 Get information about the
11007 <functionlink id="GetCurrentThreadCpuTime"/> timer.
11008 The fields of the <datalink id="jvmtiTimerInfo"/> structure
11009 are filled in with details about the timer.
11010 This information is specific to the platform and the implementation of
11011 <functionlink id="GetCurrentThreadCpuTime"/> and thus
11012 does not vary by thread nor does it vary
11013 during a particular invocation of the VM.
11014 <p/>
11015 Note that the implementations of <functionlink id="GetCurrentThreadCpuTime"/>
11016 and <functionlink id="GetThreadCpuTime"/> may differ, and thus the values
11017 returned by <code>GetCurrentThreadCpuTimerInfo</code>
11018 and <functionlink id="GetThreadCpuTimerInfo"/>
11019 may differ -- see <functionlink id="GetCurrentThreadCpuTime"/> for more information.
11020 </description>
11021 <origin>new</origin>
11022 <capabilities>
11023 <required id="can_get_current_thread_cpu_time">
11024 Can get current thread CPU time.
11025 </required>
11026 </capabilities>
11027 <parameters>
11028 <param id="info_ptr">
11029 <outptr><struct>jvmtiTimerInfo</struct></outptr>
11030 <description>
11031 On return, filled with information describing the time
11032 returned by <functionlink id="GetCurrentThreadCpuTime"/>.
11033 </description>
11034 </param>
11035 </parameters>
11036 <errors>
11037 </errors>
11038 </function>
11039
11040 <function id="GetCurrentThreadCpuTime" callbacksafe="safe" impl="innative notrace" phase="start" num="135">
11041 <synopsis>Get Current Thread CPU Time</synopsis>
11042 <description>
11043 Return the CPU time utilized by the current thread.
11044 <p/>
11045 Note that the <functionlink id="GetThreadCpuTime"/>
11046 function provides CPU time for any thread, including
11047 the current thread. <code>GetCurrentThreadCpuTime</code>
11048 exists to support platforms which cannot
11049 supply CPU time for threads other than the current
11050 thread or which have more accurate information for
11051 the current thread (see
11052 <functionlink id="GetCurrentThreadCpuTimerInfo"/> vs
11053 <functionlink id="GetThreadCpuTimerInfo"/>).
11054 An implementation is not required to support this function
11055 when the current thread is a virtual thread, in which case
11056 <errorlink id="JVMTI_ERROR_UNSUPPORTED_OPERATION"></errorlink> will be returned.
11057 On many platforms this call will be equivalent to:
11058 <example>
11059 GetThreadCpuTime(env, NULL, nanos_ptr)
11060 </example>
11061 </description>
11062 <origin>new</origin>
11063 <capabilities>
11064 <required id="can_get_current_thread_cpu_time">
11065 Can get current thread CPU time.
11066 <p/>
11067 If this capability is enabled after threads have started,
11068 the implementation may choose any time up
11069 to and including the time that the capability is enabled
11070 as the point where CPU time collection starts.
11071 <p/>
11072 This capability must be potentially available on any
11073 platform where
11074 <internallink id="jvmtiCapabilities.can_get_thread_cpu_time"><code>can_get_thread_cpu_time</code></internallink>
11075 is potentially available.
11076 </required>
11077 </capabilities>
11078 <parameters>
11079 <param id="nanos_ptr">
11080 <outptr><jlong/></outptr>
11081 <description>
11082 On return, points to the CPU time used by this thread
11083 in nanoseconds.
11084 This is an unsigned value. If tested or printed as a jlong (signed value)
11085 it may appear to be a negative number.
11086 </description>
11087 </param>
11088 </parameters>
11089 <errors>
11090 <error id="JVMTI_ERROR_UNSUPPORTED_OPERATION">
11091 The current thread is a virtual thread and the implementation does not support
11092 getting the current thread CPU time when the current thread is a virtual thread.
11093 </error>
11094 </errors>
11095 </function>
11096
11097 <function id="GetThreadCpuTimerInfo" num="136">
11098 <synopsis>Get Thread CPU Timer Information</synopsis>
11099 <description>
11100 Get information about the
11101 <functionlink id="GetThreadCpuTime"/> timer.
11102 The fields of the <datalink id="jvmtiTimerInfo"/> structure
11103 are filled in with details about the timer.
11104 This information is specific to the platform and the implementation of
11105 <functionlink id="GetThreadCpuTime"/> and thus
11106 does not vary by thread nor does it vary
11107 during a particular invocation of the VM.
11108 <p/>
11109 Note that the implementations of <functionlink id="GetCurrentThreadCpuTime"/>
11110 and <functionlink id="GetThreadCpuTime"/> may differ, and thus the values
11111 returned by <functionlink id="GetCurrentThreadCpuTimerInfo"/>
11112 and <code>GetThreadCpuTimerInfo</code>
11113 may differ -- see <functionlink id="GetCurrentThreadCpuTime"/> for more information.
11114 </description>
11115 <origin>new</origin>
11116 <capabilities>
11117 <required id="can_get_thread_cpu_time">
11118 Can get thread CPU time.
11119 </required>
11120 </capabilities>
11121 <parameters>
11122 <param id="info_ptr">
11123 <outptr><struct>jvmtiTimerInfo</struct></outptr>
11124 <description>
11125 On return, filled with information describing the time
11126 returned by <functionlink id="GetThreadCpuTime"/>.
11127 </description>
11128 </param>
11129 </parameters>
11130 <errors>
11131 </errors>
11132 </function>
11133
11134 <function id="GetThreadCpuTime" num="137">
11135 <synopsis>Get Thread CPU Time</synopsis>
11136 <description>
11137 Return the CPU time utilized by the specified thread.
11138 <p/>
11139 Get information about this timer with
11140 <functionlink id="GetThreadCpuTimerInfo"/>.
11141 </description>
11142 <origin>new</origin>
11143 <capabilities>
11144 <required id="can_get_thread_cpu_time">
11145 Can get thread CPU time.
11146 <p/>
11147 If this capability is enabled after threads have started,
11148 the implementation may choose any time up
11149 to and including the time that the capability is enabled
11150 as the point where CPU time collection starts.
11151 </required>
11152 </capabilities>
11153 <parameters>
11154 <param id="thread">
11155 <jthread null="current" impl="noconvert"/>
11156 <description>
11157 The thread to query.
11158 An implementation is not required to support this function
11159 when the given thread is a virtual thread, in which case
11160 <errorlink id="JVMTI_ERROR_UNSUPPORTED_OPERATION"></errorlink> will be returned.
11161 </description>
11162 </param>
11163 <param id="nanos_ptr">
11164 <outptr impl="nonullcheck"><jlong/></outptr>
11165 <description>
11166 On return, points to the CPU time used by the specified thread
11167 in nanoseconds.
11168 This is an unsigned value. If tested or printed as a jlong (signed value)
11169 it may appear to be a negative number.
11170 </description>
11171 </param>
11172 </parameters>
11173 <errors>
11174 <error id="JVMTI_ERROR_UNSUPPORTED_OPERATION">
11175 <paramlink id="thread"/> is a virtual thread and the implementation does not
11176 support getting the thread CPU time of a virtual thread.
11177 </error>
11178 </errors>
11179 </function>
11180
11181 <function id="GetTimerInfo" phase="any" callbacksafe="safe" num="138">
11182 <synopsis>Get Timer Information</synopsis>
11183 <description>
11184 Get information about the
11185 <functionlink id="GetTime"/> timer.
11186 The fields of the <datalink id="jvmtiTimerInfo"/> structure
11187 are filled in with details about the timer.
11188 This information will not change during a particular invocation of the VM.
11189 </description>
11190 <origin>new</origin>
11191 <capabilities>
11192 </capabilities>
11193 <parameters>
11194 <param id="info_ptr">
11195 <outptr><struct>jvmtiTimerInfo</struct></outptr>
11196 <description>
11197 On return, filled with information describing the time
11198 returned by <functionlink id="GetTime"/>.
11199 </description>
11200 </param>
11201 </parameters>
11202 <errors>
11203 </errors>
11204 </function>
11205
11206 <function id="GetTime" phase="any" callbacksafe="safe" num="139">
11207 <synopsis>Get Time</synopsis>
11208 <description>
11209 Return the current value of the system timer, in nanoseconds.
11210 <p/>
11211 The value returned represents nanoseconds since some fixed but
11212 arbitrary time (perhaps in the future, so values may be
11213 negative). This function provides nanosecond precision, but not
11214 necessarily nanosecond accuracy. No guarantees are made about
11215 how frequently values change.
11216 <p/>
11217 Get information about this timer with
11218 <functionlink id="GetTimerInfo"/>.
11219 </description>
11220 <origin>new</origin>
11221 <capabilities>
11222 </capabilities>
11223 <parameters>
11224 <param id="nanos_ptr">
11225 <outptr><jlong/></outptr>
11226 <description>
11227 On return, points to the time in nanoseconds.
11228 This is an unsigned value. If tested or printed as a jlong (signed value)
11229 it may appear to be a negative number.
11230 </description>
11231 </param>
11232 </parameters>
11233 <errors>
11234 </errors>
11235 </function>
11236
11237 <function id="GetAvailableProcessors" phase="any" num="144">
11238 <synopsis>Get Available Processors</synopsis>
11239 <description>
11240 Returns the number of processors available to the Java virtual machine.
11241 <p/>
11242 This value may change during a particular invocation of the virtual machine.
11243 Applications that are sensitive to the number of available processors should
11244 therefore occasionally poll this property.
11245 </description>
11246 <origin>new</origin>
11247 <capabilities>
11248 </capabilities>
11249 <parameters>
11250 <param id="processor_count_ptr">
11251 <outptr><jint/></outptr>
11252 <description>
11253 On return, points to the maximum number of processors available to the
11254 virtual machine; never smaller than one.
11255 </description>
11256 </param>
11257 </parameters>
11258 <errors>
11259 </errors>
11260 </function>
11261
11262 </category>
11263
11264
11265 <category id="classLoaderSearch" label="Class Loader Search">
11266
11267 <intro>
11268 These functions allow the agent to add to the locations that a class loader searches for a class.
11269 This is useful for installing instrumentation under the correct class loader.
11270 </intro>
11271
11272 <function id="AddToBootstrapClassLoaderSearch" jkernel="yes" phase="onload" num="149">
11273 <synopsis>Add To Bootstrap Class Loader Search</synopsis>
11274 <description>
11275 This function can be used to cause instrumentation classes to be defined by the
11276 bootstrap class loader. See <vmspec chapter="5.3.1"/>.
11277 After the bootstrap
11278 class loader unsuccessfully searches for a class, the specified platform-dependent
11279 search path <paramlink id="segment"/> will be searched as well. Only one segment may be specified in
11280 the <paramlink id="segment"/>. This function may be called multiple times to add multiple segments,
11281 the segments will be searched in the order that this function was called.
11282 <p/>
11283 In the <code>OnLoad</code> phase the function may be used to specify any platform-dependent
11284 search path segment to be searched after the bootstrap class loader unsuccessfully searches
11285 for a class. The segment is typically a directory or JAR file.
11286 <p/>
11287 In the live phase the <paramlink id="segment"/> may be used to specify any platform-dependent
11288 path to a <externallink id="jar/jar.html">
11289 JAR file</externallink>. The agent should take care that the JAR file does not
11290 contain any classes or resources other than those to be defined by the bootstrap
11291 class loader for the purposes of instrumentation.
11292 <p/>
11293 <vmspec/> specifies that a subsequent attempt to resolve a symbolic
11294 reference that the Java virtual machine has previously unsuccessfully attempted
11295 to resolve always fails with the same error that was thrown as a result of the
11296 initial resolution attempt. Consequently, if the JAR file contains an entry
11297 that corresponds to a class for which the Java virtual machine has
11298 unsuccessfully attempted to resolve a reference, then subsequent attempts to
11299 resolve that reference will fail with the same error as the initial attempt.
11300 </description>
11301 <origin>new</origin>
11302 <capabilities>
11303 </capabilities>
11304 <parameters>
11305 <param id="segment">
11306 <inbuf><char/></inbuf>
11307 <description>
11308 The platform-dependent search path segment, encoded as a
11309 <internallink id="mUTF">modified UTF-8</internallink> string.
11310 </description>
11311 </param>
11312 </parameters>
11313 <errors>
11314 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
11315 <paramlink id="segment"/> is an invalid path. In the live phase, anything other than an
11316 existing JAR file is an invalid path.
11317 </error>
11318 </errors>
11319 </function>
11320
11321 <function id="AddToSystemClassLoaderSearch" jkernel="yes" phase="onload" num="151" since="1.1">
11322 <synopsis>Add To System Class Loader Search</synopsis>
11323 <description>
11324 This function can be used to cause instrumentation classes to be
11325 defined by the system class loader. See <vmspec chapter="5.3.2"/>.
11326 After the class loader unsuccessfully searches for a class, the specified platform-dependent search
11327 path <paramlink id="segment"/> will be searched as well. Only one segment may be specified in the
11328 <paramlink id="segment"/>. This function may be called multiple times to add multiple segments, the
11329 segments will be searched in the order that this function was called.
11330 <p/>
11331 In the <code>OnLoad</code> phase the function may be used to specify any platform-dependent
11332 search path segment to be searched after the system class loader unsuccessfully searches
11333 for a class. The segment is typically a directory or JAR file.
11334 <p/>
11335 In the live phase the <paramlink id="segment"/> is a platform-dependent path to a
11336 <externallink id="jar/jar.html">JAR file</externallink> to be
11337 searched after the system class loader unsuccessfully searches for a class. The agent should
11338 take care that the JAR file does not contain any classes or resources other than those to be
11339 defined by the system class loader for the purposes of instrumentation.
11340 <p/>
11341 In the live phase the system class loader supports adding a JAR file to be searched if
11342 the system class loader implements a method name <code>appendToClassPathForInstrumentation</code>
11343 which takes a single parameter of type <code>java.lang.String</code>. The method is not required
11344 to have <code>public</code> access.
11345 <p/>
11346 <vmspec/> specifies that a subsequent attempt to resolve a symbolic
11347 reference that the Java virtual machine has previously unsuccessfully attempted
11348 to resolve always fails with the same error that was thrown as a result of the
11349 initial resolution attempt. Consequently, if the JAR file contains an entry
11350 that corresponds to a class for which the Java virtual machine has
11351 unsuccessfully attempted to resolve a reference, then subsequent attempts to
11352 resolve that reference will fail with the same error as the initial attempt.
11353 </description>
11354 <origin>new</origin>
11355 <capabilities>
11356 </capabilities>
11357 <parameters>
11358 <param id="segment">
11359 <inbuf><char/></inbuf>
11360 <description>
11361 The platform-dependent search path segment, encoded as a
11362 <internallink id="mUTF">modified UTF-8</internallink> string.
11363 </description>
11364 </param>
11365 </parameters>
11366 <errors>
11367 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
11368 <paramlink id="segment"/> is an invalid path. In the live phase, anything other than an
11369 existing JAR file is an invalid path.
11370 </error>
11371 <error id="JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED">
11372 Operation not supported by the system class loader.
11373 </error>
11374 </errors>
11375 </function>
11376
11377 </category>
11378
11379
11380 <category id="props" label="System Properties">
11381
11382 <intro>
11383 These functions get and set system properties.
11384 </intro>
11385
11386 <function id="GetSystemProperties" phase="onload" num="130">
11387 <synopsis>Get System Properties</synopsis>
11388 <description>
11389 The list of VM system property keys which may be used with
11390 <functionlink id="GetSystemProperty"/> is returned.
11391 It is strongly recommended that virtual machines provide the
11392 following property keys:
11393 <ul>
11394 <li><code>java.vm.vendor</code></li>
11395 <li><code>java.vm.version</code></li>
11396 <li><code>java.vm.name</code></li>
11397 <li><code>java.vm.info</code></li>
11398 <li><code>java.library.path</code></li>
11399 <li><code>java.class.path</code></li>
11400 </ul>
11401 Provides access to system properties defined by and used
11402 by the VM.
11403 Properties set on the command-line are included.
11404 This allows getting and setting of these properties
11405 before the VM even begins executing bytecodes.
11406 Since this is a VM view of system properties, the set of available
11407 properties will usually be different than that
11408 in <code>java.lang.System.getProperties</code>.
11409 JNI method invocation may be used to access
11410 <code>java.lang.System.getProperties</code>.
11411 <p/>
11412 The set of properties may grow during execution.
11413 </description>
11414 <origin>new</origin>
11415 <capabilities>
11416 </capabilities>
11417 <parameters>
11418 <param id="count_ptr">
11419 <outptr><jint/></outptr>
11420 <description>
11421 On return, points to the number of property keys returned.
11422 </description>
11423 </param>
11424 <param id="property_ptr">
11425 <allocallocbuf outcount="count_ptr"><char/></allocallocbuf>
11426 <description>
11427 On return, points to an array of property keys, encoded as
11428 <internallink id="mUTF">modified UTF-8</internallink> strings.
11429 </description>
11430 </param>
11431 </parameters>
11432 <errors>
11433 </errors>
11434 </function>
11435
11436 <function id="GetSystemProperty" phase="onload" num="131">
11437 <synopsis>Get System Property</synopsis>
11438 <description>
11439 Return a VM system property value given the property key.
11440 <p/>
11441 The function <functionlink id="GetSystemProperties"/>
11442 returns the set of property keys which may be used.
11443 The properties which can be retrieved may grow during
11444 execution.
11445 <p/>
11446 Since this is a VM view of system properties, the values
11447 of properties may differ from that returned by
11448 <code>java.lang.System.getProperty(String)</code>.
11449 A typical VM might copy the values of the VM system
11450 properties into the <code>Properties</code> held by
11451 <code>java.lang.System</code> during the initialization
11452 of that class. Thereafter any changes to the VM system
11453 properties (with <functionlink id="SetSystemProperty"/>)
11454 or the <code>java.lang.System</code> system properties
11455 (with <code>java.lang.System.setProperty(String,String)</code>)
11456 would cause the values to diverge.
11457 JNI method invocation may be used to access
11458 <code>java.lang.System.getProperty(String)</code>.
11459 </description>
11460 <origin>new</origin>
11461 <capabilities>
11462 </capabilities>
11463 <parameters>
11464 <param id="property">
11465 <inbuf><char/></inbuf>
11466 <description>
11467 The key of the property to retrieve, encoded as a
11468 <internallink id="mUTF">modified UTF-8</internallink> string.
11469 </description>
11470 </param>
11471 <param id="value_ptr">
11472 <allocbuf><char/></allocbuf>
11473 <description>
11474 On return, points to the property value, encoded as a
11475 <internallink id="mUTF">modified UTF-8</internallink> string.
11476 </description>
11477 </param>
11478 </parameters>
11479 <errors>
11480 <error id="JVMTI_ERROR_NOT_AVAILABLE">
11481 This property is not available.
11482 Use <functionlink id="GetSystemProperties"/> to find available properties.
11483 </error>
11484 </errors>
11485 </function>
11486
11487 <function id="SetSystemProperty" phase="onloadOnly" num="132">
11488 <synopsis>Set System Property</synopsis>
11489 <description>
11490 Set a VM system property value.
11491 <p/>
11492 The function <functionlink id="GetSystemProperties"/>
11493 returns the set of property keys, some of these may be settable.
11494 See <functionlink id="GetSystemProperty"/>.
11495 </description>
11496 <origin>new</origin>
11497 <capabilities>
11498 </capabilities>
11499 <parameters>
11500 <param id="property">
11501 <inbuf><char/></inbuf>
11502 <description>
11503 The key of the property, encoded as a
11504 <internallink id="mUTF">modified UTF-8</internallink> string.
11505 </description>
11506 </param>
11507 <param id="value_ptr">
11508 <inbuf>
11509 <char/>
11510 <nullok>
11511 do not set the value, but return <errorlink id="JVMTI_ERROR_NOT_AVAILABLE"/>
11512 if the property is not writeable
11513 </nullok>
11514 </inbuf>
11515 <description>
11516 The property value to set, encoded as a
11517 <internallink id="mUTF">modified UTF-8</internallink> string.
11518 </description>
11519 </param>
11520 </parameters>
11521 <errors>
11522 <error id="JVMTI_ERROR_NOT_AVAILABLE">
11523 This property is not available or is not writeable.
11524 </error>
11525 </errors>
11526 </function>
11527
11528 </category>
11529
11530 <category id="general" label="General">
11531
11532 <intro>
11533 </intro>
11534
11535 <function id="GetPhase" jkernel="yes" phase="any" num="133">
11536 <synopsis>Get Phase</synopsis>
11537 <description>
11538 Return the current phase of VM execution.
11539 The phases proceed in sequence:
11540 <constants id="jvmtiPhase" label="Phases of execution" kind="enum">
11541 <constant id="JVMTI_PHASE_ONLOAD" num="1">
11542 <code>OnLoad</code> phase: while in the
11543 <internallink id="onload"><code>Agent_OnLoad</code></internallink>
11544 or, for statically linked agents, the <internallink id="onload">
11545 <code>Agent_OnLoad_<agent-lib-name>
11546 </code></internallink> function.
11547 </constant>
11548 <constant id="JVMTI_PHASE_PRIMORDIAL" num="2">
11549 Primordial phase: between return from <code>Agent_OnLoad</code>
11550 or <code>Agent_OnLoad_<agent-lib-name></code> and the
11551 <code>VMStart</code> event.
11552 </constant>
11553 <constant id="JVMTI_PHASE_START" num="6">
11554 Start phase: when the <eventlink id="VMStart"><code>VMStart</code></eventlink> event
11555 is sent and until the <code>VMInit</code> event is sent.
11556 </constant>
11557 <constant id="JVMTI_PHASE_LIVE" num="4">
11558 Live phase: when the <eventlink id="VMInit"><code>VMInit</code></eventlink> event is sent
11559 and until the <eventlink id="VMDeath"></eventlink> event returns.
11560 </constant>
11561 <constant id="JVMTI_PHASE_DEAD" num="8">
11562 Dead phase: after the <eventlink id="VMDeath"></eventlink> event returns or after
11563 start-up failure.
11564 </constant>
11565 </constants>
11566 In the case of start-up failure the VM will proceed directly to the dead
11567 phase skipping intermediate phases and neither a <code>VMInit</code> nor
11568 <code>VMDeath</code> event will be sent.
11569 <p/>
11570 Most <jvmti/> functions operate only in the live phase.
11571 The following functions operate in either the <code>OnLoad</code> or live phases:
11572 <functionphaselist phase="onload"/>
11573 The following functions operate in only the <code>OnLoad</code> phase:
11574 <functionphaselist phase="onloadOnly"/>
11575 The following functions operate in the start or live phases:
11576 <functionphaselist phase="start"/>
11577 The following functions operate in any phase:
11578 <functionphaselist phase="any"/>
11579 JNI functions (except the Invocation API) must only be used in the start or live phases.
11580 <p/>
11581 Most <jvmti/> events are sent only in the live phase.
11582 The following events operate in others phases:
11583 <eventphaselist phase="start"/>
11584 <eventphaselist phase="any"/>
11585 </description>
11586 <origin>new</origin>
11587 <capabilities>
11588 </capabilities>
11589 <parameters>
11590 <param id="phase_ptr">
11591 <outptr><enum>jvmtiPhase</enum></outptr>
11592 <description>
11593 On return, points to the phase.
11594 </description>
11595 </param>
11596 </parameters>
11597 <errors>
11598 </errors>
11599 </function>
11600
11601 <function id="DisposeEnvironment" jkernel="yes" phase="any" num="127">
11602 <synopsis>Dispose Environment</synopsis>
11603 <description>
11604 Shutdown a <jvmti/> connection created with JNI <code>GetEnv</code>
11605 (see <internallink id="environments"><jvmti/> Environments</internallink>).
11606 Dispose of any resources held by the environment.
11607 <issue>
11608 What resources are reclaimed? What is undone?
11609 Breakpoints,watchpoints removed?
11610 </issue>
11611 Threads suspended by this environment are not resumed by this call,
11612 this must be done explicitly by the agent.
11613 Memory allocated by this environment via calls to <jvmti/> functions
11614 is not released, this can be done explicitly by the agent
11615 by calling <functionlink id="Deallocate"/>.
11616 Raw monitors created by this environment are not destroyed,
11617 this can be done explicitly by the agent
11618 by calling <functionlink id="DestroyRawMonitor"/>.
11619 The state of threads waiting on raw monitors created by this environment
11620 are not affected.
11621 <p/>
11622 Any <functionlink id="SetNativeMethodPrefix">native method
11623 prefixes</functionlink> for this environment will be unset;
11624 the agent must remove any prefixed native methods before
11625 dispose is called.
11626 <p/>
11627 Any <internallink id="capability">capabilities</internallink>
11628 held by this environment are relinquished.
11629 <p/>
11630 Events enabled by this environment will no longer be sent, however
11631 event handlers currently running will continue to run. Caution must
11632 be exercised in the design of event handlers whose environment may
11633 be disposed and thus become invalid during their execution.
11634 <p/>
11635 This environment may not be used after this call.
11636 This call returns to the caller.
11637 </description>
11638 <origin>new</origin>
11639 <capabilities>
11640 </capabilities>
11641 <parameters>
11642 </parameters>
11643 <errors>
11644 </errors>
11645 </function>
11646
11647 <function id="SetEnvironmentLocalStorage" jkernel="yes" phase="any" callbacksafe="safe" impl="innative notrace" num="148">
11648 <synopsis>Set Environment Local Storage</synopsis>
11649 <description>
11650 The VM stores a pointer value associated with each environment.
11651 This pointer value is called <i>environment-local storage</i>.
11652 This value is null unless set with this function.
11653 Agents can allocate memory in which they store environment specific
11654 information. By setting environment-local storage it can then be
11655 accessed with
11656 <functionlink id="GetEnvironmentLocalStorage"></functionlink>.
11657 <p/>
11658 Called by the agent to set the value of the <jvmti/>
11659 environment-local storage. <jvmti/> supplies to the agent a pointer-size
11660 environment-local storage that can be used to record per-environment
11661 information.
11662 </description>
11663 <origin>new</origin>
11664 <capabilities>
11665 </capabilities>
11666 <parameters>
11667 <param id="data">
11668 <inbuf>
11669 <void/>
11670 <nullok>value is set to null</nullok>
11671 </inbuf>
11672 <description>
11673 The value to be entered into the environment-local storage.
11674 </description>
11675 </param>
11676 </parameters>
11677 <errors>
11678 </errors>
11679 </function>
11680
11681 <function id="GetEnvironmentLocalStorage" jkernel="yes" phase="any" callbacksafe="safe" impl="innative notrace" num="147">
11682 <synopsis>Get Environment Local Storage</synopsis>
11683 <description>
11684 Called by the agent to get the value of the <jvmti/> environment-local
11685 storage.
11686 </description>
11687 <origin>new</origin>
11688 <capabilities>
11689 </capabilities>
11690 <parameters>
11691 <param id="data_ptr">
11692 <agentbuf><void/></agentbuf>
11693 <description>
11694 Pointer through which the value of the environment local
11695 storage is returned.
11696 If environment-local storage has not been set with
11697 <functionlink id="SetEnvironmentLocalStorage"></functionlink> returned
11698 pointer is null.
11699 </description>
11700 </param>
11701 </parameters>
11702 <errors>
11703 </errors>
11704 </function>
11705
11706 <function id="GetVersionNumber" jkernel="yes" phase="any" num="88">
11707 <synopsis>Get Version Number</synopsis>
11708 <description>
11709 Return the <jvmti/> version via <code>version_ptr</code>.
11710 The return value is the version identifier.
11711 The version identifier includes major, minor and micro
11712 version as well as the interface type.
11713 <constants id="jvmtiVersionInterfaceTypes" label="Version Interface Types" kind="bits">
11714 <constant id="JVMTI_VERSION_INTERFACE_JNI" num="0x00000000">
11715 Value of <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> for JNI.
11716 </constant>
11717 <constant id="JVMTI_VERSION_INTERFACE_JVMTI" num="0x30000000">
11718 Value of <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> for <jvmti/>.
11719 </constant>
11720 </constants>
11721 <constants id="jvmtiVersionMasks" label="Version Masks" kind="bits">
11722 <constant id="JVMTI_VERSION_MASK_INTERFACE_TYPE" num="0x70000000">
11723 Mask to extract interface type.
11724 The value of the version returned by this function masked with
11725 <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> is always
11726 <code>JVMTI_VERSION_INTERFACE_JVMTI</code>
11727 since this is a <jvmti/> function.
11728 </constant>
11729 <constant id="JVMTI_VERSION_MASK_MAJOR" num="0x0FFF0000">
11730 Mask to extract major version number.
11731 </constant>
11732 <constant id="JVMTI_VERSION_MASK_MINOR" num="0x0000FF00">
11733 Mask to extract minor version number.
11734 </constant>
11735 <constant id="JVMTI_VERSION_MASK_MICRO" num="0x000000FF">
11736 Mask to extract micro version number.
11737 </constant>
11738 </constants>
11739 <constants id="jvmtiVersionShifts" label="Version Shifts" kind="bits">
11740 <constant id="JVMTI_VERSION_SHIFT_MAJOR" num="16">
11741 Shift to extract major version number.
11742 </constant>
11743 <constant id="JVMTI_VERSION_SHIFT_MINOR" num="8">
11744 Shift to extract minor version number.
11745 </constant>
11746 <constant id="JVMTI_VERSION_SHIFT_MICRO" num="0">
11747 Shift to extract micro version number.
11748 </constant>
11749 </constants>
11750 </description>
11751 <origin>jvmdi</origin>
11752 <capabilities>
11753 </capabilities>
11754 <parameters>
11755 <param id="version_ptr">
11756 <outptr><jint/></outptr>
11757 <description>
11758 On return, points to the <jvmti/> version.
11759 </description>
11760 </param>
11761 </parameters>
11762 <errors>
11763 </errors>
11764 </function>
11765
11766
11767 <function id="GetErrorName" phase="any" num="128">
11768 <synopsis>Get Error Name</synopsis>
11769 <description>
11770 Return the symbolic name for an
11771 <internallink id="ErrorSection">error code</internallink>.
11772 <p/>
11773 For example
11774 <code>GetErrorName(env, JVMTI_ERROR_NONE, &err_name)</code>
11775 would return in <code>err_name</code> the string
11776 <code>"JVMTI_ERROR_NONE"</code>.
11777 </description>
11778 <origin>new</origin>
11779 <capabilities>
11780 </capabilities>
11781 <parameters>
11782 <param id="error">
11783 <enum>jvmtiError</enum>
11784 <description>
11785 The error code.
11786 </description>
11787 </param>
11788 <param id="name_ptr">
11789 <allocbuf><char/></allocbuf>
11790 <description>
11791 On return, points to the error name.
11792 The name is encoded as a
11793 <internallink id="mUTF">modified UTF-8</internallink> string,
11794 but is restricted to the ASCII subset.
11795 </description>
11796 </param>
11797 </parameters>
11798 <errors>
11799 </errors>
11800 </function>
11801
11802 <function id="SetVerboseFlag" phase="any" num="150">
11803 <synopsis>Set Verbose Flag</synopsis>
11804 <description>
11805 <constants id="jvmtiVerboseFlag" label="Verbose Flag Enumeration" kind="enum">
11806 <constant id="JVMTI_VERBOSE_OTHER" num="0">
11807 Verbose output other than the below.
11808 </constant>
11809 <constant id="JVMTI_VERBOSE_GC" num="1">
11810 Verbose garbage collector output, like that specified with <code>-verbose:gc</code>.
11811 </constant>
11812 <constant id="JVMTI_VERBOSE_CLASS" num="2">
11813 Verbose class loading output, like that specified with <code>-verbose:class</code>.
11814 </constant>
11815 <constant id="JVMTI_VERBOSE_JNI" num="4">
11816 Verbose JNI output, like that specified with <code>-verbose:jni</code>.
11817 </constant>
11818 </constants>
11819 Control verbose output.
11820 This is the output which typically is sent to <code>stderr</code>.
11821 </description>
11822 <origin>new</origin>
11823 <capabilities>
11824 </capabilities>
11825 <parameters>
11826 <param id="flag">
11827 <enum>jvmtiVerboseFlag</enum>
11828 <description>
11829 Which verbose flag to set.
11830 </description>
11831 </param>
11832 <param id="value">
11833 <jboolean/>
11834 <description>
11835 New value of the flag.
11836 </description>
11837 </param>
11838 </parameters>
11839 <errors>
11840 </errors>
11841 </function>
11842
11843
11844 <function id="GetJLocationFormat" phase="any" num="129">
11845 <synopsis>Get JLocation Format</synopsis>
11846 <description>
11847 Although the greatest functionality is achieved with location information
11848 referencing the virtual machine bytecode index, the definition of
11849 <code>jlocation</code> has intentionally been left unconstrained to allow VM
11850 implementations that do not have this information.
11851 <p/>
11852 This function describes the representation of <code>jlocation</code> used in this VM.
11853 If the returned format is <datalink id="JVMTI_JLOCATION_JVMBCI"></datalink>,
11854 <code>jlocation</code>s can
11855 be used as in indices into the array returned by
11856 <functionlink id="GetBytecodes"></functionlink>.
11857 <constants id="jvmtiJlocationFormat" label="JLocation Format Enumeration" kind="enum">
11858 <constant id="JVMTI_JLOCATION_JVMBCI" num="1">
11859 <code>jlocation</code> values represent virtual machine
11860 bytecode indices--that is, offsets into the
11861 virtual machine code for a method.
11862 </constant>
11863 <constant id="JVMTI_JLOCATION_MACHINEPC" num="2">
11864 <code>jlocation</code> values represent native machine
11865 program counter values.
11866 </constant>
11867 <constant id="JVMTI_JLOCATION_OTHER" num="0">
11868 <code>jlocation</code> values have some other representation.
11869 </constant>
11870 </constants>
11871 </description>
11872 <origin>new</origin>
11873 <capabilities>
11874 </capabilities>
11875 <parameters>
11876 <param id="format_ptr">
11877 <outptr><enum>jvmtiJlocationFormat</enum></outptr>
11878 <description>
11879 On return, points to the format identifier for <code>jlocation</code> values.
11880 </description>
11881 </param>
11882 </parameters>
11883 <errors>
11884 </errors>
11885 </function>
11886
11887 </category>
11888
11889 <category id="heap_monitoring" label="Heap Monitoring">
11890 <function id="SetHeapSamplingInterval" phase="onload" num="156" since="11">
11891 <synopsis>Set Heap Sampling Interval</synopsis>
11892 <description>
11893 Generate a <eventlink id="SampledObjectAlloc"/> event when objects are allocated.
11894 Each thread keeps a counter of bytes allocated. The event will only be generated
11895 when that counter exceeds an average of <paramlink id="sampling_interval"></paramlink>
11896 since the last sample.
11897 <p/>
11898 Setting <paramlink id="sampling_interval"></paramlink> to 0 will cause an event to be
11899 generated by each allocation supported by the system once the new interval is taken into account.
11900 <p/>
11901 Note that updating the new sampling interval might take various number of allocations
11902 to provoke internal data structure updates. Therefore it is important to
11903 consider the sampling interval as an average. This includes the interval 0, where events
11904 might not be generated straight away for each allocation.
11905 </description>
11906 <origin>new</origin>
11907 <capabilities>
11908 <required id="can_generate_sampled_object_alloc_events"></required>
11909 </capabilities>
11910 <parameters>
11911 <param id="sampling_interval">
11912 <jint/>
11913 <description>
11914 The sampling interval in bytes. The sampler uses a statistical approach to
11915 generate an event, on average, once for every <paramlink id="sampling_interval"/> bytes of
11916 memory allocated by a given thread.
11917 <p/>
11918 Once the new sampling interval is taken into account, 0 as a sampling interval will generate
11919 a sample for every allocation.
11920 <p/>
11921 Note: The overhead of this feature is directly correlated with the sampling interval.
11922 A high sampling interval, such as 1024 bytes, will incur a high overhead.
11923 A lower interval, such as 1024KB, will have a much lower overhead. Sampling should only
11924 be used with an understanding that it may impact performance.
11925 </description>
11926 </param>
11927 </parameters>
11928 <errors>
11929 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
11930 <paramlink id="sampling_interval"></paramlink> is less than zero.
11931 </error>
11932 </errors>
11933 </function>
11934 </category>
11935
11936 </functionsection>
11937
11938 <errorsection label="Error Reference">
11939 <intro>
11940 Every <jvmti/> function returns a <b><code>jvmtiError</code></b> error code.
11941 <p/>
11942 It is the responsibility of the agent to call <jvmti/> functions with
11943 valid parameters and in the proper context (calling thread is attached,
11944 phase is correct, etc.).
11945 Detecting some error conditions may be difficult, inefficient, or
11946 impossible for an implementation.
11947 The errors listed in
11948 <internallink id="reqerrors">Function Specific Required Errors</internallink>
11949 must be detected by the implementation.
11950 All other errors represent the recommended response to the error
11951 condition.
11952 </intro>
11953
11954 <errorcategory id="universal-error" label="Universal Errors">
11955 <intro>
11956 The following errors may be returned by any function
11957 </intro>
11958
11959 <errorid id="JVMTI_ERROR_NONE" num="0">
11960 No error has occurred. This is the error code that is returned
11961 on successful completion of the function.
11962 </errorid>
11963 <errorid id="JVMTI_ERROR_NULL_POINTER" num="100">
11964 Pointer is unexpectedly null.
11965 </errorid>
11966 <errorid id="JVMTI_ERROR_OUT_OF_MEMORY" num="110">
11967 The function attempted to allocate memory and no more memory was
11968 available for allocation.
11969 </errorid>
11970 <errorid id="JVMTI_ERROR_ACCESS_DENIED" num="111">
11971 The desired functionality has not been enabled in this virtual machine.
11972 </errorid>
11973 <errorid id="JVMTI_ERROR_UNATTACHED_THREAD" num="115">
11974 The thread being used to call this function is not attached
11975 to the virtual machine. Calls must be made from attached threads.
11976 See <code>AttachCurrentThread</code> in the JNI invocation API.
11977 </errorid>
11978 <errorid id="JVMTI_ERROR_INVALID_ENVIRONMENT" num="116">
11979 The <jvmti/> environment provided is no longer connected or is
11980 not an environment.
11981 </errorid>
11982 <errorid id="JVMTI_ERROR_WRONG_PHASE" num="112">
11983 The desired functionality is not available in the current
11984 <functionlink id="GetPhase">phase</functionlink>.
11985 Always returned if the virtual machine has completed running.
11986 </errorid>
11987 <errorid id="JVMTI_ERROR_INTERNAL" num="113">
11988 An unexpected internal error has occurred.
11989 </errorid>
11990 </errorcategory>
11991
11992 <errorcategory id="reqerrors" label="Function Specific Required Errors">
11993 <intro>
11994 The following errors are returned by some <jvmti/> functions and must
11995 be returned by the implementation when the condition occurs.
11996 </intro>
11997
11998 <errorid id="JVMTI_ERROR_INVALID_PRIORITY" num="12">
11999 Invalid priority.
12000 </errorid>
12001 <errorid id="JVMTI_ERROR_THREAD_NOT_SUSPENDED" num="13">
12002 Thread was not suspended.
12003 </errorid>
12004 <errorid id="JVMTI_ERROR_THREAD_SUSPENDED" num="14">
12005 Thread already suspended.
12006 </errorid>
12007 <errorid id="JVMTI_ERROR_THREAD_NOT_ALIVE" num="15">
12008 This operation requires the thread to be alive--that is,
12009 it must be started and not yet terminated.
12010 </errorid>
12011 <errorid id="JVMTI_ERROR_CLASS_NOT_PREPARED" num="22">
12012 The class has been loaded but not yet prepared.
12013 </errorid>
12014 <errorid id="JVMTI_ERROR_NO_MORE_FRAMES" num="31">
12015 There are no Java programming language or JNI stack frames at the specified depth.
12016 </errorid>
12017 <errorid id="JVMTI_ERROR_OPAQUE_FRAME" num="32">
12018 Information about the frame is not available (e.g. for native frames),
12019 or the implementation is unable to provide this functionality on this frame.
12020 </errorid>
12021 <errorid id="JVMTI_ERROR_DUPLICATE" num="40">
12022 Item already set.
12023 </errorid>
12024 <errorid id="JVMTI_ERROR_NOT_FOUND" num="41">
12025 Desired element (e.g. field or breakpoint) not found
12026 </errorid>
12027 <errorid id="JVMTI_ERROR_NOT_MONITOR_OWNER" num="51">
12028 This thread doesn't own the raw monitor.
12029 </errorid>
12030 <errorid id="JVMTI_ERROR_INTERRUPT" num="52">
12031 The call has been interrupted before completion.
12032 </errorid>
12033 <errorid id="JVMTI_ERROR_UNMODIFIABLE_CLASS" num="79">
12034 The class cannot be modified.
12035 </errorid>
12036 <errorid id="JVMTI_ERROR_UNMODIFIABLE_MODULE" num="80">
12037 The module cannot be modified.
12038 </errorid>
12039 <errorid id="JVMTI_ERROR_NOT_AVAILABLE" num="98">
12040 The functionality is not available in this virtual machine.
12041 </errorid>
12042 <errorid id="JVMTI_ERROR_ABSENT_INFORMATION" num="101">
12043 The requested information is not available.
12044 </errorid>
12045 <errorid id="JVMTI_ERROR_INVALID_EVENT_TYPE" num="102">
12046 The specified event type ID is not recognized.
12047 </errorid>
12048 <errorid id="JVMTI_ERROR_NATIVE_METHOD" num="104">
12049 The requested information is not available for native method.
12050 </errorid>
12051 <errorid id="JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED" num="106">
12052 The class loader does not support this operation.
12053 </errorid>
12054 </errorcategory>
12055
12056 <errorcategory id="function-specific-errors" label="Function Specific Agent Errors">
12057 <intro>
12058 The following errors are returned by some <jvmti/> functions.
12059 They are returned in the event of invalid parameters passed by the
12060 agent or usage in an invalid context.
12061 An implementation is not required to detect these errors.
12062 </intro>
12063
12064 <errorid id="JVMTI_ERROR_INVALID_THREAD" num="10">
12065 The passed thread is not a valid thread.
12066 </errorid>
12067 <errorid id="JVMTI_ERROR_INVALID_FIELDID" num="25">
12068 Invalid field.
12069 </errorid>
12070 <errorid id="JVMTI_ERROR_INVALID_MODULE" num="26">
12071 Invalid module.
12072 </errorid>
12073 <errorid id="JVMTI_ERROR_INVALID_METHODID" num="23">
12074 Invalid method.
12075 </errorid>
12076 <errorid id="JVMTI_ERROR_INVALID_LOCATION" num="24">
12077 Invalid location.
12078 </errorid>
12079 <errorid id="JVMTI_ERROR_INVALID_OBJECT" num="20">
12080 Invalid object.
12081 </errorid>
12082 <errorid id="JVMTI_ERROR_INVALID_CLASS" num="21">
12083 Invalid class.
12084 </errorid>
12085 <errorid id="JVMTI_ERROR_TYPE_MISMATCH" num="34">
12086 The variable is not an appropriate type for the function used.
12087 </errorid>
12088 <errorid id="JVMTI_ERROR_INVALID_SLOT" num="35">
12089 Invalid slot.
12090 </errorid>
12091 <errorid id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY" num="99">
12092 The capability being used is false in this environment.
12093 </errorid>
12094 <errorid id="JVMTI_ERROR_INVALID_THREAD_GROUP" num="11">
12095 Thread group invalid.
12096 </errorid>
12097 <errorid id="JVMTI_ERROR_INVALID_MONITOR" num="50">
12098 Invalid raw monitor.
12099 </errorid>
12100 <errorid id="JVMTI_ERROR_ILLEGAL_ARGUMENT" num="103">
12101 Illegal argument.
12102 </errorid>
12103 <errorid id="JVMTI_ERROR_INVALID_TYPESTATE" num="65">
12104 The state of the thread has been modified, and is now inconsistent.
12105 </errorid>
12106 <errorid id="JVMTI_ERROR_UNSUPPORTED_VERSION" num="68">
12107 A new class file has a version number not supported by this VM.
12108 </errorid>
12109 <errorid id="JVMTI_ERROR_INVALID_CLASS_FORMAT" num="60">
12110 A new class file is malformed (the VM would return a <code>ClassFormatError</code>).
12111 </errorid>
12112 <errorid id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION" num="61">
12113 The new class file definitions would lead to a circular
12114 definition (the VM would return a <code>ClassCircularityError</code>).
12115 </errorid>
12116 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED" num="63">
12117 A new class file would require adding a method.
12118 </errorid>
12119 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED" num="64">
12120 A new class version changes a field.
12121 </errorid>
12122 <errorid id="JVMTI_ERROR_FAILS_VERIFICATION" num="62">
12123 The class bytes fail verification.
12124 </errorid>
12125 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED" num="66">
12126 A direct superclass is different for the new class
12127 version, or the set of directly implemented
12128 interfaces is different.
12129 </errorid>
12130 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED" num="67">
12131 A new class version does not declare a method
12132 declared in the old class version.
12133 </errorid>
12134 <errorid id="JVMTI_ERROR_NAMES_DONT_MATCH" num="69">
12135 The class name defined in the new class file is
12136 different from the name in the old class object.
12137 </errorid>
12138 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED" num="70">
12139 A new class version has different modifiers.
12140 </errorid>
12141 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED" num="71">
12142 A method in the new class version has different modifiers
12143 than its counterpart in the old class version.
12144 </errorid>
12145 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED" num="72">
12146 A new class version has unsupported differences in class attributes.
12147 </errorid>
12148 <errorid id="JVMTI_ERROR_UNSUPPORTED_OPERATION" num="73">
12149 Functionality is unsupported in this implementation.
12150 </errorid>
12151 </errorcategory>
12152 </errorsection>
12153
12154 <eventsection label="Events">
12155 <intro label="Handling Events" id="eventIntro">
12156 Agents can be informed of many events that occur in application
12157 programs.
12158 <p/>
12159 To handle events, designate a set of callback functions with
12160 <functionlink id="SetEventCallbacks"></functionlink>.
12161 For each event the corresponding callback function will be
12162 called.
12163 Arguments to the callback function provide additional
12164 information about the event.
12165 <p/>
12166 The callback function is usually called from within an application
12167 thread. The <jvmti/> implementation does not
12168 queue events in any way. This means
12169 that event callback functions must be written
12170 carefully. Here are some general guidelines. See
12171 the individual event descriptions for further
12172 suggestions.
12173 <p/>
12174 <ul>
12175 <li>Any exception thrown during the execution of an event callback can
12176 overwrite any current pending exception in the current application thread.
12177 Care must be taken to preserve a pending exception
12178 when an event callback makes a JNI call that might generate an exception.
12179 </li>
12180 <li>Event callback functions must be re-entrant. The <jvmti/> implementation does
12181 not queue events. If an agent needs to process events one at a time, it
12182 can use a raw monitor inside the
12183 event callback functions to serialize event processing.
12184 </li>
12185 <li>Event callback functions that execute JNI's FindClass function to load
12186 classes need to note that FindClass locates the class loader associated
12187 with the current native method. For the purposes of class loading, an
12188 event callback that includes a JNI environment as a parameter to the
12189 callback will treated as if it is a native call, where the native method
12190 is in the class of the event thread's current frame.
12191 </li>
12192 </ul>
12193 <p/>
12194 Some <jvmti/> events identify objects with JNI references.
12195 All references
12196 in <jvmti/> events are JNI local references and will become invalid
12197 after the event callback returns.
12198 Unless stated otherwise, memory referenced by pointers sent in event
12199 callbacks may not be referenced after the event callback returns.
12200 <p/>
12201 Except where stated otherwise, events are delivered on the thread
12202 that caused the event.
12203 Events are sent at the time they occur.
12204 The specification for each event includes the set of
12205 <functionlink id="GetPhase">phases</functionlink> in which it can be sent;
12206 if an event triggering activity occurs during another phase, no event
12207 is sent.
12208 <p/>
12209 A thread that generates an event does not change its execution status
12210 (for example, the event does not cause the thread to be suspended).
12211 If an agent wishes the event to result in suspension, then the agent
12212 is responsible for explicitly suspending the thread with
12213 <functionlink id="SuspendThread"></functionlink>.
12214 <p/>
12215 If an event is enabled in multiple environments, the event will be sent
12216 to each agent in the order that the environments were created.
12217 </intro>
12218
12219 <intro label="Enabling Events" id="enablingevents">
12220 All events are initially disabled. In order to receive any
12221 event:
12222 <ul>
12223 <li>
12224 If the event requires a capability, that capability must
12225 be added with
12226 <functionlink id="AddCapabilities"></functionlink>.
12227 </li>
12228 <li>
12229 A callback for the event must be set with
12230 <functionlink id="SetEventCallbacks"></functionlink>.
12231 </li>
12232 <li>
12233 The event must be enabled with
12234 <functionlink id="SetEventNotificationMode"></functionlink>.
12235 </li>
12236 </ul>
12237 </intro>
12238
12239 <intro label="Multiple Co-located Events" id="eventorder">
12240 In many situations it is possible for multiple events to occur
12241 at the same location in one thread. When this happens, all the events
12242 are reported through the event callbacks in the order specified in this section.
12243 <p/>
12244 If the current location is at the entry point of a method, the
12245 <eventlink id="MethodEntry"></eventlink> event is reported before
12246 any other event at the current location in the same thread.
12247 <p/>
12248 If an exception catch has been detected at the current location,
12249 either because it is the beginning of a catch clause or a native method
12250 that cleared a pending exception has returned, the
12251 <code>exceptionCatch</code> event is reported before
12252 any other event at the current location in the same thread.
12253 <p/>
12254 If a <code>singleStep</code> event or
12255 <code>breakpoint</code> event is triggered at the
12256 current location, the event is defined to occur
12257 immediately before the code at the current location is executed.
12258 These events are reported before any events which are triggered
12259 by the execution of code at the current location in the same
12260 thread (specifically:
12261 <code>exception</code>,
12262 <code>fieldAccess</code>, and
12263 <code>fieldModification</code>).
12264 If both a step and breakpoint event are triggered for the same thread and
12265 location, the step event is reported before the breakpoint event.
12266 <p/>
12267 If the current location is the exit point of a method (that is, the last
12268 location before returning to the caller), the
12269 <eventlink id="MethodExit"></eventlink> event and
12270 the <eventlink id="FramePop"></eventlink> event (if requested)
12271 are reported after all other events at the current location in the same
12272 thread. There is no specified ordering of these two events
12273 with respect to each other.
12274 <p/>
12275 Co-located events can be triggered during the processing of some other
12276 event by the agent at the same location in the same thread.
12277 If such an event, of type <i>y</i>, is triggered during the processing of
12278 an event of type <i>x</i>, and if <i>x</i>
12279 precedes <i>y</i> in the ordering specified above, the co-located event
12280 <i>y</i> is reported for the current thread and location. If <i>x</i> does not precede
12281 <i>y</i>, <i>y</i> is not reported for the current thread and location.
12282 For example, if a breakpoint is set at the current location
12283 during the processing of <eventlink id="SingleStep"></eventlink>,
12284 that breakpoint will be reported before the thread moves off the current
12285 location.
12286 <p/>The following events are never considered to be co-located with
12287 other events.
12288 <ul>
12289 <li><eventlink id="VMStart"></eventlink></li>
12290 <li><eventlink id="VMInit"></eventlink></li>
12291 <li><eventlink id="VMDeath"></eventlink></li>
12292 <li><eventlink id="ThreadStart"></eventlink></li>
12293 <li><eventlink id="ThreadEnd"></eventlink></li>
12294 <li><eventlink id="VirtualThreadStart"></eventlink></li>
12295 <li><eventlink id="VirtualThreadEnd"></eventlink></li>
12296 <li><eventlink id="ClassLoad"></eventlink></li>
12297 <li><eventlink id="ClassPrepare"></eventlink></li>
12298 </ul>
12299 </intro>
12300
12301 <intro label="Event Callbacks" id="jvmtiEventCallbacks">
12302 The event callback structure below is used to specify the handler function
12303 for events. It is set with the
12304 <functionlink id="SetEventCallbacks"></functionlink> function.
12305 </intro>
12306
12307 <event label="Single Step"
12308 id="SingleStep" const="JVMTI_EVENT_SINGLE_STEP" filtered="thread" num="60">
12309 <description>
12310 Single step events allow the agent to trace thread execution
12311 at the finest granularity allowed by the VM. A single step event is
12312 generated whenever a thread reaches a new location.
12313 Typically, single step events represent the completion of one VM
12314 instruction as defined in <vmspec/>. However, some implementations
12315 may define locations differently. In any case the
12316 <code>method</code> and <code>location</code>
12317 parameters uniquely identify the current location and allow
12318 the mapping to source file and line number when that information is
12319 available.
12320 <p/>
12321 No single step events are generated from within native methods.
12322 </description>
12323 <origin>jvmdi</origin>
12324 <capabilities>
12325 <required id="can_generate_single_step_events"></required>
12326 </capabilities>
12327 <parameters>
12328 <param id="jni_env">
12329 <outptr>
12330 <struct>JNIEnv</struct>
12331 </outptr>
12332 <description>
12333 The JNI environment of the event (current) thread
12334 </description>
12335 </param>
12336 <param id="thread">
12337 <jthread/>
12338 <description>
12339 Thread about to execution a new instruction
12340 </description>
12341 </param>
12342 <param id="klass">
12343 <jclass method="method"/>
12344 <description>
12345 Class of the method about to execute a new instruction
12346 </description>
12347 </param>
12348 <param id="method">
12349 <jmethodID class="klass"/>
12350 <description>
12351 Method about to execute a new instruction
12352 </description>
12353 </param>
12354 <param id="location">
12355 <jlocation/>
12356 <description>
12357 Location of the new instruction
12358 </description>
12359 </param>
12360 </parameters>
12361 </event>
12362
12363 <event label="Breakpoint"
12364 id="Breakpoint" const="JVMTI_EVENT_BREAKPOINT" filtered="thread" num="62">
12365 <description>
12366 Breakpoint events are generated whenever a thread reaches a location
12367 designated as a breakpoint with <functionlink id="SetBreakpoint"></functionlink>.
12368 The <code>method</code> and <code>location</code>
12369 parameters uniquely identify the current location and allow
12370 the mapping to source file and line number when that information is
12371 available.
12372 </description>
12373 <origin>jvmdi</origin>
12374 <capabilities>
12375 <required id="can_generate_breakpoint_events"></required>
12376 </capabilities>
12377 <parameters>
12378 <param id="jni_env">
12379 <outptr>
12380 <struct>JNIEnv</struct>
12381 </outptr>
12382 <description>
12383 The JNI environment of the event (current) thread.
12384 </description>
12385 </param>
12386 <param id="thread">
12387 <jthread/>
12388 <description>
12389 Thread that hit the breakpoint
12390 </description>
12391 </param>
12392 <param id="klass">
12393 <jclass method="method"/>
12394 <description>
12395 Class of the method that hit the breakpoint
12396 </description>
12397 </param>
12398 <param id="method">
12399 <jmethodID class="klass"/>
12400 <description>
12401 Method that hit the breakpoint
12402 </description>
12403 </param>
12404 <param id="location">
12405 <jlocation/>
12406 <description>
12407 location of the breakpoint
12408 </description>
12409 </param>
12410 </parameters>
12411 </event>
12412
12413 <event label="Field Access"
12414 id="FieldAccess" const="JVMTI_EVENT_FIELD_ACCESS" filtered="thread" num="63">
12415 <description>
12416 Field access events are generated whenever a thread accesses
12417 a field that was designated as a watchpoint
12418 with <functionlink id="SetFieldAccessWatch"></functionlink>.
12419 The <code>method</code> and <code>location</code>
12420 parameters uniquely identify the current location and allow
12421 the mapping to source file and line number when that information is
12422 available.
12423 </description>
12424 <origin>jvmdi</origin>
12425 <capabilities>
12426 <required id="can_generate_field_access_events"></required>
12427 </capabilities>
12428 <parameters>
12429 <param id="jni_env">
12430 <outptr>
12431 <struct>JNIEnv</struct>
12432 </outptr>
12433 <description>
12434 The JNI environment of the event (current) thread
12435 </description>
12436 </param>
12437 <param id="thread">
12438 <jthread/>
12439 <description>
12440 Thread accessing the field
12441 </description>
12442 </param>
12443 <param id="klass">
12444 <jclass method="method"/>
12445 <description>
12446 Class of the method where the access is occurring
12447 </description>
12448 </param>
12449 <param id="method">
12450 <jmethodID class="klass"/>
12451 <description>
12452 Method where the access is occurring
12453 </description>
12454 </param>
12455 <param id="location">
12456 <jlocation/>
12457 <description>
12458 Location where the access is occurring
12459 </description>
12460 </param>
12461 <param id="field_klass">
12462 <jclass field="field"/>
12463 <description>
12464 Class of the field being accessed
12465 </description>
12466 </param>
12467 <param id="object">
12468 <jobject/>
12469 <description>
12470 Object with the field being accessed if the field is an
12471 instance field; a null pointer otherwise
12472 </description>
12473 </param>
12474 <param id="field">
12475 <jfieldID class="field_klass"/>
12476 <description>
12477 Field being accessed
12478 </description>
12479 </param>
12480 </parameters>
12481 </event>
12482
12483 <event label="Field Modification"
12484 id="FieldModification" const="JVMTI_EVENT_FIELD_MODIFICATION" filtered="thread" num="64">
12485 <description>
12486 Field modification events are generated whenever a thread modifies
12487 a field that was designated as a watchpoint
12488 with <functionlink id="SetFieldModificationWatch"></functionlink>.
12489 The <code>method</code> and <code>location</code>
12490 parameters uniquely identify the current location and allow
12491 the mapping to source file and line number when that information is
12492 available.
12493 </description>
12494 <origin>jvmdi</origin>
12495 <capabilities>
12496 <required id="can_generate_field_modification_events"></required>
12497 </capabilities>
12498 <parameters>
12499 <param id="jni_env">
12500 <outptr>
12501 <struct>JNIEnv</struct>
12502 </outptr>
12503 <description>
12504 The JNI environment of the event (current) thread
12505 </description>
12506 </param>
12507 <param id="thread">
12508 <jthread/>
12509 <description>
12510 Thread modifying the field
12511 </description>
12512 </param>
12513 <param id="klass">
12514 <jclass method="method"/>
12515 <description>
12516 Class of the method where the modification is occurring
12517 </description>
12518 </param>
12519 <param id="method">
12520 <jmethodID class="klass"/>
12521 <description>
12522 Method where the modification is occurring
12523 </description>
12524 </param>
12525 <param id="location">
12526 <jlocation/>
12527 <description>
12528 Location where the modification is occurring
12529 </description>
12530 </param>
12531 <param id="field_klass">
12532 <jclass field="field"/>
12533 <description>
12534 Class of the field being modified
12535 </description>
12536 </param>
12537 <param id="object">
12538 <jobject/>
12539 <description>
12540 Object with the field being modified if the field is an
12541 instance field; a null pointer otherwise
12542 </description>
12543 </param>
12544 <param id="field">
12545 <jfieldID class="field_klass"/>
12546 <description>
12547 Field being modified
12548 </description>
12549 </param>
12550 <param id="signature_type">
12551 <char/>
12552 <description>
12553 Signature type of the new value
12554 </description>
12555 </param>
12556 <param id="new_value">
12557 <jvalue/>
12558 <description>
12559 The new value
12560 </description>
12561 </param>
12562 </parameters>
12563 </event>
12564
12565 <event label="Frame Pop"
12566 id="FramePop" const="JVMTI_EVENT_FRAME_POP" filtered="thread" num="61">
12567 <description>
12568 Frame pop events are generated upon exit from a single method
12569 in a single frame as specified
12570 in a call to <functionlink id="NotifyFramePop"></functionlink>.
12571 This is true whether termination is caused by
12572 executing its return instruction
12573 or by throwing an exception to its caller
12574 (see <paramlink id="was_popped_by_exception"></paramlink>).
12575 However, frame pops caused by the <functionlink id="PopFrame"/>
12576 function are not reported.
12577 <p/>
12578 The location reported by <functionlink id="GetFrameLocation"></functionlink>
12579 for the depth 0 identifies the executable location in the returning method,
12580 immediately prior to the return.
12581 </description>
12582 <origin>jvmdi</origin>
12583 <capabilities>
12584 <required id="can_generate_frame_pop_events"></required>
12585 </capabilities>
12586 <parameters>
12587 <param id="jni_env">
12588 <outptr>
12589 <struct>JNIEnv</struct>
12590 </outptr>
12591 <description>
12592 The JNI environment of the event (current) thread
12593 </description>
12594 </param>
12595 <param id="thread">
12596 <jthread/>
12597 <description>
12598 Thread that is popping the frame
12599 </description>
12600 </param>
12601 <param id="klass">
12602 <jclass method="method"/>
12603 <description>
12604 Class of the method being popped
12605 </description>
12606 </param>
12607 <param id="method">
12608 <jmethodID class="klass"/>
12609 <description>
12610 Method being popped
12611 </description>
12612 </param>
12613 <param id="was_popped_by_exception">
12614 <jboolean/>
12615 <description>
12616 True if frame was popped by a thrown exception.
12617 False if method exited through its return instruction.
12618 </description>
12619 </param>
12620 </parameters>
12621 </event>
12622
12623 <event label="Method Entry"
12624 id="MethodEntry" const="JVMTI_EVENT_METHOD_ENTRY" filtered="thread" num="65">
12625 <description>
12626 Method entry events are generated upon entry of Java
12627 programming language methods (including native methods).
12628 <p/>
12629 The location reported by <functionlink id="GetFrameLocation"></functionlink>
12630 for the depth 0 identifies the initial executable location in the method.
12631 <p/>
12632 Enabling method
12633 entry or exit events will significantly degrade performance on many platforms and is thus
12634 not advised for performance critical usage (such as profiling).
12635 <internallink id="bci">Bytecode instrumentation</internallink> should be
12636 used in these cases.
12637 </description>
12638 <origin>jvmdi</origin>
12639 <capabilities>
12640 <required id="can_generate_method_entry_events"></required>
12641 </capabilities>
12642 <parameters>
12643 <param id="jni_env">
12644 <outptr>
12645 <struct>JNIEnv</struct>
12646 </outptr>
12647 <description>
12648 The JNI environment of the event (current) thread
12649 </description>
12650 </param>
12651 <param id="thread">
12652 <jthread/>
12653 <description>
12654 Thread entering the method
12655 </description>
12656 </param>
12657 <param id="klass">
12658 <jclass method="method"/>
12659 <description>
12660 Class of the method being entered
12661 </description>
12662 </param>
12663 <param id="method">
12664 <jmethodID class="klass"/>
12665 <description>
12666 Method being entered
12667 </description>
12668 </param>
12669 </parameters>
12670 </event>
12671
12672 <event label="Method Exit"
12673 id="MethodExit" const="JVMTI_EVENT_METHOD_EXIT" filtered="thread" num="66">
12674 <description>
12675 Method exit events are generated upon exit from Java
12676 programming language methods (including native methods).
12677 This is true whether termination is caused by
12678 executing its return instruction
12679 or by throwing an exception to its caller
12680 (see <paramlink id="was_popped_by_exception"></paramlink>).
12681 <p/>
12682 The location reported by <functionlink id="GetFrameLocation"></functionlink>
12683 for the depth 0 identifies the executable location in the returning method
12684 immediately prior to the return.
12685 <p/>
12686 Enabling method
12687 entry or exit events will significantly degrade performance on many platforms and is thus
12688 not advised for performance critical usage (such as profiling).
12689 <internallink id="bci">Bytecode instrumentation</internallink> should be
12690 used in these cases.
12691 </description>
12692 <origin>jvmdi</origin>
12693 <capabilities>
12694 <required id="can_generate_method_exit_events"></required>
12695 </capabilities>
12696 <parameters>
12697 <param id="jni_env">
12698 <outptr>
12699 <struct>JNIEnv</struct>
12700 </outptr>
12701 <description>
12702 The JNI environment of the event (current) thread
12703 </description>
12704 </param>
12705 <param id="thread">
12706 <jthread/>
12707 <description>
12708 Thread exiting the method
12709 </description>
12710 </param>
12711 <param id="klass">
12712 <jclass method="method"/>
12713 <description>
12714 Class of the method being exited
12715 </description>
12716 </param>
12717 <param id="method">
12718 <jmethodID class="klass"/>
12719 <description>
12720 Method being exited
12721 </description>
12722 </param>
12723 <param id="was_popped_by_exception">
12724 <jboolean/>
12725 <description>
12726 True if frame was popped by a thrown exception.
12727 False if method exited through its return instruction.
12728 </description>
12729 </param>
12730 <param id="return_value">
12731 <jvalue/>
12732 <description>
12733 The return value of the method being exited.
12734 Undefined and should not be used if
12735 <paramlink id="was_popped_by_exception"></paramlink>
12736 is true.
12737 </description>
12738 </param>
12739 </parameters>
12740 </event>
12741
12742 <event label="Native Method Bind" phase="any"
12743 id="NativeMethodBind" const="JVMTI_EVENT_NATIVE_METHOD_BIND" num="67">
12744 <description>
12745 A Native Method Bind event is sent when a VM binds a
12746 Java programming language native method
12747 to the address of a function that implements the native method.
12748 This will occur when the native method is called for the first time
12749 and also occurs when the JNI function <code>RegisterNatives</code> is called.
12750 This event allows the bind to be redirected to an agent-specified
12751 proxy function.
12752 This event is not sent when the native method is unbound.
12753 Typically, this proxy function will need to be specific to a
12754 particular method or, to handle the general case, automatically
12755 generated assembly code, since after instrumentation code is
12756 executed the function at the original binding
12757 address will usually be invoked.
12758 The original binding can be restored or the redirection changed
12759 by use of the JNI function <code>RegisterNatives</code>.
12760 Some events may be sent during the primordial phase, JNI and
12761 most of <jvmti/> cannot be used at this time but the method and
12762 address can be saved for use later.
12763 </description>
12764 <origin>new</origin>
12765 <capabilities>
12766 <required id="can_generate_native_method_bind_events"></required>
12767 </capabilities>
12768 <parameters>
12769 <param id="jni_env">
12770 <outptr>
12771 <struct>JNIEnv</struct>
12772 </outptr>
12773 <description>
12774 The JNI environment of the event (current) thread
12775 Will be null if sent during the primordial
12776 <functionlink id="GetPhase">phase</functionlink>.
12777 </description>
12778 </param>
12779 <param id="thread">
12780 <jthread/>
12781 <description>
12782 Thread requesting the bind
12783 </description>
12784 </param>
12785 <param id="klass">
12786 <jclass method="method"/>
12787 <description>
12788 Class of the method being bound
12789 </description>
12790 </param>
12791 <param id="method">
12792 <jmethodID class="klass"/>
12793 <description>
12794 Native method being bound
12795 </description>
12796 </param>
12797 <param id="address">
12798 <outptr><void/></outptr>
12799 <description>
12800 The address the VM is about to bind to--that is, the
12801 address of the implementation of the native method
12802 </description>
12803 </param>
12804 <param id="new_address_ptr">
12805 <agentbuf><void/></agentbuf>
12806 <description>
12807 if the referenced address is changed (that is, if
12808 <code>*new_address_ptr</code> is set), the binding
12809 will instead be made to the supplied address.
12810 </description>
12811 </param>
12812 </parameters>
12813 </event>
12814
12815 <event label="Exception"
12816 id="Exception" const="JVMTI_EVENT_EXCEPTION" filtered="thread" num="58">
12817 <description>
12818 Exception events are generated whenever an exception is first detected
12819 in a Java programming language method.
12820 Where "exception" means any <code>java.lang.Throwable</code>.
12821 The exception may have been thrown by a Java programming language or native
12822 method, but in the case of native methods, the event is not generated
12823 until the exception is first seen by a Java programming language method. If an exception is
12824 set and cleared in a native method (and thus is never visible to Java programming language code),
12825 no exception event is generated.
12826 <p/>
12827 The <code>method</code> and <code>location</code>
12828 parameters uniquely identify the current location
12829 (where the exception was detected) and allow
12830 the mapping to source file and line number when that information is
12831 available. The <code>exception</code> parameter identifies the thrown
12832 exception object. The <code>catch_method</code>
12833 and <code>catch_location</code> identify the location of the catch clause,
12834 if any, that handles the thrown exception. If there is no such catch clause,
12835 the <code>catch_method</code> is set to null and the <code>catch_location</code>is set to 0.
12836 There is no guarantee that the thread will ever
12837 reach this catch clause. If there are native methods on the call stack
12838 between the throw location and the catch clause, the exception may
12839 be reset by one of those native methods.
12840 Similarly, exceptions that are reported as uncaught (<code>catch_method</code>
12841 set to null) may in fact be caught by native code.
12842 Agents can check for these occurrences by monitoring
12843 <eventlink id="ExceptionCatch"></eventlink> events.
12844 Note that finally clauses are implemented as catch and re-throw. Therefore they
12845 will be reported in the catch location.
12846 </description>
12847 <origin>jvmdi</origin>
12848 <capabilities>
12849 <required id="can_generate_exception_events"></required>
12850 </capabilities>
12851 <parameters>
12852 <param id="jni_env">
12853 <outptr>
12854 <struct>JNIEnv</struct>
12855 </outptr>
12856 <description>
12857 The JNI environment of the event (current) thread
12858 </description>
12859 </param>
12860 <param id="thread">
12861 <jthread/>
12862 <description>
12863 Thread generating the exception
12864 </description>
12865 </param>
12866 <param id="klass">
12867 <jclass method="method"/>
12868 <description>
12869 Class generating the exception
12870 </description>
12871 </param>
12872 <param id="method">
12873 <jmethodID class="klass"/>
12874 <description>
12875 Method generating the exception
12876 </description>
12877 </param>
12878 <param id="location">
12879 <jlocation/>
12880 <description>
12881 Location where exception occurred
12882 </description>
12883 </param>
12884 <param id="exception">
12885 <jobject/>
12886 <description>
12887 The exception being thrown
12888 </description>
12889 </param>
12890 <param id="catch_klass">
12891 <jclass method="catch_method"/>
12892 <description>
12893 Class that will catch the exception, or null if no known catch
12894 </description>
12895 </param>
12896 <param id="catch_method">
12897 <jmethodID class="catch_klass"/>
12898 <description>
12899 Method that will catch the exception, or null if no known catch
12900 </description>
12901 </param>
12902 <param id="catch_location">
12903 <jlocation/>
12904 <description>
12905 location which will catch the exception or zero if no known catch
12906 </description>
12907 </param>
12908 </parameters>
12909 </event>
12910
12911 <event label="Exception Catch"
12912 id="ExceptionCatch" const="JVMTI_EVENT_EXCEPTION_CATCH" filtered="thread" num="59">
12913 <description>
12914 Exception catch events are generated whenever a thrown exception is caught.
12915 Where "exception" means any <code>java.lang.Throwable</code>.
12916 If the exception is caught in a Java programming language method, the event is generated
12917 when the catch clause is reached. If the exception is caught in a native
12918 method, the event is generated as soon as control is returned to a Java programming language
12919 method. Exception catch events are generated for any exception for which
12920 a throw was detected in a Java programming language method.
12921 Note that finally clauses are implemented as catch and re-throw. Therefore they
12922 will generate exception catch events.
12923 <p/>
12924 The <code>method</code> and <code>location</code>
12925 parameters uniquely identify the current location
12926 and allow the mapping to source file and line number when that information is
12927 available. For exceptions caught in a Java programming language method, the
12928 <code>exception</code> object identifies the exception object. Exceptions
12929 caught in native methods are not necessarily available by the time the
12930 exception catch is reported, so the <code>exception</code> parameter is set
12931 to null.
12932 </description>
12933 <origin>jvmdi</origin>
12934 <capabilities>
12935 <required id="can_generate_exception_events"></required>
12936 </capabilities>
12937 <parameters>
12938 <param id="jni_env">
12939 <outptr>
12940 <struct>JNIEnv</struct>
12941 </outptr>
12942 <description>
12943 The JNI environment of the event (current) thread
12944 </description>
12945 </param>
12946 <param id="thread">
12947 <jthread/>
12948 <description>
12949 Thread catching the exception
12950 </description>
12951 </param>
12952 <param id="klass">
12953 <jclass method="method"/>
12954 <description>
12955 Class catching the exception
12956 </description>
12957 </param>
12958 <param id="method">
12959 <jmethodID class="klass"/>
12960 <description>
12961 Method catching the exception
12962 </description>
12963 </param>
12964 <param id="location">
12965 <jlocation/>
12966 <description>
12967 Location where exception is being caught
12968 </description>
12969 </param>
12970 <param id="exception">
12971 <jobject/>
12972 <description>
12973 Exception being caught
12974 </description>
12975 </param>
12976 </parameters>
12977 </event>
12978
12979 <event label="Thread Start"
12980 id="ThreadStart" const="JVMTI_EVENT_THREAD_START" num="52" phase="start">
12981 <description>
12982 A thread start event is generated by a new thread before its initial
12983 method executes.
12984 <p/>
12985 This event is generated by platform thread. It is not generated by virtual threads.
12986 <p/>
12987 Agents with the <code>can_support_virtual_threads</code> capability
12988 can enable the <eventlink id="VirtualThreadStart"></eventlink> event
12989 to be notified by newly started virtual threads.
12990 <p/>
12991 A platform thread may be listed in the array returned by
12992 <functionlink id="GetAllThreads"></functionlink>
12993 before its thread start event is generated.
12994 It is possible for other events to be generated
12995 on a thread before its thread start event.
12996 <p/>
12997 The event is sent on the newly started <paramlink id="thread"></paramlink>.
12998 </description>
12999 <origin>jvmdi</origin>
13000 <capabilities>
13001 </capabilities>
13002 <parameters>
13003 <param id="jni_env">
13004 <outptr>
13005 <struct>JNIEnv</struct>
13006 </outptr>
13007 <description>
13008 The JNI environment of the event (current) thread.
13009 </description>
13010 </param>
13011 <param id="thread">
13012 <jthread/>
13013 <description>
13014 Thread starting
13015 </description>
13016 </param>
13017 </parameters>
13018 </event>
13019
13020 <event label="Thread End"
13021 id="ThreadEnd" const="JVMTI_EVENT_THREAD_END" filtered="thread" num="53" phase="start">
13022 <description>
13023 A thread end event is generated by a terminating thread after its
13024 initial method has finished execution.
13025 <p/>
13026 This event is generated by platform thread. It is not generated by virtual threads.
13027 <p/>
13028 Agents with the <code>can_support_virtual_threads</code> capability
13029 can enable the <eventlink id="VirtualThreadEnd"></eventlink> event
13030 to be notified by terminating virtual threads.
13031 <p/>
13032 A platform thread may be listed in the array returned by
13033 <functionlink id="GetAllThreads"></functionlink>
13034 after its thread end event is generated.
13035 No events are generated on a thread
13036 after its thread end event.
13037 <p/>
13038 The event is sent on the terminating <paramlink id="thread"></paramlink>.
13039 </description>
13040 <origin>jvmdi</origin>
13041 <capabilities>
13042 </capabilities>
13043 <parameters>
13044 <param id="jni_env">
13045 <outptr>
13046 <struct>JNIEnv</struct>
13047 </outptr>
13048 <description>
13049 The JNI environment of the event (current) thread.
13050 </description>
13051 </param>
13052 <param id="thread">
13053 <jthread/>
13054 <description>
13055 Thread ending
13056 </description>
13057 </param>
13058 </parameters>
13059 </event>
13060
13061 <event label="Virtual Thread Start"
13062 id="VirtualThreadStart" const="JVMTI_EVENT_VIRTUAL_THREAD_START" num="87" phase="start" since="21">
13063 <description>
13064 A virtual thread start event is generated before its initial method executes.
13065 <p/>
13066 The event is sent on the newly started <paramlink id="virtual_thread"></paramlink>.
13067 </description>
13068 <origin>new</origin>
13069 <capabilities>
13070 <required id="can_support_virtual_threads">Can support virtual threads</required>
13071 </capabilities>
13072 <parameters>
13073 <param id="jni_env">
13074 <outptr>
13075 <struct>JNIEnv</struct>
13076 </outptr>
13077 <description>
13078 The JNI environment of the event (current) thread.
13079 </description>
13080 </param>
13081 <param id="virtual_thread">
13082 <jthread/>
13083 <description>
13084 Virtual thread started for execution.
13085 </description>
13086 </param>
13087 </parameters>
13088 </event>
13089
13090 <event label="Virtual Thread End"
13091 id="VirtualThreadEnd" const="JVMTI_EVENT_VIRTUAL_THREAD_END" filtered="thread" num="88" phase="start" since="21">
13092 <description>
13093 A virtual thread end event is generated after its initial method has finished execution.
13094 <p/>
13095 The event is sent on the terminating <paramlink id="virtual_thread"></paramlink>.
13096 </description>
13097 <origin>new</origin>
13098 <capabilities>
13099 <required id="can_support_virtual_threads">Can support virtual threads</required>
13100 </capabilities>
13101 <parameters>
13102 <param id="jni_env">
13103 <outptr>
13104 <struct>JNIEnv</struct>
13105 </outptr>
13106 <description>
13107 The JNI environment of the event (current) thread.
13108 </description>
13109 </param>
13110 <param id="virtual_thread">
13111 <jthread/>
13112 <description>
13113 Virtual thread being ended.
13114 </description>
13115 </param>
13116 </parameters>
13117 </event>
13118
13119 <elide>
13120 <event label="Virtual Thread Mount"
13121 id="VirtualThreadMount" const="JVMTI_EVENT_VIRTUAL_THREAD_MOUNT" filtered="thread" num="89" phase="start" since="99">
13122 <description>
13123 A virtual thread mount event is generated before its method continue to execute on the mounted thread.
13124 <p/>
13125 The event is sent on the <paramlink id="thread"></paramlink> the virtual thread is mounted to.
13126 </description>
13127 <origin>new</origin>
13128 <capabilities>
13129 <required id="can_support_virtual_threads">Can support virtual threads</required>
13130 </capabilities>
13131 <parameters>
13132 <param id="jni_env">
13133 <outptr>
13134 <struct>JNIEnv</struct>
13135 </outptr>
13136 <description>
13137 The JNI environment of the event (current) thread.
13138 </description>
13139 </param>
13140 <param id="virtual_thread">
13141 <jthread/>
13142 <description>
13143 Virtual thread that is mounted.
13144 </description>
13145 </param>
13146 </parameters>
13147 </event>
13148 </elide>
13149
13150 <elide>
13151 <event label="Virtual Thread Unmount"
13152 id="VirtualThreadUnmount" const="JVMTI_EVENT_VIRTUAL_THREAD_UNMOUNT" filtered="thread" num="90" phase="start" since="99">
13153 <description>
13154 A virtual thread unmount event is generated when the virtual thread is about to be unmounted from the carrier thread.
13155 <p/>
13156 The event is sent on the <paramlink id="thread"></paramlink> the virtual thread is unmounted from.
13157 </description>
13158 <origin>new</origin>
13159 <capabilities>
13160 <required id="can_support_virtual_threads">Can support virtual threads</required>
13161 </capabilities>
13162 <parameters>
13163 <param id="jni_env">
13164 <outptr>
13165 <struct>JNIEnv</struct>
13166 </outptr>
13167 <description>
13168 The JNI environment of the event (current) thread.
13169 </description>
13170 </param>
13171 <param id="virtual_thread">
13172 <jthread/>
13173 <description>
13174 Virtual thread that is unmounted.
13175 </description>
13176 </param>
13177 </parameters>
13178 </event>
13179 </elide>
13180
13181 <event label="Class Load"
13182 id="ClassLoad" const="JVMTI_EVENT_CLASS_LOAD" filtered="thread" phase="start" num="55">
13183 <description>
13184 A class load event is generated
13185 <functionlink id="GetLoadedClasses">when a class or interface is created</functionlink>.
13186 <p/>
13187 Array class creation does not generate a class load event.
13188 The creation of a primitive class (for example, java.lang.Integer.TYPE)
13189 does not generate a class load event.
13190 <p/>
13191 The order of class load events generated by a particular thread is guaranteed
13192 to match the order of class loading within that thread.
13193 <p/>
13194 This event is sent at an early stage in loading the class. As
13195 a result the class should be used carefully. Note, for example,
13196 that methods and fields are not yet loaded, so queries for methods,
13197 fields, subclasses, and so on will not give correct results.
13198 See "Loading of Classes and Interfaces" in the <i>Java Language
13199 Specification</i>. For most
13200 purposes the <eventlink id="ClassPrepare"></eventlink> event will
13201 be more useful.
13202 </description>
13203 <origin>jvmdi</origin>
13204 <capabilities>
13205 </capabilities>
13206 <parameters>
13207 <param id="jni_env">
13208 <outptr>
13209 <struct>JNIEnv</struct>
13210 </outptr>
13211 <description>
13212 The JNI environment of the event (current) thread
13213 </description>
13214 </param>
13215 <param id="thread">
13216 <jthread/>
13217 <description>
13218 Thread loading the class
13219 </description>
13220 </param>
13221 <param id="klass">
13222 <jclass/>
13223 <description>
13224 Class being loaded
13225 </description>
13226 </param>
13227 </parameters>
13228 </event>
13229
13230 <elide>
13231 <event label="Class Unload"
13232 id="ClassUnload" const="JVMTI_EVENT_CLASS_UNLOAD" num="57">
13233 <description>
13234 A class unload event is generated when the class is about to be unloaded.
13235 Class unload events take place during garbage collection and must be
13236 handled extremely carefully. The garbage collector holds many locks
13237 and has suspended all other threads, so the event handler cannot depend
13238 on the ability to acquire any locks. The class unload event handler should
13239 do as little as possible, perhaps by queuing information to be processed
13240 later. In particular, the <code>jclass</code> should be used only in
13241 the JNI function <code>isSameObject</code> or in the following <jvmti/> functions:
13242 <ul>
13243 <li><functionlink id="GetClassSignature"></functionlink></li>
13244 <li><functionlink id="GetSourceFileName"></functionlink></li>
13245 <li><functionlink id="IsInterface"></functionlink></li>
13246 <li><functionlink id="IsArrayClass"></functionlink></li>
13247 </ul>
13248 </description>
13249 <origin>jvmdi</origin>
13250 <capabilities>
13251 </capabilities>
13252 <parameters>
13253 <param id="jni_env">
13254 <outptr>
13255 <struct>JNIEnv</struct>
13256 </outptr>
13257 <description>
13258 The JNI environment of the event (current) thread
13259 </description>
13260 </param>
13261 <param id="thread">
13262 <jthread/>
13263 <description>
13264 Thread generating the class unload
13265 </description>
13266 </param>
13267 <param id="klass">
13268 <jclass/>
13269 <description>
13270 Class being unloaded
13271 </description>
13272 </param>
13273 </parameters>
13274 </event>
13275 </elide>
13276
13277 <event label="Class Prepare"
13278 id="ClassPrepare" const="JVMTI_EVENT_CLASS_PREPARE" filtered="thread" phase="start" num="56">
13279 <description>
13280 A class prepare event is generated when class preparation is complete.
13281 At this point, class fields, methods, and implemented interfaces are
13282 available, and no code from the class has been executed. Since array
13283 classes never have fields or methods, class prepare events are not
13284 generated for them. Class prepare events are not generated for
13285 primitive classes (for example, <code>java.lang.Integer.TYPE</code>).
13286 </description>
13287 <origin>jvmdi</origin>
13288 <capabilities>
13289 </capabilities>
13290 <parameters>
13291 <param id="jni_env">
13292 <outptr>
13293 <struct>JNIEnv</struct>
13294 </outptr>
13295 <description>
13296 The JNI environment of the event (current) thread
13297 </description>
13298 </param>
13299 <param id="thread">
13300 <jthread/>
13301 <description>
13302 Thread generating the class prepare
13303 </description>
13304 </param>
13305 <param id="klass">
13306 <jclass/>
13307 <description>
13308 Class being prepared
13309 </description>
13310 </param>
13311 </parameters>
13312 </event>
13313
13314 <event label="Class File Load Hook" phase="any"
13315 id="ClassFileLoadHook" const="JVMTI_EVENT_CLASS_FILE_LOAD_HOOK" num="54">
13316 <description>
13317 This event is sent when the VM obtains class file data,
13318 but before it constructs
13319 the in-memory representation for that class.
13320 This event is also sent when the class is being modified by the
13321 <functionlink id="RetransformClasses"/> function or
13322 the <functionlink id="RedefineClasses"/> function,
13323 called in any <jvmti/> environment.
13324 The agent can instrument
13325 the existing class file data sent by the VM to include profiling/debugging hooks.
13326 See the description of
13327 <internallink id="bci">bytecode instrumentation</internallink>
13328 for usage information.
13329 <p/>
13330 When the capabilities
13331 <internallink id="jvmtiCapabilities.can_generate_early_class_hook_events">
13332 <code>can_generate_early_class_hook_events</code></internallink> and
13333 <internallink id="jvmtiCapabilities.can_generate_all_class_hook_events">
13334 <code>can_generate_all_class_hook_events</code></internallink>
13335 are enabled then this event may be sent in the primordial phase.
13336 Otherwise, this event may be sent before the VM is initialized (the start
13337 <functionlink id="GetPhase">phase</functionlink>).
13338 Some classes might not be compatible
13339 with the function (eg. ROMized classes or implementation defined classes) and this event will
13340 not be generated for these classes.
13341 <p/>
13342 The agent must allocate the space for the modified
13343 class file data buffer
13344 using the memory allocation function
13345 <functionlink id="Allocate"></functionlink> because the
13346 VM is responsible for freeing the new class file data buffer
13347 using <functionlink id="Deallocate"></functionlink>.
13348 <p/>
13349 If the agent wishes to modify the class file, it must set
13350 <code>new_class_data</code> to point
13351 to the newly instrumented class file data buffer and set
13352 <code>new_class_data_len</code> to the length of that
13353 buffer before returning
13354 from this call. If no modification is desired, the agent simply
13355 does not set <code>new_class_data</code>. If multiple agents
13356 have enabled this event the results are chained. That is, if
13357 <code>new_class_data</code> has been set, it becomes the
13358 <code>class_data</code> for the next agent.
13359 <p/>
13360 When handling a class load in the live phase, then the
13361 <functionlink id="GetNamedModule"></functionlink>
13362 function can be used to map class loader and a package name to a module.
13363 When a class is being redefined or retransformed then
13364 <code>class_being_redefined</code> is non-null and so
13365 the JNI <code>GetModule</code> function can also be used
13366 to obtain the Module.
13367 <p/>
13368 The order that this event is sent to each environment differs
13369 from other events.
13370 This event is sent to environments in the following order:
13371 <ul>
13372 <li><fieldlink id="can_retransform_classes"
13373 struct="jvmtiCapabilities">retransformation
13374 incapable</fieldlink>
13375 environments, in the
13376 order in which they were created
13377 </li>
13378 <li><fieldlink id="can_retransform_classes"
13379 struct="jvmtiCapabilities">retransformation
13380 capable</fieldlink>
13381 environments, in the
13382 order in which they were created
13383 </li>
13384 </ul>
13385 When triggered by <functionlink id="RetransformClasses"/>,
13386 this event is sent only to <fieldlink id="can_retransform_classes"
13387 struct="jvmtiCapabilities">retransformation
13388 capable</fieldlink>
13389 environments.
13390 </description>
13391 <origin>jvmpi</origin>
13392 <capabilities>
13393 <capability id="can_generate_all_class_hook_events"></capability>
13394 <capability id="can_generate_early_class_hook_events"></capability>
13395 </capabilities>
13396 <parameters>
13397 <param id="jni_env">
13398 <outptr>
13399 <struct>JNIEnv</struct>
13400 </outptr>
13401 <description>
13402 The JNI environment of the event (current) thread.
13403 </description>
13404 </param>
13405 <param id="class_being_redefined">
13406 <jclass/>
13407 <description>
13408 The class being
13409 <functionlink id="RedefineClasses">redefined</functionlink> or
13410 <functionlink id="RetransformClasses">retransformed</functionlink>.
13411 A null pointer if sent by class load.
13412 </description>
13413 </param>
13414 <param id="loader">
13415 <jobject/>
13416 <description>
13417 The class loader loading the class.
13418 A null pointer if the bootstrap class loader.
13419 </description>
13420 </param>
13421 <param id="name">
13422 <vmbuf><char/></vmbuf>
13423 <description>
13424 Name of class being loaded as a VM internal qualified name
13425 (for example, "java/util/List"), encoded as a
13426 <internallink id="mUTF">modified UTF-8</internallink> string.
13427 Note: if the class is defined with a null pointer name,
13428 <code>name</code> will be null.
13429 </description>
13430 </param>
13431 <param id="protection_domain">
13432 <jobject/>
13433 <description>
13434 The <code>ProtectionDomain</code> of the class.
13435 </description>
13436 </param>
13437 <param id="class_data_len">
13438 <jint/>
13439 <description>
13440 Length of current class file data buffer.
13441 </description>
13442 </param>
13443 <param id="class_data">
13444 <vmbuf><uchar/></vmbuf>
13445 <description>
13446 Pointer to the current class file data buffer.
13447 </description>
13448 </param>
13449 <param id="new_class_data_len">
13450 <outptr><jint/></outptr>
13451 <description>
13452 Pointer to the length of the new class file data buffer.
13453 </description>
13454 </param>
13455 <param id="new_class_data">
13456 <agentbuf incount="new_class_data_len"><uchar/></agentbuf>
13457 <description>
13458 Pointer to the pointer to the instrumented class file data buffer.
13459 </description>
13460 </param>
13461 </parameters>
13462 </event>
13463
13464 <event label="VM Start Event"
13465 id="VMStart" const="JVMTI_EVENT_VM_START" num="57" phase="start">
13466 <description>
13467 The VM start event signals the start of the VM.
13468 At this time JNI is live but the VM is not yet fully initialized.
13469 Once this event is generated, the agent is free to call any JNI function.
13470 This event signals the beginning of the start phase,
13471 <jvmti/> functions permitted in the start phase may be called.
13472 <p/>
13473 The timing of this event may depend on whether the agent has added the
13474 <internallink id="jvmtiCapabilities.can_generate_early_vmstart">
13475 <code>can_generate_early_vmstart</code></internallink> capability or not.
13476 If the capability has been added then the VM posts the event as early
13477 as possible. The VM is capable of executing bytecode but it may not have
13478 initialized to the point where it can load classes in modules other than
13479 <code>java.base</code>, or even arbitrary classes in <code>java.base</code>.
13480 Agents that do load-time instrumentation in this
13481 phase must take great care when instrumenting code that potentially
13482 executes in this phase. Extreme care should also be taken with JNI
13483 <code>FindClass</code> as it may not be possible to load classes and attempts
13484 to do so may result in unpredictable behavior, maybe even stability issues
13485 on some VM implementations.
13486 If the capability has not been added then the VM delays posting this
13487 event until it is capable of loading classes in modules other than
13488 <code>java.base</code> or the VM has completed its initialization.
13489 Agents that create more than one JVM TI environment, where the
13490 capability is added to some but not all environments, may observe the
13491 start phase beginning earlier in the JVM TI environments that possess
13492 the capability.
13493 <p/>
13494 In the case of VM start-up failure, this event will not be sent.
13495 </description>
13496 <origin>jvmdi</origin>
13497 <capabilities>
13498 </capabilities>
13499 <parameters>
13500 <param id="jni_env">
13501 <outptr>
13502 <struct>JNIEnv</struct>
13503 </outptr>
13504 <description>
13505 The JNI environment of the event (current) thread.
13506 </description>
13507 </param>
13508 </parameters>
13509 </event>
13510
13511 <event label="VM Initialization Event"
13512 id="VMInit" const="JVMTI_EVENT_VM_INIT" num="50">
13513 <description>
13514 The VM initialization event signals the completion of VM initialization. Once
13515 this event is generated, the agent is free to call any JNI or <jvmti/>
13516 function. The VM initialization event can be preceded by or can be concurrent
13517 with other events, but
13518 the preceding events should be handled carefully, if at all, because the
13519 VM has not completed its initialization. The thread start event for the
13520 main application thread is guaranteed not to occur until after the
13521 handler for the VM initialization event returns.
13522 <p/>
13523 In the case of VM start-up failure, this event will not be sent.
13524 </description>
13525 <origin>jvmdi</origin>
13526 <capabilities>
13527 </capabilities>
13528 <parameters>
13529 <param id="jni_env">
13530 <outptr>
13531 <struct>JNIEnv</struct>
13532 </outptr>
13533 <description>
13534 The JNI environment of the event (current) thread.
13535 </description>
13536 </param>
13537 <param id="thread">
13538 <jthread/>
13539 <description>
13540 The initial thread
13541 </description>
13542 </param>
13543 </parameters>
13544 </event>
13545
13546 <event label="VM Death Event"
13547 id="VMDeath" const="JVMTI_EVENT_VM_DEATH" num="51">
13548 <description>
13549 The VM death event notifies the agent of the termination of the VM.
13550 No events will occur after the VMDeath event.
13551 <p/>
13552 In the case of VM start-up failure, this event will not be sent.
13553 Note that <internallink id="onunload">Agent_OnUnload</internallink>
13554 will still be called in these cases.
13555 </description>
13556 <origin>jvmdi</origin>
13557 <capabilities>
13558 </capabilities>
13559 <parameters>
13560 <param id="jni_env">
13561 <outptr>
13562 <struct>JNIEnv</struct>
13563 </outptr>
13564 <description>
13565 The JNI environment of the event (current) thread
13566 </description>
13567 </param>
13568 </parameters>
13569 </event>
13570
13571 <event label="Compiled Method Load" phase="start"
13572 id="CompiledMethodLoad" const="JVMTI_EVENT_COMPILED_METHOD_LOAD" num="68">
13573 <description>
13574 Sent when a method is compiled and loaded into memory by the VM.
13575 If it is unloaded, the <eventlink id="CompiledMethodUnload"/> event is sent.
13576 If it is moved, the <eventlink id="CompiledMethodUnload"/> event is sent,
13577 followed by a new <code>CompiledMethodLoad</code> event.
13578 Note that a single method may have multiple compiled forms, and that
13579 this event will be sent for each form.
13580 Note also that several methods may be inlined into a single
13581 address range, and that this event will be sent for each method.
13582 <p/>
13583 These events can be sent after their initial occurrence with
13584 <functionlink id="GenerateEvents"></functionlink>.
13585 </description>
13586 <origin>jvmpi</origin>
13587 <typedef id="jvmtiAddrLocationMap" label="Native address to location entry">
13588 <field id="start_address">
13589 <vmbuf><void/></vmbuf>
13590 <description>
13591 Starting native address of code corresponding to a location
13592 </description>
13593 </field>
13594 <field id="location">
13595 <jlocation/>
13596 <description>
13597 Corresponding location. See
13598 <functionlink id="GetJLocationFormat"></functionlink>
13599 for the meaning of location.
13600 </description>
13601 </field>
13602 </typedef>
13603 <capabilities>
13604 <required id="can_generate_compiled_method_load_events"></required>
13605 </capabilities>
13606 <parameters>
13607 <param id="klass">
13608 <jclass method="method"/>
13609 <description>
13610 Class of the method being compiled and loaded
13611 </description>
13612 </param>
13613 <param id="method">
13614 <jmethodID class="klass"/>
13615 <description>
13616 Method being compiled and loaded
13617 </description>
13618 </param>
13619 <param id="code_size">
13620 <jint/>
13621 <description>
13622 Size of compiled code
13623 </description>
13624 </param>
13625 <param id="code_addr">
13626 <vmbuf><void/></vmbuf>
13627 <description>
13628 Address where compiled method code is loaded
13629 </description>
13630 </param>
13631 <param id="map_length">
13632 <jint/>
13633 <description>
13634 Number of <typelink id="jvmtiAddrLocationMap"></typelink>
13635 entries in the address map.
13636 Zero if mapping information cannot be supplied.
13637 </description>
13638 </param>
13639 <param id="map">
13640 <vmbuf><struct>jvmtiAddrLocationMap</struct></vmbuf>
13641 <description>
13642 Map from native addresses to location.
13643 The native address range of each entry is from
13644 <fieldlink id="start_address" struct="jvmtiAddrLocationMap"></fieldlink>
13645 to <code>start_address-1</code> of the next entry.
13646 A null pointer if mapping information cannot be supplied.
13647 </description>
13648 </param>
13649 <param id="compile_info">
13650 <vmbuf><void/></vmbuf>
13651 <description>
13652 VM-specific compilation information.
13653 The referenced compile information is managed by the VM
13654 and must not depend on the agent for collection.
13655 A VM implementation defines the content and lifetime
13656 of the information.
13657 </description>
13658 </param>
13659 </parameters>
13660 </event>
13661
13662 <event label="Compiled Method Unload" phase="start"
13663 id="CompiledMethodUnload" const="JVMTI_EVENT_COMPILED_METHOD_UNLOAD" num="69">
13664 <description>
13665 Sent when a compiled method is unloaded from memory.
13666 This event might not be sent on the thread which performed the unload.
13667 This event may be sent sometime after the unload occurs, but
13668 will be sent before the memory is reused
13669 by a newly generated compiled method. This event may be sent after
13670 the class is unloaded.
13671 </description>
13672 <origin>jvmpi</origin>
13673 <capabilities>
13674 <required id="can_generate_compiled_method_load_events"></required>
13675 </capabilities>
13676 <parameters>
13677 <param id="klass">
13678 <jclass method="method"/>
13679 <description>
13680 Class of the compiled method being unloaded.
13681 </description>
13682 </param>
13683 <param id="method">
13684 <jmethodID class="klass"/>
13685 <description>
13686 Compiled method being unloaded.
13687 For identification of the compiled method only -- the class
13688 may be unloaded and therefore the method should not be used
13689 as an argument to further JNI or <jvmti/> functions.
13690 </description>
13691 </param>
13692 <param id="code_addr">
13693 <vmbuf><void/></vmbuf>
13694 <description>
13695 Address where compiled method code was loaded.
13696 For identification of the compiled method only --
13697 the space may have been reclaimed.
13698 </description>
13699 </param>
13700 </parameters>
13701 </event>
13702
13703 <event label="Dynamic Code Generated" phase="any"
13704 id="DynamicCodeGenerated" const="JVMTI_EVENT_DYNAMIC_CODE_GENERATED" num="70">
13705 <description>
13706 Sent when a component of the virtual machine is generated dynamically.
13707 This does not correspond to Java programming language code that is
13708 compiled--see <eventlink id="CompiledMethodLoad"></eventlink>.
13709 This is for native code--for example, an interpreter that is generated
13710 differently depending on command-line options.
13711 <p/>
13712 Note that this event has no controlling capability.
13713 If a VM cannot generate these events, it simply does not send any.
13714 <p/>
13715 These events can be sent after their initial occurrence with
13716 <functionlink id="GenerateEvents"></functionlink>.
13717 </description>
13718 <origin>jvmpi</origin>
13719 <capabilities>
13720 </capabilities>
13721 <parameters>
13722 <param id="name">
13723 <vmbuf><char/></vmbuf>
13724 <description>
13725 Name of the code, encoded as a
13726 <internallink id="mUTF">modified UTF-8</internallink> string.
13727 Intended for display to an end-user.
13728 The name might not be unique.
13729 </description>
13730 </param>
13731 <param id="address">
13732 <vmbuf><void/></vmbuf>
13733 <description>
13734 Native address of the code
13735 </description>
13736 </param>
13737 <param id="length">
13738 <jint/>
13739 <description>
13740 Length in bytes of the code
13741 </description>
13742 </param>
13743 </parameters>
13744 </event>
13745
13746 <event label="Data Dump Request"
13747 id="DataDumpRequest" const="JVMTI_EVENT_DATA_DUMP_REQUEST" num="71">
13748 <description>
13749 Sent by the VM to request the agent to dump its data. This
13750 is just a hint and the agent need not react to this event.
13751 This is useful for processing command-line signals from users. For
13752 example, in the Java 2 SDK a CTRL-Break on Win32 and a CTRL-\ on Linux
13753 causes the VM to send this event to the agent.
13754 </description>
13755 <origin>jvmpi</origin>
13756 <capabilities>
13757 </capabilities>
13758 <parameters>
13759 </parameters>
13760 </event>
13761
13762 <event label="Monitor Contended Enter"
13763 id="MonitorContendedEnter" const="JVMTI_EVENT_MONITOR_CONTENDED_ENTER" filtered="thread" num="75">
13764 <description>
13765 Sent when a thread is attempting to enter a Java programming language
13766 monitor already acquired by another thread.
13767 </description>
13768 <origin>jvmpi</origin>
13769 <capabilities>
13770 <required id="can_generate_monitor_events"></required>
13771 </capabilities>
13772 <parameters>
13773 <param id="jni_env">
13774 <outptr>
13775 <struct>JNIEnv</struct>
13776 </outptr>
13777 <description>
13778 The JNI environment of the event (current) thread
13779 </description>
13780 </param>
13781 <param id="thread">
13782 <jthread/>
13783 <description>
13784 JNI local reference to the thread
13785 attempting to enter the monitor
13786 </description>
13787 </param>
13788 <param id="object">
13789 <jobject/>
13790 <description>
13791 JNI local reference to the monitor
13792 </description>
13793 </param>
13794 </parameters>
13795 </event>
13796
13797 <event label="Monitor Contended Entered"
13798 id="MonitorContendedEntered" const="JVMTI_EVENT_MONITOR_CONTENDED_ENTERED" filtered="thread" num="76">
13799 <description>
13800 Sent when a thread enters a Java programming language
13801 monitor after waiting for it to be released by another thread.
13802 </description>
13803 <origin>jvmpi</origin>
13804 <capabilities>
13805 <required id="can_generate_monitor_events"></required>
13806 </capabilities>
13807 <parameters>
13808 <param id="jni_env">
13809 <outptr>
13810 <struct>JNIEnv</struct>
13811 </outptr>
13812 <description>
13813 The JNI environment of the event (current) thread
13814 </description>
13815 </param>
13816 <param id="thread">
13817 <jthread/>
13818 <description>
13819 JNI local reference to the thread entering
13820 the monitor
13821 </description>
13822 </param>
13823 <param id="object">
13824 <jobject/>
13825 <description>
13826 JNI local reference to the monitor
13827 </description>
13828 </param>
13829 </parameters>
13830 </event>
13831
13832 <event label="Monitor Wait"
13833 id="MonitorWait" const="JVMTI_EVENT_MONITOR_WAIT" filtered="thread" num="73">
13834 <description>
13835 Sent when a thread is about to wait on an object.
13836 </description>
13837 <origin>jvmpi</origin>
13838 <capabilities>
13839 <required id="can_generate_monitor_events"></required>
13840 </capabilities>
13841 <parameters>
13842 <param id="jni_env">
13843 <outptr>
13844 <struct>JNIEnv</struct>
13845 </outptr>
13846 <description>
13847 The JNI environment of the event (current) thread
13848 </description>
13849 </param>
13850 <param id="thread">
13851 <jthread/>
13852 <description>
13853 JNI local reference to the thread about to wait
13854 </description>
13855 </param>
13856 <param id="object">
13857 <jobject/>
13858 <description>
13859 JNI local reference to the monitor
13860 </description>
13861 </param>
13862 <param id="timeout">
13863 <jlong/>
13864 <description>
13865 The number of milliseconds the thread will wait
13866 </description>
13867 </param>
13868 </parameters>
13869 </event>
13870
13871 <event label="Monitor Waited"
13872 id="MonitorWaited" const="JVMTI_EVENT_MONITOR_WAITED" filtered="thread" num="74">
13873 <description>
13874 Sent when a thread finishes waiting on an object.
13875 </description>
13876 <origin>jvmpi</origin>
13877 <capabilities>
13878 <required id="can_generate_monitor_events"></required>
13879 </capabilities>
13880 <parameters>
13881 <param id="jni_env">
13882 <outptr>
13883 <struct>JNIEnv</struct>
13884 </outptr>
13885 <description>
13886 The JNI environment of the event (current) thread
13887 </description>
13888 </param>
13889 <param id="thread">
13890 <jthread/>
13891 <description>
13892 JNI local reference to the thread that was finished waiting
13893 </description>
13894 </param>
13895 <param id="object">
13896 <jobject/>
13897 <description>
13898 JNI local reference to the monitor.
13899 </description>
13900 </param>
13901 <param id="timed_out">
13902 <jboolean/>
13903 <description>
13904 True if the monitor timed out
13905 </description>
13906 </param>
13907 </parameters>
13908 </event>
13909
13910 <event label="Resource Exhausted"
13911 id="ResourceExhausted" const="JVMTI_EVENT_RESOURCE_EXHAUSTED" num="80"
13912 since="1.1">
13913 <description>
13914 Sent when a VM resource needed by a running application has been exhausted.
13915 Except as required by the optional capabilities, the set of resources
13916 which report exhaustion is implementation dependent.
13917 <p/>
13918 The following bit flags define the properties of the resource exhaustion:
13919 <constants id="jvmtiResourceExhaustionFlags"
13920 label="Resource Exhaustion Flags"
13921 kind="bits"
13922 since="1.1">
13923 <constant id="JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR" num="0x0001">
13924 After this event returns, the VM will throw a
13925 <code>java.lang.OutOfMemoryError</code>.
13926 </constant>
13927 <constant id="JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP" num="0x0002">
13928 The VM was unable to allocate memory from the <tm>Java</tm>
13929 platform <i>heap</i>.
13930 The <i>heap</i> is the runtime
13931 data area from which memory for all class instances and
13932 arrays are allocated.
13933 </constant>
13934 <constant id="JVMTI_RESOURCE_EXHAUSTED_THREADS" num="0x0004">
13935 The VM was unable to create a thread.
13936 </constant>
13937 </constants>
13938 </description>
13939 <origin>new</origin>
13940 <capabilities>
13941 <capability id="can_generate_resource_exhaustion_heap_events">
13942 Can generate events when the VM is unable to allocate memory from the
13943 <internallink id="JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP">heap</internallink>.
13944 </capability>
13945 <capability id="can_generate_resource_exhaustion_threads_events">
13946 Can generate events when the VM is unable to
13947 <internallink id="JVMTI_RESOURCE_EXHAUSTED_THREADS">create
13948 a thread</internallink>.
13949 </capability>
13950 </capabilities>
13951 <parameters>
13952 <param id="jni_env">
13953 <outptr>
13954 <struct>JNIEnv</struct>
13955 </outptr>
13956 <description>
13957 The JNI environment of the event (current) thread
13958 </description>
13959 </param>
13960 <param id="flags">
13961 <jint/>
13962 <description>
13963 Flags defining the properties of the of resource exhaustion
13964 as specified by the
13965 <internallink id="jvmtiResourceExhaustionFlags">Resource
13966 Exhaustion Flags</internallink>.
13967 </description>
13968 </param>
13969 <param id="reserved">
13970 <vmbuf><void/></vmbuf>
13971 <description>
13972 Reserved.
13973 </description>
13974 </param>
13975 <param id="description">
13976 <vmbuf><char/></vmbuf>
13977 <description>
13978 Description of the resource exhaustion, encoded as a
13979 <internallink id="mUTF">modified UTF-8</internallink> string.
13980 </description>
13981 </param>
13982 </parameters>
13983 </event>
13984
13985 <event label="VM Object Allocation"
13986 id="VMObjectAlloc" const="JVMTI_EVENT_VM_OBJECT_ALLOC" num="84">
13987 <description>
13988 Sent when a method causes the virtual machine to directly allocate an
13989 Object visible to Java programming language code.
13990 Generally object allocation should be detected by instrumenting
13991 the bytecodes of allocating methods.
13992 Object allocation generated in native code by JNI function
13993 calls should be detected using
13994 <internallink id="jniIntercept">JNI function interception</internallink>.
13995 Some methods might not have associated bytecodes and are not
13996 native methods, they instead are executed directly by the
13997 VM. These methods should send this event.
13998 Virtual machines which are incapable of bytecode instrumentation
13999 for some or all of their methods can send this event.
14000 When preview features are enabled and the allocated object has no identity,
14001 <code>null</code> is passed for the <paramlink id="object"></paramlink> parameter.
14002
14003 Note that the <internallink
14004 id="SampledObjectAlloc">SampledObjectAlloc</internallink>
14005 event is triggered on all Java object allocations, including those
14006 caused by bytecode method execution, JNI method execution, and
14007 directly by VM methods.
14008 <p/>
14009 Typical examples where this event might be sent:
14010 <ul>
14011 <li>Reflection -- for example, <code>java.lang.Class.newInstance()</code></li>
14012 <li>Methods not represented by bytecodes -- for example, VM intrinsics and
14013 J2ME preloaded classes</li>
14014 </ul>
14015 Cases where this event would not be generated:
14016 <ul>
14017 <li>Allocation due to bytecodes -- for example, the <code>new</code>
14018 and <code>newarray</code> VM instructions</li>
14019 <li>Allocation due to JNI function calls -- for example,
14020 <code>AllocObject</code></li>
14021 <li>Allocations during VM initialization</li>
14022 <li>VM internal objects</li>
14023 </ul>
14024 </description>
14025 <origin>new</origin>
14026 <capabilities>
14027 <required id="can_generate_vm_object_alloc_events"></required>
14028 </capabilities>
14029 <parameters>
14030 <param id="jni_env">
14031 <outptr>
14032 <struct>JNIEnv</struct>
14033 </outptr>
14034 <description>
14035 The JNI environment of the event (current) thread
14036 </description>
14037 </param>
14038 <param id="thread">
14039 <jthread/>
14040 <description>
14041 Thread allocating the object.
14042 </description>
14043 </param>
14044 <param id="object">
14045 <jobject/>
14046 <description>
14047 JNI local reference to the object that was allocated.
14048 Null when preview features are enabled and the allocated object has no identity.
14049 </description>
14050 </param>
14051 <param id="object_klass">
14052 <jclass/>
14053 <description>
14054 JNI local reference to the class of the object.
14055 </description>
14056 </param>
14057 <param id="size">
14058 <jlong/>
14059 <description>
14060 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>.
14061 </description>
14062 </param>
14063 </parameters>
14064 </event>
14065
14066 <event label="Sampled Object Allocation"
14067 id="SampledObjectAlloc" const="JVMTI_EVENT_SAMPLED_OBJECT_ALLOC" filtered="thread" num="86" since="11">
14068 <description>
14069 Sent when an allocated object is sampled.
14070 By default, the sampling interval is set to 512KB. The sampling is semi-random to avoid
14071 pattern-based bias and provides an approximate overall average interval over long periods of
14072 sampling.
14073 <p/>
14074 Each thread tracks how many bytes it has allocated since it sent the last event.
14075 When the number of bytes exceeds the sampling interval, it will send another event.
14076 This implies that, on average, one object will be sampled every time a thread has
14077 allocated 512KB bytes since the last sample.
14078 <p/>
14079 Note that the sampler is pseudo-random: it will not sample every 512KB precisely.
14080 The goal of this is to ensure high quality sampling even if allocation is
14081 happening in a fixed pattern (i.e., the same set of objects are being allocated
14082 every 512KB).
14083 <p/>
14084 If another sampling interval is required, the user can call
14085 <functionlink id="SetHeapSamplingInterval"></functionlink> with a strictly positive integer value,
14086 representing the new sampling interval.
14087 <p/>
14088 This event is sent once the sampled allocation has been performed. It provides the object, stack trace
14089 of the allocation, the thread allocating, the size of allocation, and the object's class.
14090 <p/>
14091 A typical use case of this system is to determine where heap allocations originate.
14092 In conjunction with weak references and the function
14093 <functionlink id="GetStackTrace"></functionlink>, a user can track which objects were allocated from which
14094 stack trace, and which are still live during the execution of the program.
14095 When preview features are enabled and the allocated object has no identity,
14096 <code>null</code> is passed for the <paramlink id="object"></paramlink> parameter.
14097 Note that weak references support identity objects only.
14098 </description>
14099 <origin>new</origin>
14100 <capabilities>
14101 <required id="can_generate_sampled_object_alloc_events"></required>
14102 </capabilities>
14103 <parameters>
14104 <param id="jni_env">
14105 <outptr>
14106 <struct>JNIEnv</struct>
14107 </outptr>
14108 <description>
14109 The JNI environment of the event (current) thread.
14110 </description>
14111 </param>
14112 <param id="thread">
14113 <jthread/>
14114 <description>
14115 Thread allocating the object.
14116 </description>
14117 </param>
14118 <param id="object">
14119 <jobject/>
14120 <description>
14121 JNI local reference to the object that was allocated.
14122 Null when preview features are enabled and the allocated object has no identity.
14123 </description>
14124 </param>
14125 <param id="object_klass">
14126 <jclass/>
14127 <description>
14128 JNI local reference to the class of the object
14129 </description>
14130 </param>
14131 <param id="size">
14132 <jlong/>
14133 <description>
14134 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>.
14135 </description>
14136 </param>
14137 </parameters>
14138 </event>
14139
14140 <event label="Object Free"
14141 id="ObjectFree" const="JVMTI_EVENT_OBJECT_FREE" num="83">
14142 <description>
14143 An Object Free event is sent when the garbage collector frees an object.
14144 Events are only sent for tagged objects--see
14145 <internallink id="Heap">heap functions</internallink>.
14146 <p/>
14147 The event handler must not use JNI functions and
14148 must not use <jvmti/> functions except those which
14149 specifically allow such use (see the raw monitor, memory management,
14150 and environment local storage functions).
14151 When preview features are enabled, this event does not support value object allocations.
14152 </description>
14153 <origin>new</origin>
14154 <capabilities>
14155 <required id="can_generate_object_free_events"></required>
14156 </capabilities>
14157 <parameters>
14158 <param id="tag">
14159 <jlong/>
14160 <description>
14161 The freed object's tag
14162 </description>
14163 </param>
14164 </parameters>
14165 </event>
14166
14167 <event label="Garbage Collection Start"
14168 id="GarbageCollectionStart" const="JVMTI_EVENT_GARBAGE_COLLECTION_START" num="81">
14169 <description>
14170 A Garbage Collection Start event is sent when a
14171 garbage collection pause begins.
14172 Only stop-the-world collections are reported--that is, collections during
14173 which all threads cease to modify the state of the Java virtual machine.
14174 This means that some collectors will never generate these events.
14175 This event is sent while the VM is still stopped, thus
14176 the event handler must not use JNI functions and
14177 must not use <jvmti/> functions except those which
14178 specifically allow such use (see the raw monitor, memory management,
14179 and environment local storage functions).
14180 <p/>
14181 This event is always sent as a matched pair with
14182 <eventlink id="GarbageCollectionFinish"/>
14183 (assuming both events are enabled) and no garbage collection
14184 events will occur between them.
14185 </description>
14186 <origin>new</origin>
14187 <capabilities>
14188 <required id="can_generate_garbage_collection_events"></required>
14189 </capabilities>
14190 <parameters>
14191 </parameters>
14192 </event>
14193
14194 <event label="Garbage Collection Finish"
14195 id="GarbageCollectionFinish" const="JVMTI_EVENT_GARBAGE_COLLECTION_FINISH" num="82">
14196 <description>
14197 A Garbage Collection Finish event is sent when a
14198 garbage collection pause ends.
14199 This event is sent while the VM is still stopped, thus
14200 the event handler must not use JNI functions and
14201 must not use <jvmti/> functions except those which
14202 specifically allow such use (see the raw monitor, memory management,
14203 and environment local storage functions).
14204 <p/>
14205 Some agents may need to do post garbage collection operations that
14206 require the use of the disallowed <jvmti/> or JNI functions. For these
14207 cases an agent thread can be created which waits on a raw monitor,
14208 and the handler for the Garbage Collection Finish event simply
14209 notifies the raw monitor
14210 <p/>
14211 This event is always sent as a matched pair with
14212 <eventlink id="GarbageCollectionStart"/> (assuming both events are enabled).
14213 <issue>
14214 The most important use of this event is to provide timing information,
14215 and thus additional information is not required. However,
14216 information about the collection which is "free" should be included -
14217 what that information is needs to be determined.
14218 </issue>
14219 </description>
14220 <origin>new</origin>
14221 <capabilities>
14222 <required id="can_generate_garbage_collection_events"></required>
14223 </capabilities>
14224 <parameters>
14225 </parameters>
14226 </event>
14227
14228 <elide>
14229 <event label="Verbose Output" phase="any"
14230 id="VerboseOutput" const="JVMTI_EVENT_VERBOSE_OUTPUT" num="85">
14231 <description>
14232 Send verbose messages as strings.
14233 <issue>
14234 This format is extremely fragile, as it can change with each
14235 platform, collector and version. Alternatives include:
14236 <ul>
14237 <li>building off Java programming language M and M APIs</li>
14238 <li>XML</li>
14239 <li>key/value pairs</li>
14240 <li>removing it</li>
14241 </ul>
14242 </issue>
14243 <issue>
14244 Though this seemed trivial to implement.
14245 In the RI it appears this will be quite complex.
14246 </issue>
14247 </description>
14248 <origin>new</origin>
14249 <capabilities>
14250 </capabilities>
14251 <parameters>
14252 <param id="flag">
14253 <enum>jvmtiVerboseFlag</enum>
14254 <description>
14255 Which verbose output is being sent.
14256 </description>
14257 </param>
14258 <param id="message">
14259 <vmbuf><char/></vmbuf>
14260 <description>
14261 Message text, encoded as a
14262 <internallink id="mUTF">modified UTF-8</internallink> string.
14263 </description>
14264 </param>
14265 </parameters>
14266 </event>
14267 </elide>
14268
14269 </eventsection>
14270
14271 <datasection>
14272 <intro>
14273 <jvmti/> extends the data types defined by JNI.
14274 </intro>
14275 <basetypes id="jniTypes" label="JNI Types Used in the JVM Tool Interface">
14276 <basetype id="jboolean">
14277 <description>
14278 Holds a Java programming language <code>boolean</code>.
14279 Unsigned 8 bits.
14280 </description>
14281 </basetype>
14282 <basetype id="jchar">
14283 <description>
14284 Holds a Java programming language <code>char</code>.
14285 Unsigned 16 bits.
14286 </description>
14287 </basetype>
14288 <basetype id="jint">
14289 <description>
14290 Holds a Java programming language <code>int</code>.
14291 Signed 32 bits.
14292 </description>
14293 </basetype>
14294 <basetype id="jlong">
14295 <description>
14296 Holds a Java programming language <code>long</code>.
14297 Signed 64 bits.
14298 </description>
14299 </basetype>
14300 <basetype id="jfloat">
14301 <description>
14302 Holds a Java programming language <code>float</code>.
14303 32 bits.
14304 </description>
14305 </basetype>
14306 <basetype id="jdouble">
14307 <description>
14308 Holds a Java programming language <code>double</code>.
14309 64 bits.
14310 </description>
14311 </basetype>
14312 <basetype id="jobject">
14313 <description>
14314 Holds a Java programming language object.
14315 </description>
14316 </basetype>
14317 <basetype id="jclass">
14318 <description>
14319 Holds a Java programming language class.
14320 </description>
14321 </basetype>
14322 <basetype id="jvalue">
14323 <description>
14324 Is a union of all primitive types and <code>jobject</code>. Thus, holds any Java
14325 programming language value.
14326 </description>
14327 </basetype>
14328 <basetype id="jfieldID">
14329 <description>
14330 Identifies a Java programming language field.
14331 <code>jfieldID</code>s returned by <jvmti/> functions and events may be
14332 safely stored.
14333 </description>
14334 </basetype>
14335 <basetype id="jmethodID">
14336 <description>
14337 Identifies a Java programming language method, initializer, or constructor.
14338 <code>jmethodID</code>s returned by <jvmti/> functions and events may be
14339 safely stored. However, if the class is unloaded, they become invalid
14340 and must not be used.
14341 </description>
14342 </basetype>
14343 <basetype id="JNIEnv">
14344 <description>
14345 Pointer to the JNI function table. Pointer to this (<code>JNIEnv *</code>)
14346 is a JNI environment.
14347 </description>
14348 </basetype>
14349 </basetypes>
14350
14351 <basetypes id="jvmtiTypes" label="JVM Tool Interface Base Types">
14352 <basetype id="jvmtiEnv">
14353 <description>
14354 The <jvmti/> <internallink id="environments">environment</internallink> pointer.
14355 See the <internallink id="FunctionSection">Function Section</internallink>.
14356 <code>jvmtiEnv</code> points to the
14357 <internallink id="FunctionTable">function table</internallink> pointer.
14358 </description>
14359 </basetype>
14360 <basetype id="jthread">
14361 <definition>typedef jobject jthread;</definition>
14362 <description>
14363 Subtype of <datalink id="jobject"></datalink> that holds a thread.
14364 </description>
14365 </basetype>
14366 <basetype id="jthreadGroup">
14367 <definition>typedef jobject jthreadGroup;</definition>
14368 <description>
14369 Subtype of <datalink id="jobject"></datalink> that holds a thread group.
14370 </description>
14371 </basetype>
14372 <basetype id="jlocation">
14373 <definition>typedef jlong jlocation;</definition>
14374 <description>
14375 A 64 bit value, representing a monotonically increasing
14376 executable position within a method.
14377 <code>-1</code> indicates a native method.
14378 See <functionlink id="GetJLocationFormat"></functionlink> for the format on a
14379 given VM.
14380 </description>
14381 </basetype>
14382 <basetype id="jrawMonitorID">
14383 <definition>struct _jrawMonitorID;
14384 typedef struct _jrawMonitorID *jrawMonitorID;</definition>
14385 <description>
14386 A raw monitor.
14387 </description>
14388 </basetype>
14389 <basetype id="jvmtiError">
14390 <description>
14391 Holds an error return code.
14392 See the <internallink id="ErrorSection">Error section</internallink> for possible values.
14393 <example>
14394 typedef enum {
14395 JVMTI_ERROR_NONE = 0,
14396 JVMTI_ERROR_INVALID_THREAD = 10,
14397 ...
14398 } jvmtiError;
14399 </example>
14400 </description>
14401 </basetype>
14402 <basetype id="jvmtiEvent">
14403 <description>
14404 An identifier for an event type.
14405 See the <internallink id="EventSection">Event section</internallink> for possible values.
14406 It is guaranteed that future versions of this specification will
14407 never assign zero as an event type identifier.
14408 <example>
14409 typedef enum {
14410 JVMTI_EVENT_SINGLE_STEP = 1,
14411 JVMTI_EVENT_BREAKPOINT = 2,
14412 ...
14413 } jvmtiEvent;
14414 </example>
14415 </description>
14416 </basetype>
14417 <basetype id="jvmtiEventCallbacks" name="eventCallbacks">
14418 <description>
14419 The callbacks used for events.
14420 <example>
14421 typedef struct {
14422 jvmtiEventVMInit VMInit;
14423 jvmtiEventVMDeath VMDeath;
14424 ...
14425 } jvmtiEventCallbacks;
14426 </example>
14427 See <internallink id="jvmtiEventCallbacks">event callbacks</internallink>
14428 for the complete structure.
14429 <p/>
14430 Where, for example, the VM initialization callback is defined:
14431 <example>
14432 typedef void (JNICALL *jvmtiEventVMInit)
14433 (jvmtiEnv *jvmti_env,
14434 JNIEnv* jni_env,
14435 jthread thread);
14436 </example>
14437 See the individual events for the callback function definition.
14438 </description>
14439 </basetype>
14440 <basetype id="jniNativeInterface">
14441 <definition>typedef struct JNINativeInterface_ jniNativeInterface;</definition>
14442 <description>
14443 Typedef for the JNI function table <code>JNINativeInterface</code>
14444 defined in the
14445 <externallink id="jni/functions.html#interface-function-table">
14446 JNI Specification</externallink>.
14447 The JNI reference implementation defines this with an underscore.
14448 </description>
14449 </basetype>
14450 </basetypes>
14451
14452 </datasection>
14453
14454 <issuessection label="Issues">
14455 <intro id="suspendRequired" label="Resolved Issue: Suspend - Required or Automatic">
14456 JVMDI requires that the agent suspend threads before calling
14457 certain sensitive functions. JVMPI requires garbage collection to be
14458 disabled before calling certain sensitive functions.
14459 It was suggested that rather than have this requirement, that
14460 VM place itself in a suitable state before performing an
14461 operation. This makes considerable sense since each VM
14462 knows its requirements and can most easily arrange a
14463 safe state.
14464 <p/>
14465 The ability to externally suspend/resume threads will, of
14466 course, remain. The ability to enable/disable garbage collection will not.
14467 <p/>
14468 This issue is resolved--suspend will not
14469 be required. The spec has been updated to reflect this.
14470 </intro>
14471
14472 <intro id="stackSampling" label="Resolved Issue: Call Stack Sampling">
14473 There are a variety of approaches to sampling call stacks.
14474 The biggest bifurcation is between VM controlled and agent
14475 controlled.
14476 <p/>
14477 This issue is resolved--agent controlled
14478 sampling will be the approach.
14479 </intro>
14480
14481 <intro id="threadRepresentation" label="Resolved Issue: Thread Representation">
14482 JVMDI represents threads as jthread. JVMPI primarily
14483 uses JNIEnv* to represent threads.
14484 <p/>
14485 The Expert Group has chosen jthread as the representation
14486 for threads in <jvmti/>.
14487 JNIEnv* is sent by
14488 events since it is needed to JNI functions. JNIEnv, per the
14489 JNI spec, are not supposed to be used outside their thread.
14490 </intro>
14491
14492 <intro id="design" label="Resolved Issue: Method Representation">
14493 The JNI spec allows an implementation to depend on jclass/jmethodID
14494 pairs, rather than simply a jmethodID, to reference a method.
14495 JVMDI, for consistency, choose the same representation.
14496 JVMPI, however, specifies that a jmethodID alone maps to a
14497 method. Both of the Sun <tm>J2SE</tm> virtual machines (Classic and <tm>HotSpot</tm>) store
14498 pointers in jmethodIDs, and as a result, a jmethodID is sufficient.
14499 In fact, any JVM implementation that supports JVMPI must have
14500 such a representation.
14501 <jvmti/> will use jmethodID as a unique representation of a method
14502 (no jclass is used).
14503 There should be efficiency gains, particularly in
14504 functionality like stack dumping, to this representation.
14505 <p/>
14506 Note that fields were not used in JVMPI and that the access profile
14507 of fields differs from methods--for implementation efficiency
14508 reasons, a jclass/jfieldID pair will still be needed for field
14509 reference.
14510 </intro>
14511
14512 <intro id="localReferenceIssue" label="Resolved Issue: Local References">
14513 Functions return local references.
14514 </intro>
14515
14516 <intro id="frameRep" label="Resolved Issue: Representation of frames">
14517 In JVMDI, a frame ID is used to represent a frame. Problem with this
14518 is that a VM must track when a frame becomes invalid, a far better
14519 approach, and the one used in <jvmti/>, is to reference frames by depth.
14520 </intro>
14521
14522 <intro id="requiredCapabilities" label="Issue: Required Capabilities">
14523 Currently, having a required capabilities means that the functionality
14524 is optional. Capabilities are useful even for required functionality
14525 since they can inform the VM is needed set-up. Thus, there should be
14526 a set of capabilities that a conformant implementation must provide
14527 (if requested during Agent_OnLoad).
14528 </intro>
14529
14530 <intro id="taghint" label="Proposal: add tag hint function">
14531 A hint of the percentage of objects that will be tagged would
14532 help the VM pick a good implementation.
14533 </intro>
14534
14535 <intro id="moreMonitorQueries" label="Request: More Monitor Quires">
14536 How difficult or easy would be to extend the monitor_info category to include
14537 <pre>
14538 - current number of monitors
14539 - enumeration of monitors
14540 - enumeration of threads waiting on a given monitor
14541 </pre>
14542 The reason for my question is the fact that current get_monitor_info support
14543 requires the agent to specify a given thread to get the info which is probably
14544 OK in the profiling/debugging space, while in the monitoring space the agent
14545 could be watching the monitor list and then decide which thread to ask for
14546 the info. You might ask why is this important for monitoring .... I think it
14547 can aid in the detection/prediction of application contention caused by hot-locks.
14548 </intro>
14549 </issuessection>
14550
14551 <changehistory id="ChangeHistory" update="09/05/07">
14552 <intro>
14553 The <jvmti/> specification is an evolving document with major, minor,
14554 and micro version numbers.
14555 A released version of the specification is uniquely identified
14556 by its major and minor version.
14557 The functions, events, and capabilities in this specification
14558 indicate a "Since" value which is the major and minor version in
14559 which it was introduced.
14560 The version of the specification implemented by the VM can
14561 be retrieved at runtime with the <functionlink id="GetVersionNumber"/>
14562 function.
14563 </intro>
14564 <change date="14 Nov 2002">
14565 Converted to XML document.
14566 </change>
14567 <change date="14 Nov 2002">
14568 Elided heap dump functions (for now) since what was there
14569 was wrong.
14570 </change>
14571 <change date="18 Nov 2002">
14572 Added detail throughout.
14573 </change>
14574 <change date="18 Nov 2002">
14575 Changed JVMTI_THREAD_STATUS_RUNNING to JVMTI_THREAD_STATUS_RUNNABLE.
14576 </change>
14577 <change date="19 Nov 2002">
14578 Added AsyncGetStackTrace.
14579 </change>
14580 <change date="19 Nov 2002">
14581 Added jframeID return to GetStackTrace.
14582 </change>
14583 <change date="19 Nov 2002">
14584 Elided GetCurrentFrame and GetCallingFrame functions (for now) since what was there
14585 since they are redundant with GetStackTrace.
14586 </change>
14587 <change date="19 Nov 2002">
14588 Elided ClearAllBreakpoints since it has always been redundant.
14589 </change>
14590 <change date="19 Nov 2002">
14591 Added GetSystemProperties.
14592 </change>
14593 <change date="19 Nov 2002">
14594 Changed the thread local storage functions to use jthread.
14595 </change>
14596 <change date="20 Nov 2002">
14597 Added GetJLocationFormat.
14598 </change>
14599 <change date="22 Nov 2002">
14600 Added events and introductory text.
14601 </change>
14602 <change date="22 Nov 2002">
14603 Cross reference type and constant definitions.
14604 </change>
14605 <change date="24 Nov 2002">
14606 Added DTD.
14607 </change>
14608 <change date="24 Nov 2002">
14609 Added capabilities function section.
14610 </change>
14611 <change date="29 Nov 2002">
14612 Assign capabilities to each function and event.
14613 </change>
14614 <change date="29 Nov 2002">
14615 Add <internallink id="jniIntercept">JNI interception functions</internallink>.
14616 </change>
14617 <change date="30 Nov 2002">
14618 Auto generate SetEventNotificationMode capabilities.
14619 </change>
14620 <change date="30 Nov 2002">
14621 Add <eventlink id="VMObjectAlloc"></eventlink> event.
14622 </change>
14623 <change date="30 Nov 2002">
14624 Add <eventlink id="DynamicCodeGenerated"></eventlink> event.
14625 </change>
14626 <change date="30 Nov 2002">
14627 Add const to declarations.
14628 </change>
14629 <change date="30 Nov 2002">
14630 Change method exit and frame pop to send on exception.
14631 </change>
14632 <change date="1 Dec 2002">
14633 Add ForceGarbageCollection.
14634 </change>
14635 <change date="2 Dec 2002">
14636 Redo Xrun section; clarify GetStackTrace and add example;
14637 Fix width problems; use "agent" consistently.
14638 </change>
14639 <change date="8 Dec 2002">
14640 Remove previous start-up intro.
14641 Add <internallink id="environments"><jvmti/> Environments</internallink>
14642 section.
14643 </change>
14644 <change date="8 Dec 2002">
14645 Add <functionlink id="DisposeEnvironment"></functionlink>.
14646 </change>
14647 <change date="9 Dec 2002">
14648 Numerous minor updates.
14649 </change>
14650 <change date="15 Dec 2002">
14651 Add heap profiling functions added:
14652 get/set annotation, iterate live objects/heap.
14653 Add heap profiling functions place holder added:
14654 heap roots.
14655 Heap profiling event added: object free.
14656 Heap profiling event redesigned: vm object allocation.
14657 Heap profiling event placeholders added: garbage collection start/finish.
14658 Native method bind event added.
14659 </change>
14660 <change date="19 Dec 2002">
14661 Revamp suspend/resume functions.
14662 Add origin information with jvmdi tag.
14663 Misc fixes.
14664 </change>
14665 <change date="24 Dec 2002">
14666 Add semantics to types.
14667 </change>
14668 <change date="27 Dec 2002">
14669 Add local reference section.
14670 Autogenerate parameter descriptions from types.
14671 </change>
14672 <change date="28 Dec 2002">
14673 Document that RunAgentThread sends threadStart.
14674 </change>
14675 <change date="29 Dec 2002">
14676 Remove redundant local ref and dealloc warning.
14677 Convert GetRawMonitorName to allocated buffer.
14678 Add GenerateEvents.
14679 </change>
14680 <change date="30 Dec 2002">
14681 Make raw monitors a type and rename to "jrawMonitorID".
14682 </change>
14683 <change date="1 Jan 2003">
14684 Include origin information.
14685 Clean-up JVMDI issue references.
14686 Remove Deallocate warnings which are now automatically generated.
14687 </change>
14688 <change date="2 Jan 2003">
14689 Fix representation issues for jthread.
14690 </change>
14691 <change date="3 Jan 2003">
14692 Make capabilities buffered out to 64 bits - and do it automatically.
14693 </change>
14694 <change date="4 Jan 2003">
14695 Make constants which are enumeration into enum types.
14696 Parameters now of enum type.
14697 Clean-up and index type section.
14698 Replace remaining datadef entities with callback.
14699 </change>
14700 <change date="7 Jan 2003">
14701 Correct GenerateEvents description.
14702 More internal semantics work.
14703 </change>
14704 <change date="9 Jan 2003">
14705 Replace previous GetSystemProperties with two functions
14706 which use allocated information instead fixed.
14707 Add SetSystemProperty.
14708 More internal semantics work.
14709 </change>
14710 <change date="12 Jan 2003">
14711 Add varargs to end of SetEventNotificationMode.
14712 </change>
14713 <change date="20 Jan 2003">
14714 Finish fixing spec to reflect that alloc sizes are jlong.
14715 </change>
14716 <change date="22 Jan 2003">
14717 Allow null as RunAgentThread arg.
14718 </change>
14719 <change date="22 Jan 2003">
14720 Fixed names to standardized naming convention
14721 Removed AsyncGetStackTrace.
14722 </change>
14723 <change date="29 Jan 2003">
14724 Since we are using jthread, removed GetThread.
14725 </change>
14726 <change date="31 Jan 2003">
14727 Change GetFieldName to allow null like GetMethodName.
14728 </change>
14729 <change date="29 Feb 2003" version="v40">
14730 Rewrite the introductory text, adding sections on
14731 start-up, environments and bytecode instrumentation.
14732 Change the command line arguments per EG discussions.
14733 Add an introduction to the capabilities section.
14734 Add the extension mechanism category and functions.
14735 Mark for deletion, but clarified anyhow, SuspendAllThreads.
14736 Rename IterateOverLiveObjects to IterateOverReachableObjects and
14737 change the text accordingly.
14738 Clarify IterateOverHeap.
14739 Clarify CompiledMethodLoad.
14740 Discuss prerequisite state for Calling Functions.
14741 Clarify SetAllocationHooks.
14742 Added issues ("To be resolved:") through-out.
14743 And so on...
14744 </change>
14745 <change date="6 Mar 2003" version="v41">
14746 Remove struct from the call to GetOwnedMonitorInfo.
14747 Automatically generate most error documentation, remove
14748 (rather broken) hand written error doc.
14749 Better describe capability use (empty initial set).
14750 Add min value to jint params.
14751 Remove the capability can_access_thread_local_storage.
14752 Rename error JVMTI_ERROR_NOT_IMPLEMENTED to JVMTI_ERROR_MUST_POSSESS_CAPABILITY;
14753 same for *NOT_IMPLEMENTED.
14754 Description fixes.
14755 </change>
14756 <change date="8 Mar 2003" version="v42">
14757 Rename GetClassSignature to GetClassName.
14758 Rename IterateOverClassObjects to IterateOverInstancesOfClass.
14759 Remove GetMaxStack (operand stack isn't used in <jvmti/>).
14760 Description fixes: define launch-time, remove native frame pop
14761 from PopFrame, and assorted clarifications.
14762 </change>
14763 <change date="8 Mar 2003" version="v43">
14764 Fix minor editing problem.
14765 </change>
14766 <change date="10 Mar 2003" version="v44">
14767 Add phase information.
14768 Remap (compact) event numbers.
14769 </change>
14770 <change date="11 Mar 2003" version="v45">
14771 More phase information - allow "any".
14772 Elide raw monitor queries and events.
14773 Minor description fixes.
14774 </change>
14775 <change date="12 Mar 2003" version="v46">
14776 Add GetPhase.
14777 Use "phase" through document.
14778 Elide GetRawMonitorName.
14779 Elide GetObjectMonitors.
14780 </change>
14781 <change date="12 Mar 2003" version="v47">
14782 Fixes from link, XML, and spell checking.
14783 Auto-generate the callback structure.
14784 </change>
14785 <change date="13 Mar 2003" version="v48">
14786 One character XML fix.
14787 </change>
14788 <change date="13 Mar 2003" version="v49">
14789 Change function parameter names to be consistent with
14790 event parameters (fooBarBaz becomes foo_bar_baz).
14791 </change>
14792 <change date="14 Mar 2003" version="v50">
14793 Fix broken link. Fix thread markers.
14794 </change>
14795 <change date="14 Mar 2003" version="v51">
14796 Change constants so they are under 128 to workaround
14797 compiler problems.
14798 </change>
14799 <change date="23 Mar 2003" version="v52">
14800 Overhaul capabilities. Separate GetStackTrace into
14801 GetStackTrace and GetStackFrames.
14802 </change>
14803 <change date="8 Apr 2003" version="v54">
14804 Use depth instead of jframeID to reference frames.
14805 Remove the now irrelevant GetCurrentFrame, GetCallerFrame and GetStackFrames.
14806 Remove frame arg from events.
14807 </change>
14808 <change date="9 Apr 2003" version="v55">
14809 Remove GetObjectWithAnnotation since tests show buffered approach more efficient.
14810 Add missing annotation_count to GetObjectsWithAnnotations
14811 </change>
14812 <change date="10 Apr 2003" version="v56">
14813 Remove confusing parenthetical statement in GetObjectsWithAnnotations
14814 </change>
14815 <change date="13 Apr 2003" version="v58">
14816 Replace jclass/jmethodID representation of method with simply jmethodID;
14817 Pass JvmtiEnv* as first arg of every event; remove JNIEnv* where inappropriate.
14818 Replace can_access_frames with can_access_local_variables; remove from purely stack access.
14819 Use can_get_synthetic_attribute; fix description.
14820 Clarify that zero length arrays must be deallocated.
14821 Clarify RelinquishCapabilities.
14822 Generalize JVMTI_ERROR_VM_DEAD to JVMTI_ERROR_WRONG_PHASE.
14823 </change>
14824 <change date="27 Apr 2003" version="v59">
14825 Remove lingering indirect references to OBSOLETE_METHOD_ID.
14826 </change>
14827 <change date="4 May 2003" version="v60">
14828 Allow DestroyRawMonitor during OnLoad.
14829 </change>
14830 <change date="7 May 2003" version="v61">
14831 Added not monitor owner error return to DestroyRawMonitor.
14832 </change>
14833 <change date="13 May 2003" version="v62">
14834 Clarify semantics of raw monitors.
14835 Change flags on <code>GetThreadStatus</code>.
14836 <code>GetClassLoader</code> return a null pointer for the bootstrap class loader.
14837 Add <code>GetClassName</code> issue.
14838 Define local variable signature.
14839 Disallow zero in annotations array of <code>GetObjectsWithAnnotations</code>.
14840 Remove over specification in <code>GetObjectsWithAnnotations</code>.
14841 Elide <code>SetAllocationHooks</code>.
14842 Elide <code>SuspendAllThreads</code>.
14843 </change>
14844 <change date="14 May 2003" version="v63">
14845 Define the data type <code>jvmtiEventCallbacks</code>.
14846 Zero length allocations return a null pointer.
14847 Keep SetAllocationHooks in JVMDI, but remove from <jvmti/>.
14848 Add JVMTI_THREAD_STATUS_FLAG_INTERRUPTED.
14849 </change>
14850 <change date="15 May 2003" version="v64">
14851 Better wording, per review.
14852 </change>
14853 <change date="15 May 2003" version="v65">
14854 First Alpha.
14855 Make jmethodID and jfieldID unique, jclass not used.
14856 </change>
14857 <change date="27 May 2003" version="v66">
14858 Fix minor XSLT errors.
14859 </change>
14860 <change date="13 June 2003" version="v67">
14861 Undo making jfieldID unique (jmethodID still is).
14862 </change>
14863 <change date="17 June 2003" version="v68">
14864 Changes per June 11th Expert Group meeting --
14865 Overhaul Heap functionality: single callback,
14866 remove GetHeapRoots, add reachable iterators,
14867 and rename "annotation" to "tag".
14868 A null pointer thread parameter on most functions is current
14869 thread.
14870 Add timers.
14871 Remove ForceExit.
14872 Add GetEnvironmentLocalStorage.
14873 Add verbose flag and event.
14874 Add AddToBootstrapClassLoaderSearch.
14875 Update ClassFileLoadHook.
14876 </change>
14877 <change date="18 June 2003" version="v69">
14878 Clean up issues sections.
14879 Rename GetClassName back to GetClassSignature and
14880 fix description.
14881 Add generic signature to GetClassSignature,
14882 GetFieldSignature, GetMethodSignature, and
14883 GetLocalVariableTable.
14884 Elide EstimateCostOfCapabilities.
14885 Clarify that the system property functions operate
14886 on the VM view of system properties.
14887 Clarify Agent_OnLoad.
14888 Remove "const" from JNIEnv* in events.
14889 Add metadata accessors.
14890 </change>
14891 <change date="18 June 2003" version="v70">
14892 Add start_depth to GetStackTrace.
14893 Move system properties to a new category.
14894 Add GetObjectSize.
14895 Remove "X" from command line flags.
14896 XML, HTML, and spell check corrections.
14897 </change>
14898 <change date="19 June 2003" version="v71">
14899 Fix JVMTI_HEAP_ROOT_THREAD to be 6.
14900 Make each synopsis match the function name.
14901 Fix unclear wording.
14902 </change>
14903 <change date="26 June 2003" version="v72">
14904 SetThreadLocalStorage and SetEnvironmentLocalStorage should allow value
14905 to be set to null pointer.
14906 NotifyFramePop, GetFrameLocationm and all the local variable operations
14907 needed to have their wording about frames fixed.
14908 Grammar and clarity need to be fixed throughout.
14909 Capitalization and puntuation need to be consistent.
14910 Need micro version number and masks for accessing major, minor, and micro.
14911 The error code lists should indicate which must be returned by
14912 an implementation.
14913 The command line properties should be visible in the properties functions.
14914 Disallow popping from the current thread.
14915 Allow implementations to return opaque frame error when they cannot pop.
14916 The NativeMethodBind event should be sent during any phase.
14917 The DynamicCodeGenerated event should be sent during any phase.
14918 The following functions should be allowed to operate before VMInit:
14919 Set/GetEnvironmentLocalStorage
14920 GetMethodDeclaringClass
14921 GetClassSignature
14922 GetClassModifiers
14923 IsInterface
14924 IsArrayClass
14925 GetMethodName
14926 GetMethodModifiers
14927 GetMaxLocals
14928 GetArgumentsSize
14929 GetLineNumberTable
14930 GetMethodLocation
14931 IsMethodNative
14932 IsMethodSynthetic.
14933 Other changes (to XSL):
14934 Argument description should show asterisk after not before pointers.
14935 NotifyFramePop, GetFrameLocationm and all the local variable operations
14936 should hsve the NO_MORE_FRAMES error added.
14937 Not alive threads should have a different error return than invalid thread.
14938 </change>
14939 <change date="7 July 2003" version="v73">
14940 VerboseOutput event was missing message parameter.
14941 Minor fix-ups.
14942 </change>
14943 <change date="14 July 2003" version="v74">
14944 Technical Publications Department corrections.
14945 Allow thread and environment local storage to be set to null pointer.
14946 </change>
14947 <change date="23 July 2003" version="v75">
14948 Use new Agent_OnLoad rather than overloaded JVM_OnLoad.
14949 Add JNICALL to callbacks (XSL).
14950 Document JNICALL requirement for both events and callbacks (XSL).
14951 Restrict RedefineClasses to methods and attributes.
14952 Elide the VerboseOutput event.
14953 VMObjectAlloc: restrict when event is sent and remove method parameter.
14954 Finish loose ends from Tech Pubs edit.
14955 </change>
14956 <change date="24 July 2003" version="v76">
14957 Change ClassFileLoadHook event to send the class instead of a boolean of redefine.
14958 </change>
14959 <change date="24 July 2003" version="v77">
14960 XML fixes.
14961 Minor text clarifications and corrections.
14962 </change>
14963 <change date="24 July 2003" version="v78">
14964 Remove GetExceptionHandlerTable and GetThrownExceptions from <jvmti/>.
14965 Clarify that stack frames are JVM Spec frames.
14966 Split can_get_source_info into can_get_source_file_name, can_get_line_numbers,
14967 and can_get_source_debug_extension.
14968 PopFrame cannot have a native calling method.
14969 Removed incorrect statement in GetClassloaderClasses
14970 (see <vmspec chapter="4.4"/>).
14971 </change>
14972 <change date="24 July 2003" version="v79">
14973 XML and text fixes.
14974 Move stack frame description into Stack Frame category.
14975 </change>
14976 <change date="26 July 2003" version="v80">
14977 Allow null pointer (means bootstrap loader) for GetClassloaderClasses.
14978 Add new heap reference kinds for references from classes.
14979 Add timer information struct and query functions.
14980 Add AvailableProcessors.
14981 Rename GetOtherThreadCpuTime to GetThreadCpuTime.
14982 Explicitly add JVMTI_ERROR_INVALID_THREAD and JVMTI_ERROR_THREAD_NOT_ALIVE
14983 to SetEventNotification mode.
14984 Add initial thread to the VM_INIT event.
14985 Remove platform assumptions from AddToBootstrapClassLoaderSearch.
14986 </change>
14987 <change date="26 July 2003" version="v81">
14988 Grammar and clarity changes per review.
14989 </change>
14990 <change date="27 July 2003" version="v82">
14991 More grammar and clarity changes per review.
14992 Add Agent_OnUnload.
14993 </change>
14994 <change date="28 July 2003" version="v83">
14995 Change return type of Agent_OnUnload to void.
14996 </change>
14997 <change date="28 July 2003" version="v84">
14998 Rename JVMTI_REFERENCE_ARRAY to JVMTI_REFERENCE_ARRAY_ELEMENT.
14999 </change>
15000 <change date="28 July 2003" version="v85">
15001 Steal java.lang.Runtime.availableProcessors() wording for
15002 AvailableProcessors().
15003 Guarantee that zero will never be an event ID.
15004 Remove some issues which are no longer issues.
15005 Per review, rename and more completely document the timer
15006 information functions.
15007 </change>
15008 <change date="29 July 2003" version="v86">
15009 Non-spec visible change to XML controlled implementation:
15010 SetThreadLocalStorage must run in VM mode.
15011 </change>
15012 <change date="5 August 2003" version="0.1.87">
15013 Add GetErrorName.
15014 Add varargs warning to jvmtiExtensionEvent.
15015 Remove "const" on the jvmtiEnv* of jvmtiExtensionEvent.
15016 Remove unused can_get_exception_info capability.
15017 Pass jvmtiEnv* and JNIEnv* to the jvmtiStartFunction.
15018 Fix jvmtiExtensionFunctionInfo.func declared type.
15019 Extension function returns error code.
15020 Use new version numbering.
15021 </change>
15022 <change date="5 August 2003" version="0.2.88">
15023 Remove the ClassUnload event.
15024 </change>
15025 <change date="8 August 2003" version="0.2.89">
15026 Heap reference iterator callbacks return an enum that
15027 allows outgoing object references to be ignored.
15028 Allow JNIEnv as a param type to extension events/functions.
15029 </change>
15030 <change date="15 August 2003" version="0.2.90">
15031 Fix a typo.
15032 </change>
15033 <change date="2 September 2003" version="0.2.91">
15034 Remove all metadata functions: GetClassMetadata,
15035 GetFieldMetadata, and GetMethodMetadata.
15036 </change>
15037 <change date="1 October 2003" version="0.2.92">
15038 Mark the functions Allocate. Deallocate, RawMonitor*,
15039 SetEnvironmentLocalStorage, and GetEnvironmentLocalStorage
15040 as safe for use in heap callbacks and GC events.
15041 </change>
15042 <change date="24 November 2003" version="0.2.93">
15043 Add pass through opaque user data pointer to heap iterate
15044 functions and callbacks.
15045 In the CompiledMethodUnload event, send the code address.
15046 Add GarbageCollectionOccurred event.
15047 Add constant pool reference kind.
15048 Mark the functions CreateRawMonitor and DestroyRawMonitor
15049 as safe for use in heap callbacks and GC events.
15050 Clarify: VMDeath, GetCurrentThreadCpuTimerInfo,
15051 GetThreadCpuTimerInfo, IterateOverReachableObjects,
15052 IterateOverObjectsReachableFromObject, GetTime and
15053 JVMTI_ERROR_NULL_POINTER.
15054 Add missing errors to: GenerateEvents and
15055 AddToBootstrapClassLoaderSearch.
15056 Fix description of ClassFileLoadHook name parameter.
15057 In heap callbacks and GC/ObjectFree events, specify
15058 that only explicitly allowed functions can be called.
15059 Allow GetCurrentThreadCpuTimerInfo, GetCurrentThreadCpuTime,
15060 GetTimerInfo, and GetTime during callback.
15061 Allow calling SetTag/GetTag during the onload phase.
15062 SetEventNotificationMode, add: error attempted inappropriate
15063 thread level control.
15064 Remove jvmtiExceptionHandlerEntry.
15065 Fix handling of native methods on the stack --
15066 location_ptr param of GetFrameLocation, remove
15067 JVMTI_ERROR_OPAQUE_FRAME from GetFrameLocation,
15068 jvmtiFrameInfo.location, and jlocation.
15069 Remove typo (from JVMPI) implying that the MonitorWaited
15070 event is sent on sleep.
15071 </change>
15072 <change date="25 November 2003" version="0.2.94">
15073 Clarifications and typos.
15074 </change>
15075 <change date="3 December 2003" version="0.2.95">
15076 Allow null pointer user_data in heap iterators.
15077 </change>
15078 <change date="28 January 2004" version="0.2.97">
15079 Add GetThreadState, deprecate GetThreadStatus.
15080 </change>
15081 <change date="29 January 2004" version="0.2.98">
15082 INVALID_SLOT and TYPE_MISMATCH errors should be optional.
15083 </change>
15084 <change date="12 February 2004" version="0.2.102">
15085 Remove MonitorContendedExit.
15086 Added JNIEnv parameter to VMObjectAlloc.
15087 Clarified definition of class_tag and referrer_index
15088 parameters to heap callbacks.
15089 </change>
15090 <change date="16 February 2004" version="0.2.103">
15091 Document JAVA_TOOL_OPTIONS.
15092 </change>
15093 <change date="17 February 2004" version="0.2.105">
15094 Divide start phase into primordial and start.
15095 Add VMStart event
15096 Change phase associations of functions and events.
15097 </change>
15098 <change date="18 February 2004" version="0.3.6">
15099 Elide deprecated GetThreadStatus.
15100 Bump minor version, subtract 100 from micro version
15101 </change>
15102 <change date="18 February 2004" version="0.3.7">
15103 Document that timer nanosecond values are unsigned.
15104 Clarify text having to do with native methods.
15105 </change>
15106 <change date="19 February 2004" version="0.3.8">
15107 Fix typos.
15108 Remove elided deprecated GetThreadStatus.
15109 </change>
15110 <change date="23 February 2004" version="0.3.9">
15111 Require NotifyFramePop to act on suspended threads.
15112 </change>
15113 <change date="24 February 2004" version="0.3.10">
15114 Add capabilities
15115 (<internallink id="jvmtiCapabilities.can_redefine_any_class"
15116 ><code>can_redefine_any_class</code></internallink>
15117 and
15118 <internallink id="jvmtiCapabilities.can_generate_all_class_hook_events"
15119 ><code>can_generate_all_class_hook_events</code></internallink>)
15120 and an error (<errorlink id="JVMTI_ERROR_UNMODIFIABLE_CLASS"></errorlink>)
15121 which allow some classes to be unmodifiable.
15122 </change>
15123 <change date="28 February 2004" version="0.3.11">
15124 Add JVMTI_ERROR_MUST_POSSESS_CAPABILITY to SetEventNotificationMode.
15125 </change>
15126 <change date="8 March 2004" version="0.3.12">
15127 Clarified CompiledMethodUnload so that it is clear the event
15128 may be posted after the class has been unloaded.
15129 </change>
15130 <change date="5 March 2004" version="0.3.13">
15131 Change the size parameter of VMObjectAlloc to jlong to match GetObjectSize.
15132 </change>
15133 <change date="13 March 2004" version="0.3.14">
15134 Added guideline for the use of the JNI FindClass function in event
15135 callback functions.
15136 </change>
15137 <change date="15 March 2004" version="0.3.15">
15138 Add GetAllStackTraces and GetThreadListStackTraces.
15139 </change>
15140 <change date="19 March 2004" version="0.3.16">
15141 ClassLoad and ClassPrepare events can be posted during start phase.
15142 </change>
15143 <change date="25 March 2004" version="0.3.17">
15144 Add JVMTI_ERROR_NATIVE_METHOD to GetLineNumberTable, GetLocalVariableTable,
15145 GetMaxLocals, GetArgumentsSize, GetMethodLocation, GetBytecodes.
15146 </change>
15147 <change date="29 March 2004" version="0.3.18">
15148 Return the timer kind in the timer information structure.
15149 </change>
15150 <change date="31 March 2004" version="0.3.19">
15151 Spec clarifications:
15152 JVMTI_THREAD_STATE_IN_NATIVE might not include JNI or <jvmti/>.
15153 ForceGarbageCollection does not run finalizers.
15154 The context of the specification is the Java platform.
15155 Warn about early instrumentation.
15156 </change>
15157 <change date="1 April 2004" version="0.3.20">
15158 Refinements to the above clarifications and
15159 Clarify that an error returned by Agent_OnLoad terminates the VM.
15160 </change>
15161 <change date="1 April 2004" version="0.3.21">
15162 Array class creation does not generate a class load event.
15163 </change>
15164 <change date="7 April 2004" version="0.3.22">
15165 Align thread state hierarchy more closely with java.lang.Thread.State.
15166 </change>
15167 <change date="12 April 2004" version="0.3.23">
15168 Clarify the documentation of thread state.
15169 </change>
15170 <change date="19 April 2004" version="0.3.24">
15171 Remove GarbageCollectionOccurred event -- can be done by agent.
15172 </change>
15173 <change date="22 April 2004" version="0.3.25">
15174 Define "command-line option".
15175 </change>
15176 <change date="29 April 2004" version="0.3.26">
15177 Describe the intended use of bytecode instrumentation.
15178 Fix description of extension event first parameter.
15179 </change>
15180 <change date="30 April 2004" version="0.3.27">
15181 Clarification and typos.
15182 </change>
15183 <change date="18 May 2004" version="0.3.28">
15184 Remove DataDumpRequest event.
15185 </change>
15186 <change date="18 May 2004" version="0.3.29">
15187 Clarify RawMonitorWait with zero timeout.
15188 Clarify thread state after RunAgentThread.
15189 </change>
15190 <change date="24 May 2004" version="0.3.30">
15191 Clean-up: fix bad/old links, etc.
15192 </change>
15193 <change date="30 May 2004" version="0.3.31">
15194 Clarifications including:
15195 All character strings are modified UTF-8.
15196 Agent thread visibiity.
15197 Meaning of obsolete method version.
15198 Thread invoking heap callbacks,
15199 </change>
15200 <change date="1 June 2004" version="1.0.32">
15201 Bump major.minor version numbers to "1.0".
15202 </change>
15203 <change date="2 June 2004" version="1.0.33">
15204 Clarify interaction between ForceGarbageCollection
15205 and ObjectFree.
15206 </change>
15207 <change date="6 June 2004" version="1.0.34">
15208 Restrict AddToBootstrapClassLoaderSearch and
15209 SetSystemProperty to the OnLoad phase only.
15210 </change>
15211 <change date="11 June 2004" version="1.0.35">
15212 Fix typo in SetTag.
15213 </change>
15214 <change date="18 June 2004" version="1.0.36">
15215 Fix trademarks.
15216 Add missing parameter in example GetThreadState usage.
15217 </change>
15218 <change date="4 August 2004" version="1.0.37">
15219 Copyright updates.
15220 </change>
15221 <change date="5 November 2004" version="1.0.38">
15222 Add missing function table layout.
15223 Add missing description of C++ member function format of functions.
15224 Clarify that name in CFLH can be null pointer.
15225 Released as part of <tm>J2SE</tm> 5.0.
15226 </change>
15227 <change date="24 April 2005" version="1.1.47">
15228 Bump major.minor version numbers to "1.1".
15229 Add ForceEarlyReturn* functions.
15230 Add GetOwnedMonitorStackDepthInfo function.
15231 Add GetCurrentThread function.
15232 Add "since" version marker.
15233 Add AddToSystemClassLoaderSearch.
15234 Allow AddToBootstrapClassLoaderSearch be used in live phase.
15235 Fix historic rubbish in the descriptions of the heap_object_callback
15236 parameter of IterateOverHeap and IterateOverInstancesOfClass functions;
15237 disallow null pointer for this parameter.
15238 Clarify, correct and make consistent: wording about current thread,
15239 opaque frames and insufficient number of frames in PopFrame.
15240 Consistently use "current frame" rather than "topmost".
15241 Clarify the JVMTI_ERROR_TYPE_MISMATCH errors in GetLocal* and SetLocal*
15242 by making them compatible with those in ForceEarlyReturn*.
15243 Many other clarifications and wording clean ups.
15244 </change>
15245 <change date="25 April 2005" version="1.1.48">
15246 Add GetConstantPool.
15247 Switch references to the first edition of the VM Spec, to the seconds edition.
15248 </change>
15249 <change date="26 April 2005" version="1.1.49">
15250 Clarify minor/major version order in GetConstantPool.
15251 </change>
15252 <change date="26 April 2005" version="1.1.50">
15253 Add SetNativeMethodPrefix and SetNativeMethodPrefixes.
15254 Reassign GetOwnedMonitorStackDepthInfo to position 153.
15255 Break out Class Loader Search in its own documentation category.
15256 Deal with overly long lines in XML source.
15257 </change>
15258 <change date="29 April 2005" version="1.1.51">
15259 Allow agents be started in the live phase.
15260 Added paragraph about deploying agents.
15261 </change>
15262 <change date="30 April 2005" version="1.1.52">
15263 Add specification description to SetNativeMethodPrefix(es).
15264 Better define the conditions on GetConstantPool.
15265 </change>
15266 <change date="30 April 2005" version="1.1.53">
15267 Break out the GetClassVersionNumber function from GetConstantPool.
15268 Clean-up the references to the VM Spec.
15269 </change>
15270 <change date="1 May 2005" version="1.1.54">
15271 Allow SetNativeMethodPrefix(es) in any phase.
15272 Add clarifications about the impact of redefinition on GetConstantPool.
15273 </change>
15274 <change date="2 May 2005" version="1.1.56">
15275 Various clarifications to SetNativeMethodPrefix(es).
15276 </change>
15277 <change date="2 May 2005" version="1.1.57">
15278 Add missing performance warning to the method entry event.
15279 </change>
15280 <change date="5 May 2005" version="1.1.58">
15281 Remove internal JVMDI support.
15282 </change>
15283 <change date="8 May 2005" version="1.1.59">
15284 Add <functionlink id="RetransformClasses"/>.
15285 Revamp the bytecode instrumentation documentation.
15286 Change <functionlink id="IsMethodObsolete"/> to no longer
15287 require the can_redefine_classes capability.
15288 </change>
15289 <change date="11 May 2005" version="1.1.63">
15290 Clarifications for retransformation.
15291 </change>
15292 <change date="11 May 2005" version="1.1.64">
15293 Clarifications for retransformation, per review.
15294 Lock "retransformation (in)capable" at class load enable time.
15295 </change>
15296 <change date="4 June 2005" version="1.1.67">
15297 Add new heap functionity which supports reporting primitive values,
15298 allows setting the referrer tag, and has more powerful filtering:
15299 FollowReferences, IterateThroughHeap, and their associated
15300 callbacks, structs, enums, and constants.
15301 </change>
15302 <change date="4 June 2005" version="1.1.68">
15303 Clarification.
15304 </change>
15305 <change date="6 June 2005" version="1.1.69">
15306 FollowReferences, IterateThroughHeap: Put callbacks in a struct;
15307 Add missing error codes; reduce bits in the visit control flags.
15308 </change>
15309 <change date="14 June 2005" version="1.1.70">
15310 More on new heap functionity: spec clean-up per review.
15311 </change>
15312 <change date="15 June 2005" version="1.1.71">
15313 More on new heap functionity: Rename old heap section to Heap (1.0).
15314 </change>
15315 <change date="21 June 2005" version="1.1.72">
15316 Fix typos.
15317 </change>
15318 <change date="27 June 2005" version="1.1.73">
15319 Make referrer info structure a union.
15320 </change>
15321 <change date="9 September 2005" version="1.1.74">
15322 In new heap functions:
15323 Add missing superclass reference kind.
15324 Use a single scheme for computing field indexes.
15325 Remove outdated references to struct based referrer info.
15326 </change>
15327 <change date="12 September 2005" version="1.1.75">
15328 Don't callback during FollowReferences on frivolous java.lang.Object superclass.
15329 </change>
15330 <change date="13 September 2005" version="1.1.76">
15331 In string primitive callback, length now Unicode length.
15332 In array and string primitive callbacks, value now "const".
15333 Note possible compiler impacts on setting JNI function table.
15334 </change>
15335 <change date="13 September 2005" version="1.1.77">
15336 GetClassVersionNumbers() and GetConstantPool() should return
15337 error on array or primitive class.
15338 </change>
15339 <change date="14 September 2005" version="1.1.78">
15340 Grammar fixes.
15341 </change>
15342 <change date="26 September 2005" version="1.1.79">
15343 Add IsModifiableClass query.
15344 </change>
15345 <change date="9 February 2006" version="1.1.81">
15346 Add referrer_class_tag parameter to jvmtiHeapReferenceCallback.
15347 </change>
15348 <change date="13 February 2006" version="1.1.82">
15349 Doc fixes: update can_redefine_any_class to include retransform.
15350 Clarify that exception events cover all Throwables.
15351 In GetStackTrace, no test is done for start_depth too big if start_depth is zero,
15352 Clarify fields reported in Primitive Field Callback -- static vs instance.
15353 Repair confusing names of heap types, including callback names.
15354 Require consistent usage of stack depth in the face of thread launch methods.
15355 Note incompatibility of <jvmti/> memory management with other systems.
15356 </change>
15357 <change date="14 February 2006" version="1.1.85">
15358 Fix typos and missing renames.
15359 </change>
15360 <change date="13 March 2006" version="1.1.86">
15361 Clarify that jmethodIDs and jfieldIDs can be saved.
15362 Clarify that Iterate Over Instances Of Class includes subclasses.
15363 </change>
15364 <change date="14 March 2006" version="1.1.87">
15365 Better phrasing.
15366 </change>
15367 <change date="16 March 2006" version="1.1.88">
15368 Match the referrer_index for static fields in Object Reference Callback
15369 with the Reference Implementation (and all other known implementations);
15370 that is, make it match the definition for instance fields.
15371 In GetThreadListStackTraces, add JVMTI_ERROR_INVALID_THREAD to cover
15372 an invalid thread in the list; and specify that not started threads
15373 return empty stacks.
15374 </change>
15375 <change date="17 March 2006" version="1.1.89">
15376 Typo.
15377 </change>
15378 <change date="25 March 2006" version="1.1.90">
15379 Typo.
15380 </change>
15381 <change date="6 April 2006" version="1.1.91">
15382 Remove restrictions on AddToBootstrapClassLoaderSearch and
15383 AddToSystemClassLoaderSearch.
15384 </change>
15385 <change date="1 May 2006" version="1.1.93">
15386 Changed spec to return -1 for monitor stack depth for the
15387 implementation which can not determine stack depth.
15388 </change>
15389 <change date="3 May 2006" version="1.1.94">
15390 Corrections for readability and accuracy courtesy of Alan Pratt of IBM.
15391 List the object relationships reported in FollowReferences.
15392 </change>
15393 <change date="5 May 2006" version="1.1.95">
15394 Clarify the object relationships reported in FollowReferences.
15395 </change>
15396 <change date="28 June 2006" version="1.1.98">
15397 Clarify DisposeEnvironment; add warning.
15398 Fix typos in SetLocalXXX "retrieve" => "set".
15399 Clarify that native method prefixes must remain set while used.
15400 Clarify that exactly one Agent_OnXXX is called per agent.
15401 Clarify that library loading is independent from start-up.
15402 Remove ambiguous reference to Agent_OnLoad in the Agent_OnUnload spec.
15403 </change>
15404 <change date="31 July 2006" version="1.1.99">
15405 Clarify the interaction between functions and exceptions.
15406 Clarify and give examples of field indices.
15407 Remove confusing "That is" sentence from MonitorWait and MonitorWaited events.
15408 Update links to point to Java 6.
15409 </change>
15410 <change date="6 August 2006" version="1.1.102">
15411 Add ResourceExhaustedEvent.
15412 </change>
15413 <change date="11 October 2012" version="1.2.2">
15414 Fixed the "HTTP" and "Missing Anchor" errors reported by the LinkCheck tool.
15415 </change>
15416 <change date="19 June 2013" version="1.2.3">
15417 Added support for statically linked agents.
15418 </change>
15419 <change date="13 October 2016" version="9.0.0">
15420 Support for modules:
15421 The majorversion is 9 now.
15422 The ClassFileLoadHook events are not sent during the primordial phase anymore.
15423 Allow CompiledMethodLoad events at start phase.
15424 Add new capabilities: can_generate_early_vmstart, can_generate_early_class_hook_events.
15425 Add new functions: GetAllModules, AddModuleReads, AddModuleExports,
15426 AddModuleOpens, AddModuleUses, AddModuleProvides, IsModifiableModule.
15427 Clarified can_redefine_any_classes, can_retransform_any_classes and
15428 IsModifiableClass API to disallow some implementation defined classes.
15429 </change>
15430 <change date="12 February 2017" version="9.0.0">
15431 Minor update for GetCurrentThread function:
15432 The function may return null pointer in the start phase if the
15433 can_generate_early_vmstart capability is enabled.
15434 </change>
15435 <change date="7 February 2018" version="11.0.0">
15436 Minor update for new class file NestHost and NestMembers attributes:
15437 Specify that RedefineClasses and RetransformClasses are not allowed
15438 to change the class file NestHost and NestMembers attributes;
15439 Add new error JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED
15440 that can be returned by RedefineClasses and RetransformClasses.
15441 </change>
15442 <change date="15 June 2018" version="11.0.0">
15443 Support for Low Overhead Heap Sampling:
15444 Add new capability: can_generate_sampled_object_alloc_events.
15445 Add new function: SetHeapSamplingInterval.
15446 Add new event type: JVMTI_EVENT_SAMPLED_OBJECT_ALLOC.
15447 </change>
15448 <change date="20 May 2019" version="13.0.0">
15449 Minor spec update for the capability "can_redefine_any_class".
15450 It now says: "RedefineClasses can be called on any modifiable class."
15451 See IsModifiableClass. (can_redefine_classes must also be set)
15452 </change>
15453 <change date="5 June 2019" version="13.0.0">
15454 Minor PopFrame spec update:
15455 The specified thread must be suspended or must be the current thread.
15456 (It was not allowed to be the current thread before.)
15457 </change>
15458 <change date="10 October 2019" version="14.0.0">
15459 Minor update for new class file Record attribute:
15460 Specify that RedefineClasses and RetransformClasses are not allowed
15461 to change the class file Record attribute.
15462 </change>
15463 <change date="13 May 2020" version="15.0.0">
15464 Minor update for new class file PermittedSubclasses attribute:
15465 Specify that RedefineClasses and RetransformClasses are not allowed
15466 to change the class file PermittedSubclasses attribute.
15467 </change>
15468 <change date="15 January 2021" version="17.0.0">
15469 Minor clarification in the section "Agent Shutdown" that says the
15470 implementation may choose to not call the Agent_OnUnload function
15471 if the Agent_OnAttach/Agent_OnAttach_L function reported an error.
15472 </change>
15473 <change date="8 June 2021" version="17.0.0">
15474 Minor update to deprecate Heap functions 1.0.
15475 </change>
15476 <change date="27 April 2022" version="19.0.0">
15477 Support for virtual threads (Preview):
15478 Add new capability: can_support_virtual_threads.
15479 Add new functions: SuspendAllVirtualThreads, ResumeAllVirtualThreads.
15480 Add new event types: JVMTI_EVENT_VIRTUAL_THREAD_START, JVMTI_EVENT_VIRTUAL_THREAD_END.
15481 Add new error code: JVMTI_ERROR_UNSUPPORTED_OPERATION.
15482 </change>
15483 <change date="7 June 2023" version="21.0.0">
15484 Virtual threads finalized to be a permanent feature.
15485 Agent start-up in the live phase now specified to print a warning.
15486 </change>
15487 <change date="10 January 2025" version="25.0.0">
15488 Add new function ClearAllFramePops. Needed to speedup debugger single stepping.
15489 </change>
15490 </changehistory>
15491
15492 </specification>
15493 <!-- Keep this comment at the end of the file
15494 Local variables:
15495 mode: sgml
15496 sgml-omittag:t
15497 sgml-shorttag:t
15498 sgml-namecase-general:t
15499 sgml-general-insert-case:lower
15500 sgml-minimize-attributes:nil
15501 sgml-always-quote-attributes:t
15502 sgml-indent-step:2
15503 sgml-indent-data:t
15504 sgml-parent-document:nil
15505 sgml-exposed-tags:nil
15506 sgml-local-catalogs:nil
15507 sgml-local-ecat-files:nil
15508 End:
15509 -->