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