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