1 <?xml version="1.0" encoding="ISO-8859-1"?> 2 <?xml-stylesheet type="text/xsl" href="jvmti.xsl"?> 3 <!-- 4 Copyright (c) 2002, 2022, 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 If an agent is started during the live phase then its agent library 644 must export a start-up function 645 with the following prototype: 646 <example> 647 JNIEXPORT jint JNICALL 648 Agent_OnAttach(JavaVM* vm, char *options, void *reserved)</example> 649 Or for a statically linked agent named 'L': 650 <example> 651 JNIEXPORT jint JNICALL 652 Agent_OnAttach_L(JavaVM* vm, char *options, void *reserved)</example> 653 654 <p/> 655 The VM will start the agent by calling this function. 656 It will be called in the context of a thread 657 that is attached to the VM. The first argument <i><vm></i> is the Java VM. 658 The <i><options></i> argument is the startup options provided to the agent. 659 <i><options></i> is encoded as a <internallink id="mUTF">modified UTF-8 660 </internallink> string. 661 If startup options were not provided, a zero length string is passed to 662 <code>options</code>. The lifespan of the <code>options</code> string is the 663 <code>Agent_OnAttach</code> or <code>Agent_OnAttach_<agent-lib-name></code> call. 664 If needed beyond this time the string or parts of the string must be copied. 665 <p/> 666 Note that some <internallink id="capability">capabilities</internallink> 667 may not be available in the live phase. 668 <p/> 669 The <code>Agent_OnAttach</code> or <code>Agent_OnAttach_<agent-lib-name 670 ></code> function initializes the agent and returns a value 671 to the VM to indicate if an error occurred. Any value other than zero indicates an error. 672 An error does not cause the VM to terminate. Instead the VM ignores the error, or takes 673 some implementation specific action -- for example it might print an error to standard error, 674 or record the error in a system log. 675 </intro> 676 677 <intro id="onunload" label="Agent Shutdown"> 678 The library may optionally export a 679 shutdown function with the following prototype: 680 <example> 681 JNIEXPORT void JNICALL 682 Agent_OnUnload(JavaVM *vm)</example> 683 Or for a statically linked agent named 'L': 684 <example> 685 JNIEXPORT void JNICALL 686 Agent_OnUnload_L(JavaVM *vm)</example> 687 688 This function will be called by the VM when the library is about to be unloaded. 689 The library will be unloaded (unless it is statically linked into the 690 executable) and this function will be called if some platform specific 691 mechanism causes the unload (an unload mechanism is not specified in this document) 692 or the library is (in effect) unloaded by the termination of the VM. 693 VM termination includes normal termination and VM failure, including start-up failure, 694 but not, of course, uncontrolled shutdown. An implementation may also 695 choose to not call this function if the <code>Agent_OnAttach</code>/ 696 <code>Agent_OnAttach_L</code> function reported an error (returned a non-zero value). 697 Note the distinction between this function and the 698 <eventlink id="VMDeath">VM Death event</eventlink>: for the VM Death event 699 to be sent, the VM must have run at least to the point of initialization and a valid 700 <jvmti/> environment must exist which has set a callback for VMDeath 701 and enabled the event. 702 None of these are required for <code>Agent_OnUnload</code> or 703 <code>Agent_OnUnload_<agent-lib-name></code> and this function 704 is also called if the library is unloaded for other reasons. 705 In the case that a VM Death event is sent, it will be sent before this 706 function is called (assuming this function is called due to VM termination). 707 This function can be used to clean-up resources allocated by the agent. 708 </intro> 709 710 <intro id="tooloptions" label="JAVA_TOOL_OPTIONS"> 711 Since the command-line cannot always be accessed or modified, for example in embedded VMs 712 or simply VMs launched deep within scripts, a <code>JAVA_TOOL_OPTIONS</code> variable is 713 provided so that agents may be launched in these cases. 714 <p/> 715 Platforms which support environment variables or other named strings, may support the 716 <code>JAVA_TOOL_OPTIONS</code> variable. This variable will be broken into options at white-space 717 boundaries. White-space characters include space, tab, carriage-return, new-line, 718 vertical-tab, and form-feed. Sequences of white-space characters are considered 719 equivalent to a single white-space character. No white-space is included in the options 720 unless quoted. Quoting is as follows: 721 <ul> 722 <li>All characters enclosed between a pair of single quote marks (''), except a single 723 quote, are quoted.</li> 724 <li>Double quote characters have no special meaning inside a pair of single quote marks.</li> 725 <li>All characters enclosed between a pair of double quote marks (""), except a double 726 quote, are quoted.</li> 727 <li>Single quote characters have no special meaning inside a pair of double quote marks.</li> 728 <li>A quoted part can start or end anywhere in the variable.</li> 729 <li>White-space characters have no special meaning when quoted -- they are included in 730 the option like any other character and do not mark white-space boundaries.</li> 731 <li>The pair of quote marks is not included in the option.</li> 732 </ul> 733 <code>JNI_CreateJavaVM</code> (in the JNI Invocation API) will prepend these options to the options supplied 734 in its <code>JavaVMInitArgs</code> argument. Platforms may disable this feature in cases where security is 735 a concern; for example, the Reference Implementation disables this feature on Unix systems when 736 the effective user or group ID differs from the real ID. 737 This feature is intended to support the initialization of tools -- specifically including the 738 launching of native or Java programming language agents. Multiple tools may wish to use this 739 feature, so the variable should not be overwritten, instead, options should be appended to 740 the variable. Note that since the variable is processed at the time of the JNI Invocation 741 API create VM call, options processed by a launcher (e.g., VM selection options) will not be handled. 742 </intro> 743 744 <intro id="environments" label="Environments"> 745 The <jvmti/> specification supports the use of multiple simultaneous 746 <jvmti/> agents. 747 Each agent has its own <jvmti/> environment. 748 That is, the <jvmti/> state is 749 separate for each agent - changes to one environment do not affect the 750 others. The state of a <jvmti/> 751 environment includes: 752 <ul> 753 <li><functionlink id="SetEventCallbacks">the event callbacks</functionlink></li> 754 <li><functionlink id="SetEventNotificationMode">the set of events which are enabled</functionlink></li> 755 <li><internallink id="capability">the capabilities</internallink></li> 756 <li><internallink id="memory">the memory allocation/deallocation hooks</internallink></li> 757 </ul> 758 Although their <jvmti/> state 759 is separate, agents inspect and modify the shared state 760 of the VM, they also share the native environment in which they execute. 761 As such, an agent can perturb the results of other agents or cause them 762 to fail. It is the responsibility of the agent writer to specify the level 763 of compatibility with other agents. <jvmti/> implementations are not capable 764 of preventing destructive interactions between agents. Techniques to reduce 765 the likelihood of these occurrences are beyond the scope of this document. 766 <p/> 767 An agent creates a <jvmti/> environment 768 by passing a <jvmti/> version 769 as the interface ID to the JNI Invocation API function 770 <externallink id="jni/invocation.html#getenv"> 771 <code>GetEnv</code></externallink>. 772 See <internallink id="jvmtiEnvAccess">Accessing <jvmti/> Functions</internallink> 773 for more details on the creation and use of 774 <jvmti/> environments. 775 Typically, <jvmti/> environments are created by calling <code>GetEnv</code> from 776 <internallink id="onload"><code>Agent_OnLoad</code></internallink>. 777 </intro> 778 779 <intro id="bci" label="Bytecode Instrumentation"> 780 This interface does not include some events that one might expect in an interface with 781 profiling support. Some examples include full speed 782 method enter and exit events. The interface instead provides support for 783 <i>bytecode instrumentation</i>, the ability to alter the Java virtual machine 784 bytecode instructions which comprise the target program. Typically, these alterations 785 are to add "events" to the code of a method - for example, to add, at the beginning of a method, 786 a call to <code>MyProfiler.methodEntered()</code>. 787 Since the changes are purely additive, they do not modify application 788 state or behavior. 789 Because the inserted agent code is standard bytecodes, the VM can run at full speed, 790 optimizing not only the target program but also the instrumentation. If the 791 instrumentation does not involve switching from bytecode execution, no expensive 792 state transitions are needed. The result is high performance events. 793 This approach also provides complete control to the agent: instrumentation can be 794 restricted to "interesting" portions of the code (e.g., the end user's code) and 795 can be conditional. Instrumentation can run entirely in Java programming language 796 code or can call into the native agent. Instrumentation can simply maintain 797 counters or can statistically sample events. 798 <p/> 799 Instrumentation can be inserted in one of three ways: 800 <ul> 801 <li> 802 Static Instrumentation: The class file is instrumented before it 803 is loaded into the VM - for example, by creating a duplicate directory of 804 <code>*.class</code> files which have been modified to add the instrumentation. 805 This method is extremely awkward and, in general, an agent cannot know 806 the origin of the class files which will be loaded. 807 </li> 808 <li> 809 Load-Time Instrumentation: When a class file is loaded by the VM, the raw 810 bytes of the class file are sent for instrumentation to the agent. 811 The <eventlink id="ClassFileLoadHook"/> 812 event, triggered by the class load, 813 provides this functionality. This mechanism provides efficient 814 and complete access to one-time instrumentation. 815 </li> 816 <li> 817 Dynamic Instrumentation: A class which is already loaded (and possibly 818 even running) is modified. This optional feature is provided by the 819 <eventlink id="ClassFileLoadHook"/> event, triggered by calling the 820 <functionlink id="RetransformClasses"/> function. 821 Classes can be modified multiple times and can be returned to their 822 original state. 823 The mechanism allows instrumentation which changes during the 824 course of execution. 825 </li> 826 </ul> 827 <p/> 828 The class modification functionality provided in this interface 829 is intended to provide a mechanism for instrumentation 830 (the <eventlink id="ClassFileLoadHook"/> event 831 and the <functionlink id="RetransformClasses"/> function) 832 and, during development, for fix-and-continue debugging 833 (the <functionlink id="RedefineClasses"/> function). 834 <p/> 835 Care must be taken to avoid perturbing dependencies, especially when 836 instrumenting core classes. For example, an approach to getting notification 837 of every object allocation is to instrument the constructor on 838 <code>Object</code>. Assuming that the constructor is initially 839 empty, the constructor could be changed to: 840 <example> 841 public Object() { 842 MyProfiler.allocationTracker(this); 843 } 844 </example> 845 However, if this change was made using the 846 <eventlink id="ClassFileLoadHook"/> 847 event then this might impact a typical VM as follows: 848 the first created object will call the constructor causing a class load of 849 <code>MyProfiler</code>; which will then cause 850 object creation, and since <code>MyProfiler</code> isn't loaded yet, 851 infinite recursion; resulting in a stack overflow. A refinement of this 852 would be to delay invoking the tracking method until a safe time. For 853 example, <code>trackAllocations</code> could be set in the 854 handler for the <code>VMInit</code> event. 855 <example> 856 static boolean trackAllocations = false; 857 858 public Object() { 859 if (trackAllocations) { 860 MyProfiler.allocationTracker(this); 861 } 862 } 863 </example> 864 <p/> 865 The <functionlink id="SetNativeMethodPrefix"/> allows native methods 866 to be instrumented by the use of wrapper methods. 867 </intro> 868 869 <intro id="bcimodules" label="Bytecode Instrumentation of code in modules"> 870 Agents can use the functions <functionlink id="AddModuleReads"/>, 871 <functionlink id="AddModuleExports"/>, <functionlink id="AddModuleOpens"/>, 872 <functionlink id="AddModuleUses"/> and <functionlink id="AddModuleProvides"/> 873 to update a module to expand the set of modules that it reads, the set of 874 packages that it exports or opens to other modules, or the services that it 875 uses and provides. 876 <p/> 877 As an aid to agents that deploy supporting classes on the search path of 878 the bootstrap class loader, or the search path of the class loader that 879 loads the main class, the Java virtual machine arranges for the module 880 of classes transformed by the <eventlink id="ClassFileLoadHook"/> event to 881 read the unnamed module of both class loaders. 882 </intro> 883 884 <intro id="mUTF" label="Modified UTF-8 String Encoding"> 885 <jvmti/> uses modified UTF-8 to encode character strings. 886 This is the same encoding used by JNI. 887 Modified UTF-8 differs 888 from standard UTF-8 in the representation of supplementary characters 889 and of the null character. See the 890 <externallink id="jni/types.html#modified-utf-8-strings"> 891 Modified UTF-8 Strings</externallink> 892 section of the JNI specification for details. 893 </intro> 894 895 <intro id="context" label="Specification Context"> 896 Since this interface provides access to the state of applications running in the 897 Java virtual machine; 898 terminology refers to the Java platform and not the native 899 platform (unless stated otherwise). For example: 900 <ul> 901 <li>"thread" means Java programming language thread.</li> 902 <li>"stack frame" means Java virtual machine stack frame.</li> 903 <li>"class" means Java programming language class.</li> 904 <li>"heap" means Java virtual machine heap.</li> 905 <li>"monitor" means Java programming language object monitor.</li> 906 </ul> 907 <p/> 908 Sun, Sun Microsystems, the Sun logo, Java, and JVM 909 are trademarks or registered trademarks of Oracle 910 and/or its affiliates, in the U.S. and other countries. 911 </intro> 912 913 914 <functionsection label="Functions"> 915 <intro id="jvmtiEnvAccess" label="Accessing Functions"> 916 Native code accesses <jvmti/> features 917 by calling <jvmti/> functions. 918 Access to <jvmti/> functions is by use of an interface pointer 919 in the same manner as 920 <externallink id="jni/design.html">Java 921 Native Interface (JNI) functions</externallink> are accessed. 922 The <jvmti/> interface pointer is called the 923 <i>environment pointer</i>. 924 <p/> 925 An environment pointer is a pointer to an environment and has 926 the type <code>jvmtiEnv*</code>. 927 An environment has information about its <jvmti/> connection. 928 The first value in the environment is a pointer to the function table. 929 The function table is an array of pointers to <jvmti/> functions. 930 Every function pointer is at a predefined offset inside the 931 array. 932 <p/> 933 When used from the C language: 934 double indirection is used to access the functions; 935 the environment pointer provides context and is the first 936 parameter of each function call; for example: 937 <example> 938 jvmtiEnv *jvmti; 939 ... 940 jvmtiError err = (*jvmti)->GetLoadedClasses(jvmti, &class_count, &classes); 941 </example> 942 <p/> 943 When used from the C++ language: 944 functions are accessed as member functions of <code>jvmtiEnv</code>; 945 the environment pointer is not passed to the function call; for example: 946 <example> 947 jvmtiEnv *jvmti; 948 ... 949 jvmtiError err = jvmti->GetLoadedClasses(&class_count, &classes); 950 </example> 951 Unless otherwise stated, all examples and declarations in this 952 specification use the C language. 953 <p/> 954 A <jvmti/> environment can be obtained through the JNI Invocation API 955 <code>GetEnv</code> function: 956 <example> 957 jvmtiEnv *jvmti; 958 ... 959 (*jvm)->GetEnv(jvm, &jvmti, JVMTI_VERSION_1_0); 960 </example> 961 Each call to <code>GetEnv</code> 962 creates a new <jvmti/> connection and thus 963 a new <jvmti/> environment. 964 The <code>version</code> argument of <code>GetEnv</code> must be 965 a <jvmti/> version. 966 The returned environment may have a different version than the 967 requested version but the returned environment must be compatible. 968 <code>GetEnv</code> will return <code>JNI_EVERSION</code> if a 969 compatible version is not available, if <jvmti/> is not supported or 970 <jvmti/> is not supported in the current VM configuration. 971 Other interfaces may be added for creating <jvmti/> environments 972 in specific contexts. 973 Each environment has its own state (for example, 974 <functionlink id="SetEventNotificationMode">desired events</functionlink>, 975 <functionlink id="SetEventCallbacks">event handling functions</functionlink>, and 976 <functionlink id="AddCapabilities">capabilities</functionlink>). 977 An environment is released with 978 <functionlink id="DisposeEnvironment"></functionlink>. 979 Thus, unlike JNI which has one environment per thread, <jvmti/> environments work 980 across threads and are created dynamically. 981 </intro> 982 983 <intro id="functionReturn" label="Function Return Values"> 984 <jvmti/> functions always return an 985 <internallink id="ErrorSection">error code</internallink> via the 986 <datalink id="jvmtiError"/> function return value. 987 Some functions can return additional 988 values through pointers provided by the calling function. 989 In some cases, <jvmti/> functions allocate memory that your program must 990 explicitly deallocate. This is indicated in the individual <jvmti/> 991 function descriptions. Empty lists, arrays, sequences, etc are 992 returned as <code>NULL</code>. 993 <p/> 994 In the event that the <jvmti/> function encounters 995 an error (any return value other than <code>JVMTI_ERROR_NONE</code>) the values 996 of memory referenced by argument pointers is undefined, but no memory 997 will have been allocated and no global references will have been allocated. 998 If the error occurs because of invalid input, no action will have occurred. 999 </intro> 1000 1001 <intro id="refs" label="Managing JNI Object References"> 1002 <jvmti/> functions identify objects with JNI references 1003 (<datalink id="jobject"/> and <datalink id="jclass"/>) 1004 and their derivatives 1005 (<datalink id="jthread"/> and <datalink id="jthreadGroup"/>). 1006 References passed to 1007 <jvmti/> functions can be either global or local, but they must be 1008 strong references. All references returned by <jvmti/> functions are 1009 local references--these local references are created 1010 during the <jvmti/> call. 1011 Local references are a resource that must be managed (see the 1012 <externallink id="jni/functions.html#local-references"> 1013 JNI Documentation</externallink>). 1014 When threads return from native code all local references 1015 are freed. Note that some threads, including typical 1016 agent threads, will never return from native code. 1017 A thread is ensured the ability to create sixteen local 1018 references without the need for any explicit management. 1019 For threads executing a limited number of <jvmti/> calls before 1020 returning from native code 1021 (for example, threads processing events), 1022 it may be determined that no explicit management 1023 is needed. 1024 However, long running agent threads will need explicit 1025 local reference management--usually with the JNI functions 1026 <code>PushLocalFrame</code> and <code>PopLocalFrame</code>. 1027 Conversely, to preserve references beyond the 1028 return from native code, they must be converted to global references. 1029 These rules do not apply to <datalink id="jmethodID"/> and <datalink id="jfieldID"/> 1030 as they are not <datalink id="jobject"/>s. 1031 </intro> 1032 1033 <intro id="prereqState" label="Prerequisite State for Calling Functions"> 1034 Unless the function explicitly states that the agent must bring 1035 a thread or the VM to a particular state (for example, suspended), 1036 the <jvmti/> implementation is responsible for bringing the VM to a 1037 safe and consistent state for performing the function. 1038 </intro> 1039 1040 <intro id="functionsExceptions" label="Exceptions and Functions"> 1041 <jvmti/> functions never throw exceptions; error conditions are 1042 communicated via the 1043 <internallink id="functionReturn">function return value</internallink>. 1044 Any existing exception state is preserved across a call to a 1045 <jvmti/> function. 1046 See the 1047 <externallink 1048 id="jni/design.html#java-exceptions" 1049 >Java Exceptions</externallink> 1050 section of the JNI specification for information on handling exceptions. 1051 </intro> 1052 1053 <category id="memory" label="Memory Management"> 1054 <intro> 1055 These functions provide for the allocation and deallocation of 1056 memory used by <jvmti/> functionality and can be used to provide 1057 working memory for agents. 1058 Memory managed by <jvmti/> is not compatible with other memory 1059 allocation libraries and mechanisms. 1060 </intro> 1061 1062 <function id="Allocate" jkernel="yes" phase="any" callbacksafe="safe" impl="notrace" num="46"> 1063 <synopsis>Allocate</synopsis> 1064 <description> 1065 Allocate an area of memory through the <jvmti/> allocator. 1066 The allocated 1067 memory should be freed with <functionlink id="Deallocate"></functionlink>. 1068 </description> 1069 <origin>jvmdi</origin> 1070 <capabilities> 1071 </capabilities> 1072 <parameters> 1073 <param id="size"> 1074 <jlong/> 1075 <description> 1076 The number of bytes to allocate. 1077 <rationale> 1078 <code>jlong</code> is used for compatibility with JVMDI. 1079 </rationale> 1080 </description> 1081 </param> 1082 <param id="mem_ptr"> 1083 <allocbuf incount="size"><uchar/></allocbuf> 1084 <description> 1085 On return, a pointer to the beginning of the allocated memory. 1086 If <code>size</code> is zero, <code>NULL</code> is returned. 1087 </description> 1088 </param> 1089 </parameters> 1090 <errors> 1091 <error id="JVMTI_ERROR_OUT_OF_MEMORY"> 1092 Memory request cannot be honored. 1093 </error> 1094 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 1095 <paramlink id="size"></paramlink> is less than zero. 1096 </error> 1097 </errors> 1098 </function> 1099 1100 <function id="Deallocate" jkernel="yes" phase="any" callbacksafe="safe" impl="notrace" num="47"> 1101 <synopsis>Deallocate</synopsis> 1102 <description> 1103 Deallocate <code>mem</code> using the <jvmti/> allocator. 1104 This function should 1105 be used to deallocate any memory allocated and returned 1106 by a <jvmti/> function 1107 (including memory allocated with <functionlink id="Allocate"></functionlink>). 1108 All allocated memory must be deallocated 1109 or the memory cannot be reclaimed. 1110 </description> 1111 <origin>jvmdi</origin> 1112 <capabilities> 1113 </capabilities> 1114 <parameters> 1115 <param id="mem"> 1116 <outbuf> 1117 <uchar/> 1118 <nullok>the call is ignored</nullok> 1119 </outbuf> 1120 <description> 1121 A pointer to the beginning of the allocated memory. 1122 Please ignore "On return, the elements are set." 1123 <todo>keep it from generating "On return, the elements are set"</todo> 1124 </description> 1125 </param> 1126 </parameters> 1127 <errors> 1128 </errors> 1129 </function> 1130 </category> 1131 1132 <category id="threadCategory" label="Thread"> 1133 <intro> 1134 These functions provide information about threads and allow an agent to 1135 suspend and resume threads. 1136 <p/> 1137 The <code>jthread</code> specified to these functions can be a JNI 1138 reference to a 1139 <externallink id="../api/java.base/java/lang/Thread.html#platform-threads">platform thread</externallink> 1140 or <externallink id="../api/java.base/java/lang/Thread.html#virtual-threads">virtual thread</externallink>. 1141 Some functions are not supported on virtual threads and return 1142 <code>JVMTI_ERROR_UNSUPPORTED_OPERATION</code> when called with a reference 1143 to a virtual thread. 1144 </intro> 1145 1146 <function id="GetThreadState" num="17"> 1147 <synopsis>Get Thread State</synopsis> 1148 <description> 1149 Get the state of a thread. The state of the thread is represented by the 1150 answers to the hierarchical set of questions below: 1151 <ul type="circle"> 1152 <li><i>Alive?</i> 1153 <ul> 1154 <li>Not alive. 1155 <ul type="circle"> 1156 <li><i>Why not alive?</i> 1157 <ul> 1158 <li>New.</li> 1159 <li>Terminated (<datalink 1160 id="JVMTI_THREAD_STATE_TERMINATED"><code>JVMTI_THREAD_STATE_TERMINATED</code></datalink>)</li> 1161 </ul> 1162 </li> 1163 </ul> 1164 </li> 1165 <li>Alive (<datalink 1166 id="JVMTI_THREAD_STATE_ALIVE"><code>JVMTI_THREAD_STATE_ALIVE</code></datalink>) 1167 <ul type="circle"> 1168 <li><i>Suspended?</i> 1169 <ul> 1170 <li>Suspended (<datalink 1171 id="JVMTI_THREAD_STATE_SUSPENDED"><code>JVMTI_THREAD_STATE_SUSPENDED</code></datalink>)</li> 1172 <li>Not suspended</li> 1173 </ul> 1174 </li> 1175 <li><i>Interrupted?</i> 1176 <ul> 1177 <li>Interrupted (<datalink 1178 id="JVMTI_THREAD_STATE_INTERRUPTED"><code>JVMTI_THREAD_STATE_INTERRUPTED</code></datalink>)</li> 1179 <li>Not interrupted.</li> 1180 </ul> 1181 </li> 1182 <li><i>In native?</i> 1183 <ul> 1184 <li>In native code (<datalink 1185 id="JVMTI_THREAD_STATE_IN_NATIVE"><code>JVMTI_THREAD_STATE_IN_NATIVE</code></datalink>)</li> 1186 <li>In Java programming language code</li> 1187 </ul> 1188 </li> 1189 <li><i>What alive state?</i> 1190 <ul> 1191 <li>Runnable (<datalink 1192 id="JVMTI_THREAD_STATE_RUNNABLE"><code>JVMTI_THREAD_STATE_RUNNABLE</code></datalink>)</li> 1193 <li>Blocked (<datalink 1194 id="JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER"><code>JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER</code></datalink>)</li> 1195 <li>Waiting (<datalink 1196 id="JVMTI_THREAD_STATE_WAITING"><code>JVMTI_THREAD_STATE_WAITING</code></datalink>) 1197 <ul type="circle"> 1198 <li><i>Timed wait?</i> 1199 <ul> 1200 <li>Indefinite (<datalink 1201 id="JVMTI_THREAD_STATE_WAITING_INDEFINITELY"><code>JVMTI_THREAD_STATE_WAITING_INDEFINITELY</code></datalink></li> 1202 <li>Timed (<datalink 1203 id="JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT"><code>JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT</code></datalink>)</li> 1204 </ul> 1205 </li> 1206 <li><i>Why waiting?</i> 1207 <ul> 1208 <li>Object.wait (<datalink 1209 id="JVMTI_THREAD_STATE_IN_OBJECT_WAIT"><code>JVMTI_THREAD_STATE_IN_OBJECT_WAIT</code></datalink>)</li> 1210 <li>LockSupport.park (<datalink 1211 id="JVMTI_THREAD_STATE_PARKED"><code>JVMTI_THREAD_STATE_PARKED</code></datalink>)</li> 1212 <li>Sleeping (<datalink 1213 id="JVMTI_THREAD_STATE_SLEEPING"><code>JVMTI_THREAD_STATE_SLEEPING</code></datalink>)</li> 1214 </ul> 1215 </li> 1216 </ul> 1217 </li> 1218 </ul> 1219 </li> 1220 </ul> 1221 </li> 1222 </ul> 1223 </li> 1224 </ul> 1225 <p/> 1226 The answers are represented by the following bit vector. 1227 <constants id="jvmtiThreadState" label="Thread State Flags" kind="bits"> 1228 <constant id="JVMTI_THREAD_STATE_ALIVE" num="0x0001"> 1229 Thread is alive. Zero if thread is new (not started) or terminated. 1230 </constant> 1231 <constant id="JVMTI_THREAD_STATE_TERMINATED" num="0x0002"> 1232 Thread has completed execution. 1233 </constant> 1234 <constant id="JVMTI_THREAD_STATE_RUNNABLE" num="0x0004"> 1235 Thread is runnable. 1236 </constant> 1237 <constant id="JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER" num="0x0400"> 1238 Thread is waiting to enter a synchronized block/method or, 1239 after an <code>Object.wait()</code>, waiting to re-enter a 1240 synchronized block/method. 1241 </constant> 1242 <constant id="JVMTI_THREAD_STATE_WAITING" num="0x0080"> 1243 Thread is waiting. 1244 </constant> 1245 <constant id="JVMTI_THREAD_STATE_WAITING_INDEFINITELY" num="0x0010"> 1246 Thread is waiting without a timeout. 1247 For example, <code>Object.wait()</code>. 1248 </constant> 1249 <constant id="JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT" num="0x0020"> 1250 Thread is waiting with a maximum time to wait specified. 1251 For example, <code>Object.wait(long)</code>. 1252 </constant> 1253 <constant id="JVMTI_THREAD_STATE_SLEEPING" num="0x0040"> 1254 Thread is sleeping -- <code>Thread.sleep</code>. 1255 </constant> 1256 <constant id="JVMTI_THREAD_STATE_IN_OBJECT_WAIT" num="0x0100"> 1257 Thread is waiting on an object monitor -- <code>Object.wait</code>. 1258 </constant> 1259 <constant id="JVMTI_THREAD_STATE_PARKED" num="0x0200"> 1260 Thread is parked, for example: <code>LockSupport.park</code>, 1261 <code>LockSupport.parkUtil</code> and <code>LockSupport.parkNanos</code>. 1262 A virtual thread that is sleeping, in <code>Thread.sleep</code>, may 1263 have this state flag set instead of <code>JVMTI_THREAD_STATE_SLEEPING</code>. 1264 </constant> 1265 <constant id="JVMTI_THREAD_STATE_SUSPENDED" num="0x100000"> 1266 Thread is suspended by a suspend function 1267 (such as <functionlink id="SuspendThread"></functionlink>). 1268 If this bit is set, the other bits refer to the thread state before 1269 suspension. 1270 </constant> 1271 <constant id="JVMTI_THREAD_STATE_INTERRUPTED" num="0x200000"> 1272 Thread has been interrupted. 1273 </constant> 1274 <constant id="JVMTI_THREAD_STATE_IN_NATIVE" num="0x400000"> 1275 Thread is in native code--that is, a native method is running 1276 which has not called back into the VM or Java programming 1277 language code. 1278 <p/> 1279 This flag is not set when running VM compiled Java programming 1280 language code nor is it set when running VM code or 1281 VM support code. Native VM interface functions, such as JNI and 1282 <jvmti/> functions, may be implemented as VM code. 1283 </constant> 1284 <constant id="JVMTI_THREAD_STATE_VENDOR_1" num="0x10000000"> 1285 Defined by VM vendor. 1286 </constant> 1287 <constant id="JVMTI_THREAD_STATE_VENDOR_2" num="0x20000000"> 1288 Defined by VM vendor. 1289 </constant> 1290 <constant id="JVMTI_THREAD_STATE_VENDOR_3" num="0x40000000"> 1291 Defined by VM vendor. 1292 </constant> 1293 </constants> 1294 The following definitions are used to convert <jvmti/> thread state 1295 to <code>java.lang.Thread.State</code> style states. 1296 <constants id="jvmtiJavaLangThreadState" label="java.lang.Thread.State Conversion Masks" kind="bits"> 1297 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_MASK" 1298 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"> 1299 Mask the state with this before comparison 1300 </constant> 1301 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_NEW" 1302 num="0"> 1303 <code>java.lang.Thread.State.NEW</code> 1304 </constant> 1305 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_TERMINATED" 1306 num="JVMTI_THREAD_STATE_TERMINATED"> 1307 <code>java.lang.Thread.State.TERMINATED</code> 1308 </constant> 1309 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_RUNNABLE" 1310 num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_RUNNABLE"> 1311 <code>java.lang.Thread.State.RUNNABLE</code> 1312 </constant> 1313 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_BLOCKED" 1314 num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER"> 1315 <code>java.lang.Thread.State.BLOCKED</code> 1316 </constant> 1317 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_WAITING" 1318 num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_INDEFINITELY"> 1319 <code>java.lang.Thread.State.WAITING</code> 1320 </constant> 1321 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_TIMED_WAITING" 1322 num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT"> 1323 <code>java.lang.Thread.State.TIMED_WAITING</code> 1324 </constant> 1325 </constants> 1326 <b>Rules</b> 1327 <p/> 1328 There can be no more than one answer to a question, although there can be no 1329 answer (because the answer is unknown, does not apply, or none of the answers is 1330 correct). An answer is set only when the enclosing answers match. 1331 That is, no more than one of 1332 <ul type="circle"> 1333 <li><code>JVMTI_THREAD_STATE_RUNNABLE</code></li> 1334 <li><code>JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER</code></li> 1335 <li><code>JVMTI_THREAD_STATE_WAITING</code></li> 1336 </ul> 1337 can be set (a <tm>J2SE</tm> compliant implementation will always set 1338 one of these if <code>JVMTI_THREAD_STATE_ALIVE</code> is set). 1339 And if any of these are set, the enclosing answer 1340 <code>JVMTI_THREAD_STATE_ALIVE</code> is set. 1341 No more than one of 1342 <ul type="circle"> 1343 <li><code>JVMTI_THREAD_STATE_WAITING_INDEFINITELY</code></li> 1344 <li><code>JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT</code></li> 1345 </ul> 1346 can be set (a <tm>J2SE</tm> compliant implementation will always set 1347 one of these if <code>JVMTI_THREAD_STATE_WAITING</code> is set). 1348 And if either is set, the enclosing answers 1349 <code>JVMTI_THREAD_STATE_ALIVE</code> and 1350 <code>JVMTI_THREAD_STATE_WAITING</code> are set. 1351 No more than one of 1352 <ul type="circle"> 1353 <li><code>JVMTI_THREAD_STATE_IN_OBJECT_WAIT</code></li> 1354 <li><code>JVMTI_THREAD_STATE_PARKED</code></li> 1355 <li><code>JVMTI_THREAD_STATE_SLEEPING</code></li> 1356 </ul> 1357 can be set. And if any of these is set, the enclosing answers 1358 <code>JVMTI_THREAD_STATE_ALIVE</code> and 1359 <code>JVMTI_THREAD_STATE_WAITING</code> are set. 1360 Also, if <code>JVMTI_THREAD_STATE_SLEEPING</code> is set, 1361 then <code>JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT</code> is set. 1362 If a state <i>A</i> is implemented using the mechanism of 1363 state <i>B</i> then it is state <i>A</i> which 1364 is returned by this function. 1365 For example, if <code>Thread.sleep(long)</code> 1366 is implemented using <code>Object.wait(long)</code> 1367 then it is still <code>JVMTI_THREAD_STATE_SLEEPING</code> 1368 which is returned. 1369 More than one of 1370 <ul type="circle"> 1371 <li><code>JVMTI_THREAD_STATE_SUSPENDED</code></li> 1372 <li><code>JVMTI_THREAD_STATE_INTERRUPTED</code></li> 1373 <li><code>JVMTI_THREAD_STATE_IN_NATIVE</code></li> 1374 </ul> 1375 can be set, but if any is set, 1376 <code>JVMTI_THREAD_STATE_ALIVE</code> is set. 1377 <p/> 1378 And finally, 1379 <code>JVMTI_THREAD_STATE_TERMINATED</code> cannot be set unless 1380 <code>JVMTI_THREAD_STATE_ALIVE</code> is not set. 1381 <p/> 1382 The thread state representation is designed for extension in future versions 1383 of the specification; thread state values should be used accordingly, that is 1384 they should not be used as ordinals. 1385 Most queries can be made by testing a single bit, if use in a switch statement is desired, 1386 the state bits should be masked with the interesting bits. 1387 All bits not defined above are reserved for future use. 1388 A VM, compliant to the current specification, must set reserved bits to zero. 1389 An agent should ignore reserved bits -- 1390 they should not be assumed to be zero and thus should not be included in comparisons. 1391 <p/> 1392 <b>Examples</b> 1393 <p/> 1394 Note that the values below exclude reserved and vendor bits. 1395 <p/> 1396 The state of a thread blocked at a <code>synchronized</code>-statement would be: 1397 <example> 1398 JVMTI_THREAD_STATE_ALIVE + JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER 1399 </example> 1400 The state of a thread which hasn't started yet would be: 1401 <example> 1402 0 1403 </example> 1404 The state of a thread at a <code>Object.wait(3000)</code> would be: 1405 <example> 1406 JVMTI_THREAD_STATE_ALIVE + JVMTI_THREAD_STATE_WAITING + 1407 JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT + 1408 JVMTI_THREAD_STATE_MONITOR_WAITING 1409 </example> 1410 The state of a thread suspended while runnable would be: 1411 <example> 1412 JVMTI_THREAD_STATE_ALIVE + JVMTI_THREAD_STATE_RUNNABLE + JVMTI_THREAD_STATE_SUSPENDED 1413 </example> 1414 <p/> 1415 <b>Testing the State</b> 1416 <p/> 1417 In most cases, the thread state can be determined by testing the one bit corresponding 1418 to that question. For example, the code to test if a thread is sleeping: 1419 <example> 1420 jint state; 1421 jvmtiError err; 1422 1423 err = (*jvmti)->GetThreadState(jvmti, thread, &state); 1424 if (err == JVMTI_ERROR_NONE) { 1425 if (state & JVMTI_THREAD_STATE_SLEEPING) { ... 1426 </example> 1427 <p/> 1428 For waiting (that is, in <code>Object.wait</code>, parked, or sleeping) it would be: 1429 <example> 1430 if (state & JVMTI_THREAD_STATE_WAITING) { ... 1431 </example> 1432 For some states, more than one bit will need to be tested as is the case 1433 when testing if a thread has not yet been started: 1434 <example> 1435 if ((state & (JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_TERMINATED)) == 0) { ... 1436 </example> 1437 To distinguish timed from untimed <code>Object.wait</code>: 1438 <example> 1439 if (state & JVMTI_THREAD_STATE_IN_OBJECT_WAIT) { 1440 if (state & JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT) { 1441 printf("in Object.wait(long timeout)\n"); 1442 } else { 1443 printf("in Object.wait()\n"); 1444 } 1445 } 1446 </example> 1447 <p/> 1448 <b>Relationship to <code>java.lang.Thread.State</code></b> 1449 <p/> 1450 The thread state represented by <code>java.lang.Thread.State</code> 1451 returned from <code>java.lang.Thread.getState()</code> is a subset of the 1452 information returned from this function. 1453 The corresponding <code>java.lang.Thread.State</code> can be determined 1454 by using the provided conversion masks. 1455 For example, this returns the name of the <code>java.lang.Thread.State</code> thread state: 1456 <example> 1457 err = (*jvmti)->GetThreadState(jvmti, thread, &state); 1458 abortOnError(err); 1459 switch (state & JVMTI_JAVA_LANG_THREAD_STATE_MASK) { 1460 case JVMTI_JAVA_LANG_THREAD_STATE_NEW: 1461 return "NEW"; 1462 case JVMTI_JAVA_LANG_THREAD_STATE_TERMINATED: 1463 return "TERMINATED"; 1464 case JVMTI_JAVA_LANG_THREAD_STATE_RUNNABLE: 1465 return "RUNNABLE"; 1466 case JVMTI_JAVA_LANG_THREAD_STATE_BLOCKED: 1467 return "BLOCKED"; 1468 case JVMTI_JAVA_LANG_THREAD_STATE_WAITING: 1469 return "WAITING"; 1470 case JVMTI_JAVA_LANG_THREAD_STATE_TIMED_WAITING: 1471 return "TIMED_WAITING"; 1472 } 1473 </example> 1474 </description> 1475 <origin>new</origin> 1476 <capabilities> 1477 </capabilities> 1478 <parameters> 1479 <param id="thread"> 1480 <jthread null="current" started="maybe" impl="noconvert"/> 1481 <description> 1482 The thread to query. 1483 </description> 1484 </param> 1485 <param id="thread_state_ptr"> 1486 <outptr><jint/></outptr> 1487 <description> 1488 On return, points to state flags, 1489 as defined by the <internallink id="jvmtiThreadState">Thread State Flags</internallink>. 1490 </description> 1491 </param> 1492 </parameters> 1493 <errors> 1494 </errors> 1495 </function> 1496 1497 <function id="GetCurrentThread" phase="start" num="18" since="1.1"> 1498 <synopsis>Get Current Thread</synopsis> 1499 <description> 1500 Get the current thread. 1501 The current thread is the Java programming language thread which has called the function. 1502 The function may return <code>NULL</code> in the start phase if the 1503 <internallink id="jvmtiCapabilities.can_generate_early_vmstart"> 1504 <code>can_generate_early_vmstart</code></internallink> capability is enabled 1505 and the <code>java.lang.Thread</code> class has not been initialized yet. 1506 <p/> 1507 Note that most <jvmti/> functions that take a thread 1508 as an argument will accept <code>NULL</code> to mean 1509 the current thread. 1510 </description> 1511 <origin>new</origin> 1512 <capabilities> 1513 </capabilities> 1514 <parameters> 1515 <param id="thread_ptr"> 1516 <outptr><jthread/></outptr> 1517 <description> 1518 On return, points to the current thread, or <code>NULL</code>. 1519 </description> 1520 </param> 1521 </parameters> 1522 <errors> 1523 </errors> 1524 </function> 1525 1526 <function id="GetAllThreads" num="4"> 1527 <synopsis>Get All Threads</synopsis> 1528 <description> 1529 Get all live platform threads that are attached to the VM. 1530 The list of threads includes 1531 <internallink id="RunAgentThread">agent threads</internallink>. 1532 It does not include virtual threads. 1533 A thread is live if <code>java.lang.Thread.isAlive()</code> 1534 would return <code>true</code>, that is, the thread has 1535 been started and has not yet terminated. 1536 The universe of threads is determined by the context of the <jvmti/> 1537 environment, which typically is all threads attached to the VM. 1538 </description> 1539 <origin>jvmdi</origin> 1540 <capabilities> 1541 </capabilities> 1542 <parameters> 1543 <param id="threads_count_ptr"> 1544 <outptr><jint/></outptr> 1545 <description> 1546 On return, points to the number of threads. 1547 </description> 1548 </param> 1549 <param id="threads_ptr"> 1550 <allocbuf outcount="threads_count_ptr"><jthread/></allocbuf> 1551 <description> 1552 On return, points to an array of references, one 1553 for each thread. 1554 </description> 1555 </param> 1556 </parameters> 1557 <errors> 1558 </errors> 1559 </function> 1560 1561 <function id="SuspendThread" num="5"> 1562 <synopsis>Suspend Thread</synopsis> 1563 <description> 1564 Suspend the specified thread. If the calling thread is specified, 1565 this function will not return until some other thread calls 1566 <functionlink id="ResumeThread"></functionlink>. 1567 If the thread is currently suspended, this function 1568 does nothing and returns an error. 1569 </description> 1570 <origin>jvmdi</origin> 1571 <capabilities> 1572 <required id="can_suspend"></required> 1573 </capabilities> 1574 <parameters> 1575 <param id="thread"> 1576 <jthread null="current" impl="noconvert"/> 1577 <description> 1578 The thread to suspend. 1579 </description> 1580 </param> 1581 </parameters> 1582 <errors> 1583 <error id="JVMTI_ERROR_THREAD_SUSPENDED"> 1584 Thread already suspended. 1585 </error> 1586 </errors> 1587 </function> 1588 1589 <elide> 1590 <function id="SuspendAllThreads" num="101"> 1591 <synopsis>Suspend All Threads</synopsis> 1592 <description> 1593 <issue> 1594 There has been no explicit call for this function, and it will 1595 thus be removed if there is no interest. 1596 </issue> 1597 Suspend all live threads except: 1598 <ul> 1599 <li>already suspended threads</li> 1600 <li>those listed in <paramlink id="except_list"></paramlink></li> 1601 <li>certain system (non application) threads, as determined 1602 by the VM implementation</li> 1603 </ul> 1604 The threads are Java programming language threads; 1605 native threads which are not attached to the VM are not 1606 Java programming language threads. 1607 A thread is live if <code>java.lang.Thread.isAlive()</code> 1608 would return <code>true</code>, that is, the thread has 1609 been started and has not yet terminated. 1610 The universe of threads is determined 1611 by the context of the <jvmti/> 1612 environment, which, typically, is all threads attached to the VM, 1613 except critical VM internal threads and <jvmti/> agent threads 1614 (see <functionlink id="RunAgentThread"/>). 1615 <p/> 1616 If the calling thread is specified, 1617 all other threads are suspended first then the caller thread is suspended - 1618 this function will not return until some other thread calls 1619 <functionlink id="ResumeThread"></functionlink>. 1620 <p/> 1621 The list of actually 1622 suspended threads is returned in 1623 <paramlink id="suspended_list_ptr"></paramlink>. 1624 Suspension is as defined in <functionlink id="SuspendThread"></functionlink>. 1625 <functionlink id="ResumeThreadList"></functionlink> 1626 can be used to resume the suspended threads. 1627 </description> 1628 <origin>new</origin> 1629 <capabilities> 1630 <required id="can_suspend"></required> 1631 </capabilities> 1632 <parameters> 1633 <param id="except_count"> 1634 <jint min="0"/> 1635 <description> 1636 The number of threads in the list of threads not to be suspended. 1637 </description> 1638 </param> 1639 <param id="except_list"> 1640 <inbuf incount="except_count"> 1641 <jthread/> 1642 <nullok>not an error if <code>except_count == 0</code></nullok> 1643 </inbuf> 1644 <description> 1645 The list of threads not to be suspended. 1646 </description> 1647 </param> 1648 <param id="suspended_count_ptr"> 1649 <outptr><jint/></outptr> 1650 <description> 1651 On return, points to the number of threads suspended by this call. 1652 </description> 1653 </param> 1654 <param id="suspended_list_ptr"> 1655 <allocbuf outcount="suspended_count_ptr"><jthread/></allocbuf> 1656 <description> 1657 On return, points to an array of references, one 1658 for each thread suspended. 1659 </description> 1660 </param> 1661 </parameters> 1662 <errors> 1663 <error id="JVMTI_ERROR_INVALID_THREAD"> 1664 A thread in <paramlink id="except_list"></paramlink> was invalid. 1665 </error> 1666 <error id="JVMTI_ERROR_NULL_POINTER"> 1667 Both <paramlink id="except_list"></paramlink> was <code>NULL</code> 1668 and <paramlink id="except_count"></paramlink> was non-zero. 1669 </error> 1670 </errors> 1671 </function> 1672 </elide> 1673 1674 <function id="SuspendThreadList" num="92"> 1675 <synopsis>Suspend Thread List</synopsis> 1676 <description> 1677 Suspend the <paramlink id="request_count"></paramlink> 1678 threads specified in the 1679 <paramlink id="request_list"></paramlink> array. 1680 Threads may be resumed with 1681 <functionlink id="ResumeThreadList"></functionlink> or 1682 <functionlink id="ResumeThread"></functionlink>. 1683 If the calling thread is specified in the 1684 <paramlink id="request_list"></paramlink> array, this function will 1685 not return until some other thread resumes it. 1686 Errors encountered in the suspension of a thread 1687 are returned in the <paramlink id="results"></paramlink> 1688 array, <b>not</b> in the return value of this function. 1689 Threads that are currently suspended do not change state. 1690 </description> 1691 <origin>jvmdi</origin> 1692 <capabilities> 1693 <required id="can_suspend"></required> 1694 </capabilities> 1695 <parameters> 1696 <param id="request_count"> 1697 <jint min="0"/> 1698 <description> 1699 The number of threads to suspend. 1700 </description> 1701 </param> 1702 <param id="request_list"> 1703 <inbuf incount="request_count"><jthread/></inbuf> 1704 <description> 1705 The list of threads to suspend. 1706 </description> 1707 </param> 1708 <param id="results"> 1709 <outbuf incount="request_count"><enum>jvmtiError</enum></outbuf> 1710 <description> 1711 An agent supplied array of 1712 <paramlink id="request_count"></paramlink> elements. 1713 On return, filled with the error code for 1714 the suspend of the corresponding thread. 1715 The error code will be 1716 <errorlink id="JVMTI_ERROR_NONE"></errorlink> 1717 if the thread was suspended by this call. 1718 Possible error codes are those specified 1719 for <functionlink id="SuspendThread"></functionlink>. 1720 </description> 1721 </param> 1722 </parameters> 1723 <errors> 1724 </errors> 1725 </function> 1726 1727 <function id="SuspendAllVirtualThreads" num="118" since="19"> 1728 <synopsis>Suspend All Virtual Threads</synopsis> 1729 <description> 1730 <b> SuspendAllVirtualThreads is a preview API of the Java platform. </b> 1731 <i>Preview features may be removed in a future release, or upgraded to 1732 permanent features of the Java platform.</i> 1733 <p/> 1734 Suspend all virtual threads except those in the exception list. 1735 Virtual threads that are currently suspended do not change state. 1736 Virtual threads may be resumed with 1737 <functionlink id="ResumeAllVirtualThreads"></functionlink> or 1738 <functionlink id="ResumeThreadList"></functionlink> or 1739 <functionlink id="ResumeThread"></functionlink>. 1740 </description> 1741 <origin>new</origin> 1742 <capabilities> 1743 <required id="can_suspend"></required> 1744 <required id="can_support_virtual_threads">Can support virtual threads</required> 1745 </capabilities> 1746 <parameters> 1747 <param id="except_count"> 1748 <jint min="0"/> 1749 <description> 1750 The number of threads in the list of threads not to be suspended. 1751 </description> 1752 </param> 1753 <param id="except_list"> 1754 <inbuf incount="except_count"> 1755 <jthread/> 1756 <nullok>not an error if <code>except_count == 0</code></nullok> 1757 </inbuf> 1758 <description> 1759 The list of threads not to be suspended. 1760 </description> 1761 </param> 1762 </parameters> 1763 <errors> 1764 <error id="JVMTI_ERROR_INVALID_THREAD"> 1765 A thread in <paramlink id="except_list"></paramlink> was invalid. 1766 </error> 1767 <error id="JVMTI_ERROR_NULL_POINTER"> 1768 Both <paramlink id="except_list"></paramlink> was <code>NULL</code> 1769 and <paramlink id="except_count"></paramlink> was non-zero. 1770 </error> 1771 </errors> 1772 </function> 1773 1774 <function id="ResumeThread" num="6"> 1775 <synopsis>Resume Thread</synopsis> 1776 <description> 1777 Resume a suspended thread. 1778 Any threads currently suspended through 1779 a <jvmti/> suspend function (eg. 1780 <functionlink id="SuspendThread"></functionlink>) 1781 will resume execution; 1782 all other threads are unaffected. 1783 </description> 1784 <origin>jvmdi</origin> 1785 <capabilities> 1786 <required id="can_suspend"></required> 1787 </capabilities> 1788 <parameters> 1789 <param id="thread"> 1790 <jthread impl="noconvert"/> 1791 <description> 1792 The thread to resume. 1793 </description> 1794 </param> 1795 </parameters> 1796 <errors> 1797 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 1798 Thread was not suspended. 1799 </error> 1800 <error id="JVMTI_ERROR_INVALID_TYPESTATE"> 1801 The state of the thread has been modified, and is now inconsistent. 1802 </error> 1803 </errors> 1804 </function> 1805 1806 <function id="ResumeThreadList" num="93"> 1807 <synopsis>Resume Thread List</synopsis> 1808 <description> 1809 Resume the <paramlink id="request_count"></paramlink> 1810 threads specified in the 1811 <paramlink id="request_list"></paramlink> array. 1812 Any thread suspended through 1813 a <jvmti/> suspend function (eg. 1814 <functionlink id="SuspendThreadList"></functionlink>) 1815 will resume execution. 1816 </description> 1817 <origin>jvmdi</origin> 1818 <capabilities> 1819 <required id="can_suspend"></required> 1820 </capabilities> 1821 <parameters> 1822 <param id="request_count"> 1823 <jint min="0"/> 1824 <description> 1825 The number of threads to resume. 1826 </description> 1827 </param> 1828 <param id="request_list"> 1829 <inbuf incount="request_count"><jthread/></inbuf> 1830 <description> 1831 The threads to resume. 1832 </description> 1833 </param> 1834 <param id="results"> 1835 <outbuf incount="request_count"><enum>jvmtiError</enum></outbuf> 1836 <description> 1837 An agent supplied array of 1838 <paramlink id="request_count"></paramlink> elements. 1839 On return, filled with the error code for 1840 the resume of the corresponding thread. 1841 The error code will be 1842 <errorlink id="JVMTI_ERROR_NONE"></errorlink> 1843 if the thread was suspended by this call. 1844 Possible error codes are those specified 1845 for <functionlink id="ResumeThread"></functionlink>. 1846 </description> 1847 </param> 1848 </parameters> 1849 <errors> 1850 </errors> 1851 </function> 1852 1853 <function id="ResumeAllVirtualThreads" num="119" since="19"> 1854 <synopsis>Resume All Virtual Threads</synopsis> 1855 <description> 1856 <b> ResumeAllVirtualThreads is a preview API of the Java platform. </b> 1857 <i>Preview features may be removed in a future release, or upgraded to 1858 permanent features of the Java platform.</i> 1859 <p/> 1860 Resume all virtual threads except those in the exception list. 1861 Virtual threads that are currently resumed do not change state. 1862 Virtual threads may be suspended with 1863 <functionlink id="SuspendAllVirtualThreads"></functionlink> or 1864 <functionlink id="SuspendThreadList"></functionlink> or 1865 <functionlink id="SuspendThread"></functionlink>. 1866 </description> 1867 <origin>new</origin> 1868 <capabilities> 1869 <required id="can_suspend"></required> 1870 <required id="can_support_virtual_threads">Can support virtual threads</required> 1871 </capabilities> 1872 <parameters> 1873 <param id="except_count"> 1874 <jint min="0"/> 1875 <description> 1876 The number of threads in the list of threads not to be resumed. 1877 </description> 1878 </param> 1879 <param id="except_list"> 1880 <inbuf incount="except_count"> 1881 <jthread/> 1882 <nullok>not an error if <code>except_count == 0</code></nullok> 1883 </inbuf> 1884 <description> 1885 The list of threads not to be resumed. 1886 </description> 1887 </param> 1888 </parameters> 1889 <errors> 1890 <error id="JVMTI_ERROR_INVALID_THREAD"> 1891 A thread in <paramlink id="except_list"></paramlink> was invalid. 1892 </error> 1893 <error id="JVMTI_ERROR_NULL_POINTER"> 1894 Both <paramlink id="except_list"></paramlink> was <code>NULL</code> 1895 and <paramlink id="except_count"></paramlink> was non-zero. 1896 </error> 1897 </errors> 1898 </function> 1899 1900 <function id="StopThread" num="7"> 1901 <synopsis>Stop Thread</synopsis> 1902 <description> 1903 Send the specified asynchronous exception to the specified platform thread. 1904 </description> 1905 <origin>jvmdi</origin> 1906 <capabilities> 1907 <required id="can_signal_thread"></required> 1908 </capabilities> 1909 <parameters> 1910 <param id="thread"> 1911 <jthread impl="noconvert"/> 1912 <description> 1913 The thread to stop. 1914 The <code>thread</code> may not be a virtual thread. Otherwise, the error code 1915 <errorlink id="JVMTI_ERROR_UNSUPPORTED_OPERATION"></errorlink> will be returned. 1916 </description> 1917 </param> 1918 <param id="exception"> 1919 <jobject/> 1920 <description> 1921 The asynchronous exception object. 1922 </description> 1923 </param> 1924 </parameters> 1925 <errors> 1926 <error id="JVMTI_ERROR_UNSUPPORTED_OPERATION"> 1927 <paramlink id="thread"/> is a virtual thread. 1928 </error> 1929 </errors> 1930 </function> 1931 1932 <function id="InterruptThread" num="8"> 1933 <synopsis>Interrupt Thread</synopsis> 1934 <description> 1935 Interrupt the specified thread 1936 (similar to <code>java.lang.Thread.interrupt</code>). 1937 </description> 1938 <origin>jvmdi</origin> 1939 <capabilities> 1940 <required id="can_signal_thread"></required> 1941 </capabilities> 1942 <parameters> 1943 <param id="thread"> 1944 <jthread impl="noconvert"/> 1945 <description> 1946 The thread to interrupt. 1947 </description> 1948 </param> 1949 </parameters> 1950 <errors> 1951 </errors> 1952 </function> 1953 1954 <function id="GetThreadInfo" num="9"> 1955 <synopsis>Get Thread Info</synopsis> 1956 <typedef id="jvmtiThreadInfo" label="Thread information structure"> 1957 <field id="name"> 1958 <allocfieldbuf><char/></allocfieldbuf> 1959 <description> 1960 The thread name, encoded as a 1961 <internallink id="mUTF">modified UTF-8</internallink> string. 1962 </description> 1963 </field> 1964 <field id="priority"> 1965 <jint/> 1966 <description> 1967 The thread priority. See the thread priority constants: 1968 <datalink id="jvmtiThreadPriority"></datalink>. The priority of a 1969 virtual thread is always <code>JVMTI_THREAD_NORM_PRIORITY</code>. 1970 </description> 1971 </field> 1972 <field id="is_daemon"> 1973 <jboolean/> 1974 <description> 1975 Is this a daemon thread? The daemon status of a virtual thread is 1976 always <code>JNI_TRUE</code>. 1977 </description> 1978 </field> 1979 <field id="thread_group"> 1980 <jthreadGroup/> 1981 <description> 1982 The thread group to which this thread belongs. 1983 <code>NULL</code> if the thread has terminated. 1984 </description> 1985 </field> 1986 <field id="context_class_loader"> 1987 <jobject/> 1988 <description> 1989 The context class loader associated with this thread. 1990 </description> 1991 </field> 1992 </typedef> 1993 <description> 1994 Get thread information. The fields of the <datalink id="jvmtiThreadInfo"/> structure 1995 are filled in with details of the specified thread. 1996 </description> 1997 <origin>jvmdi</origin> 1998 <capabilities> 1999 </capabilities> 2000 <parameters> 2001 <param id="thread"> 2002 <jthread null="current" impl="noconvert" started="maybe"/> 2003 <description> 2004 The thread to query. 2005 </description> 2006 </param> 2007 <param id="info_ptr"> 2008 <outptr><struct>jvmtiThreadInfo</struct></outptr> 2009 <description> 2010 On return, filled with information describing the specified thread. 2011 </description> 2012 </param> 2013 </parameters> 2014 <errors> 2015 </errors> 2016 </function> 2017 2018 <function id="GetOwnedMonitorInfo" num="10"> 2019 <synopsis>Get Owned Monitor Info</synopsis> 2020 <description> 2021 Get information about the monitors owned by the 2022 specified thread. 2023 </description> 2024 <origin>jvmdiClone</origin> 2025 <capabilities> 2026 <required id="can_get_owned_monitor_info"></required> 2027 </capabilities> 2028 <parameters> 2029 <param id="thread"> 2030 <jthread null="current" impl="noconvert"/> 2031 <description> 2032 The thread to query. 2033 </description> 2034 </param> 2035 <param id="owned_monitor_count_ptr"> 2036 <outptr><jint/></outptr> 2037 <description> 2038 The number of monitors returned. 2039 </description> 2040 </param> 2041 <param id="owned_monitors_ptr"> 2042 <allocbuf outcount="owned_monitor_count_ptr"><jobject/></allocbuf> 2043 <description> 2044 The array of owned monitors. 2045 </description> 2046 </param> 2047 </parameters> 2048 <errors> 2049 </errors> 2050 </function> 2051 2052 <function id="GetOwnedMonitorStackDepthInfo" num="153" since="1.1"> 2053 <synopsis>Get Owned Monitor Stack Depth Info</synopsis> 2054 <typedef id="jvmtiMonitorStackDepthInfo" 2055 label="Monitor stack depth information structure"> 2056 <field id="monitor"> 2057 <jobject/> 2058 <description> 2059 The owned monitor. 2060 </description> 2061 </field> 2062 <field id="stack_depth"> 2063 <jint/> 2064 <description> 2065 The stack depth. Corresponds to the stack depth used in the 2066 <internallink id="stack">Stack Frame functions</internallink>. 2067 That is, zero is the current frame, one is the frame which 2068 called the current frame. And it is negative one if the 2069 implementation cannot determine the stack depth (e.g., for 2070 monitors acquired by JNI <code>MonitorEnter</code>). 2071 </description> 2072 </field> 2073 </typedef> 2074 <description> 2075 Get information about the monitors owned by the 2076 specified thread and the depth of the stack frame which locked them. 2077 </description> 2078 <origin>new</origin> 2079 <capabilities> 2080 <required id="can_get_owned_monitor_stack_depth_info"></required> 2081 </capabilities> 2082 <parameters> 2083 <param id="thread"> 2084 <jthread null="current" impl="noconvert"/> 2085 <description> 2086 The thread to query. 2087 </description> 2088 </param> 2089 <param id="monitor_info_count_ptr"> 2090 <outptr><jint/></outptr> 2091 <description> 2092 The number of monitors returned. 2093 </description> 2094 </param> 2095 <param id="monitor_info_ptr"> 2096 <allocbuf outcount="monitor_info_count_ptr"> 2097 <struct>jvmtiMonitorStackDepthInfo</struct> 2098 </allocbuf> 2099 <description> 2100 The array of owned monitor depth information. 2101 </description> 2102 </param> 2103 </parameters> 2104 <errors> 2105 </errors> 2106 </function> 2107 2108 <function id="GetCurrentContendedMonitor" num="11"> 2109 <synopsis>Get Current Contended Monitor</synopsis> 2110 <description> 2111 Get the object, if any, whose monitor the specified thread is waiting to 2112 enter or waiting to regain through <code>java.lang.Object.wait</code>. 2113 </description> 2114 <origin>jvmdi</origin> 2115 <capabilities> 2116 <required id="can_get_current_contended_monitor"></required> 2117 </capabilities> 2118 <parameters> 2119 <param id="thread"> 2120 <jthread null="current" impl="noconvert"/> 2121 <description> 2122 The thread to query. 2123 </description> 2124 </param> 2125 <param id="monitor_ptr"> 2126 <outptr><jobject/></outptr> 2127 <description> 2128 On return, filled with the current contended monitor, or 2129 NULL if there is none. 2130 </description> 2131 </param> 2132 </parameters> 2133 <errors> 2134 </errors> 2135 </function> 2136 2137 <callback id="jvmtiStartFunction"> 2138 <void/> 2139 <synopsis>Agent Start Function</synopsis> 2140 <description> 2141 Agent supplied callback function. 2142 This function is the entry point for an agent thread 2143 started with 2144 <functionlink id="RunAgentThread"></functionlink>. 2145 </description> 2146 <parameters> 2147 <param id="jvmti_env"> 2148 <outptr> 2149 <struct>jvmtiEnv</struct> 2150 </outptr> 2151 <description> 2152 The <jvmti/> environment. 2153 </description> 2154 </param> 2155 <param id="jni_env"> 2156 <outptr> 2157 <struct>JNIEnv</struct> 2158 </outptr> 2159 <description> 2160 The JNI environment. 2161 </description> 2162 </param> 2163 <param id="arg"> 2164 <outptr> 2165 <void/> 2166 </outptr> 2167 <description> 2168 The <code>arg</code> parameter passed to 2169 <functionlink id="RunAgentThread"></functionlink>. 2170 </description> 2171 </param> 2172 </parameters> 2173 </callback> 2174 2175 <function id="RunAgentThread" num="12"> 2176 <synopsis>Run Agent Thread</synopsis> 2177 <description> 2178 Starts the execution of an agent thread. with the specified native function. 2179 The parameter <paramlink id="arg"></paramlink> is forwarded on to the 2180 <functionlink id="jvmtiStartFunction">start function</functionlink> 2181 (specified with <paramlink id="proc"></paramlink>) as its single argument. 2182 This function allows the creation of agent threads 2183 for handling communication with another process or for handling events 2184 without the need to load a special subclass of <code>java.lang.Thread</code> or 2185 implementer of <code>java.lang.Runnable</code>. 2186 Instead, the created thread can run entirely in native code. 2187 However, the created thread does require a newly created instance 2188 of <code>java.lang.Thread</code> (referenced by the argument <code>thread</code>) to 2189 which it will be associated. 2190 The thread object can be created with JNI calls. 2191 <p/> 2192 The following common thread priorities are provided for your convenience: 2193 <constants id="jvmtiThreadPriority" label="Thread Priority Constants" kind="const"> 2194 <constant id="JVMTI_THREAD_MIN_PRIORITY" num="1"> 2195 Minimum possible thread priority 2196 </constant> 2197 <constant id="JVMTI_THREAD_NORM_PRIORITY" num="5"> 2198 Normal thread priority 2199 </constant> 2200 <constant id="JVMTI_THREAD_MAX_PRIORITY" num="10"> 2201 Maximum possible thread priority 2202 </constant> 2203 </constants> 2204 <p/> 2205 The new thread is started as a daemon thread with the specified 2206 <paramlink id="priority"></paramlink>. 2207 If enabled, a <eventlink id="ThreadStart"/> event will be sent. 2208 <p/> 2209 Since the thread has been started, the thread will be live when this function 2210 returns, unless the thread terminated immediately. 2211 <p/> 2212 The thread group of the thread is ignored -- specifically, the thread is not 2213 added to the thread group and the thread is not seen on queries of the thread 2214 group at either the Java programming language or <jvmti/> levels. 2215 <p/> 2216 The thread is not visible to Java programming language queries but is 2217 included in <jvmti/> queries (for example, 2218 <functionlink id="GetAllThreads"/> and 2219 <functionlink id="GetAllStackTraces"/>). 2220 <p/> 2221 Upon execution of <code>proc</code>, the new thread will be attached to the 2222 VM -- see the JNI documentation on 2223 <externallink id="jni/invocation.html#attaching-to-the-vm" 2224 >Attaching to the VM</externallink>. 2225 </description> 2226 <origin>jvmdiClone</origin> 2227 <capabilities> 2228 </capabilities> 2229 <parameters> 2230 <param id="thread"> 2231 <jthread impl="noconvert" started="no"/> 2232 <description> 2233 The thread to run. 2234 The <code>thread</code> may not be a virtual thread. Otherwise, the error code 2235 <errorlink id="JVMTI_ERROR_UNSUPPORTED_OPERATION"></errorlink> will be returned. 2236 </description> 2237 </param> 2238 <param id="proc"> 2239 <ptrtype> 2240 <struct>jvmtiStartFunction</struct> 2241 </ptrtype> 2242 <description> 2243 The start function. 2244 </description> 2245 </param> 2246 <param id="arg"> 2247 <inbuf> 2248 <void/> 2249 <nullok><code>NULL</code> is passed to the start function</nullok> 2250 </inbuf> 2251 <description> 2252 The argument to the start function. 2253 </description> 2254 </param> 2255 <param id="priority"> 2256 <jint/> 2257 <description> 2258 The priority of the started thread. Any thread 2259 priority allowed by <code>java.lang.Thread.setPriority</code> can be used including 2260 those in <datalink id="jvmtiThreadPriority"></datalink>. 2261 </description> 2262 </param> 2263 </parameters> 2264 <errors> 2265 <error id="JVMTI_ERROR_INVALID_PRIORITY"> 2266 <paramlink id="priority"/> is less than 2267 <datalink id="JVMTI_THREAD_MIN_PRIORITY"/> 2268 or greater than 2269 <datalink id="JVMTI_THREAD_MAX_PRIORITY"/> 2270 </error> 2271 <error id="JVMTI_ERROR_UNSUPPORTED_OPERATION"> 2272 <paramlink id="thread"/> is a virtual thread. 2273 </error> 2274 </errors> 2275 </function> 2276 2277 <function id="SetThreadLocalStorage" jkernel="yes" impl="notrace" phase="start" num="103"> 2278 <synopsis>Set Thread Local Storage</synopsis> 2279 <description> 2280 The VM stores a pointer value associated with each environment-thread 2281 pair. This pointer value is called <i>thread-local storage</i>. 2282 This value is <code>NULL</code> unless set with this function. 2283 Agents can allocate memory in which they store thread specific 2284 information. By setting thread-local storage it can then be 2285 accessed with 2286 <functionlink id="GetThreadLocalStorage"></functionlink>. 2287 <p/> 2288 This function is called by the agent to set the value of the <jvmti/> 2289 thread-local storage. <jvmti/> supplies to the agent a pointer-size 2290 thread-local storage that can be used to record per-thread 2291 information. 2292 </description> 2293 <origin>jvmpi</origin> 2294 <capabilities> 2295 </capabilities> 2296 <parameters> 2297 <param id="thread"> 2298 <jthread null="current" impl="noconvert"/> 2299 <description> 2300 Store to this thread. 2301 </description> 2302 </param> 2303 <param id="data"> 2304 <inbuf> 2305 <void/> 2306 <nullok>value is set to <code>NULL</code></nullok> 2307 </inbuf> 2308 <description> 2309 The value to be entered into the thread-local storage. 2310 </description> 2311 </param> 2312 </parameters> 2313 <errors> 2314 </errors> 2315 </function> 2316 2317 <function id="GetThreadLocalStorage" jkernel="yes" impl="innative notrace" phase="start" num="102"> 2318 <synopsis>Get Thread Local Storage</synopsis> 2319 <description> 2320 Called by the agent to get the value of the <jvmti/> thread-local 2321 storage. 2322 </description> 2323 <origin>jvmpi</origin> 2324 <capabilities> 2325 </capabilities> 2326 <parameters> 2327 <param id="thread"> 2328 <jthread null="current" impl="noconvert"/> 2329 <description> 2330 Retrieve from this thread. 2331 </description> 2332 </param> 2333 <param id="data_ptr"> 2334 <agentbuf><void/></agentbuf> 2335 <description> 2336 Pointer through which the value of the thread local 2337 storage is returned. 2338 If thread-local storage has not been set with 2339 <functionlink id="SetThreadLocalStorage"></functionlink> the returned 2340 pointer is <code>NULL</code>. 2341 </description> 2342 </param> 2343 </parameters> 2344 <errors> 2345 </errors> 2346 </function> 2347 2348 </category> 2349 2350 <category id="thread_groups" label="Thread Group"> 2351 <intro> 2352 </intro> 2353 2354 <function id="GetTopThreadGroups" num="13"> 2355 <synopsis>Get Top Thread Groups</synopsis> 2356 <description> 2357 Return all top-level (parentless) thread groups in the VM. 2358 </description> 2359 <origin>jvmdi</origin> 2360 <capabilities> 2361 </capabilities> 2362 <parameters> 2363 <param id="group_count_ptr"> 2364 <outptr><jint/></outptr> 2365 <description> 2366 On return, points to the number of top-level thread groups. 2367 </description> 2368 </param> 2369 <param id="groups_ptr"> 2370 <allocbuf outcount="group_count_ptr"><jthreadGroup/></allocbuf> 2371 <description> 2372 On return, refers to a pointer to the top-level thread group array. 2373 </description> 2374 </param> 2375 </parameters> 2376 <errors> 2377 </errors> 2378 </function> 2379 2380 <function id="GetThreadGroupInfo" num="14"> 2381 <synopsis>Get Thread Group Info</synopsis> 2382 <typedef id="jvmtiThreadGroupInfo" label="Thread group information structure"> 2383 <field id="parent"> 2384 <jthreadGroup/> 2385 <description> 2386 The parent thread group. 2387 </description> 2388 </field> 2389 <field id="name"> 2390 <allocfieldbuf><char/></allocfieldbuf> 2391 <description> 2392 The thread group's name, encoded as a 2393 <internallink id="mUTF">modified UTF-8</internallink> string. 2394 </description> 2395 </field> 2396 <field id="max_priority"> 2397 <jint/> 2398 <description> 2399 The maximum priority for this thread group. 2400 </description> 2401 </field> 2402 <field id="is_daemon"> 2403 <jboolean/> 2404 <description> 2405 Is this a daemon thread group? 2406 </description> 2407 </field> 2408 </typedef> 2409 <description> 2410 Get information about the thread group. The fields of the 2411 <functionlink id="jvmtiThreadGroupInfo"></functionlink> structure 2412 are filled in with details of the specified thread group. 2413 </description> 2414 <origin>jvmdi</origin> 2415 <capabilities> 2416 </capabilities> 2417 <parameters> 2418 <param id="group"> 2419 <jthreadGroup/> 2420 <description> 2421 The thread group to query. 2422 </description> 2423 </param> 2424 <param id="info_ptr"> 2425 <outptr><struct>jvmtiThreadGroupInfo</struct></outptr> 2426 <description> 2427 On return, filled with information describing the specified 2428 thread group. 2429 </description> 2430 </param> 2431 </parameters> 2432 <errors> 2433 </errors> 2434 </function> 2435 2436 <function id="GetThreadGroupChildren" num="15"> 2437 <synopsis>Get Thread Group Children</synopsis> 2438 <description> 2439 Get the live platform threads and the child thread groups in this 2440 thread group. Virtual threads are not returned by this function. 2441 </description> 2442 <origin>jvmdi</origin> 2443 <capabilities> 2444 </capabilities> 2445 <parameters> 2446 <param id="group"> 2447 <jthreadGroup/> 2448 <description> 2449 The group to query. 2450 </description> 2451 </param> 2452 <param id="thread_count_ptr"> 2453 <outptr><jint/></outptr> 2454 <description> 2455 On return, points to the number of live threads in this thread group. 2456 </description> 2457 </param> 2458 <param id="threads_ptr"> 2459 <allocbuf outcount="thread_count_ptr"><jthread/></allocbuf> 2460 <description> 2461 On return, points to an array of the live threads in this thread group. 2462 </description> 2463 </param> 2464 <param id="group_count_ptr"> 2465 <outptr><jint/></outptr> 2466 <description> 2467 On return, points to the number of child thread groups 2468 </description> 2469 </param> 2470 <param id="groups_ptr"> 2471 <allocbuf outcount="group_count_ptr"><jthreadGroup/></allocbuf> 2472 <description> 2473 On return, points to an array of the child thread groups. 2474 </description> 2475 </param> 2476 </parameters> 2477 <errors> 2478 </errors> 2479 </function> 2480 </category> 2481 2482 <category id="stack" label="Stack Frame"> 2483 <intro> 2484 These functions provide information about the stack of a thread. 2485 Stack frames are referenced by depth. 2486 The frame at depth zero is the current frame. 2487 <p/> 2488 Stack frames are as described in 2489 <vmspec chapter="3.6"/>, 2490 That is, they correspond to method 2491 invocations (including native methods) but do not correspond to platform native or 2492 VM internal frames. 2493 <p/> 2494 A <jvmti/> implementation may use method invocations to launch a thread and 2495 the corresponding frames may be included in the stack as presented by these functions -- 2496 that is, there may be frames shown 2497 deeper than <code>main()</code> and <code>run()</code>. 2498 However this presentation must be consistent across all <jvmti/> functionality which 2499 uses stack frames or stack depth. 2500 </intro> 2501 2502 <typedef id="jvmtiFrameInfo" label="Stack frame information structure"> 2503 <description> 2504 Information about a stack frame is returned in this structure. 2505 </description> 2506 <field id="method"> 2507 <jmethodID/> 2508 <description> 2509 The method executing in this frame. 2510 </description> 2511 </field> 2512 <field id="location"> 2513 <jlocation/> 2514 <description> 2515 The index of the instruction executing in this frame. 2516 <code>-1</code> if the frame is executing a native method. 2517 </description> 2518 </field> 2519 </typedef> 2520 2521 <typedef id="jvmtiStackInfo" label="Stack information structure"> 2522 <description> 2523 Information about a set of stack frames is returned in this structure. 2524 </description> 2525 <field id="thread"> 2526 <jthread/> 2527 <description> 2528 On return, the thread traced. 2529 </description> 2530 </field> 2531 <field id="state"> 2532 <jint/> 2533 <description> 2534 On return, the thread state. See <functionlink id="GetThreadState"></functionlink>. 2535 </description> 2536 </field> 2537 <field id="frame_buffer"> 2538 <outbuf incount="max_frame_count"> 2539 <struct>jvmtiFrameInfo</struct> 2540 </outbuf> 2541 <description> 2542 On return, this agent allocated buffer is filled 2543 with stack frame information. 2544 </description> 2545 </field> 2546 <field id="frame_count"> 2547 <jint/> 2548 <description> 2549 On return, the number of records filled into 2550 <code>frame_buffer</code>. 2551 This will be 2552 min(<code>max_frame_count</code>, <i>stackDepth</i>). 2553 </description> 2554 </field> 2555 </typedef> 2556 2557 <function id="GetStackTrace" num="104"> 2558 <synopsis>Get Stack Trace</synopsis> 2559 <description> 2560 Get information about the stack of a thread. 2561 If <paramlink id="max_frame_count"></paramlink> is less than the depth of the stack, 2562 the <paramlink id="max_frame_count"></paramlink> topmost frames are returned, 2563 otherwise the entire stack is returned. 2564 The topmost frames, those most recently invoked, are at the beginning of the returned buffer. 2565 <p/> 2566 The following example causes up to five of the topmost frames 2567 to be returned and (if there are any frames) the currently 2568 executing method name to be printed. 2569 <example> 2570 jvmtiFrameInfo frames[5]; 2571 jint count; 2572 jvmtiError err; 2573 2574 err = (*jvmti)->GetStackTrace(jvmti, aThread, 0, 5, 2575 frames, &count); 2576 if (err == JVMTI_ERROR_NONE && count >= 1) { 2577 char *methodName; 2578 err = (*jvmti)->GetMethodName(jvmti, frames[0].method, 2579 &methodName, NULL, NULL); 2580 if (err == JVMTI_ERROR_NONE) { 2581 printf("Executing method: %s", methodName); 2582 } 2583 } 2584 </example> 2585 <todo> 2586 check example code. 2587 </todo> 2588 <p/> 2589 The <paramlink id="thread"></paramlink> need not be suspended 2590 to call this function. 2591 <p/> 2592 The <functionlink id="GetLineNumberTable"></functionlink> 2593 function can be used to map locations to line numbers. Note that 2594 this mapping can be done lazily. 2595 </description> 2596 <origin>jvmpi</origin> 2597 <capabilities> 2598 </capabilities> 2599 <parameters> 2600 <param id="thread"> 2601 <jthread null="current" impl="noconvert"/> 2602 <description> 2603 Fetch the stack trace of this thread. 2604 </description> 2605 </param> 2606 <param id="start_depth"> 2607 <jint/> 2608 <description> 2609 Begin retrieving frames at this depth. 2610 If non-negative, count from the current frame, 2611 the first frame retrieved is at depth <code>start_depth</code>. 2612 For example, if zero, start from the current frame; if one, start from the 2613 caller of the current frame; if two, start from the caller of the 2614 caller of the current frame; and so on. 2615 If negative, count from below the oldest frame, 2616 the first frame retrieved is at depth <i>stackDepth</i><code> + start_depth</code>, 2617 where <i>stackDepth</i> is the count of frames on the stack. 2618 For example, if negative one, only the oldest frame is retrieved; 2619 if negative two, start from the frame called by the oldest frame. 2620 </description> 2621 </param> 2622 <param id="max_frame_count"> 2623 <jint min="0"/> 2624 <description> 2625 The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve. 2626 </description> 2627 </param> 2628 <param id="frame_buffer"> 2629 <outbuf incount="max_frame_count" outcount="count_ptr"> 2630 <struct>jvmtiFrameInfo</struct> 2631 </outbuf> 2632 <description> 2633 On return, this agent allocated buffer is filled 2634 with stack frame information. 2635 </description> 2636 </param> 2637 <param id="count_ptr"> 2638 <outptr><jint/></outptr> 2639 <description> 2640 On return, points to the number of records filled in. 2641 For non-negative <code>start_depth</code>, this will be 2642 min(<code>max_frame_count</code>, <i>stackDepth</i><code> - start_depth</code>). 2643 For negative <code>start_depth</code>, this will be 2644 min(<code>max_frame_count</code>, <code>-start_depth</code>). 2645 </description> 2646 </param> 2647 </parameters> 2648 <errors> 2649 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 2650 <paramlink id="start_depth"/> is positive and greater than or equal to <i>stackDepth</i>. 2651 Or <paramlink id="start_depth"/> is negative and less than <i>-stackDepth</i>. 2652 </error> 2653 </errors> 2654 </function> 2655 2656 2657 <function id="GetAllStackTraces" num="100"> 2658 <synopsis>Get All Stack Traces</synopsis> 2659 <description> 2660 Get the stack traces of all live platform threads attached to the VM. 2661 The list includes the stack traces of 2662 <internallink id="RunAgentThread">agent threads</internallink>. 2663 It does not include the stack traces of virtual threads. 2664 <p/> 2665 If <paramlink id="max_frame_count"/> is less than the depth of a stack, 2666 the <paramlink id="max_frame_count"/> topmost frames are returned for that thread, 2667 otherwise the entire stack is returned. 2668 The topmost frames, those most recently invoked, are at the beginning of the returned buffer. 2669 <p/> 2670 All stacks are collected simultaneously, that is, no changes will occur to the 2671 thread state or stacks between the sampling of one thread and the next. 2672 The threads need not be suspended. 2673 2674 <example> 2675 jvmtiStackInfo *stack_info; 2676 jint thread_count; 2677 int ti; 2678 jvmtiError err; 2679 2680 err = (*jvmti)->GetAllStackTraces(jvmti, MAX_FRAMES, &stack_info, &thread_count); 2681 if (err != JVMTI_ERROR_NONE) { 2682 ... 2683 } 2684 for (ti = 0; ti < thread_count; ++ti) { 2685 jvmtiStackInfo *infop = &stack_info[ti]; 2686 jthread thread = infop->thread; 2687 jint state = infop->state; 2688 jvmtiFrameInfo *frames = infop->frame_buffer; 2689 int fi; 2690 2691 myThreadAndStatePrinter(thread, state); 2692 for (fi = 0; fi < infop->frame_count; fi++) { 2693 myFramePrinter(frames[fi].method, frames[fi].location); 2694 } 2695 } 2696 /* this one Deallocate call frees all data allocated by GetAllStackTraces */ 2697 err = (*jvmti)->Deallocate(jvmti, stack_info); 2698 </example> 2699 <todo> 2700 check example code. 2701 </todo> 2702 2703 </description> 2704 <origin>new</origin> 2705 <capabilities> 2706 </capabilities> 2707 <parameters> 2708 <param id="max_frame_count"> 2709 <jint min="0"/> 2710 <description> 2711 The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve per thread. 2712 </description> 2713 </param> 2714 <param id="stack_info_ptr"> 2715 <allocbuf> 2716 <struct>jvmtiStackInfo</struct> 2717 </allocbuf> 2718 <description> 2719 On return, this buffer is filled 2720 with stack information for each thread. 2721 The number of <datalink id="jvmtiStackInfo"/> records is determined 2722 by <paramlink id="thread_count_ptr"/>. 2723 <p/> 2724 Note that this buffer is allocated to include the <datalink id="jvmtiFrameInfo"/> 2725 buffers pointed to by <datalink id="jvmtiStackInfo.frame_buffer"/>. 2726 These buffers must not be separately deallocated. 2727 </description> 2728 </param> 2729 <param id="thread_count_ptr"> 2730 <outptr><jint/></outptr> 2731 <description> 2732 The number of threads traced. 2733 </description> 2734 </param> 2735 </parameters> 2736 <errors> 2737 </errors> 2738 </function> 2739 2740 <function id="GetThreadListStackTraces" num="101"> 2741 <synopsis>Get Thread List Stack Traces</synopsis> 2742 <description> 2743 Get information about the stacks of the supplied threads. 2744 If <paramlink id="max_frame_count"/> is less than the depth of a stack, 2745 the <paramlink id="max_frame_count"/> topmost frames are returned for that thread, 2746 otherwise the entire stack is returned. 2747 The topmost frames, those most recently invoked, are at the beginning of the returned buffer. 2748 <p/> 2749 All stacks are collected simultaneously, that is, no changes will occur to the 2750 thread state or stacks between the sampling one thread and the next. 2751 The threads need not be suspended. 2752 <p/> 2753 If a thread has not yet started or terminates before the stack information is collected, 2754 a zero length stack (<datalink id="jvmtiStackInfo.frame_count"/> will be zero) 2755 will be returned and the thread <datalink id="jvmtiStackInfo.state"/> can be checked. 2756 <p/> 2757 See the example for the similar function 2758 <functionlink id="GetAllStackTraces"/>. 2759 </description> 2760 <origin>new</origin> 2761 <capabilities> 2762 </capabilities> 2763 <parameters> 2764 <param id="thread_count"> 2765 <jint min="0"/> 2766 <description> 2767 The number of threads to trace. 2768 </description> 2769 </param> 2770 <param id="thread_list"> 2771 <inbuf incount="thread_count"><jthread/></inbuf> 2772 <description> 2773 The list of threads to trace. 2774 </description> 2775 </param> 2776 <param id="max_frame_count"> 2777 <jint min="0"/> 2778 <description> 2779 The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve per thread. 2780 </description> 2781 </param> 2782 <param id="stack_info_ptr"> 2783 <allocbuf outcount="thread_count"> 2784 <struct>jvmtiStackInfo</struct> 2785 </allocbuf> 2786 <description> 2787 On return, this buffer is filled 2788 with stack information for each thread. 2789 The number of <datalink id="jvmtiStackInfo"/> records is determined 2790 by <paramlink id="thread_count"/>. 2791 <p/> 2792 Note that this buffer is allocated to include the <datalink id="jvmtiFrameInfo"/> 2793 buffers pointed to by <datalink id="jvmtiStackInfo.frame_buffer"/>. 2794 These buffers must not be separately deallocated. 2795 </description> 2796 </param> 2797 </parameters> 2798 <errors> 2799 <error id="JVMTI_ERROR_INVALID_THREAD"> 2800 An element in <paramlink id="thread_list"/> is not a thread object. 2801 </error> 2802 </errors> 2803 </function> 2804 2805 <elide> 2806 <function id="AsyncGetStackTrace" num="1000"> 2807 <synopsis>Get Stack Trace--Asynchronous</synopsis> 2808 <description> 2809 Get information about the entire stack of a thread (or a sub-section of it). 2810 This is the asynchronous version of <functionlink id="GetStackTrace"></functionlink> 2811 and is reentrant and safe to call 2812 from asynchronous signal handlers. 2813 The stack trace is returned only for the calling thread. 2814 <p/> 2815 The <functionlink id="GetLineNumberTable"></functionlink> 2816 function can be used to map locations to line numbers. Note that 2817 this mapping can be done lazily. 2818 </description> 2819 <origin>jvmpi</origin> 2820 <capabilities> 2821 <required id="can_get_async_stack_trace"></required> 2822 <capability id="can_show_JVM_spec_async_frames"> 2823 If <code>false</code>, 2824 <paramlink id="use_java_stack"></paramlink> 2825 must be <code>false</code>. 2826 </capability> 2827 </capabilities> 2828 <parameters> 2829 <param id="use_java_stack"> 2830 <jboolean/> 2831 <description> 2832 Return the stack showing <vmspec/> 2833 model of the stack; 2834 otherwise, show the internal representation of the stack with 2835 inlined and optimized methods missing. If the virtual machine 2836 is using the <i>Java Virtual Machine Specification</i> stack model 2837 internally, this flag is ignored. 2838 </description> 2839 </param> 2840 <param id="max_count"> 2841 <jint min="0"/> 2842 <description> 2843 The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve. 2844 Retrieve this many unless the stack depth is less than <code>max_count</code>. 2845 </description> 2846 </param> 2847 <param id="frame_buffer"> 2848 <outbuf incount="max_count" outcount="count_ptr"> 2849 <struct>jvmtiFrameInfo</struct> 2850 <nullok>this information is not returned</nullok> 2851 </outbuf> 2852 <description> 2853 The agent passes in a buffer 2854 large enough to hold <code>max_count</code> records of 2855 <datalink id="jvmtiFrameInfo"></datalink>. This buffer must be 2856 pre-allocated by the agent. 2857 </description> 2858 </param> 2859 <param id="count_ptr"> 2860 <outptr><jint/></outptr> 2861 <description> 2862 On return, points to the number of records filled in.. 2863 </description> 2864 </param> 2865 </parameters> 2866 <errors> 2867 <error id="JVMTI_ERROR_UNATTACHED_THREAD"> 2868 The thread being used to call this function is not attached 2869 to the virtual machine. Calls must be made from attached threads. 2870 </error> 2871 </errors> 2872 </function> 2873 </elide> 2874 2875 <function id="GetFrameCount" num="16"> 2876 <synopsis>Get Frame Count</synopsis> 2877 <description> 2878 Get the number of frames currently in the specified thread's call stack. 2879 <p/> 2880 If this function is called for a thread actively executing bytecodes (for example, 2881 not the current thread and not suspended), the information returned is transient. 2882 </description> 2883 <origin>jvmdi</origin> 2884 <capabilities> 2885 </capabilities> 2886 <parameters> 2887 <param id="thread"> 2888 <jthread null="current" impl="noconvert"/> 2889 <description> 2890 The thread to query. 2891 </description> 2892 </param> 2893 <param id="count_ptr"> 2894 <outptr><jint/></outptr> 2895 <description> 2896 On return, points to the number of frames in the call stack. 2897 </description> 2898 </param> 2899 </parameters> 2900 <errors> 2901 </errors> 2902 </function> 2903 2904 <function id="PopFrame" num="80"> 2905 <synopsis>Pop Frame</synopsis> 2906 <description> 2907 Pop the current frame of <code>thread</code>'s stack. 2908 Popping a frame takes you to the previous frame. 2909 When the thread is resumed, the execution 2910 state of the thread is reset to the state 2911 immediately before the called method was invoked. 2912 That is (using <vmspec/> terminology): 2913 <ul> 2914 <li>the current frame is discarded as the previous frame becomes the current one</li> 2915 <li>the operand stack is restored--the argument values are added back 2916 and if the invoke was not <code>invokestatic</code>, 2917 <code>objectref</code> is added back as well</li> 2918 <li>the Java virtual machine PC is restored to the opcode 2919 of the invoke instruction</li> 2920 </ul> 2921 Note however, that any changes to the arguments, which 2922 occurred in the called method, remain; 2923 when execution continues, the first instruction to 2924 execute will be the invoke. 2925 <p/> 2926 Between calling <code>PopFrame</code> and resuming the 2927 thread the state of the stack is undefined. 2928 To pop frames beyond the first, 2929 these three steps must be repeated: 2930 <ul> 2931 <li>suspend the thread via an event (step, breakpoint, ...)</li> 2932 <li>call <code>PopFrame</code></li> 2933 <li>resume the thread</li> 2934 </ul> 2935 <p/> 2936 A lock acquired by calling the called method 2937 (if it is a <code>synchronized</code> method) 2938 and locks acquired by entering <code>synchronized</code> 2939 blocks within the called method are released. 2940 Note: this does not apply to native locks or 2941 <code>java.util.concurrent.locks</code> locks. 2942 <p/> 2943 Finally blocks are not executed. 2944 <p/> 2945 Changes to global state are not addressed and thus remain changed. 2946 <p/> 2947 The specified thread must be suspended or must be the current thread. 2948 <p/> 2949 Both the called method and calling method must be non-native Java programming 2950 language methods. 2951 <p/> 2952 No <jvmti/> events are generated by this function. 2953 </description> 2954 <origin>jvmdi</origin> 2955 <capabilities> 2956 <required id="can_pop_frame"></required> 2957 </capabilities> 2958 <parameters> 2959 <param id="thread"> 2960 <jthread impl="noconvert"/> 2961 <description> 2962 The thread whose current frame is to be popped. 2963 </description> 2964 </param> 2965 </parameters> 2966 <errors> 2967 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 2968 Called or calling method is a native method. 2969 The implementation is unable to pop this frame. 2970 </error> 2971 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 2972 The thread is a virtual thread and the implementation is unable 2973 to pop this frame. 2974 </error> 2975 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 2976 Thread was not suspended and was not the current thread. 2977 </error> 2978 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 2979 There are less than two stack frames on the call stack. 2980 </error> 2981 </errors> 2982 </function> 2983 2984 <function id="GetFrameLocation" num="19"> 2985 <synopsis>Get Frame Location</synopsis> 2986 <description> 2987 <p/> 2988 For a Java programming language frame, return the location of the instruction 2989 currently executing. 2990 </description> 2991 <origin>jvmdiClone</origin> 2992 <capabilities> 2993 </capabilities> 2994 <parameters> 2995 <param id="thread"> 2996 <jthread null="current" frame="frame" impl="noconvert"/> 2997 <description> 2998 The thread of the frame to query. 2999 </description> 3000 </param> 3001 <param id="depth"> 3002 <jframeID thread="thread"/> 3003 <description> 3004 The depth of the frame to query. 3005 </description> 3006 </param> 3007 <param id="method_ptr"> 3008 <outptr><jmethodID/></outptr> 3009 <description> 3010 On return, points to the method for the current location. 3011 </description> 3012 </param> 3013 <param id="location_ptr"> 3014 <outptr><jlocation/></outptr> 3015 <description> 3016 On return, points to the index of the currently 3017 executing instruction. 3018 Is set to <code>-1</code> if the frame is executing 3019 a native method. 3020 </description> 3021 </param> 3022 </parameters> 3023 <errors> 3024 </errors> 3025 </function> 3026 3027 <function id="NotifyFramePop" num="20"> 3028 <synopsis>Notify Frame Pop</synopsis> 3029 <description> 3030 When the frame that is currently at <paramlink id="depth"></paramlink> 3031 is popped from the stack, generate a 3032 <eventlink id="FramePop"></eventlink> event. See the 3033 <eventlink id="FramePop"></eventlink> event for details. 3034 Only frames corresponding to non-native Java programming language 3035 methods can receive notification. 3036 <p/> 3037 The specified thread must be suspended or must be the current thread. 3038 </description> 3039 <origin>jvmdi</origin> 3040 <capabilities> 3041 <required id="can_generate_frame_pop_events"></required> 3042 </capabilities> 3043 <parameters> 3044 <param id="thread"> 3045 <jthread null="current" frame="depth" impl="noconvert"/> 3046 <description> 3047 The thread of the frame for which the frame pop event will be generated. 3048 </description> 3049 </param> 3050 <param id="depth"> 3051 <jframeID thread="thread"/> 3052 <description> 3053 The depth of the frame for which the frame pop event will be generated. 3054 </description> 3055 </param> 3056 </parameters> 3057 <errors> 3058 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3059 The frame at <code>depth</code> is executing a 3060 native method. 3061 </error> 3062 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3063 Thread was not suspended and was not the current thread. 3064 </error> 3065 </errors> 3066 </function> 3067 3068 </category> 3069 3070 <category id="ForceEarlyReturn" label="Force Early Return"> 3071 <intro> 3072 These functions allow an agent to force a method 3073 to return at any point during its execution. 3074 The method which will return early is referred to as the <i>called method</i>. 3075 The called method is the current method 3076 (as defined by 3077 <vmspec chapter="3.6"/>) 3078 for the specified thread at 3079 the time the function is called. 3080 <p/> 3081 The specified thread must be suspended or must be the current thread. 3082 The return occurs when execution of Java programming 3083 language code is resumed on this thread. 3084 Between calling one of these functions and resumption 3085 of thread execution, the state of the stack is undefined. 3086 <p/> 3087 No further instructions are executed in the called method. 3088 Specifically, finally blocks are not executed. 3089 Note: this can cause inconsistent states in the application. 3090 <p/> 3091 A lock acquired by calling the called method 3092 (if it is a <code>synchronized</code> method) 3093 and locks acquired by entering <code>synchronized</code> 3094 blocks within the called method are released. 3095 Note: this does not apply to native locks or 3096 <code>java.util.concurrent.locks</code> locks. 3097 <p/> 3098 Events, such as <eventlink id="MethodExit"></eventlink>, 3099 are generated as they would be in a normal return. 3100 <p/> 3101 The called method must be a non-native Java programming 3102 language method. 3103 Forcing return on a thread with only one frame on the 3104 stack causes the thread to exit when resumed. 3105 </intro> 3106 3107 <function id="ForceEarlyReturnObject" num="81" since="1.1"> 3108 <synopsis>Force Early Return - Object</synopsis> 3109 <description> 3110 This function can be used to return from a method whose 3111 result type is <code>Object</code> 3112 or a subclass of <code>Object</code>. 3113 </description> 3114 <origin>new</origin> 3115 <capabilities> 3116 <required id="can_force_early_return"></required> 3117 </capabilities> 3118 <parameters> 3119 <param id="thread"> 3120 <jthread null="current" impl="noconvert"/> 3121 <description> 3122 The thread whose current frame is to return early. 3123 </description> 3124 </param> 3125 <param id="value"> 3126 <jobject/> 3127 <description> 3128 The return value for the called frame. 3129 An object or <code>NULL</code>. 3130 </description> 3131 </param> 3132 </parameters> 3133 <errors> 3134 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3135 Attempted to return early from a frame 3136 corresponding to a native method. 3137 The thread is a virtual thread and the implementation is 3138 unable to force its current frame to return. 3139 Or the implementation is unable to provide 3140 this functionality on this frame. 3141 </error> 3142 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3143 The result type of the called method is not 3144 <code>Object</code> or a subclass of <code>Object</code>. 3145 </error> 3146 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3147 The supplied <paramlink id="value"/> is not compatible with the 3148 result type of the called method. 3149 </error> 3150 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3151 Thread was not suspended and was not the current thread. 3152 </error> 3153 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3154 There are no more frames on the call stack. 3155 </error> 3156 </errors> 3157 </function> 3158 3159 <function id="ForceEarlyReturnInt" num="82" since="1.1"> 3160 <synopsis>Force Early Return - Int</synopsis> 3161 <description> 3162 This function can be used to return from a method whose 3163 result type is <code>int</code>, <code>short</code>, 3164 <code>char</code>, <code>byte</code>, or 3165 <code>boolean</code>. 3166 </description> 3167 <origin>new</origin> 3168 <capabilities> 3169 <required id="can_force_early_return"></required> 3170 </capabilities> 3171 <parameters> 3172 <param id="thread"> 3173 <jthread null="current" impl="noconvert"/> 3174 <description> 3175 The thread whose current frame is to return early. 3176 </description> 3177 </param> 3178 <param id="value"> 3179 <jint/> 3180 <description> 3181 The return value for the called frame. 3182 </description> 3183 </param> 3184 </parameters> 3185 <errors> 3186 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3187 Attempted to return early from a frame 3188 corresponding to a native method. 3189 The thread is a virtual thread and the implementation is 3190 unable to force its current frame to return. 3191 Or the implementation is unable to provide 3192 this functionality on this frame. 3193 </error> 3194 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3195 The result type of the called method is not 3196 <code>int</code>, <code>short</code>, 3197 <code>char</code>, <code>byte</code>, or 3198 <code>boolean</code>. 3199 </error> 3200 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3201 Thread was not suspended and was not the current thread. 3202 </error> 3203 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3204 There are no frames on the call stack. 3205 </error> 3206 </errors> 3207 </function> 3208 3209 <function id="ForceEarlyReturnLong" num="83" since="1.1"> 3210 <synopsis>Force Early Return - Long</synopsis> 3211 <description> 3212 This function can be used to return from a method whose 3213 result type is <code>long</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 <jlong/> 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 Attempted to return early from a frame 3236 corresponding to a native method. 3237 The thread is a virtual thread and the implementation is 3238 unable to force its current frame to return. 3239 Or the implementation is unable to provide 3240 this functionality on this frame. 3241 </error> 3242 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3243 The result type of the called method is not <code>long</code>. 3244 </error> 3245 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3246 Thread was not suspended and was not the current thread. 3247 </error> 3248 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3249 There are no frames on the call stack. 3250 </error> 3251 </errors> 3252 </function> 3253 3254 <function id="ForceEarlyReturnFloat" num="84" since="1.1"> 3255 <synopsis>Force Early Return - Float</synopsis> 3256 <description> 3257 This function can be used to return from a method whose 3258 result type is <code>float</code>. 3259 </description> 3260 <origin>new</origin> 3261 <capabilities> 3262 <required id="can_force_early_return"></required> 3263 </capabilities> 3264 <parameters> 3265 <param id="thread"> 3266 <jthread null="current" impl="noconvert"/> 3267 <description> 3268 The thread whose current frame is to return early. 3269 </description> 3270 </param> 3271 <param id="value"> 3272 <jfloat/> 3273 <description> 3274 The return value for the called frame. 3275 </description> 3276 </param> 3277 </parameters> 3278 <errors> 3279 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3280 Attempted to return early from a frame 3281 corresponding to a native method. 3282 The thread is a virtual thread and the implementation is 3283 unable to force its current frame to return. 3284 Or the implementation is unable to provide 3285 this functionality on this frame. 3286 </error> 3287 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3288 The result type of the called method is not <code>float</code>. 3289 </error> 3290 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3291 Thread was not suspended and was not the current thread. 3292 </error> 3293 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3294 There are no frames on the call stack. 3295 </error> 3296 </errors> 3297 </function> 3298 3299 <function id="ForceEarlyReturnDouble" num="85" since="1.1"> 3300 <synopsis>Force Early Return - Double</synopsis> 3301 <description> 3302 This function can be used to return from a method whose 3303 result type is <code>double</code>. 3304 </description> 3305 <origin>new</origin> 3306 <capabilities> 3307 <required id="can_force_early_return"></required> 3308 </capabilities> 3309 <parameters> 3310 <param id="thread"> 3311 <jthread null="current" impl="noconvert"/> 3312 <description> 3313 The thread whose current frame is to return early. 3314 </description> 3315 </param> 3316 <param id="value"> 3317 <jdouble/> 3318 <description> 3319 The return value for the called frame. 3320 </description> 3321 </param> 3322 </parameters> 3323 <errors> 3324 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3325 Attempted to return early from a frame 3326 corresponding to a native method. 3327 The thread is a virtual thread and the implementation is 3328 unable to force its current frame to return. 3329 Or the implementation is unable to provide 3330 this functionality on this frame. 3331 </error> 3332 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3333 The result type of the called method is not <code>double</code>. 3334 </error> 3335 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3336 Thread was not suspended and was not the current thread. 3337 </error> 3338 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3339 There are no frames on the call stack. 3340 </error> 3341 </errors> 3342 </function> 3343 3344 <function id="ForceEarlyReturnVoid" num="86" since="1.1"> 3345 <synopsis>Force Early Return - Void</synopsis> 3346 <description> 3347 This function can be used to return from a method with no result type. 3348 That is, the called method must be declared <code>void</code>. 3349 </description> 3350 <origin>new</origin> 3351 <capabilities> 3352 <required id="can_force_early_return"></required> 3353 </capabilities> 3354 <parameters> 3355 <param id="thread"> 3356 <jthread null="current" impl="noconvert"/> 3357 <description> 3358 The thread whose current frame is to return early. 3359 </description> 3360 </param> 3361 </parameters> 3362 <errors> 3363 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3364 Attempted to return early from a frame 3365 corresponding to a native method. 3366 The thread is a virtual thread and the implementation is 3367 unable to force its current frame to return. 3368 Or the implementation is unable to provide 3369 this functionality on this frame. 3370 </error> 3371 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3372 The called method has a result type. 3373 </error> 3374 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3375 Thread was not suspended and was not the current thread. 3376 </error> 3377 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3378 There are no frames on the call stack. 3379 </error> 3380 </errors> 3381 </function> 3382 3383 </category> 3384 3385 <category id="Heap" label="Heap"> 3386 <intro> 3387 These functions are used to analyze the heap. 3388 Functionality includes the ability to view the objects in the 3389 heap and to tag these objects. 3390 </intro> 3391 3392 <intro id="objectTags" label="Object Tags"> 3393 A <i>tag</i> is a value associated with an object. 3394 Tags are explicitly set by the agent using the 3395 <functionlink id="SetTag"></functionlink> function or by 3396 callback functions such as <functionlink id="jvmtiHeapIterationCallback"/>. 3397 <p/> 3398 Tags are local to the environment; that is, the tags of one 3399 environment are not visible in another. 3400 <p/> 3401 Tags are <code>jlong</code> values which can be used 3402 simply to mark an object or to store a pointer to more detailed 3403 information. Objects which have not been tagged have a 3404 tag of zero. 3405 Setting a tag to zero makes the object untagged. 3406 </intro> 3407 3408 <intro id="heapCallbacks" label="Heap Callback Functions"> 3409 Heap functions which iterate through the heap and recursively 3410 follow object references use agent supplied callback functions 3411 to deliver the information. 3412 <p/> 3413 These heap callback functions must adhere to the following restrictions -- 3414 These callbacks must not use JNI functions. 3415 These callbacks must not use <jvmti/> functions except 3416 <i>callback safe</i> functions which 3417 specifically allow such use (see the raw monitor, memory management, 3418 and environment local storage functions). 3419 <p/> 3420 An implementation may invoke a callback on an internal thread or 3421 the thread which called the iteration function. 3422 Heap callbacks are single threaded -- no more than one callback will 3423 be invoked at a time. 3424 <p/> 3425 The Heap Filter Flags can be used to prevent reporting 3426 based on the tag status of an object or its class. 3427 If no flags are set (the <code>jint</code> is zero), objects 3428 will not be filtered out. 3429 3430 <constants id="jvmtiHeapFilter" label="Heap Filter Flags" kind="bits"> 3431 <constant id="JVMTI_HEAP_FILTER_TAGGED" num="0x4"> 3432 Filter out tagged objects. Objects which are tagged are not included. 3433 </constant> 3434 <constant id="JVMTI_HEAP_FILTER_UNTAGGED" num="0x8"> 3435 Filter out untagged objects. Objects which are not tagged are not included. 3436 </constant> 3437 <constant id="JVMTI_HEAP_FILTER_CLASS_TAGGED" num="0x10"> 3438 Filter out objects with tagged classes. Objects whose class is tagged are not included. 3439 </constant> 3440 <constant id="JVMTI_HEAP_FILTER_CLASS_UNTAGGED" num="0x20"> 3441 Filter out objects with untagged classes. Objects whose class is not tagged are not included. 3442 </constant> 3443 </constants> 3444 3445 <p/> 3446 The Heap Visit Control Flags are returned by the heap callbacks 3447 and can be used to abort the iteration. For the 3448 <functionlink id="jvmtiHeapReferenceCallback">Heap 3449 Reference Callback</functionlink>, it can also be used 3450 to prune the graph of traversed references 3451 (<code>JVMTI_VISIT_OBJECTS</code> is not set). 3452 3453 <constants id="jvmtiHeapVisitControl" 3454 label="Heap Visit Control Flags" 3455 kind="bits" 3456 since="1.1"> 3457 <constant id="JVMTI_VISIT_OBJECTS" num="0x100"> 3458 If we are visiting an object and if this callback 3459 was initiated by <functionlink id="FollowReferences"/>, 3460 traverse the references of this object. 3461 Otherwise ignored. 3462 </constant> 3463 <constant id="JVMTI_VISIT_ABORT" num="0x8000"> 3464 Abort the iteration. Ignore all other bits. 3465 </constant> 3466 </constants> 3467 3468 <p/> 3469 The Heap Reference Enumeration is provided by the 3470 <functionlink id="jvmtiHeapReferenceCallback">Heap 3471 Reference Callback</functionlink> and 3472 <functionlink id="jvmtiPrimitiveFieldCallback">Primitive Field 3473 Callback</functionlink> to 3474 describe the kind of reference 3475 being reported. 3476 3477 <constants id="jvmtiHeapReferenceKind" 3478 label="Heap Reference Enumeration" 3479 kind="enum" 3480 since="1.1"> 3481 <constant id="JVMTI_HEAP_REFERENCE_CLASS" num="1"> 3482 Reference from an object to its class. 3483 </constant> 3484 <constant id="JVMTI_HEAP_REFERENCE_FIELD" num="2"> 3485 Reference from an object to the value of one of its instance fields. 3486 </constant> 3487 <constant id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT" num="3"> 3488 Reference from an array to one of its elements. 3489 </constant> 3490 <constant id="JVMTI_HEAP_REFERENCE_CLASS_LOADER" num="4"> 3491 Reference from a class to its class loader. 3492 </constant> 3493 <constant id="JVMTI_HEAP_REFERENCE_SIGNERS" num="5"> 3494 Reference from a class to its signers array. 3495 </constant> 3496 <constant id="JVMTI_HEAP_REFERENCE_PROTECTION_DOMAIN" num="6"> 3497 Reference from a class to its protection domain. 3498 </constant> 3499 <constant id="JVMTI_HEAP_REFERENCE_INTERFACE" num="7"> 3500 Reference from a class to one of its interfaces. 3501 Note: interfaces are defined via a constant pool reference, 3502 so the referenced interfaces may also be reported with a 3503 <code>JVMTI_HEAP_REFERENCE_CONSTANT_POOL</code> reference kind. 3504 </constant> 3505 <constant id="JVMTI_HEAP_REFERENCE_STATIC_FIELD" num="8"> 3506 Reference from a class to the value of one of its static fields. 3507 </constant> 3508 <constant id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL" num="9"> 3509 Reference from a class to a resolved entry in the constant pool. 3510 </constant> 3511 <constant id="JVMTI_HEAP_REFERENCE_SUPERCLASS" num="10"> 3512 Reference from a class to its superclass. 3513 A callback is not sent if the superclass is <code>java.lang.Object</code>. 3514 Note: loaded classes define superclasses via a constant pool 3515 reference, so the referenced superclass may also be reported with 3516 a <code>JVMTI_HEAP_REFERENCE_CONSTANT_POOL</code> reference kind. 3517 </constant> 3518 <constant id="JVMTI_HEAP_REFERENCE_JNI_GLOBAL" num="21"> 3519 Heap root reference: JNI global reference. 3520 </constant> 3521 <constant id="JVMTI_HEAP_REFERENCE_SYSTEM_CLASS" num="22"> 3522 Heap root reference: System class. 3523 </constant> 3524 <constant id="JVMTI_HEAP_REFERENCE_MONITOR" num="23"> 3525 Heap root reference: monitor. 3526 </constant> 3527 <constant id="JVMTI_HEAP_REFERENCE_STACK_LOCAL" num="24"> 3528 Heap root reference: local variable on the stack. 3529 </constant> 3530 <constant id="JVMTI_HEAP_REFERENCE_JNI_LOCAL" num="25"> 3531 Heap root reference: JNI local reference. 3532 </constant> 3533 <constant id="JVMTI_HEAP_REFERENCE_THREAD" num="26"> 3534 Heap root reference: Thread. 3535 </constant> 3536 <constant id="JVMTI_HEAP_REFERENCE_OTHER" num="27"> 3537 Heap root reference: other heap root reference. 3538 </constant> 3539 </constants> 3540 3541 <p/> 3542 Definitions for the single character type descriptors of 3543 primitive types. 3544 3545 <constants id="jvmtiPrimitiveType" 3546 label="Primitive Type Enumeration" 3547 kind="enum" 3548 since="1.1"> 3549 <constant id="JVMTI_PRIMITIVE_TYPE_BOOLEAN" num="90"> 3550 'Z' - Java programming language <code>boolean</code> - JNI <code>jboolean</code> 3551 </constant> 3552 <constant id="JVMTI_PRIMITIVE_TYPE_BYTE" num="66"> 3553 'B' - Java programming language <code>byte</code> - JNI <code>jbyte</code> 3554 </constant> 3555 <constant id="JVMTI_PRIMITIVE_TYPE_CHAR" num="67"> 3556 'C' - Java programming language <code>char</code> - JNI <code>jchar</code> 3557 </constant> 3558 <constant id="JVMTI_PRIMITIVE_TYPE_SHORT" num="83"> 3559 'S' - Java programming language <code>short</code> - JNI <code>jshort</code> 3560 </constant> 3561 <constant id="JVMTI_PRIMITIVE_TYPE_INT" num="73"> 3562 'I' - Java programming language <code>int</code> - JNI <code>jint</code> 3563 </constant> 3564 <constant id="JVMTI_PRIMITIVE_TYPE_LONG" num="74"> 3565 'J' - Java programming language <code>long</code> - JNI <code>jlong</code> 3566 </constant> 3567 <constant id="JVMTI_PRIMITIVE_TYPE_FLOAT" num="70"> 3568 'F' - Java programming language <code>float</code> - JNI <code>jfloat</code> 3569 </constant> 3570 <constant id="JVMTI_PRIMITIVE_TYPE_DOUBLE" num="68"> 3571 'D' - Java programming language <code>double</code> - JNI <code>jdouble</code> 3572 </constant> 3573 </constants> 3574 </intro> 3575 3576 <typedef id="jvmtiHeapReferenceInfoField" 3577 label="Reference information structure for Field references" 3578 since="1.1"> 3579 <description> 3580 Reference information returned for 3581 <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/> and 3582 <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/> references. 3583 </description> 3584 <field id="index"> 3585 <jint/> 3586 <description> 3587 For <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/>, the 3588 referrer object is not a class or an interface. 3589 In this case, <code>index</code> is the index of the field 3590 in the class of the referrer object. 3591 This class is referred to below as <i>C</i>. 3592 <p/> 3593 For <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/>, 3594 the referrer object is a class (referred to below as <i>C</i>) 3595 or an interface (referred to below as <i>I</i>). 3596 In this case, <code>index</code> is the index of the field in 3597 that class or interface. 3598 <p/> 3599 If the referrer object is not an interface, then the field 3600 indices are determined as follows: 3601 <ul> 3602 <li>make a list of all the fields in <i>C</i> and its 3603 superclasses, starting with all the fields in 3604 <code>java.lang.Object</code> and ending with all the 3605 fields in <i>C</i>.</li> 3606 <li>Within this list, put 3607 the fields for a given class in the order returned by 3608 <functionlink id="GetClassFields"/>.</li> 3609 <li>Assign the fields in this list indices 3610 <i>n</i>, <i>n</i>+1, ..., in order, where <i>n</i> 3611 is the count of the fields in all the interfaces 3612 implemented by <i>C</i>. 3613 Note that <i>C</i> implements all interfaces 3614 directly implemented by its superclasses; as well 3615 as all superinterfaces of these interfaces.</li> 3616 </ul> 3617 If the referrer object is an interface, then the field 3618 indices are determined as follows: 3619 <ul> 3620 <li>make a list of the fields directly declared in 3621 <i>I</i>.</li> 3622 <li>Within this list, put 3623 the fields in the order returned by 3624 <functionlink id="GetClassFields"/>.</li> 3625 <li>Assign the fields in this list indices 3626 <i>n</i>, <i>n</i>+1, ..., in order, where <i>n</i> 3627 is the count of the fields in all the superinterfaces 3628 of <i>I</i>.</li> 3629 </ul> 3630 All fields are included in this computation, regardless of 3631 field modifier (static, public, private, etc). 3632 <p/> 3633 For example, given the following classes and interfaces: 3634 <example> 3635 interface I0 { 3636 int p = 0; 3637 } 3638 3639 interface I1 extends I0 { 3640 int x = 1; 3641 } 3642 3643 interface I2 extends I0 { 3644 int y = 2; 3645 } 3646 3647 class C1 implements I1 { 3648 public static int a = 3; 3649 private int b = 4; 3650 } 3651 3652 class C2 extends C1 implements I2 { 3653 static int q = 5; 3654 final int r = 6; 3655 } 3656 </example> 3657 Assume that <functionlink id="GetClassFields"/> called on 3658 <code>C1</code> returns the fields of <code>C1</code> in the 3659 order: a, b; and that the fields of <code>C2</code> are 3660 returned in the order: q, r. 3661 An instance of class <code>C1</code> will have the 3662 following field indices: 3663 <blockquote><table> 3664 <tr class="bgLight"> 3665 <th class="centered" scope="col">Field</th> 3666 <th class="centered" scope="col">Index</th> 3667 <th scope="col">Description</th> 3668 </tr> 3669 <tr> 3670 <th class="centered" scope="row"> 3671 a 3672 </th> 3673 <td class="centered"> 3674 2 3675 </td> 3676 <td> 3677 The count of the fields in the interfaces 3678 implemented by <code>C1</code> is two (<i>n</i>=2): 3679 <code>p</code> of <code>I0</code> 3680 and <code>x</code> of <code>I1</code>. 3681 </td> 3682 </tr> 3683 <tr> 3684 <th class="centered" scope="row"> 3685 b 3686 </th> 3687 <td class="centered"> 3688 3 3689 </td> 3690 <td> 3691 the subsequent index. 3692 </td> 3693 </tr> 3694 </table></blockquote> 3695 The class <code>C1</code> will have the same field indices. 3696 <p/> 3697 An instance of class <code>C2</code> will have the 3698 following field indices: 3699 <blockquote><table> 3700 <tr class="bgLight"> 3701 <th class="centered" scope="col">Field</th> 3702 <th class="centered" scope="col">Index</th> 3703 <th scope="col">Description</th> 3704 </tr> 3705 <tr> 3706 <th class="centered" scope="row"> 3707 a 3708 </th> 3709 <td class="centered"> 3710 3 3711 </td> 3712 <td> 3713 The count of the fields in the interfaces 3714 implemented by <code>C2</code> is three (<i>n</i>=3): 3715 <code>p</code> of <code>I0</code>, 3716 <code>x</code> of <code>I1</code> and <code>y</code> of <code>I2</code> 3717 (an interface of <code>C2</code>). Note that the field <code>p</code> 3718 of <code>I0</code> is only included once. 3719 </td> 3720 </tr> 3721 <tr> 3722 <th class="centered" scope="row"> 3723 b 3724 </th> 3725 <td class="centered"> 3726 4 3727 </td> 3728 <td> 3729 the subsequent index to "a". 3730 </td> 3731 </tr> 3732 <tr> 3733 <th class="centered" scope="row"> 3734 q 3735 </th> 3736 <td class="centered"> 3737 5 3738 </td> 3739 <td> 3740 the subsequent index to "b". 3741 </td> 3742 </tr> 3743 <tr> 3744 <th class="centered" scope="row"> 3745 r 3746 </th> 3747 <td class="centered"> 3748 6 3749 </td> 3750 <td> 3751 the subsequent index to "q". 3752 </td> 3753 </tr> 3754 </table></blockquote> 3755 The class <code>C2</code> will have the same field indices. 3756 Note that a field may have a different index depending on the 3757 object that is viewing it -- for example field "a" above. 3758 Note also: not all field indices may be visible from the 3759 callbacks, but all indices are shown for illustrative purposes. 3760 <p/> 3761 The interface <code>I1</code> will have the 3762 following field indices: 3763 <blockquote><table> 3764 <tr class="bgLight"> 3765 <th class="centered" scope="col">Field</th> 3766 <th class="centered" scope="col">Index</th> 3767 <th scope="col">Description</th> 3768 </tr> 3769 <tr> 3770 <th class="centered" scope="row"> 3771 x 3772 </th> 3773 <td class="centered"> 3774 1 3775 </td> 3776 <td> 3777 The count of the fields in the superinterfaces 3778 of <code>I1</code> is one (<i>n</i>=1): 3779 <code>p</code> of <code>I0</code>. 3780 </td> 3781 </tr> 3782 </table></blockquote> 3783 </description> 3784 </field> 3785 </typedef> 3786 3787 <typedef id="jvmtiHeapReferenceInfoArray" 3788 label="Reference information structure for Array references" 3789 since="1.1"> 3790 <description> 3791 Reference information returned for 3792 <datalink id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT"/> references. 3793 </description> 3794 <field id="index"> 3795 <jint/> 3796 <description> 3797 The array index. 3798 </description> 3799 </field> 3800 </typedef> 3801 3802 <typedef id="jvmtiHeapReferenceInfoConstantPool" 3803 label="Reference information structure for Constant Pool references" 3804 since="1.1"> 3805 <description> 3806 Reference information returned for 3807 <datalink id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL"/> references. 3808 </description> 3809 <field id="index"> 3810 <jint/> 3811 <description> 3812 The index into the constant pool of the class. See the description in 3813 <vmspec chapter="4.4"/>. 3814 </description> 3815 </field> 3816 </typedef> 3817 3818 <typedef id="jvmtiHeapReferenceInfoStackLocal" 3819 label="Reference information structure for Local Variable references" 3820 since="1.1"> 3821 <description> 3822 Reference information returned for 3823 <datalink id="JVMTI_HEAP_REFERENCE_STACK_LOCAL"/> references. 3824 </description> 3825 <field id="thread_tag"> 3826 <jlong/> 3827 <description> 3828 The tag of the thread corresponding to this stack, zero if not tagged. 3829 </description> 3830 </field> 3831 <field id="thread_id"> 3832 <jlong/> 3833 <description> 3834 The unique thread ID of the thread corresponding to this stack. 3835 </description> 3836 </field> 3837 <field id="depth"> 3838 <jint/> 3839 <description> 3840 The depth of the frame. 3841 </description> 3842 </field> 3843 <field id="method"> 3844 <jmethodID/> 3845 <description> 3846 The method executing in this frame. 3847 </description> 3848 </field> 3849 <field id="location"> 3850 <jlocation/> 3851 <description> 3852 The currently executing location in this frame. 3853 </description> 3854 </field> 3855 <field id="slot"> 3856 <jint/> 3857 <description> 3858 The slot number of the local variable. 3859 </description> 3860 </field> 3861 </typedef> 3862 3863 <typedef id="jvmtiHeapReferenceInfoJniLocal" 3864 label="Reference information structure for JNI local references" 3865 since="1.1"> 3866 <description> 3867 Reference information returned for 3868 <datalink id="JVMTI_HEAP_REFERENCE_JNI_LOCAL"/> references. 3869 </description> 3870 <field id="thread_tag"> 3871 <jlong/> 3872 <description> 3873 The tag of the thread corresponding to this stack, zero if not tagged. 3874 </description> 3875 </field> 3876 <field id="thread_id"> 3877 <jlong/> 3878 <description> 3879 The unique thread ID of the thread corresponding to this stack. 3880 </description> 3881 </field> 3882 <field id="depth"> 3883 <jint/> 3884 <description> 3885 The depth of the frame. 3886 </description> 3887 </field> 3888 <field id="method"> 3889 <jmethodID/> 3890 <description> 3891 The method executing in this frame. 3892 </description> 3893 </field> 3894 </typedef> 3895 3896 <typedef id="jvmtiHeapReferenceInfoReserved" 3897 label="Reference information structure for Other references" 3898 since="1.1"> 3899 <description> 3900 Reference information returned for other references. 3901 </description> 3902 <field id="reserved1"> 3903 <jlong/> 3904 <description> 3905 reserved for future use. 3906 </description> 3907 </field> 3908 <field id="reserved2"> 3909 <jlong/> 3910 <description> 3911 reserved for future use. 3912 </description> 3913 </field> 3914 <field id="reserved3"> 3915 <jlong/> 3916 <description> 3917 reserved for future use. 3918 </description> 3919 </field> 3920 <field id="reserved4"> 3921 <jlong/> 3922 <description> 3923 reserved for future use. 3924 </description> 3925 </field> 3926 <field id="reserved5"> 3927 <jlong/> 3928 <description> 3929 reserved for future use. 3930 </description> 3931 </field> 3932 <field id="reserved6"> 3933 <jlong/> 3934 <description> 3935 reserved for future use. 3936 </description> 3937 </field> 3938 <field id="reserved7"> 3939 <jlong/> 3940 <description> 3941 reserved for future use. 3942 </description> 3943 </field> 3944 <field id="reserved8"> 3945 <jlong/> 3946 <description> 3947 reserved for future use. 3948 </description> 3949 </field> 3950 </typedef> 3951 3952 <uniontypedef id="jvmtiHeapReferenceInfo" 3953 label="Reference information structure" 3954 since="1.1"> 3955 <description> 3956 The information returned about referrers. 3957 Represented as a union of the various kinds of reference information. 3958 </description> 3959 <field id="field"> 3960 <struct>jvmtiHeapReferenceInfoField</struct> 3961 <description> 3962 The referrer information for 3963 <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/> 3964 and <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/> references. 3965 </description> 3966 </field> 3967 <field id="array"> 3968 <struct>jvmtiHeapReferenceInfoArray</struct> 3969 <description> 3970 The referrer information for 3971 For <datalink id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT"/> references. 3972 </description> 3973 </field> 3974 <field id="constant_pool"> 3975 <struct>jvmtiHeapReferenceInfoConstantPool</struct> 3976 <description> 3977 The referrer information for 3978 For <datalink id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL"/> references. 3979 </description> 3980 </field> 3981 <field id="stack_local"> 3982 <struct>jvmtiHeapReferenceInfoStackLocal</struct> 3983 <description> 3984 The referrer information for 3985 For <datalink id="JVMTI_HEAP_REFERENCE_STACK_LOCAL"/> references. 3986 </description> 3987 </field> 3988 <field id="jni_local"> 3989 <struct>jvmtiHeapReferenceInfoJniLocal</struct> 3990 <description> 3991 The referrer information for 3992 For <datalink id="JVMTI_HEAP_REFERENCE_JNI_LOCAL"/> references. 3993 </description> 3994 </field> 3995 <field id="other"> 3996 <struct>jvmtiHeapReferenceInfoReserved</struct> 3997 <description> 3998 reserved for future use. 3999 </description> 4000 </field> 4001 </uniontypedef> 4002 4003 <typedef id="jvmtiHeapCallbacks" 4004 label="Heap callback function structure" 4005 since="1.1"> 4006 <field id="heap_iteration_callback"> 4007 <ptrtype> 4008 <struct>jvmtiHeapIterationCallback</struct> 4009 </ptrtype> 4010 <description> 4011 The callback to be called to describe an 4012 object in the heap. Used by the 4013 <functionlink id="IterateThroughHeap"/> function, ignored by the 4014 <functionlink id="FollowReferences"/> function. 4015 </description> 4016 </field> 4017 <field id="heap_reference_callback"> 4018 <ptrtype> 4019 <struct>jvmtiHeapReferenceCallback</struct> 4020 </ptrtype> 4021 <description> 4022 The callback to be called to describe an 4023 object reference. Used by the 4024 <functionlink id="FollowReferences"/> function, ignored by the 4025 <functionlink id="IterateThroughHeap"/> function. 4026 </description> 4027 </field> 4028 <field id="primitive_field_callback"> 4029 <ptrtype> 4030 <struct>jvmtiPrimitiveFieldCallback</struct> 4031 </ptrtype> 4032 <description> 4033 The callback to be called to describe a 4034 primitive field. 4035 </description> 4036 </field> 4037 <field id="array_primitive_value_callback"> 4038 <ptrtype> 4039 <struct>jvmtiArrayPrimitiveValueCallback</struct> 4040 </ptrtype> 4041 <description> 4042 The callback to be called to describe an 4043 array of primitive values. 4044 </description> 4045 </field> 4046 <field id="string_primitive_value_callback"> 4047 <ptrtype> 4048 <struct>jvmtiStringPrimitiveValueCallback</struct> 4049 </ptrtype> 4050 <description> 4051 The callback to be called to describe a String value. 4052 </description> 4053 </field> 4054 <field id="reserved5"> 4055 <ptrtype> 4056 <struct>jvmtiReservedCallback</struct> 4057 </ptrtype> 4058 <description> 4059 Reserved for future use.. 4060 </description> 4061 </field> 4062 <field id="reserved6"> 4063 <ptrtype> 4064 <struct>jvmtiReservedCallback</struct> 4065 </ptrtype> 4066 <description> 4067 Reserved for future use.. 4068 </description> 4069 </field> 4070 <field id="reserved7"> 4071 <ptrtype> 4072 <struct>jvmtiReservedCallback</struct> 4073 </ptrtype> 4074 <description> 4075 Reserved for future use.. 4076 </description> 4077 </field> 4078 <field id="reserved8"> 4079 <ptrtype> 4080 <struct>jvmtiReservedCallback</struct> 4081 </ptrtype> 4082 <description> 4083 Reserved for future use.. 4084 </description> 4085 </field> 4086 <field id="reserved9"> 4087 <ptrtype> 4088 <struct>jvmtiReservedCallback</struct> 4089 </ptrtype> 4090 <description> 4091 Reserved for future use.. 4092 </description> 4093 </field> 4094 <field id="reserved10"> 4095 <ptrtype> 4096 <struct>jvmtiReservedCallback</struct> 4097 </ptrtype> 4098 <description> 4099 Reserved for future use.. 4100 </description> 4101 </field> 4102 <field id="reserved11"> 4103 <ptrtype> 4104 <struct>jvmtiReservedCallback</struct> 4105 </ptrtype> 4106 <description> 4107 Reserved for future use.. 4108 </description> 4109 </field> 4110 <field id="reserved12"> 4111 <ptrtype> 4112 <struct>jvmtiReservedCallback</struct> 4113 </ptrtype> 4114 <description> 4115 Reserved for future use.. 4116 </description> 4117 </field> 4118 <field id="reserved13"> 4119 <ptrtype> 4120 <struct>jvmtiReservedCallback</struct> 4121 </ptrtype> 4122 <description> 4123 Reserved for future use.. 4124 </description> 4125 </field> 4126 <field id="reserved14"> 4127 <ptrtype> 4128 <struct>jvmtiReservedCallback</struct> 4129 </ptrtype> 4130 <description> 4131 Reserved for future use.. 4132 </description> 4133 </field> 4134 <field id="reserved15"> 4135 <ptrtype> 4136 <struct>jvmtiReservedCallback</struct> 4137 </ptrtype> 4138 <description> 4139 Reserved for future use.. 4140 </description> 4141 </field> 4142 </typedef> 4143 4144 4145 <intro> 4146 <rationale> 4147 The heap dumping functionality (below) uses a callback 4148 for each object. While it would seem that a buffered approach 4149 would provide better throughput, tests do 4150 not show this to be the case--possibly due to locality of 4151 memory reference or array access overhead. 4152 </rationale> 4153 4154 <issue> 4155 Still under investigation as to if java.lang.ref references 4156 are reported as a different type of reference. 4157 </issue> 4158 4159 <issue> 4160 Should or can an indication of the cost or relative cost of 4161 these operations be included? 4162 </issue> 4163 4164 </intro> 4165 4166 <callback id="jvmtiHeapIterationCallback" since="1.1"> 4167 <jint/> 4168 <synopsis>Heap Iteration Callback</synopsis> 4169 <description> 4170 Agent supplied callback function. 4171 Describes (but does not pass in) an object in the heap. 4172 <p/> 4173 This function should return a bit vector of the desired 4174 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>. 4175 This will determine if the entire iteration should be aborted 4176 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored). 4177 <p/> 4178 See the <internallink id="heapCallbacks">heap callback 4179 function restrictions</internallink>. 4180 </description> 4181 <parameters> 4182 <param id="class_tag"> 4183 <jlong/> 4184 <description> 4185 The tag of the class of object (zero if the class is not tagged). 4186 If the object represents a runtime class, 4187 the <code>class_tag</code> is the tag 4188 associated with <code>java.lang.Class</code> 4189 (zero if <code>java.lang.Class</code> is not tagged). 4190 </description> 4191 </param> 4192 <param id="size"> 4193 <jlong/> 4194 <description> 4195 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 4196 </description> 4197 </param> 4198 <param id="tag_ptr"> 4199 <outptr><jlong/></outptr> 4200 <description> 4201 The object tag value, or zero if the object is not tagged. 4202 To set the tag value to be associated with the object 4203 the agent sets the <code>jlong</code> pointed to by the parameter. 4204 </description> 4205 </param> 4206 <param id="length"> 4207 <jint/> 4208 <description> 4209 If this object is an array, the length of the array. Otherwise negative one (-1). 4210 </description> 4211 </param> 4212 <param id="user_data"> 4213 <outptr><void/></outptr> 4214 <description> 4215 The user supplied data that was passed into the iteration function. 4216 </description> 4217 </param> 4218 </parameters> 4219 </callback> 4220 4221 <callback id="jvmtiHeapReferenceCallback" since="1.1"> 4222 <jint/> 4223 <synopsis>Heap Reference Callback</synopsis> 4224 <description> 4225 Agent supplied callback function. 4226 Describes a reference from an object or the VM (the referrer) to another object 4227 (the referree) or a heap root to a referree. 4228 <p/> 4229 This function should return a bit vector of the desired 4230 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>. 4231 This will determine if the objects referenced by the referree 4232 should be visited or if the entire iteration should be aborted. 4233 <p/> 4234 See the <internallink id="heapCallbacks">heap callback 4235 function restrictions</internallink>. 4236 </description> 4237 <parameters> 4238 <param id="reference_kind"> 4239 <enum>jvmtiHeapReferenceKind</enum> 4240 <description> 4241 The kind of reference. 4242 </description> 4243 </param> 4244 <param id="reference_info"> 4245 <inptr> 4246 <struct>jvmtiHeapReferenceInfo</struct> 4247 </inptr> 4248 <description> 4249 Details about the reference. 4250 Set when the <datalink id="jvmtiHeapReferenceCallback.reference_kind">reference_kind</datalink> is 4251 <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/>, 4252 <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/>, 4253 <datalink id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT"/>, 4254 <datalink id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL"/>, 4255 <datalink id="JVMTI_HEAP_REFERENCE_STACK_LOCAL"/>, 4256 or <datalink id="JVMTI_HEAP_REFERENCE_JNI_LOCAL"/>. 4257 Otherwise <code>NULL</code>. 4258 </description> 4259 </param> 4260 <param id="class_tag"> 4261 <jlong/> 4262 <description> 4263 The tag of the class of referree object (zero if the class is not tagged). 4264 If the referree object represents a runtime class, 4265 the <code>class_tag</code> is the tag 4266 associated with <code>java.lang.Class</code> 4267 (zero if <code>java.lang.Class</code> is not tagged). 4268 </description> 4269 </param> 4270 <param id="referrer_class_tag"> 4271 <jlong/> 4272 <description> 4273 The tag of the class of the referrer object (zero if the class is not tagged 4274 or the referree is a heap root). If the referrer object represents a runtime 4275 class, the <code>referrer_class_tag</code> is the tag associated with 4276 the <code>java.lang.Class</code> 4277 (zero if <code>java.lang.Class</code> is not tagged). 4278 </description> 4279 </param> 4280 <param id="size"> 4281 <jlong/> 4282 <description> 4283 Size of the referree object (in bytes). 4284 See <functionlink id="GetObjectSize"/>. 4285 </description> 4286 </param> 4287 <param id="tag_ptr"> 4288 <outptr><jlong/></outptr> 4289 <description> 4290 Points to the referree object tag value, or zero if the object is not 4291 tagged. 4292 To set the tag value to be associated with the object 4293 the agent sets the <code>jlong</code> pointed to by the parameter. 4294 </description> 4295 </param> 4296 <param id="referrer_tag_ptr"> 4297 <outptr><jlong/></outptr> 4298 <description> 4299 Points to the tag of the referrer object, or 4300 points to the zero if the referrer 4301 object is not tagged. 4302 <code>NULL</code> if the referrer in not an object (that is, 4303 this callback is reporting a heap root). 4304 To set the tag value to be associated with the referrer object 4305 the agent sets the <code>jlong</code> pointed to by the parameter. 4306 If this callback is reporting a reference from an object to itself, 4307 <code>referrer_tag_ptr == tag_ptr</code>. 4308 </description> 4309 </param> 4310 <param id="length"> 4311 <jint/> 4312 <description> 4313 If this object is an array, the length of the array. Otherwise negative one (-1). 4314 </description> 4315 </param> 4316 <param id="user_data"> 4317 <outptr><void/></outptr> 4318 <description> 4319 The user supplied data that was passed into the iteration function. 4320 </description> 4321 </param> 4322 </parameters> 4323 </callback> 4324 4325 <callback id="jvmtiPrimitiveFieldCallback" since="1.1"> 4326 <jint/> 4327 <synopsis>Primitive Field Callback</synopsis> 4328 <description> 4329 Agent supplied callback function which 4330 describes a primitive field of an object (<i>the object</i>). 4331 A primitive field is a field whose type is a primitive type. 4332 This callback will describe a static field if the object is a class, 4333 and otherwise will describe an instance field. 4334 <p/> 4335 This function should return a bit vector of the desired 4336 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>. 4337 This will determine if the entire iteration should be aborted 4338 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored). 4339 <p/> 4340 See the <internallink id="heapCallbacks">heap callback 4341 function restrictions</internallink>. 4342 </description> 4343 <parameters> 4344 <param id="kind"> 4345 <enum>jvmtiHeapReferenceKind</enum> 4346 <description> 4347 The kind of field -- instance or static (<datalink id="JVMTI_HEAP_REFERENCE_FIELD"/> or 4348 <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/>). 4349 </description> 4350 </param> 4351 <param id="info"> 4352 <inptr> 4353 <struct>jvmtiHeapReferenceInfo</struct> 4354 </inptr> 4355 <description> 4356 Which field (the field index). 4357 </description> 4358 </param> 4359 <param id="object_class_tag"> 4360 <jlong/> 4361 <description> 4362 The tag of the class of the object (zero if the class is not tagged). 4363 If the object represents a runtime class, the 4364 <code>object_class_tag</code> is the tag 4365 associated with <code>java.lang.Class</code> 4366 (zero if <code>java.lang.Class</code> is not tagged). 4367 </description> 4368 </param> 4369 <param id="object_tag_ptr"> 4370 <outptr><jlong/></outptr> 4371 <description> 4372 Points to the tag of the object, or zero if the object is not 4373 tagged. 4374 To set the tag value to be associated with the object 4375 the agent sets the <code>jlong</code> pointed to by the parameter. 4376 </description> 4377 </param> 4378 <param id="value"> 4379 <jvalue/> 4380 <description> 4381 The value of the field. 4382 </description> 4383 </param> 4384 <param id="value_type"> 4385 <enum>jvmtiPrimitiveType</enum> 4386 <description> 4387 The type of the field. 4388 </description> 4389 </param> 4390 <param id="user_data"> 4391 <outptr><void/></outptr> 4392 <description> 4393 The user supplied data that was passed into the iteration function. 4394 </description> 4395 </param> 4396 </parameters> 4397 </callback> 4398 4399 <callback id="jvmtiArrayPrimitiveValueCallback" since="1.1"> 4400 <jint/> 4401 <synopsis>Array Primitive Value Callback</synopsis> 4402 <description> 4403 Agent supplied callback function. 4404 Describes the values in an array of a primitive type. 4405 <p/> 4406 This function should return a bit vector of the desired 4407 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>. 4408 This will determine if the entire iteration should be aborted 4409 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored). 4410 <p/> 4411 See the <internallink id="heapCallbacks">heap callback 4412 function restrictions</internallink>. 4413 </description> 4414 <parameters> 4415 <param id="class_tag"> 4416 <jlong/> 4417 <description> 4418 The tag of the class of the array object (zero if the class is not tagged). 4419 </description> 4420 </param> 4421 <param id="size"> 4422 <jlong/> 4423 <description> 4424 Size of the array (in bytes). 4425 See <functionlink id="GetObjectSize"/>. 4426 </description> 4427 </param> 4428 <param id="tag_ptr"> 4429 <outptr><jlong/></outptr> 4430 <description> 4431 Points to the tag of the array object, or zero if the object is not 4432 tagged. 4433 To set the tag value to be associated with the object 4434 the agent sets the <code>jlong</code> pointed to by the parameter. 4435 </description> 4436 </param> 4437 <param id="element_count"> 4438 <jint/> 4439 <description> 4440 The length of the primitive array. 4441 </description> 4442 </param> 4443 <param id="element_type"> 4444 <enum>jvmtiPrimitiveType</enum> 4445 <description> 4446 The type of the elements of the array. 4447 </description> 4448 </param> 4449 <param id="elements"> 4450 <vmbuf><void/></vmbuf> 4451 <description> 4452 The elements of the array in a packed array of <code>element_count</code> 4453 items of <code>element_type</code> size each. 4454 </description> 4455 </param> 4456 <param id="user_data"> 4457 <outptr><void/></outptr> 4458 <description> 4459 The user supplied data that was passed into the iteration function. 4460 </description> 4461 </param> 4462 </parameters> 4463 </callback> 4464 4465 <callback id="jvmtiStringPrimitiveValueCallback" since="1.1"> 4466 <jint/> 4467 <synopsis>String Primitive Value Callback</synopsis> 4468 <description> 4469 Agent supplied callback function. 4470 Describes the value of a java.lang.String. 4471 <p/> 4472 This function should return a bit vector of the desired 4473 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>. 4474 This will determine if the entire iteration should be aborted 4475 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored). 4476 <p/> 4477 See the <internallink id="heapCallbacks">heap callback 4478 function restrictions</internallink>. 4479 </description> 4480 <parameters> 4481 <param id="class_tag"> 4482 <jlong/> 4483 <description> 4484 The tag of the class of the String class (zero if the class is not tagged). 4485 <issue>Is this needed?</issue> 4486 </description> 4487 </param> 4488 <param id="size"> 4489 <jlong/> 4490 <description> 4491 Size of the string (in bytes). 4492 See <functionlink id="GetObjectSize"/>. 4493 </description> 4494 </param> 4495 <param id="tag_ptr"> 4496 <outptr><jlong/></outptr> 4497 <description> 4498 Points to the tag of the String object, or zero if the object is not 4499 tagged. 4500 To set the tag value to be associated with the object 4501 the agent sets the <code>jlong</code> pointed to by the parameter. 4502 </description> 4503 </param> 4504 <param id="value"> 4505 <vmbuf><jchar/></vmbuf> 4506 <description> 4507 The value of the String, encoded as a Unicode string. 4508 </description> 4509 </param> 4510 <param id="value_length"> 4511 <jint/> 4512 <description> 4513 The length of the string. 4514 The length is equal to the number of 16-bit Unicode 4515 characters in the string. 4516 </description> 4517 </param> 4518 <param id="user_data"> 4519 <outptr><void/></outptr> 4520 <description> 4521 The user supplied data that was passed into the iteration function. 4522 </description> 4523 </param> 4524 </parameters> 4525 </callback> 4526 4527 4528 <callback id="jvmtiReservedCallback" since="1.1"> 4529 <jint/> 4530 <synopsis>reserved for future use Callback</synopsis> 4531 <description> 4532 Placeholder -- reserved for future use. 4533 </description> 4534 <parameters> 4535 </parameters> 4536 </callback> 4537 4538 <function id="FollowReferences" num="115" since="1.1"> 4539 <synopsis>Follow References</synopsis> 4540 <description> 4541 This function initiates a traversal over the objects that are 4542 directly and indirectly reachable from the specified object or, 4543 if <code>initial_object</code> is not specified, all objects 4544 reachable from the heap roots. 4545 The heap root are the set of system classes, 4546 JNI globals, references from thread stacks, and other objects used as roots 4547 for the purposes of garbage collection. 4548 <p/> 4549 This function operates by traversing the reference graph. 4550 Let <i>A</i>, <i>B</i>, ... represent objects. 4551 When a reference from <i>A</i> to <i>B</i> is traversed, 4552 when a reference from a heap root to <i>B</i> is traversed, 4553 or when <i>B</i> is specified as the <paramlink id="initial_object"/>, 4554 then <i>B</i> is said to be <i>visited</i>. 4555 A reference from <i>A</i> to <i>B</i> is not traversed until <i>A</i> 4556 is visited. 4557 References are reported in the same order that the references are traversed. 4558 Object references are reported by invoking the agent supplied 4559 callback function <functionlink id="jvmtiHeapReferenceCallback"/>. 4560 In a reference from <i>A</i> to <i>B</i>, <i>A</i> is known 4561 as the <i>referrer</i> and <i>B</i> as the <i>referree</i>. 4562 The callback is invoked exactly once for each reference from a referrer; 4563 this is true even if there are reference cycles or multiple paths to 4564 the referrer. 4565 There may be more than one reference between a referrer and a referree, 4566 each reference is reported. 4567 These references may be distinguished by examining the 4568 <datalink 4569 id="jvmtiHeapReferenceCallback.reference_kind"><code>reference_kind</code></datalink> 4570 and 4571 <datalink 4572 id="jvmtiHeapReferenceCallback.reference_info"><code>reference_info</code></datalink> 4573 parameters of the <functionlink id="jvmtiHeapReferenceCallback"/> callback. 4574 <p/> 4575 This function reports a Java programming language view of object references, 4576 not a virtual machine implementation view. The following object references 4577 are reported when they are non-null: 4578 <ul> 4579 <li>Instance objects report references to each non-primitive instance fields 4580 (including inherited fields).</li> 4581 <li>Instance objects report a reference to the object type (class).</li> 4582 <li>Classes report a reference to the superclass and directly 4583 implemented/extended interfaces.</li> 4584 <li>Classes report a reference to the class loader, protection domain, 4585 signers, and resolved entries in the constant pool.</li> 4586 <li>Classes report a reference to each directly declared non-primitive 4587 static field.</li> 4588 <li>Arrays report a reference to the array type (class) and each 4589 array element.</li> 4590 <li>Primitive arrays report a reference to the array type.</li> 4591 </ul> 4592 <p/> 4593 This function can also be used to examine primitive (non-object) values. 4594 The primitive value of an array or String 4595 is reported after the object has been visited; 4596 it is reported by invoking the agent supplied callback function 4597 <functionlink id="jvmtiArrayPrimitiveValueCallback"/> or 4598 <functionlink id="jvmtiStringPrimitiveValueCallback"/>. 4599 A primitive field 4600 is reported after the object with that field is visited; 4601 it is reported by invoking the agent supplied callback function 4602 <functionlink id="jvmtiPrimitiveFieldCallback"/>. 4603 <p/> 4604 Whether a callback is provided or is <code>NULL</code> only determines 4605 whether the callback will be invoked, it does not influence 4606 which objects are visited nor does it influence whether other callbacks 4607 will be invoked. 4608 However, the 4609 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink> 4610 returned by <functionlink id="jvmtiHeapReferenceCallback"/> 4611 do determine if the objects referenced by the 4612 current object as visited. 4613 The <datalink id="jvmtiHeapFilter">heap filter flags</datalink> 4614 and <paramlink id="klass"/> provided as parameters to this function 4615 do not control which objects are visited but they do control which 4616 objects and primitive values are reported by the callbacks. 4617 For example, if the only callback that was set is 4618 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> and <code>klass</code> 4619 is set to the array of bytes class, then only arrays of byte will be 4620 reported. 4621 The table below summarizes this: 4622 <p/> 4623 <table> 4624 <tr class="bgLight"> 4625 <th/> 4626 <th class="centered" scope="col">Controls objects visited</th> 4627 <th class="centered" scope="col">Controls objects reported</th> 4628 <th class="centered" scope="col">Controls primitives reported</th> 4629 </tr> 4630 <tr> 4631 <th scope="row"> 4632 the 4633 <datalink id="jvmtiHeapVisitControl">Heap Visit Control Flags</datalink> 4634 returned by <functionlink id="jvmtiHeapReferenceCallback"/> 4635 </th> 4636 <td class="centered"> 4637 <b>Yes</b> 4638 </td> 4639 <td class="centered"> 4640 <b>Yes</b>, since visits are controlled 4641 </td> 4642 <td class="centered"> 4643 <b>Yes</b>, since visits are controlled 4644 </td> 4645 </tr> 4646 <tr> 4647 <th scope="row"> 4648 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> 4649 in <paramlink id="callbacks"/> set 4650 </th> 4651 <td class="centered"> 4652 No 4653 </td> 4654 <td class="centered"> 4655 <b>Yes</b> 4656 </td> 4657 <td class="centered"> 4658 No 4659 </td> 4660 </tr> 4661 <tr> 4662 <th scope="row"> 4663 <paramlink id="heap_filter"/> 4664 </th> 4665 <td class="centered"> 4666 No 4667 </td> 4668 <td class="centered"> 4669 <b>Yes</b> 4670 </td> 4671 <td class="centered"> 4672 <b>Yes</b> 4673 </td> 4674 </tr> 4675 <tr> 4676 <th scope="row"> 4677 <paramlink id="klass"/> 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 <b>Yes</b> 4687 </td> 4688 </tr> 4689 </table> 4690 <p/> 4691 During the execution of this function the state of the heap 4692 does not change: no objects are allocated, no objects are 4693 garbage collected, and the state of objects (including 4694 held values) does not change. 4695 As a result, threads executing Java 4696 programming language code, threads attempting to resume the 4697 execution of Java programming language code, and threads 4698 attempting to execute JNI functions are typically stalled. 4699 </description> 4700 <origin>new</origin> 4701 <capabilities> 4702 <required id="can_tag_objects"></required> 4703 </capabilities> 4704 <parameters> 4705 <param id="heap_filter"> 4706 <jint/> 4707 <description> 4708 This bit vector of 4709 <datalink id="jvmtiHeapFilter">heap filter flags</datalink>. 4710 restricts the objects for which the callback function is called. 4711 This applies to both the object and primitive callbacks. 4712 </description> 4713 </param> 4714 <param id="klass"> 4715 <ptrtype> 4716 <jclass/> 4717 <nullok>callbacks are not limited to instances of a particular 4718 class</nullok> 4719 </ptrtype> 4720 <description> 4721 Callbacks are only reported when the object is an instance of 4722 this class. 4723 Objects which are instances of a subclass of <code>klass</code> 4724 are not reported. 4725 If <code>klass</code> is an interface, no objects are reported. 4726 This applies to both the object and primitive callbacks. 4727 </description> 4728 </param> 4729 <param id="initial_object"> 4730 <ptrtype> 4731 <jobject/> 4732 <nullok>references are followed from the heap roots</nullok> 4733 </ptrtype> 4734 <description> 4735 The object to follow 4736 </description> 4737 </param> 4738 <param id="callbacks"> 4739 <inptr> 4740 <struct>jvmtiHeapCallbacks</struct> 4741 </inptr> 4742 <description> 4743 Structure defining the set of callback functions. 4744 </description> 4745 </param> 4746 <param id="user_data"> 4747 <inbuf> 4748 <void/> 4749 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 4750 </inbuf> 4751 <description> 4752 User supplied data to be passed to the callback. 4753 </description> 4754 </param> 4755 </parameters> 4756 <errors> 4757 <error id="JVMTI_ERROR_INVALID_CLASS"> 4758 <paramlink id="klass"/> is not a valid class. 4759 </error> 4760 <error id="JVMTI_ERROR_INVALID_OBJECT"> 4761 <paramlink id="initial_object"/> is not a valid object. 4762 </error> 4763 </errors> 4764 </function> 4765 4766 4767 <function id="IterateThroughHeap" num="116" since="1.1"> 4768 <synopsis>Iterate Through Heap</synopsis> 4769 <description> 4770 Initiate an iteration over all objects in the heap. 4771 This includes both reachable and 4772 unreachable objects. Objects are visited in no particular order. 4773 <p/> 4774 Heap objects are reported by invoking the agent supplied 4775 callback function <functionlink id="jvmtiHeapIterationCallback"/>. 4776 References between objects are not reported. 4777 If only reachable objects are desired, or if object reference information 4778 is needed, use <functionlink id="FollowReferences"/>. 4779 <p/> 4780 This function can also be used to examine primitive (non-object) values. 4781 The primitive value of an array or String 4782 is reported after the object has been visited; 4783 it is reported by invoking the agent supplied callback function 4784 <functionlink id="jvmtiArrayPrimitiveValueCallback"/> or 4785 <functionlink id="jvmtiStringPrimitiveValueCallback"/>. 4786 A primitive field 4787 is reported after the object with that field is visited; 4788 it is reported by invoking the agent supplied 4789 callback function 4790 <functionlink id="jvmtiPrimitiveFieldCallback"/>. 4791 <p/> 4792 Unless the iteration is aborted by the 4793 <datalink id="jvmtiHeapVisitControl">Heap Visit Control Flags</datalink> 4794 returned by a callback, all objects in the heap are visited. 4795 Whether a callback is provided or is <code>NULL</code> only determines 4796 whether the callback will be invoked, it does not influence 4797 which objects are visited nor does it influence whether other callbacks 4798 will be invoked. 4799 The <datalink id="jvmtiHeapFilter">heap filter flags</datalink> 4800 and <paramlink id="klass"/> provided as parameters to this function 4801 do not control which objects are visited but they do control which 4802 objects and primitive values are reported by the callbacks. 4803 For example, if the only callback that was set is 4804 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> and <code>klass</code> 4805 is set to the array of bytes class, then only arrays of byte will be 4806 reported. The table below summarizes this (contrast this with 4807 <functionlink id="FollowReferences"/>): 4808 <p/> 4809 <table> 4810 <tr class="bgLight"> 4811 <th/> 4812 <th class="centered" scope="col">Controls objects visited</th> 4813 <th class="centered" scope="col">Controls objects reported</th> 4814 <th class="centered" scope="col">Controls primitives reported</th> 4815 </tr> 4816 <tr> 4817 <th scope="row"> 4818 the 4819 <datalink id="jvmtiHeapVisitControl">Heap Visit Control Flags</datalink> 4820 returned by <functionlink id="jvmtiHeapIterationCallback"/> 4821 </th> 4822 <td class="centered"> 4823 No<br/>(unless they abort the iteration) 4824 </td> 4825 <td class="centered"> 4826 No<br/>(unless they abort the iteration) 4827 </td> 4828 <td class="centered"> 4829 No<br/>(unless they abort the iteration) 4830 </td> 4831 </tr> 4832 <tr> 4833 <th scope="row"> 4834 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> 4835 in <paramlink id="callbacks"/> set 4836 </th> 4837 <td class="centered"> 4838 No 4839 </td> 4840 <td class="centered"> 4841 <b>Yes</b> 4842 </td> 4843 <td class="centered"> 4844 No 4845 </td> 4846 </tr> 4847 <tr> 4848 <th scope="row"> 4849 <paramlink id="heap_filter"/> 4850 </th> 4851 <td class="centered"> 4852 No 4853 </td> 4854 <td class="centered"> 4855 <b>Yes</b> 4856 </td> 4857 <td class="centered"> 4858 <b>Yes</b> 4859 </td> 4860 </tr> 4861 <tr> 4862 <th scope="row"> 4863 <paramlink id="klass"/> 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 <b>Yes</b> 4873 </td> 4874 </tr> 4875 </table> 4876 <p/> 4877 During the execution of this function the state of the heap 4878 does not change: no objects are allocated, no objects are 4879 garbage collected, and the state of objects (including 4880 held values) does not change. 4881 As a result, threads executing Java 4882 programming language code, threads attempting to resume the 4883 execution of Java programming language code, and threads 4884 attempting to execute JNI functions are typically stalled. 4885 </description> 4886 <origin>new</origin> 4887 <capabilities> 4888 <required id="can_tag_objects"></required> 4889 </capabilities> 4890 <parameters> 4891 <param id="heap_filter"> 4892 <jint/> 4893 <description> 4894 This bit vector of 4895 <datalink id="jvmtiHeapFilter">heap filter flags</datalink>. 4896 restricts the objects for which the callback function is called. 4897 This applies to both the object and primitive callbacks. 4898 </description> 4899 </param> 4900 <param id="klass"> 4901 <ptrtype> 4902 <jclass/> 4903 <nullok>callbacks are not limited to instances of a particular class</nullok> 4904 </ptrtype> 4905 <description> 4906 Callbacks are only reported when the object is an instance of 4907 this class. 4908 Objects which are instances of a subclass of <code>klass</code> 4909 are not reported. 4910 If <code>klass</code> is an interface, no objects are reported. 4911 This applies to both the object and primitive callbacks. 4912 </description> 4913 </param> 4914 <param id="callbacks"> 4915 <inptr> 4916 <struct>jvmtiHeapCallbacks</struct> 4917 </inptr> 4918 <description> 4919 Structure defining the set callback functions. 4920 </description> 4921 </param> 4922 <param id="user_data"> 4923 <inbuf> 4924 <void/> 4925 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 4926 </inbuf> 4927 <description> 4928 User supplied data to be passed to the callback. 4929 </description> 4930 </param> 4931 </parameters> 4932 <errors> 4933 <error id="JVMTI_ERROR_INVALID_CLASS"> 4934 <paramlink id="klass"/> is not a valid class. 4935 </error> 4936 </errors> 4937 </function> 4938 4939 <function id="GetTag" phase="start" num="106"> 4940 <synopsis>Get Tag</synopsis> 4941 <description> 4942 Retrieve the tag associated with an object. 4943 The tag is a long value typically used to store a 4944 unique identifier or pointer to object information. 4945 The tag is set with 4946 <functionlink id="SetTag"></functionlink>. 4947 Objects for which no tags have been set return a 4948 tag value of zero. 4949 </description> 4950 <origin>new</origin> 4951 <capabilities> 4952 <required id="can_tag_objects"></required> 4953 </capabilities> 4954 <parameters> 4955 <param id="object"> 4956 <jobject/> 4957 <description> 4958 The object whose tag is to be retrieved. 4959 </description> 4960 </param> 4961 <param id="tag_ptr"> 4962 <outptr><jlong/></outptr> 4963 <description> 4964 On return, the referenced long is set to the value 4965 of the tag. 4966 </description> 4967 </param> 4968 </parameters> 4969 <errors> 4970 </errors> 4971 </function> 4972 4973 <function id="SetTag" phase="start" num="107"> 4974 <synopsis>Set Tag</synopsis> 4975 <description> 4976 Set the tag associated with an object. 4977 The tag is a long value typically used to store a 4978 unique identifier or pointer to object information. 4979 The tag is visible with 4980 <functionlink id="GetTag"></functionlink>. 4981 </description> 4982 <origin>new</origin> 4983 <capabilities> 4984 <required id="can_tag_objects"></required> 4985 </capabilities> 4986 <parameters> 4987 <param id="object"> 4988 <jobject/> 4989 <description> 4990 The object whose tag is to be set. 4991 </description> 4992 </param> 4993 <param id="tag"> 4994 <jlong/> 4995 <description> 4996 The new value of the tag. 4997 </description> 4998 </param> 4999 </parameters> 5000 <errors> 5001 </errors> 5002 </function> 5003 5004 <function id="GetObjectsWithTags" num="114"> 5005 <synopsis>Get Objects With Tags</synopsis> 5006 <description> 5007 Return objects in the heap with the specified tags. 5008 The format is parallel arrays of objects and tags. 5009 </description> 5010 <origin>new</origin> 5011 <capabilities> 5012 <required id="can_tag_objects"></required> 5013 </capabilities> 5014 <parameters> 5015 <param id="tag_count"> 5016 <jint min="0"/> 5017 <description> 5018 Number of tags to scan for. 5019 </description> 5020 </param> 5021 <param id="tags"> 5022 <inbuf incount="tag_count"> 5023 <jlong/> 5024 </inbuf> 5025 <description> 5026 Scan for objects with these tags. 5027 Zero is not permitted in this array. 5028 </description> 5029 </param> 5030 <param id="count_ptr"> 5031 <outptr> 5032 <jint/> 5033 </outptr> 5034 <description> 5035 Return the number of objects with any of the tags 5036 in <paramlink id="tags"/>. 5037 </description> 5038 </param> 5039 <param id="object_result_ptr"> 5040 <allocbuf outcount="count_ptr"> 5041 <jobject/> 5042 <nullok>this information is not returned</nullok> 5043 </allocbuf> 5044 <description> 5045 Returns the array of objects with any of the tags 5046 in <paramlink id="tags"/>. 5047 </description> 5048 </param> 5049 <param id="tag_result_ptr"> 5050 <allocbuf outcount="count_ptr"> 5051 <jlong/> 5052 <nullok>this information is not returned</nullok> 5053 </allocbuf> 5054 <description> 5055 For each object in <paramlink id="object_result_ptr"/>, 5056 return the tag at the corresponding index. 5057 </description> 5058 </param> 5059 </parameters> 5060 <errors> 5061 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 5062 Zero is present in <paramlink id="tags"></paramlink>. 5063 </error> 5064 </errors> 5065 </function> 5066 5067 <function id="ForceGarbageCollection" num="108"> 5068 <synopsis>Force Garbage Collection</synopsis> 5069 <description> 5070 Force the VM to perform a garbage collection. 5071 The garbage collection is as complete as possible. 5072 This function does not cause finalizers to be run. 5073 This function does not return until the garbage collection 5074 is finished. 5075 <p/> 5076 Although garbage collection is as complete 5077 as possible there is no guarantee that all 5078 <eventlink id="ObjectFree"/> 5079 events will have been 5080 sent by the time that this function 5081 returns. In particular, an object may be 5082 prevented from being freed because it 5083 is awaiting finalization. 5084 </description> 5085 <origin>new</origin> 5086 <capabilities> 5087 </capabilities> 5088 <parameters> 5089 </parameters> 5090 <errors> 5091 </errors> 5092 </function> 5093 5094 5095 </category> 5096 5097 <category id="Heap_1_0" label="Heap (1.0)"> 5098 <intro> 5099 <b> 5100 These functions and data types were introduced in the original 5101 <jvmti/> version 1.0. They are deprecated and will be changed 5102 to return an error in a future release. They were superseded in 5103 <jvmti/> version 1.2 (Java SE 6) by more 5104 </b> 5105 <internallink id="Heap"><b>powerful and flexible versions</b></internallink> 5106 <b> 5107 which: 5108 </b> 5109 <ul> 5110 <li> 5111 <b> 5112 Allow access to primitive values (the value of Strings, arrays, 5113 and primitive fields) 5114 </b> 5115 </li> 5116 <li> 5117 <b> 5118 Allow the tag of the referrer to be set, thus enabling more 5119 efficient localized reference graph building 5120 </b> 5121 </li> 5122 <li> 5123 <b> 5124 Provide more extensive filtering abilities 5125 </b> 5126 </li> 5127 <li> 5128 <b> 5129 Are extensible, allowing their abilities to grow in future versions of <jvmti/> 5130 </b> 5131 </li> 5132 </ul> 5133 <p/> 5134 <b>Please use the </b> 5135 <internallink id="Heap"><b>current Heap functions</b></internallink>. 5136 <p/> 5137 <constants id="jvmtiHeapObjectFilter" label="Heap Object Filter Enumeration" kind="enum"> 5138 <constant id="JVMTI_HEAP_OBJECT_TAGGED" num="1"> 5139 Tagged objects only. 5140 </constant> 5141 <constant id="JVMTI_HEAP_OBJECT_UNTAGGED" num="2"> 5142 Untagged objects only. 5143 </constant> 5144 <constant id="JVMTI_HEAP_OBJECT_EITHER" num="3"> 5145 Either tagged or untagged objects. 5146 </constant> 5147 </constants> 5148 5149 <constants id="jvmtiHeapRootKind" label="Heap Root Kind Enumeration" kind="enum"> 5150 <constant id="JVMTI_HEAP_ROOT_JNI_GLOBAL" num="1"> 5151 JNI global reference. 5152 </constant> 5153 <constant id="JVMTI_HEAP_ROOT_SYSTEM_CLASS" num="2"> 5154 System class. 5155 </constant> 5156 <constant id="JVMTI_HEAP_ROOT_MONITOR" num="3"> 5157 Monitor. 5158 </constant> 5159 <constant id="JVMTI_HEAP_ROOT_STACK_LOCAL" num="4"> 5160 Stack local. 5161 </constant> 5162 <constant id="JVMTI_HEAP_ROOT_JNI_LOCAL" num="5"> 5163 JNI local reference. 5164 </constant> 5165 <constant id="JVMTI_HEAP_ROOT_THREAD" num="6"> 5166 Thread. 5167 </constant> 5168 <constant id="JVMTI_HEAP_ROOT_OTHER" num="7"> 5169 Other. 5170 </constant> 5171 </constants> 5172 5173 <constants id="jvmtiObjectReferenceKind" label="Object Reference Enumeration" kind="enum"> 5174 <constant id="JVMTI_REFERENCE_CLASS" num="1"> 5175 Reference from an object to its class. 5176 </constant> 5177 <constant id="JVMTI_REFERENCE_FIELD" num="2"> 5178 Reference from an object to the value of one of its instance fields. 5179 For references of this kind the <code>referrer_index</code> 5180 parameter to the <internallink id="jvmtiObjectReferenceCallback"> 5181 jvmtiObjectReferenceCallback</internallink> is the index of the 5182 the instance field. The index is based on the order of all the 5183 object's fields. This includes all fields of the directly declared 5184 static and instance fields in the class, and includes all fields (both 5185 public and private) fields declared in superclasses and superinterfaces. 5186 The index is thus calculated by summing the index of the field in the directly 5187 declared class (see <functionlink id="GetClassFields"/>), with the total 5188 number of fields (both public and private) declared in all superclasses 5189 and superinterfaces. The index starts at zero. 5190 </constant> 5191 <constant id="JVMTI_REFERENCE_ARRAY_ELEMENT" num="3"> 5192 Reference from an array to one of its elements. 5193 For references of this kind the <code>referrer_index</code> 5194 parameter to the <internallink id="jvmtiObjectReferenceCallback"> 5195 jvmtiObjectReferenceCallback</internallink> is the array index. 5196 </constant> 5197 <constant id="JVMTI_REFERENCE_CLASS_LOADER" num="4"> 5198 Reference from a class to its class loader. 5199 </constant> 5200 <constant id="JVMTI_REFERENCE_SIGNERS" num="5"> 5201 Reference from a class to its signers array. 5202 </constant> 5203 <constant id="JVMTI_REFERENCE_PROTECTION_DOMAIN" num="6"> 5204 Reference from a class to its protection domain. 5205 </constant> 5206 <constant id="JVMTI_REFERENCE_INTERFACE" num="7"> 5207 Reference from a class to one of its interfaces. 5208 </constant> 5209 <constant id="JVMTI_REFERENCE_STATIC_FIELD" num="8"> 5210 Reference from a class to the value of one of its static fields. 5211 For references of this kind the <code>referrer_index</code> 5212 parameter to the <internallink id="jvmtiObjectReferenceCallback"> 5213 jvmtiObjectReferenceCallback</internallink> is the index of the 5214 the static field. The index is based on the order of all the 5215 object's fields. This includes all fields of the directly declared 5216 static and instance fields in the class, and includes all fields (both 5217 public and private) fields declared in superclasses and superinterfaces. 5218 The index is thus calculated by summing the index of the field in the directly 5219 declared class (see <functionlink id="GetClassFields"/>), with the total 5220 number of fields (both public and private) declared in all superclasses 5221 and superinterfaces. The index starts at zero. 5222 Note: this definition differs from that in the <jvmti/> 1.0 Specification. 5223 <rationale>No known implementations used the 1.0 definition.</rationale> 5224 </constant> 5225 <constant id="JVMTI_REFERENCE_CONSTANT_POOL" num="9"> 5226 Reference from a class to a resolved entry in the constant pool. 5227 For references of this kind the <code>referrer_index</code> 5228 parameter to the <internallink id="jvmtiObjectReferenceCallback"> 5229 jvmtiObjectReferenceCallback</internallink> is the index into 5230 constant pool table of the class, starting at 1. See 5231 <vmspec chapter="4.4"/>. 5232 </constant> 5233 </constants> 5234 5235 <constants id="jvmtiIterationControl" label="Iteration Control Enumeration" kind="enum"> 5236 <constant id="JVMTI_ITERATION_CONTINUE" num="1"> 5237 Continue the iteration. 5238 If this is a reference iteration, follow the references of this object. 5239 </constant> 5240 <constant id="JVMTI_ITERATION_IGNORE" num="2"> 5241 Continue the iteration. 5242 If this is a reference iteration, ignore the references of this object. 5243 </constant> 5244 <constant id="JVMTI_ITERATION_ABORT" num="0"> 5245 Abort the iteration. 5246 </constant> 5247 </constants> 5248 </intro> 5249 5250 <callback id="jvmtiHeapObjectCallback"> 5251 <enum>jvmtiIterationControl</enum> 5252 <synopsis>Heap Object Callback</synopsis> 5253 <description> 5254 Agent supplied callback function. 5255 Describes (but does not pass in) an object in the heap. 5256 <p/> 5257 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration, 5258 or <code>JVMTI_ITERATION_ABORT</code> to stop iteration. 5259 <p/> 5260 See the <internallink id="heapCallbacks">heap callback 5261 function restrictions</internallink>. 5262 </description> 5263 <parameters> 5264 <param id="class_tag"> 5265 <jlong/> 5266 <description> 5267 The tag of the class of object (zero if the class is not tagged). 5268 If the object represents a runtime class, 5269 the <code>class_tag</code> is the tag 5270 associated with <code>java.lang.Class</code> 5271 (zero if <code>java.lang.Class</code> is not tagged). 5272 </description> 5273 </param> 5274 <param id="size"> 5275 <jlong/> 5276 <description> 5277 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 5278 </description> 5279 </param> 5280 <param id="tag_ptr"> 5281 <outptr><jlong/></outptr> 5282 <description> 5283 The object tag value, or zero if the object is not tagged. 5284 To set the tag value to be associated with the object 5285 the agent sets the <code>jlong</code> pointed to by the parameter. 5286 </description> 5287 </param> 5288 <param id="user_data"> 5289 <outptr><void/></outptr> 5290 <description> 5291 The user supplied data that was passed into the iteration function. 5292 </description> 5293 </param> 5294 </parameters> 5295 </callback> 5296 5297 <callback id="jvmtiHeapRootCallback"> 5298 <enum>jvmtiIterationControl</enum> 5299 <synopsis>Heap Root Object Callback</synopsis> 5300 <description> 5301 Agent supplied callback function. 5302 Describes (but does not pass in) an object that is a root for the purposes 5303 of garbage collection. 5304 <p/> 5305 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration, 5306 <code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing 5307 references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration. 5308 <p/> 5309 See the <internallink id="heapCallbacks">heap callback 5310 function restrictions</internallink>. 5311 </description> 5312 <parameters> 5313 <param id="root_kind"> 5314 <enum>jvmtiHeapRootKind</enum> 5315 <description> 5316 The kind of heap root. 5317 </description> 5318 </param> 5319 <param id="class_tag"> 5320 <jlong/> 5321 <description> 5322 The tag of the class of object (zero if the class is not tagged). 5323 If the object represents a runtime class, the <code>class_tag</code> is the tag 5324 associated with <code>java.lang.Class</code> 5325 (zero if <code>java.lang.Class</code> is not tagged). 5326 </description> 5327 </param> 5328 <param id="size"> 5329 <jlong/> 5330 <description> 5331 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 5332 </description> 5333 </param> 5334 <param id="tag_ptr"> 5335 <outptr><jlong/></outptr> 5336 <description> 5337 The object tag value, or zero if the object is not tagged. 5338 To set the tag value to be associated with the object 5339 the agent sets the <code>jlong</code> pointed to by the parameter. 5340 </description> 5341 </param> 5342 <param id="user_data"> 5343 <outptr><void/></outptr> 5344 <description> 5345 The user supplied data that was passed into the iteration function. 5346 </description> 5347 </param> 5348 </parameters> 5349 </callback> 5350 5351 <callback id="jvmtiStackReferenceCallback"> 5352 <enum>jvmtiIterationControl</enum> 5353 <synopsis>Stack Reference Object Callback</synopsis> 5354 <description> 5355 Agent supplied callback function. 5356 Describes (but does not pass in) an object on the stack that is a root for 5357 the purposes of garbage collection. 5358 <p/> 5359 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration, 5360 <code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing 5361 references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration. 5362 <p/> 5363 See the <internallink id="heapCallbacks">heap callback 5364 function restrictions</internallink>. 5365 </description> 5366 <parameters> 5367 <param id="root_kind"> 5368 <enum>jvmtiHeapRootKind</enum> 5369 <description> 5370 The kind of root (either <code>JVMTI_HEAP_ROOT_STACK_LOCAL</code> or 5371 <code>JVMTI_HEAP_ROOT_JNI_LOCAL</code>). 5372 </description> 5373 </param> 5374 <param id="class_tag"> 5375 <jlong/> 5376 <description> 5377 The tag of the class of object (zero if the class is not tagged). 5378 If the object represents a runtime class, the <code>class_tag</code> is the tag 5379 associated with <code>java.lang.Class</code> 5380 (zero if <code>java.lang.Class</code> is not tagged). 5381 </description> 5382 </param> 5383 <param id="size"> 5384 <jlong/> 5385 <description> 5386 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 5387 </description> 5388 </param> 5389 <param id="tag_ptr"> 5390 <outptr><jlong/></outptr> 5391 <description> 5392 The object tag value, or zero if the object is not tagged. 5393 To set the tag value to be associated with the object 5394 the agent sets the <code>jlong</code> pointed to by the parameter. 5395 </description> 5396 </param> 5397 <param id="thread_tag"> 5398 <jlong/> 5399 <description> 5400 The tag of the thread corresponding to this stack, zero if not tagged. 5401 </description> 5402 </param> 5403 <param id="depth"> 5404 <jint/> 5405 <description> 5406 The depth of the frame. 5407 </description> 5408 </param> 5409 <param id="method"> 5410 <jmethodID/> 5411 <description> 5412 The method executing in this frame. 5413 </description> 5414 </param> 5415 <param id="slot"> 5416 <jint/> 5417 <description> 5418 The slot number. 5419 </description> 5420 </param> 5421 <param id="user_data"> 5422 <outptr><void/></outptr> 5423 <description> 5424 The user supplied data that was passed into the iteration function. 5425 </description> 5426 </param> 5427 </parameters> 5428 </callback> 5429 5430 <callback id="jvmtiObjectReferenceCallback"> 5431 <enum>jvmtiIterationControl</enum> 5432 <synopsis>Object Reference Callback</synopsis> 5433 <description> 5434 Agent supplied callback function. 5435 Describes a reference from an object (the referrer) to another object 5436 (the referree). 5437 <p/> 5438 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration, 5439 <code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing 5440 references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration. 5441 <p/> 5442 See the <internallink id="heapCallbacks">heap callback 5443 function restrictions</internallink>. 5444 </description> 5445 <parameters> 5446 <param id="reference_kind"> 5447 <enum>jvmtiObjectReferenceKind</enum> 5448 <description> 5449 The type of reference. 5450 </description> 5451 </param> 5452 <param id="class_tag"> 5453 <jlong/> 5454 <description> 5455 The tag of the class of referree object (zero if the class is not tagged). 5456 If the referree object represents a runtime class, 5457 the <code>class_tag</code> is the tag 5458 associated with <code>java.lang.Class</code> 5459 (zero if <code>java.lang.Class</code> is not tagged). 5460 </description> 5461 </param> 5462 <param id="size"> 5463 <jlong/> 5464 <description> 5465 Size of the referree object (in bytes). 5466 See <functionlink id="GetObjectSize"/>. 5467 </description> 5468 </param> 5469 <param id="tag_ptr"> 5470 <outptr><jlong/></outptr> 5471 <description> 5472 The referree object tag value, or zero if the object is not 5473 tagged. 5474 To set the tag value to be associated with the object 5475 the agent sets the <code>jlong</code> pointed to by the parameter. 5476 </description> 5477 </param> 5478 <param id="referrer_tag"> 5479 <jlong/> 5480 <description> 5481 The tag of the referrer object, or zero if the referrer 5482 object is not tagged. 5483 </description> 5484 </param> 5485 <param id="referrer_index"> 5486 <jint/> 5487 <description> 5488 For references of type <code>JVMTI_REFERENCE_FIELD</code> or 5489 <code>JVMTI_REFERENCE_STATIC_FIELD</code> the index 5490 of the field in the referrer object. The index is based on the 5491 order of all the object's fields - see <internallink 5492 id="JVMTI_REFERENCE_FIELD">JVMTI_REFERENCE_FIELD</internallink> 5493 or <internallink 5494 id="JVMTI_REFERENCE_STATIC_FIELD">JVMTI_REFERENCE_STATIC_FIELD 5495 </internallink> for further description. 5496 <p/> 5497 For references of type <code>JVMTI_REFERENCE_ARRAY_ELEMENT</code> 5498 the array index - see <internallink id="JVMTI_REFERENCE_ARRAY_ELEMENT"> 5499 JVMTI_REFERENCE_ARRAY_ELEMENT</internallink> for further description. 5500 <p/> 5501 For references of type <code>JVMTI_REFERENCE_CONSTANT_POOL</code> 5502 the index into the constant pool of the class - see 5503 <internallink id="JVMTI_REFERENCE_CONSTANT_POOL"> 5504 JVMTI_REFERENCE_CONSTANT_POOL</internallink> for further 5505 description. 5506 <p/> 5507 For references of other kinds the <code>referrer_index</code> is 5508 <code>-1</code>. 5509 </description> 5510 </param> 5511 <param id="user_data"> 5512 <outptr><void/></outptr> 5513 <description> 5514 The user supplied data that was passed into the iteration function. 5515 </description> 5516 </param> 5517 </parameters> 5518 </callback> 5519 5520 <function id="IterateOverObjectsReachableFromObject" num="109"> 5521 <synopsis>Iterate Over Objects Reachable From Object</synopsis> 5522 <description> 5523 This function iterates over all objects that are directly 5524 and indirectly reachable from the specified object. 5525 For each object <i>A</i> (known 5526 as the referrer) with a reference to object <i>B</i> the specified 5527 callback function is called to describe the object reference. 5528 The callback is called exactly once for each reference from a referrer; 5529 this is true even if there are reference cycles or multiple paths to 5530 the referrer. 5531 There may be more than one reference between a referrer and a referree, 5532 These may be distinguished by the 5533 <datalink id="jvmtiObjectReferenceCallback.reference_kind"></datalink> and 5534 <datalink id="jvmtiObjectReferenceCallback.referrer_index"></datalink>. 5535 The callback for an object will always occur after the callback for 5536 its referrer. 5537 <p/> 5538 See <functionlink id="FollowReferences"/> for the object 5539 references which are reported. 5540 <p/> 5541 During the execution of this function the state of the heap 5542 does not change: no objects are allocated, no objects are 5543 garbage collected, and the state of objects (including 5544 held values) does not change. 5545 As a result, threads executing Java 5546 programming language code, threads attempting to resume the 5547 execution of Java programming language code, and threads 5548 attempting to execute JNI functions are typically stalled. 5549 </description> 5550 <origin>new</origin> 5551 <capabilities> 5552 <required id="can_tag_objects"></required> 5553 </capabilities> 5554 <parameters> 5555 <param id="object"> 5556 <jobject/> 5557 <description> 5558 The object 5559 </description> 5560 </param> 5561 <param id="object_reference_callback"> 5562 <ptrtype> 5563 <struct>jvmtiObjectReferenceCallback</struct> 5564 </ptrtype> 5565 <description> 5566 The callback to be called to describe each 5567 object reference. 5568 </description> 5569 </param> 5570 <param id="user_data"> 5571 <inbuf> 5572 <void/> 5573 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 5574 </inbuf> 5575 <description> 5576 User supplied data to be passed to the callback. 5577 </description> 5578 </param> 5579 </parameters> 5580 <errors> 5581 </errors> 5582 </function> 5583 5584 <function id="IterateOverReachableObjects" num="110"> 5585 <synopsis>Iterate Over Reachable Objects</synopsis> 5586 <description> 5587 This function iterates over the root objects and all objects that 5588 are directly and indirectly reachable from the root objects. 5589 The root objects comprise the set of system classes, 5590 JNI globals, references from thread stacks, and other objects used as roots 5591 for the purposes of garbage collection. 5592 <p/> 5593 For each root the <paramlink id="heap_root_callback"></paramlink> 5594 or <paramlink id="stack_ref_callback"></paramlink> callback is called. 5595 An object can be a root object for more than one reason and in that case 5596 the appropriate callback is called for each reason. 5597 <p/> 5598 For each object reference the <paramlink id="object_ref_callback"></paramlink> 5599 callback function is called to describe the object reference. 5600 The callback is called exactly once for each reference from a referrer; 5601 this is true even if there are reference cycles or multiple paths to 5602 the referrer. 5603 There may be more than one reference between a referrer and a referree, 5604 These may be distinguished by the 5605 <datalink id="jvmtiObjectReferenceCallback.reference_kind"></datalink> and 5606 <datalink id="jvmtiObjectReferenceCallback.referrer_index"></datalink>. 5607 The callback for an object will always occur after the callback for 5608 its referrer. 5609 <p/> 5610 See <functionlink id="FollowReferences"/> for the object 5611 references which are reported. 5612 <p/> 5613 Roots are always reported to the profiler before any object references 5614 are reported. In other words, the <paramlink id="object_ref_callback"></paramlink> 5615 callback will not be called until the appropriate callback has been called 5616 for all roots. If the <paramlink id="object_ref_callback"></paramlink> callback is 5617 specified as <code>NULL</code> then this function returns after 5618 reporting the root objects to the profiler. 5619 <p/> 5620 During the execution of this function the state of the heap 5621 does not change: no objects are allocated, no objects are 5622 garbage collected, and the state of objects (including 5623 held values) does not change. 5624 As a result, threads executing Java 5625 programming language code, threads attempting to resume the 5626 execution of Java programming language code, and threads 5627 attempting to execute JNI functions are typically stalled. 5628 </description> 5629 <origin>new</origin> 5630 <capabilities> 5631 <required id="can_tag_objects"></required> 5632 </capabilities> 5633 <parameters> 5634 <param id="heap_root_callback"> 5635 <ptrtype> 5636 <struct>jvmtiHeapRootCallback</struct> 5637 <nullok>do not report heap roots</nullok> 5638 </ptrtype> 5639 <description> 5640 The callback function to be called for each heap root of type 5641 <code>JVMTI_HEAP_ROOT_JNI_GLOBAL</code>, 5642 <code>JVMTI_HEAP_ROOT_SYSTEM_CLASS</code>, 5643 <code>JVMTI_HEAP_ROOT_MONITOR</code>, 5644 <code>JVMTI_HEAP_ROOT_THREAD</code>, or 5645 <code>JVMTI_HEAP_ROOT_OTHER</code>. 5646 </description> 5647 </param> 5648 <param id="stack_ref_callback"> 5649 <ptrtype> 5650 <struct>jvmtiStackReferenceCallback</struct> 5651 <nullok>do not report stack references</nullok> 5652 </ptrtype> 5653 <description> 5654 The callback function to be called for each heap root of 5655 <code>JVMTI_HEAP_ROOT_STACK_LOCAL</code> or 5656 <code>JVMTI_HEAP_ROOT_JNI_LOCAL</code>. 5657 </description> 5658 </param> 5659 <param id="object_ref_callback"> 5660 <ptrtype> 5661 <struct>jvmtiObjectReferenceCallback</struct> 5662 <nullok>do not follow references from the root objects</nullok> 5663 </ptrtype> 5664 <description> 5665 The callback function to be called for each object reference. 5666 </description> 5667 </param> 5668 <param id="user_data"> 5669 <inbuf> 5670 <void/> 5671 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 5672 </inbuf> 5673 <description> 5674 User supplied data to be passed to the callback. 5675 </description> 5676 </param> 5677 </parameters> 5678 <errors> 5679 </errors> 5680 </function> 5681 5682 <function id="IterateOverHeap" num="111"> 5683 <synopsis>Iterate Over Heap</synopsis> 5684 <description> 5685 Iterate over all objects in the heap. This includes both reachable and 5686 unreachable objects. 5687 <p/> 5688 The <paramlink id="object_filter"></paramlink> parameter indicates the 5689 objects for which the callback function is called. If this parameter 5690 is <code>JVMTI_HEAP_OBJECT_TAGGED</code> then the callback will only be 5691 called for every object that is tagged. If the parameter is 5692 <code>JVMTI_HEAP_OBJECT_UNTAGGED</code> then the callback will only be 5693 for objects that are not tagged. If the parameter 5694 is <code>JVMTI_HEAP_OBJECT_EITHER</code> then the callback will be 5695 called for every object in the heap, irrespective of whether it is 5696 tagged or not. 5697 <p/> 5698 During the execution of this function the state of the heap 5699 does not change: no objects are allocated, no objects are 5700 garbage collected, and the state of objects (including 5701 held values) does not change. 5702 As a result, threads executing Java 5703 programming language code, threads attempting to resume the 5704 execution of Java programming language code, and threads 5705 attempting to execute JNI functions are typically stalled. 5706 </description> 5707 <origin>new</origin> 5708 <capabilities> 5709 <required id="can_tag_objects"></required> 5710 </capabilities> 5711 <parameters> 5712 <param id="object_filter"> 5713 <enum>jvmtiHeapObjectFilter</enum> 5714 <description> 5715 Indicates the objects for which the callback function is called. 5716 </description> 5717 </param> 5718 <param id="heap_object_callback"> 5719 <ptrtype> 5720 <struct>jvmtiHeapObjectCallback</struct> 5721 </ptrtype> 5722 <description> 5723 The iterator function to be called for each 5724 object matching the <paramlink id="object_filter"/>. 5725 </description> 5726 </param> 5727 <param id="user_data"> 5728 <inbuf> 5729 <void/> 5730 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 5731 </inbuf> 5732 <description> 5733 User supplied data to be passed to the callback. 5734 </description> 5735 </param> 5736 </parameters> 5737 <errors> 5738 </errors> 5739 </function> 5740 5741 <function id="IterateOverInstancesOfClass" num="112"> 5742 <synopsis>Iterate Over Instances Of Class</synopsis> 5743 <description> 5744 Iterate over all objects in the heap that are instances of the specified class. 5745 This includes direct instances of the specified class and 5746 instances of all subclasses of the specified class. 5747 This includes both reachable and unreachable objects. 5748 <p/> 5749 The <paramlink id="object_filter"></paramlink> parameter indicates the 5750 objects for which the callback function is called. If this parameter 5751 is <code>JVMTI_HEAP_OBJECT_TAGGED</code> then the callback will only be 5752 called for every object that is tagged. If the parameter is 5753 <code>JVMTI_HEAP_OBJECT_UNTAGGED</code> then the callback will only be 5754 called for objects that are not tagged. If the parameter 5755 is <code>JVMTI_HEAP_OBJECT_EITHER</code> then the callback will be 5756 called for every object in the heap, irrespective of whether it is 5757 tagged or not. 5758 <p/> 5759 During the execution of this function the state of the heap 5760 does not change: no objects are allocated, no objects are 5761 garbage collected, and the state of objects (including 5762 held values) does not change. 5763 As a result, threads executing Java 5764 programming language code, threads attempting to resume the 5765 execution of Java programming language code, and threads 5766 attempting to execute JNI functions are typically stalled. 5767 </description> 5768 <origin>new</origin> 5769 <capabilities> 5770 <required id="can_tag_objects"></required> 5771 </capabilities> 5772 <parameters> 5773 <param id="klass"> 5774 <jclass/> 5775 <description> 5776 Iterate over objects of this class only. 5777 </description> 5778 </param> 5779 <param id="object_filter"> 5780 <enum>jvmtiHeapObjectFilter</enum> 5781 <description> 5782 Indicates the objects for which the callback function is called. 5783 </description> 5784 </param> 5785 <param id="heap_object_callback"> 5786 <ptrtype> 5787 <struct>jvmtiHeapObjectCallback</struct> 5788 </ptrtype> 5789 <description> 5790 The iterator function to be called for each 5791 <paramlink id="klass"/> instance matching 5792 the <paramlink id="object_filter"/>. 5793 </description> 5794 </param> 5795 <param id="user_data"> 5796 <inbuf> 5797 <void/> 5798 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 5799 </inbuf> 5800 <description> 5801 User supplied data to be passed to the callback. 5802 </description> 5803 </param> 5804 </parameters> 5805 <errors> 5806 </errors> 5807 </function> 5808 5809 </category> 5810 5811 <category id="local" label="Local Variable"> 5812 5813 <intro> 5814 These functions are used to retrieve or set the value of a local variable. 5815 The variable is identified by the depth of the frame containing its 5816 value and the variable's slot number within that frame. 5817 The mapping of variables to 5818 slot numbers can be obtained with the function 5819 <functionlink id="GetLocalVariableTable"></functionlink>. 5820 <p/> 5821 The <code>GetLocalXXX</code> functions may be used to retrieve the value of 5822 a local variable contained in the frame of a virtual thread. 5823 The <code>SetLocalXXX</code> functions may be used to set the value of a 5824 local variable in the topmost frame of a virtual thread suspended at a 5825 breakpoint or single step event. An implementation may support setting locals 5826 in other cases. 5827 </intro> 5828 5829 <function id="GetLocalObject" num="21"> 5830 <synopsis>Get Local Variable - Object</synopsis> 5831 <description> 5832 This function can be used to retrieve the value of a local 5833 variable whose type is <code>Object</code> or a subclass of <code>Object</code>. 5834 <p/> 5835 The specified thread must be suspended or must be the current thread. 5836 </description> 5837 <origin>jvmdi</origin> 5838 <capabilities> 5839 <required id="can_access_local_variables"></required> 5840 </capabilities> 5841 <parameters> 5842 <param id="thread"> 5843 <jthread null="current" frame="frame" impl="noconvert"/> 5844 <description> 5845 The thread of the frame containing the variable's value. 5846 </description> 5847 </param> 5848 <param id="depth"> 5849 <jframeID thread="thread"/> 5850 <description> 5851 The depth of the frame containing the variable's value. 5852 </description> 5853 </param> 5854 <param id="slot"> 5855 <jint/> 5856 <description> 5857 The variable's slot number. 5858 </description> 5859 </param> 5860 <param id="value_ptr"> 5861 <outptr><jobject/></outptr> 5862 <description> 5863 On return, points to the variable's value. 5864 </description> 5865 </param> 5866 </parameters> 5867 <errors> 5868 <error id="JVMTI_ERROR_INVALID_SLOT"> 5869 Invalid <code>slot</code>. 5870 </error> 5871 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 5872 The variable type is not 5873 <code>Object</code> or a subclass of <code>Object</code>. 5874 </error> 5875 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 5876 Not a visible frame 5877 </error> 5878 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 5879 Thread was not suspended and was not the current thread. 5880 </error> 5881 </errors> 5882 </function> 5883 5884 <function id="GetLocalInstance" num="155" since="1.2"> 5885 <synopsis>Get Local Instance</synopsis> 5886 <description> 5887 This function can be used to retrieve the value of the local object 5888 variable at slot 0 (the "<code>this</code>" object) from non-static 5889 frames. This function can retrieve the "<code>this</code>" object from 5890 native method frames, whereas <code>GetLocalObject()</code> would 5891 return <code>JVMTI_ERROR_OPAQUE_FRAME</code> in those cases. 5892 <p/> 5893 The specified thread must be suspended or must be the current thread. 5894 </description> 5895 <origin>new</origin> 5896 <capabilities> 5897 <required id="can_access_local_variables"></required> 5898 </capabilities> 5899 <parameters> 5900 <param id="thread"> 5901 <jthread null="current" frame="frame" impl="noconvert"/> 5902 <description> 5903 The thread of the frame containing the variable's value. 5904 </description> 5905 </param> 5906 <param id="depth"> 5907 <jframeID thread="thread"/> 5908 <description> 5909 The depth of the frame containing the variable's value. 5910 </description> 5911 </param> 5912 <param id="value_ptr"> 5913 <outptr><jobject/></outptr> 5914 <description> 5915 On return, points to the variable's value. 5916 </description> 5917 </param> 5918 </parameters> 5919 <errors> 5920 <error id="JVMTI_ERROR_INVALID_SLOT"> 5921 If the specified frame is a static method frame. 5922 </error> 5923 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 5924 Thread was not suspended and was not the current thread. 5925 </error> 5926 </errors> 5927 </function> 5928 <function id="GetLocalInt" num="22"> 5929 <synopsis>Get Local Variable - Int</synopsis> 5930 <description> 5931 This function can be used to retrieve the value of a local 5932 variable whose type is <code>int</code>, 5933 <code>short</code>, <code>char</code>, <code>byte</code>, or 5934 <code>boolean</code>. 5935 <p/> 5936 The specified thread must be suspended or must be the current thread. 5937 </description> 5938 <origin>jvmdi</origin> 5939 <capabilities> 5940 <required id="can_access_local_variables"></required> 5941 </capabilities> 5942 <parameters> 5943 <param id="thread"> 5944 <jthread null="current" frame="frame" impl="noconvert"/> 5945 <description> 5946 The thread of the frame containing the variable's value. 5947 </description> 5948 </param> 5949 <param id="depth"> 5950 <jframeID thread="thread"/> 5951 <description> 5952 The depth of the frame containing the variable's value. 5953 </description> 5954 </param> 5955 <param id="slot"> 5956 <jint/> 5957 <description> 5958 The variable's slot number. 5959 </description> 5960 </param> 5961 <param id="value_ptr"> 5962 <outptr><jint/></outptr> 5963 <description> 5964 On return, points to the variable's value. 5965 </description> 5966 </param> 5967 </parameters> 5968 <errors> 5969 <error id="JVMTI_ERROR_INVALID_SLOT"> 5970 Invalid <code>slot</code>. 5971 </error> 5972 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 5973 The variable type is not 5974 <code>int</code>, <code>short</code>, 5975 <code>char</code>, <code>byte</code>, or 5976 <code>boolean</code>. 5977 </error> 5978 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 5979 Not a visible frame 5980 </error> 5981 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 5982 Thread was not suspended and was not the current thread. 5983 </error> 5984 </errors> 5985 </function> 5986 5987 <function id="GetLocalLong" num="23"> 5988 <synopsis>Get Local Variable - Long</synopsis> 5989 <description> 5990 This function can be used to retrieve the value of a local 5991 variable whose type is <code>long</code>. 5992 <p/> 5993 The specified thread must be suspended or must be the current thread. 5994 </description> 5995 <origin>jvmdi</origin> 5996 <capabilities> 5997 <required id="can_access_local_variables"></required> 5998 </capabilities> 5999 <parameters> 6000 <param id="thread"> 6001 <jthread null="current" frame="frame" impl="noconvert"/> 6002 <description> 6003 The thread of the frame containing the variable's value. 6004 </description> 6005 </param> 6006 <param id="depth"> 6007 <jframeID thread="thread"/> 6008 <description> 6009 The depth of the frame containing the variable's value. 6010 </description> 6011 </param> 6012 <param id="slot"> 6013 <jint/> 6014 <description> 6015 The variable's slot number. 6016 </description> 6017 </param> 6018 <param id="value_ptr"> 6019 <outptr><jlong/></outptr> 6020 <description> 6021 On return, points to the variable's value. 6022 </description> 6023 </param> 6024 </parameters> 6025 <errors> 6026 <error id="JVMTI_ERROR_INVALID_SLOT"> 6027 Invalid <code>slot</code>. 6028 </error> 6029 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6030 The variable type is not <code>long</code>. 6031 </error> 6032 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6033 Not a visible frame 6034 </error> 6035 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 6036 Thread was not suspended and was not the current thread. 6037 </error> 6038 </errors> 6039 </function> 6040 6041 <function id="GetLocalFloat" num="24"> 6042 <synopsis>Get Local Variable - Float</synopsis> 6043 <description> 6044 This function can be used to retrieve the value of a local 6045 variable whose type is <code>float</code>. 6046 <p/> 6047 The specified thread must be suspended or must be the current thread. 6048 </description> 6049 <origin>jvmdi</origin> 6050 <capabilities> 6051 <required id="can_access_local_variables"></required> 6052 </capabilities> 6053 <parameters> 6054 <param id="thread"> 6055 <jthread null="current" frame="frame" impl="noconvert"/> 6056 <description> 6057 The thread of the frame containing the variable's value. 6058 </description> 6059 </param> 6060 <param id="depth"> 6061 <jframeID thread="thread"/> 6062 <description> 6063 The depth of the frame containing the variable's value. 6064 </description> 6065 </param> 6066 <param id="slot"> 6067 <jint/> 6068 <description> 6069 The variable's slot number. 6070 </description> 6071 </param> 6072 <param id="value_ptr"> 6073 <outptr><jfloat/></outptr> 6074 <description> 6075 On return, points to the variable's value. 6076 </description> 6077 </param> 6078 </parameters> 6079 <errors> 6080 <error id="JVMTI_ERROR_INVALID_SLOT"> 6081 Invalid <code>slot</code>. 6082 </error> 6083 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6084 The variable type is not <code>float</code>. 6085 </error> 6086 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6087 Not a visible frame 6088 </error> 6089 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 6090 Thread was not suspended and was not the current thread. 6091 </error> 6092 </errors> 6093 </function> 6094 6095 <function id="GetLocalDouble" num="25"> 6096 <synopsis>Get Local Variable - Double</synopsis> 6097 <description> 6098 This function can be used to retrieve the value of a local 6099 variable whose type is <code>long</code>. 6100 <p/> 6101 The specified thread must be suspended or must be the current thread. 6102 </description> 6103 <origin>jvmdi</origin> 6104 <capabilities> 6105 <required id="can_access_local_variables"></required> 6106 </capabilities> 6107 <parameters> 6108 <param id="thread"> 6109 <jthread null="current" frame="frame" impl="noconvert"/> 6110 <description> 6111 The thread of the frame containing the variable's value. 6112 </description> 6113 </param> 6114 <param id="depth"> 6115 <jframeID thread="thread"/> 6116 <description> 6117 The depth of the frame containing the variable's value. 6118 </description> 6119 </param> 6120 <param id="slot"> 6121 <jint/> 6122 <description> 6123 The variable's slot number. 6124 </description> 6125 </param> 6126 <param id="value_ptr"> 6127 <outptr><jdouble/></outptr> 6128 <description> 6129 On return, points to the variable's value. 6130 </description> 6131 </param> 6132 </parameters> 6133 <errors> 6134 <error id="JVMTI_ERROR_INVALID_SLOT"> 6135 Invalid <code>slot</code>. 6136 </error> 6137 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6138 The variable type is not <code>double</code>. 6139 </error> 6140 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6141 Not a visible frame 6142 </error> 6143 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 6144 Thread was not suspended and was not the current thread. 6145 </error> 6146 </errors> 6147 </function> 6148 6149 <function id="SetLocalObject" num="26"> 6150 <synopsis>Set Local Variable - Object</synopsis> 6151 <description> 6152 This function can be used to set the value of a local 6153 variable whose type is <code>Object</code> or a subclass of <code>Object</code>. 6154 <p/> 6155 The specified thread must be suspended or must be the current thread. 6156 </description> 6157 <origin>jvmdi</origin> 6158 <capabilities> 6159 <required id="can_access_local_variables"></required> 6160 </capabilities> 6161 <parameters> 6162 <param id="thread"> 6163 <jthread null="current" frame="frame" impl="noconvert"/> 6164 <description> 6165 The thread of the frame containing the variable's value. 6166 </description> 6167 </param> 6168 <param id="depth"> 6169 <jframeID thread="thread"/> 6170 <description> 6171 The depth of the frame containing the variable's value. 6172 </description> 6173 </param> 6174 <param id="slot"> 6175 <jint/> 6176 <description> 6177 The variable's slot number. 6178 </description> 6179 </param> 6180 <param id="value"> 6181 <jobject/> 6182 <description> 6183 The new value for the variable. 6184 </description> 6185 </param> 6186 </parameters> 6187 <errors> 6188 <error id="JVMTI_ERROR_INVALID_SLOT"> 6189 Invalid <code>slot</code>. 6190 </error> 6191 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6192 The variable type is not 6193 <code>Object</code> or a subclass of <code>Object</code>. 6194 </error> 6195 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6196 The supplied <paramlink id="value"/> is not compatible 6197 with the variable type. 6198 </error> 6199 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6200 Not a visible frame 6201 </error> 6202 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6203 The thread is a virtual thread and the implementation does not support 6204 setting the value of locals in the frame of the given depth. 6205 See <internallink id="local">Local Variables</internallink>. 6206 </error> 6207 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 6208 Thread was not suspended and was not the current thread. 6209 </error> 6210 </errors> 6211 </function> 6212 6213 <function id="SetLocalInt" num="27"> 6214 <synopsis>Set Local Variable - Int</synopsis> 6215 <description> 6216 This function can be used to set the value of a local 6217 variable whose type is <code>int</code>, 6218 <code>short</code>, <code>char</code>, <code>byte</code>, or 6219 <code>boolean</code>. 6220 <p/> 6221 The specified thread must be suspended or must be the current thread. 6222 </description> 6223 <origin>jvmdi</origin> 6224 <capabilities> 6225 <required id="can_access_local_variables"></required> 6226 </capabilities> 6227 <parameters> 6228 <param id="thread"> 6229 <jthread null="current" frame="frame" impl="noconvert"/> 6230 <description> 6231 The thread of the frame containing the variable's value. 6232 </description> 6233 </param> 6234 <param id="depth"> 6235 <jframeID thread="thread"/> 6236 <description> 6237 The depth of the frame containing the variable's value. 6238 </description> 6239 </param> 6240 <param id="slot"> 6241 <jint/> 6242 <description> 6243 The variable's slot number. 6244 </description> 6245 </param> 6246 <param id="value"> 6247 <jint/> 6248 <description> 6249 The new value for the variable. 6250 </description> 6251 </param> 6252 </parameters> 6253 <errors> 6254 <error id="JVMTI_ERROR_INVALID_SLOT"> 6255 Invalid <code>slot</code>. 6256 </error> 6257 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6258 The variable type is not 6259 <code>int</code>, <code>short</code>, 6260 <code>char</code>, <code>byte</code>, or 6261 <code>boolean</code>. 6262 </error> 6263 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6264 Not a visible frame 6265 </error> 6266 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6267 The thread is a virtual thread and the implementation does not support 6268 setting the value of locals in the frame of the given depth. 6269 See <internallink id="local">Local Variables</internallink>. 6270 </error> 6271 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 6272 Thread was not suspended and was not the current thread. 6273 </error> 6274 </errors> 6275 </function> 6276 6277 <function id="SetLocalLong" num="28"> 6278 <synopsis>Set Local Variable - Long</synopsis> 6279 <description> 6280 This function can be used to set the value of a local 6281 variable whose type is <code>long</code>. 6282 <p/> 6283 The specified thread must be suspended or must be the current thread. 6284 </description> 6285 <origin>jvmdi</origin> 6286 <capabilities> 6287 <required id="can_access_local_variables"></required> 6288 </capabilities> 6289 <parameters> 6290 <param id="thread"> 6291 <jthread null="current" frame="frame" impl="noconvert"/> 6292 <description> 6293 The thread of the frame containing the variable's value. 6294 </description> 6295 </param> 6296 <param id="depth"> 6297 <jframeID thread="thread"/> 6298 <description> 6299 The depth of the frame containing the variable's value. 6300 </description> 6301 </param> 6302 <param id="slot"> 6303 <jint/> 6304 <description> 6305 The variable's slot number. 6306 </description> 6307 </param> 6308 <param id="value"> 6309 <jlong/> 6310 <description> 6311 The new value for the variable. 6312 </description> 6313 </param> 6314 </parameters> 6315 <errors> 6316 <error id="JVMTI_ERROR_INVALID_SLOT"> 6317 Invalid <code>slot</code>. 6318 </error> 6319 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6320 The variable type is not <code>long</code>. 6321 </error> 6322 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6323 Not a visible frame 6324 </error> 6325 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6326 The thread is a virtual thread and the implementation does not support 6327 setting the value of locals in the frame of the given depth. 6328 See <internallink id="local">Local Variables</internallink>. 6329 </error> 6330 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 6331 Thread was not suspended and was not the current thread. 6332 </error> 6333 </errors> 6334 </function> 6335 6336 <function id="SetLocalFloat" num="29"> 6337 <synopsis>Set Local Variable - Float</synopsis> 6338 <description> 6339 This function can be used to set the value of a local 6340 variable whose type is <code>float</code>. 6341 <p/> 6342 The specified thread must be suspended or must be the current thread. 6343 </description> 6344 <origin>jvmdi</origin> 6345 <capabilities> 6346 <required id="can_access_local_variables"></required> 6347 </capabilities> 6348 <parameters> 6349 <param id="thread"> 6350 <jthread null="current" frame="frame" impl="noconvert"/> 6351 <description> 6352 The thread of the frame containing the variable's value. 6353 </description> 6354 </param> 6355 <param id="depth"> 6356 <jframeID thread="thread"/> 6357 <description> 6358 The depth of the frame containing the variable's value. 6359 </description> 6360 </param> 6361 <param id="slot"> 6362 <jint/> 6363 <description> 6364 The variable's slot number. 6365 </description> 6366 </param> 6367 <param id="value"> 6368 <jfloat/> 6369 <description> 6370 The new value for the variable. 6371 </description> 6372 </param> 6373 </parameters> 6374 <errors> 6375 <error id="JVMTI_ERROR_INVALID_SLOT"> 6376 Invalid <code>slot</code>. 6377 </error> 6378 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6379 The variable type is not <code>float</code>. 6380 </error> 6381 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6382 Not a visible frame 6383 </error> 6384 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6385 The thread is a virtual thread and the implementation does not support 6386 setting the value of locals in the frame of the given depth. 6387 See <internallink id="local">Local Variables</internallink>. 6388 </error> 6389 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 6390 Thread was not suspended and was not the current thread. 6391 </error> 6392 </errors> 6393 </function> 6394 6395 <function id="SetLocalDouble" num="30"> 6396 <synopsis>Set Local Variable - Double</synopsis> 6397 <description> 6398 This function can be used to set the value of a local 6399 variable whose type is <code>double</code>. 6400 <p/> 6401 The specified thread must be suspended or must be the current thread. 6402 </description> 6403 <origin>jvmdi</origin> 6404 <capabilities> 6405 <required id="can_access_local_variables"></required> 6406 </capabilities> 6407 <parameters> 6408 <param id="thread"> 6409 <jthread null="current" frame="frame" impl="noconvert"/> 6410 <description> 6411 The thread of the frame containing the variable's value. 6412 </description> 6413 </param> 6414 <param id="depth"> 6415 <jframeID thread="thread"/> 6416 <description> 6417 The depth of the frame containing the variable's value. 6418 </description> 6419 </param> 6420 <param id="slot"> 6421 <jint/> 6422 <description> 6423 The variable's slot number. 6424 </description> 6425 </param> 6426 <param id="value"> 6427 <jdouble/> 6428 <description> 6429 The new value for the variable. 6430 </description> 6431 </param> 6432 </parameters> 6433 <errors> 6434 <error id="JVMTI_ERROR_INVALID_SLOT"> 6435 Invalid <code>slot</code>. 6436 </error> 6437 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6438 The variable type is not <code>double</code>. 6439 </error> 6440 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6441 Not a visible frame 6442 </error> 6443 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6444 The thread is a virtual thread and the implementation does not support 6445 setting the value of locals in the frame of the given depth. 6446 See <internallink id="local">Local Variables</internallink>. 6447 </error> 6448 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 6449 Thread was not suspended and was not the current thread. 6450 </error> 6451 </errors> 6452 </function> 6453 </category> 6454 6455 <category id="breakpointCategory" label="Breakpoint"> 6456 6457 <intro> 6458 </intro> 6459 6460 <function id="SetBreakpoint" num="38"> 6461 <synopsis>Set Breakpoint</synopsis> 6462 <description> 6463 Set a breakpoint at the instruction indicated by 6464 <code>method</code> and <code>location</code>. 6465 An instruction can only have one breakpoint. 6466 <p/> 6467 Whenever the designated instruction is about to be executed, a 6468 <eventlink id="Breakpoint"></eventlink> event is generated. 6469 </description> 6470 <origin>jvmdi</origin> 6471 <capabilities> 6472 <required id="can_generate_breakpoint_events"></required> 6473 </capabilities> 6474 <parameters> 6475 <param id="klass"> 6476 <jclass method="method"/> 6477 <description> 6478 The class in which to set the breakpoint 6479 </description> 6480 </param> 6481 <param id="method"> 6482 <jmethodID class="klass"/> 6483 <description> 6484 The method in which to set the breakpoint 6485 </description> 6486 </param> 6487 <param id="location"> 6488 <jlocation/> 6489 <description> 6490 the index of the instruction at which to set the breakpoint 6491 6492 </description> 6493 </param> 6494 </parameters> 6495 <errors> 6496 <error id="JVMTI_ERROR_DUPLICATE"> 6497 The designated bytecode already has a breakpoint. 6498 </error> 6499 </errors> 6500 </function> 6501 6502 <function id="ClearBreakpoint" num="39"> 6503 <synopsis>Clear Breakpoint</synopsis> 6504 <description> 6505 Clear the breakpoint at the bytecode indicated by 6506 <code>method</code> and <code>location</code>. 6507 </description> 6508 <origin>jvmdi</origin> 6509 <capabilities> 6510 <required id="can_generate_breakpoint_events"></required> 6511 </capabilities> 6512 <parameters> 6513 <param id="klass"> 6514 <jclass method="method"/> 6515 <description> 6516 The class in which to clear the breakpoint 6517 </description> 6518 </param> 6519 <param id="method"> 6520 <jmethodID class="klass"/> 6521 <description> 6522 The method in which to clear the breakpoint 6523 </description> 6524 </param> 6525 <param id="location"> 6526 <jlocation/> 6527 <description> 6528 the index of the instruction at which to clear the breakpoint 6529 </description> 6530 </param> 6531 </parameters> 6532 <errors> 6533 <error id="JVMTI_ERROR_NOT_FOUND"> 6534 There's no breakpoint at the designated bytecode. 6535 </error> 6536 </errors> 6537 </function> 6538 6539 </category> 6540 6541 <category id="fieldWatch" label="Watched Field"> 6542 6543 <intro> 6544 </intro> 6545 6546 <function id="SetFieldAccessWatch" num="41"> 6547 <synopsis>Set Field Access Watch</synopsis> 6548 <description> 6549 Generate a <eventlink id="FieldAccess"></eventlink> event 6550 when the field specified 6551 by <code>klass</code> and 6552 <code>field</code> is about to be accessed. 6553 An event will be generated for each access of the field 6554 until it is canceled with 6555 <functionlink id="ClearFieldAccessWatch"></functionlink>. 6556 Field accesses from Java programming language code or from JNI code are watched, 6557 fields modified by other means are not watched. 6558 Note that <jvmti/> users should be aware that their own field accesses 6559 will trigger the watch. 6560 A field can only have one field access watch set. 6561 Modification of a field is not considered an access--use 6562 <functionlink id="SetFieldModificationWatch"></functionlink> 6563 to monitor modifications. 6564 </description> 6565 <origin>jvmdi</origin> 6566 <capabilities> 6567 <required id="can_generate_field_access_events"></required> 6568 </capabilities> 6569 <parameters> 6570 <param id="klass"> 6571 <jclass field="field"/> 6572 <description> 6573 The class containing the field to watch 6574 </description> 6575 </param> 6576 <param id="field"> 6577 <jfieldID class="klass"/> 6578 <description> 6579 The field to watch 6580 6581 </description> 6582 </param> 6583 </parameters> 6584 <errors> 6585 <error id="JVMTI_ERROR_DUPLICATE"> 6586 The designated field is already being watched for accesses. 6587 </error> 6588 </errors> 6589 </function> 6590 6591 <function id="ClearFieldAccessWatch" num="42"> 6592 <synopsis>Clear Field Access Watch</synopsis> 6593 <description> 6594 Cancel a field access watch previously set by 6595 <functionlink id="SetFieldAccessWatch"></functionlink>, on the 6596 field specified 6597 by <code>klass</code> and 6598 <code>field</code>. 6599 </description> 6600 <origin>jvmdi</origin> 6601 <capabilities> 6602 <required id="can_generate_field_access_events"></required> 6603 </capabilities> 6604 <parameters> 6605 <param id="klass"> 6606 <jclass field="field"/> 6607 <description> 6608 The class containing the field to watch 6609 </description> 6610 </param> 6611 <param id="field"> 6612 <jfieldID class="klass"/> 6613 <description> 6614 The field to watch 6615 6616 </description> 6617 </param> 6618 </parameters> 6619 <errors> 6620 <error id="JVMTI_ERROR_NOT_FOUND"> 6621 The designated field is not being watched for accesses. 6622 </error> 6623 </errors> 6624 </function> 6625 6626 <function id="SetFieldModificationWatch" num="43"> 6627 <synopsis>Set Field Modification Watch</synopsis> 6628 <description> 6629 Generate a <eventlink id="FieldModification"></eventlink> event 6630 when the field specified 6631 by <code>klass</code> and 6632 <code>field</code> is about to be modified. 6633 An event will be generated for each modification of the field 6634 until it is canceled with 6635 <functionlink id="ClearFieldModificationWatch"></functionlink>. 6636 Field modifications from Java programming language code or from JNI code are watched, 6637 fields modified by other means are not watched. 6638 Note that <jvmti/> users should be aware that their own field modifications 6639 will trigger the watch. 6640 A field can only have one field modification watch set. 6641 </description> 6642 <origin>jvmdi</origin> 6643 <capabilities> 6644 <required id="can_generate_field_modification_events"></required> 6645 </capabilities> 6646 <parameters> 6647 <param id="klass"> 6648 <jclass field="field"/> 6649 <description> 6650 The class containing the field to watch 6651 </description> 6652 </param> 6653 <param id="field"> 6654 <jfieldID class="klass"/> 6655 <description> 6656 The field to watch 6657 6658 </description> 6659 </param> 6660 </parameters> 6661 <errors> 6662 <error id="JVMTI_ERROR_DUPLICATE"> 6663 The designated field is already being watched for modifications. 6664 </error> 6665 </errors> 6666 </function> 6667 6668 <function id="ClearFieldModificationWatch" num="44"> 6669 <synopsis>Clear Field Modification Watch</synopsis> 6670 <description> 6671 6672 Cancel a field modification watch previously set by 6673 <functionlink id="SetFieldModificationWatch"></functionlink>, on the 6674 field specified 6675 by <code>klass</code> and 6676 <code>field</code>. 6677 </description> 6678 <origin>jvmdi</origin> 6679 <capabilities> 6680 <required id="can_generate_field_modification_events"></required> 6681 </capabilities> 6682 <parameters> 6683 <param id="klass"> 6684 <jclass field="field"/> 6685 <description> 6686 The class containing the field to watch 6687 </description> 6688 </param> 6689 <param id="field"> 6690 <jfieldID class="klass"/> 6691 <description> 6692 The field to watch 6693 6694 </description> 6695 </param> 6696 </parameters> 6697 <errors> 6698 <error id="JVMTI_ERROR_NOT_FOUND"> 6699 The designated field is not being watched for modifications. 6700 </error> 6701 </errors> 6702 </function> 6703 </category> 6704 6705 <category id="module" label="Module"> 6706 6707 <intro> 6708 </intro> 6709 6710 <function id="GetAllModules" num="3" since="9"> 6711 <synopsis>Get All Modules</synopsis> 6712 <description> 6713 Return an array of all modules loaded in the virtual machine. 6714 The array includes the unnamed module for each class loader. 6715 The number of modules in the array is returned via 6716 <code>module_count_ptr</code>, and the array itself via 6717 <code>modules_ptr</code>. 6718 <p/> 6719 </description> 6720 <origin>new</origin> 6721 <capabilities> 6722 </capabilities> 6723 <parameters> 6724 <param id="module_count_ptr"> 6725 <outptr><jint/></outptr> 6726 <description> 6727 On return, points to the number of returned modules. 6728 </description> 6729 </param> 6730 <param id="modules_ptr"> 6731 <allocbuf outcount="module_count_ptr"><jobject/></allocbuf> 6732 <description> 6733 On return, points to an array of references, one 6734 for each module. 6735 </description> 6736 </param> 6737 </parameters> 6738 <errors> 6739 </errors> 6740 </function> 6741 6742 <function id="GetNamedModule" num="40" since="9"> 6743 <synopsis>Get Named Module</synopsis> 6744 <description> 6745 Return the <code>java.lang.Module</code> object for a named 6746 module defined to a class loader that contains a given package. 6747 The module is returned via <code>module_ptr</code>. 6748 <p/> 6749 If a named module is defined to the class loader and it 6750 contains the package then that named module is returned, 6751 otherwise <code>NULL</code> is returned. 6752 <p/> 6753 </description> 6754 <origin>new</origin> 6755 <capabilities> 6756 </capabilities> 6757 <parameters> 6758 <param id="class_loader"> 6759 <ptrtype> 6760 <jobject/> 6761 <nullok>the bootstrap loader is assumed</nullok> 6762 </ptrtype> 6763 <description> 6764 A class loader. 6765 If the <code>class_loader</code> is not <code>NULL</code> 6766 or a subclass of <code>java.lang.ClassLoader</code> 6767 this function returns 6768 <errorlink id="JVMTI_ERROR_ILLEGAL_ARGUMENT"></errorlink>. 6769 </description> 6770 </param> 6771 <param id="package_name"> 6772 <inbuf><char/></inbuf> 6773 <description> 6774 The name of the package, encoded as a 6775 <internallink id="mUTF">modified UTF-8</internallink> string. 6776 The package name is in internal form (JVMS 4.2.1); 6777 identifiers are separated by forward slashes rather than periods. 6778 </description> 6779 </param> 6780 <param id="module_ptr"> 6781 <outptr><jobject/></outptr> 6782 <description> 6783 On return, points to a <code>java.lang.Module</code> object 6784 or points to <code>NULL</code>. 6785 </description> 6786 </param> 6787 </parameters> 6788 <errors> 6789 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 6790 If class loader is not <code>NULL</code> and is not a class loader object. 6791 </error> 6792 </errors> 6793 </function> 6794 6795 <function id="AddModuleReads" num="94" since="9"> 6796 <synopsis>Add Module Reads</synopsis> 6797 <description> 6798 Update a module to read another module. This function is a no-op 6799 when <paramlink id="module"></paramlink> is an unnamed module. 6800 This function facilitates the instrumentation of code 6801 in named modules where that instrumentation requires 6802 expanding the set of modules that a module reads. 6803 </description> 6804 <origin>new</origin> 6805 <capabilities> 6806 </capabilities> 6807 <parameters> 6808 <param id="module"> 6809 <ptrtype><jobject/></ptrtype> 6810 <description> 6811 The module to update. 6812 </description> 6813 </param> 6814 <param id="to_module"> 6815 <ptrtype><jobject/></ptrtype> 6816 <description> 6817 The additional module to read. 6818 </description> 6819 </param> 6820 </parameters> 6821 <errors> 6822 <error id="JVMTI_ERROR_INVALID_MODULE"> 6823 If <paramlink id="module"></paramlink> is not a module object. 6824 </error> 6825 <error id="JVMTI_ERROR_INVALID_MODULE"> 6826 If <paramlink id="to_module"></paramlink> is not a module object. 6827 </error> 6828 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE"> 6829 if the module cannot be modified. 6830 See <functionlink id="IsModifiableModule"/>. 6831 </error> 6832 </errors> 6833 </function> 6834 6835 <function id="AddModuleExports" num="95" since="9"> 6836 <synopsis>Add Module Exports</synopsis> 6837 <description> 6838 Update a module to export a package to another module. 6839 This function is a no-op when <paramlink id="module"></paramlink> 6840 is an unnamed module or an open module. 6841 This function facilitates the instrumentation of code 6842 in named modules where that instrumentation requires 6843 expanding the set of packages that a module exports. 6844 </description> 6845 <origin>new</origin> 6846 <capabilities> 6847 </capabilities> 6848 <parameters> 6849 <param id="module"> 6850 <ptrtype><jobject/></ptrtype> 6851 <description> 6852 The module to update. 6853 </description> 6854 </param> 6855 <param id="pkg_name"> 6856 <inbuf><char/></inbuf> 6857 <description> 6858 The exported package name. 6859 </description> 6860 </param> 6861 <param id="to_module"> 6862 <ptrtype><jobject/></ptrtype> 6863 <description> 6864 The module the package is exported to. 6865 If the <code>to_module</code> is not a subclass of 6866 <code>java.lang.Module</code> this function returns 6867 <errorlink id="JVMTI_ERROR_INVALID_MODULE"></errorlink>. 6868 </description> 6869 </param> 6870 </parameters> 6871 <errors> 6872 <error id="JVMTI_ERROR_INVALID_MODULE"> 6873 If <paramlink id="module"></paramlink> is not a module object. 6874 </error> 6875 <error id="JVMTI_ERROR_INVALID_MODULE"> 6876 If <paramlink id="to_module"></paramlink> is not a module object. 6877 </error> 6878 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 6879 If the package <paramlink id="pkg_name"></paramlink> 6880 does not belong to the module. 6881 </error> 6882 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE"> 6883 if the module cannot be modified. 6884 See <functionlink id="IsModifiableModule"/>. 6885 </error> 6886 </errors> 6887 </function> 6888 6889 <function id="AddModuleOpens" num="96" since="9"> 6890 <synopsis>Add Module Opens</synopsis> 6891 <description> 6892 Update a module to open a package to another module. 6893 This function is a no-op when <paramlink id="module"></paramlink> 6894 is an unnamed module or an open module. 6895 This function facilitates the instrumentation of code 6896 in modules where that instrumentation requires 6897 expanding the set of packages that a module opens to 6898 other modules. 6899 </description> 6900 <origin>new</origin> 6901 <capabilities> 6902 </capabilities> 6903 <parameters> 6904 <param id="module"> 6905 <ptrtype><jobject/></ptrtype> 6906 <description> 6907 The module to update. 6908 </description> 6909 </param> 6910 <param id="pkg_name"> 6911 <inbuf><char/></inbuf> 6912 <description> 6913 The package name of the package to open. 6914 </description> 6915 </param> 6916 <param id="to_module"> 6917 <ptrtype><jobject/></ptrtype> 6918 <description> 6919 The module with the package to open. 6920 If the <code>to_module</code> is not a subclass of 6921 <code>java.lang.Module</code> this function returns 6922 <errorlink id="JVMTI_ERROR_INVALID_MODULE"></errorlink>. 6923 </description> 6924 </param> 6925 </parameters> 6926 <errors> 6927 <error id="JVMTI_ERROR_INVALID_MODULE"> 6928 If <paramlink id="module"></paramlink> is not a module object. 6929 </error> 6930 <error id="JVMTI_ERROR_INVALID_MODULE"> 6931 If <paramlink id="to_module"></paramlink> is not a module object. 6932 </error> 6933 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 6934 If the package <paramlink id="pkg_name"></paramlink> 6935 does not belong to the module. 6936 </error> 6937 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE"> 6938 if the module cannot be modified. 6939 See <functionlink id="IsModifiableModule"/>. 6940 </error> 6941 </errors> 6942 </function> 6943 6944 <function id="AddModuleUses" num="97" since="9"> 6945 <synopsis>Add Module Uses</synopsis> 6946 <description> 6947 Updates a module to add a service to the set of services that 6948 a module uses. This function is a no-op when the module 6949 is an unnamed module. 6950 This function facilitates the instrumentation of code 6951 in named modules where that instrumentation requires 6952 expanding the set of services that a module is using. 6953 </description> 6954 <origin>new</origin> 6955 <capabilities> 6956 </capabilities> 6957 <parameters> 6958 <param id="module"> 6959 <ptrtype><jobject/></ptrtype> 6960 <description> 6961 The module to update. 6962 </description> 6963 </param> 6964 <param id="service"> 6965 <ptrtype><jclass/></ptrtype> 6966 <description> 6967 The service to use. 6968 </description> 6969 </param> 6970 </parameters> 6971 <errors> 6972 <error id="JVMTI_ERROR_INVALID_MODULE"> 6973 If <paramlink id="module"></paramlink> is not a module object. 6974 </error> 6975 <error id="JVMTI_ERROR_INVALID_CLASS"> 6976 If <paramlink id="service"></paramlink> is not a class object. 6977 </error> 6978 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE"> 6979 if the module cannot be modified. 6980 See <functionlink id="IsModifiableModule"/>. 6981 </error> 6982 </errors> 6983 </function> 6984 6985 <function id="AddModuleProvides" num="98" since="9"> 6986 <synopsis>Add Module Provides</synopsis> 6987 <description> 6988 Updates a module to add a service to the set of services that 6989 a module provides. This function is a no-op when the module 6990 is an unnamed module. 6991 This function facilitates the instrumentation of code 6992 in named modules where that instrumentation requires 6993 changes to the services that are provided. 6994 </description> 6995 <origin>new</origin> 6996 <capabilities> 6997 </capabilities> 6998 <parameters> 6999 <param id="module"> 7000 <ptrtype><jobject/></ptrtype> 7001 <description> 7002 The module to update. 7003 </description> 7004 </param> 7005 <param id="service"> 7006 <ptrtype><jclass/></ptrtype> 7007 <description> 7008 The service to provide. 7009 </description> 7010 </param> 7011 <param id="impl_class"> 7012 <ptrtype><jclass/></ptrtype> 7013 <description> 7014 The implementation class for the provided service. 7015 </description> 7016 </param> 7017 </parameters> 7018 <errors> 7019 <error id="JVMTI_ERROR_INVALID_MODULE"> 7020 If <paramlink id="module"></paramlink> is not a module object. 7021 </error> 7022 <error id="JVMTI_ERROR_INVALID_CLASS"> 7023 If <paramlink id="service"></paramlink> is not a class object. 7024 </error> 7025 <error id="JVMTI_ERROR_INVALID_CLASS"> 7026 If <paramlink id="impl_class"></paramlink> is not a class object. 7027 </error> 7028 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE"> 7029 if the module cannot be modified. 7030 See <functionlink id="IsModifiableModule"/>. 7031 </error> 7032 </errors> 7033 </function> 7034 7035 <function id="IsModifiableModule" num="99" since="9"> 7036 <synopsis>Is Modifiable Module</synopsis> 7037 <description> 7038 Determines whether a module is modifiable. 7039 If a module is modifiable then this module can be updated with 7040 <functionlink id="AddModuleReads"/>, <functionlink id="AddModuleExports"/>, 7041 <functionlink id="AddModuleOpens"/>, <functionlink id="AddModuleUses"/>, 7042 and <functionlink id="AddModuleProvides"/>. If a module is not modifiable 7043 then the module can not be updated with these functions. The result of 7044 this function is always <code>JNI_TRUE</code> when called to determine 7045 if an unnamed module is modifiable. 7046 </description> 7047 <origin>new</origin> 7048 <capabilities> 7049 </capabilities> 7050 <parameters> 7051 <param id="module"> 7052 <ptrtype><jobject/></ptrtype> 7053 <description> 7054 The module to query. 7055 </description> 7056 </param> 7057 <param id="is_modifiable_module_ptr"> 7058 <outptr><jboolean/></outptr> 7059 <description> 7060 On return, points to the boolean result of this function. 7061 </description> 7062 </param> 7063 </parameters> 7064 <errors> 7065 <error id="JVMTI_ERROR_INVALID_MODULE"> 7066 If <paramlink id="module"></paramlink> is not a module object. 7067 </error> 7068 </errors> 7069 </function> 7070 7071 </category> 7072 7073 <category id="class" label="Class"> 7074 <function id="GetLoadedClasses" jkernel="yes" num="78"> 7075 <synopsis>Get Loaded Classes</synopsis> 7076 <description> 7077 Return an array of all classes loaded in the virtual machine. 7078 The number of classes in the array is returned via 7079 <code>class_count_ptr</code>, and the array itself via 7080 <code>classes_ptr</code>. 7081 <p/> 7082 A class or interface creation can be triggered by one of the following: 7083 <ul> 7084 <li>By loading and deriving a class from a <code>class</code> file representation 7085 using a class loader (see <vmspec chapter="5.3"/>).</li> 7086 <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> 7087 that creates a hidden class or interface from a <code>class</code> file representation.</li> 7088 <li>By invoking methods in certain Java SE Platform APIs such as reflection.</li> 7089 </ul> 7090 <p/> 7091 An array class is created directly by the Java virtual machine. The creation 7092 can be triggered by using class loaders or by invoking methods in certain 7093 Java SE Platform APIs such as reflection. 7094 <p/> 7095 The returned list includes all classes and interfaces, including 7096 <externallink id="../api/java.base/java/lang/Class.html#isHidden()"> 7097 hidden classes or interfaces</externallink>, 7098 and also array classes of all types 7099 (including arrays of primitive types). 7100 Primitive classes (for example, <code>java.lang.Integer.TYPE</code>) are 7101 <i>not</i> included in the returned list. 7102 </description> 7103 <origin>jvmdi</origin> 7104 <capabilities> 7105 </capabilities> 7106 <parameters> 7107 <param id="class_count_ptr"> 7108 <outptr><jint/></outptr> 7109 <description> 7110 On return, points to the number of classes. 7111 </description> 7112 </param> 7113 <param id="classes_ptr"> 7114 <allocbuf outcount="class_count_ptr"><jclass/></allocbuf> 7115 <description> 7116 On return, points to an array of references, one 7117 for each class. 7118 </description> 7119 </param> 7120 </parameters> 7121 <errors> 7122 </errors> 7123 </function> 7124 7125 <function id="GetClassLoaderClasses" jkernel="yes" num="79"> 7126 <synopsis>Get Classloader Classes</synopsis> 7127 <description> 7128 Returns an array of all classes which this class loader 7129 can find by name via 7130 <externallink id="../api/java.base/java/lang/ClassLoader.html#loadClass(java.lang.String,boolean)">ClassLoader::loadClass</externallink>, 7131 <externallink id="../api/java.base/java/lang/Class.html#forName(java.lang.String,boolean,java.lang.ClassLoader)">Class::forName</externallink> and bytecode linkage. 7132 That is, all classes for which <code>initiating_loader</code> 7133 has been recorded as an initiating loader. 7134 Each class in the returned array was created by this class loader, 7135 either by defining it directly or by delegation to another class loader. 7136 See <vmspec chapter="5.3"/>. 7137 <p/> 7138 The returned list does not include 7139 <externallink id="../api/java.base/java/lang/Class.html#isHidden()">hidden 7140 classes or interfaces</externallink> or array classes whose 7141 element type is a hidden class or interface as they cannot be discovered 7142 by any class loader. 7143 <p/> 7144 The number of classes in the array is returned via 7145 <code>class_count_ptr</code>, and the array itself via 7146 <code>classes_ptr</code>. 7147 <p/> 7148 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>. 7149 </description> 7150 <origin>jvmdi</origin> 7151 <capabilities> 7152 </capabilities> 7153 <parameters> 7154 <param id="initiating_loader"> 7155 <ptrtype> 7156 <jobject/> 7157 <nullok>the classes initiated by the bootstrap loader will be returned</nullok> 7158 </ptrtype> 7159 <description> 7160 An initiating class loader. 7161 </description> 7162 </param> 7163 <param id="class_count_ptr"> 7164 <outptr><jint/></outptr> 7165 <description> 7166 On return, points to the number of classes. 7167 </description> 7168 </param> 7169 <param id="classes_ptr"> 7170 <allocbuf outcount="class_count_ptr"><jclass/></allocbuf> 7171 <description> 7172 On return, points to an array of references, one 7173 for each class. 7174 </description> 7175 </param> 7176 </parameters> 7177 <errors> 7178 </errors> 7179 </function> 7180 7181 <function id="GetClassSignature" phase="start" num="48"> 7182 <synopsis>Get Class Signature</synopsis> 7183 <description> 7184 Return the name and the generic signature of the class indicated by <code>klass</code>. 7185 <p/> 7186 If the class is a class or interface, then: 7187 <ul> 7188 <li>If the class or interface is not <externallink id="../api/java.base/java/lang/Class.html#isHidden()">hidden</externallink>, 7189 then the returned name is the <externallink id="jni/types.html#type-signatures"> 7190 JNI type signature</externallink>. 7191 For example, java.util.List is "Ljava/util/List;" 7192 </li> 7193 <li>If the class or interface is <externallink id="../api/java.base/java/lang/Class.html#isHidden()">hidden</externallink>, 7194 then the returned name is a string of the form: 7195 <code>"L" + N + "." + S + ";"</code> 7196 where <code>N</code> is the binary name encoded in internal form (JVMS 4.2.1) 7197 indicated by the <code>class</code> file passed to 7198 <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>, 7199 and <code>S</code> is an unqualified name. 7200 The returned name is not a type descriptor and does not conform to JVMS 4.3.2. 7201 For example, com.foo.Foo/AnySuffix is "Lcom/foo/Foo.AnySuffix;" 7202 </li> 7203 </ul> 7204 <p/> 7205 If the class indicated by <code>klass</code> represents an array class, then 7206 the returned name is a string consisting of one or more "<code>[</code>" characters 7207 representing the depth of the array nesting, followed by the class signature 7208 of the element type. For example the class signature of java.lang.String[] is 7209 "[Ljava/lang/String;" and that of int[] is "[I". 7210 <p/> 7211 If the class indicated by <code>klass</code> represents primitive type or <code>void</code>, 7212 then the returned name is the <externallink id="jni/types.html#type-signatures"> 7213 type signature character of the corresponding primitive type</externallink>. 7214 For example, java.lang.Integer.TYPE is "I". 7215 </description> 7216 <origin>jvmdiClone</origin> 7217 <capabilities> 7218 </capabilities> 7219 <parameters> 7220 <param id="klass"> 7221 <jclass/> 7222 <description> 7223 The class to query. 7224 </description> 7225 </param> 7226 <param id="signature_ptr"> 7227 <allocbuf> 7228 <char/> 7229 <nullok>the signature is not returned</nullok> 7230 </allocbuf> 7231 <description> 7232 On return, points to the JNI type signature of the class, encoded as a 7233 <internallink id="mUTF">modified UTF-8</internallink> string. 7234 </description> 7235 </param> 7236 <param id="generic_ptr"> 7237 <allocbuf> 7238 <char/> 7239 <nullok>the generic signature is not returned</nullok> 7240 </allocbuf> 7241 <description> 7242 On return, points to the generic signature of the class, encoded as a 7243 <internallink id="mUTF">modified UTF-8</internallink> string. 7244 If there is no generic signature attribute for the class, then, 7245 on return, points to <code>NULL</code>. 7246 </description> 7247 </param> 7248 </parameters> 7249 <errors> 7250 </errors> 7251 </function> 7252 7253 <function id="GetClassStatus" phase="start" num="49"> 7254 <synopsis>Get Class Status</synopsis> 7255 <description> 7256 Get the status of the class. Zero or more of the following bits can be 7257 set. 7258 <constants id="jvmtiClassStatus" label="Class Status Flags" kind="bits"> 7259 <constant id="JVMTI_CLASS_STATUS_VERIFIED" num="1"> 7260 Class bytecodes have been verified 7261 </constant> 7262 <constant id="JVMTI_CLASS_STATUS_PREPARED" num="2"> 7263 Class preparation is complete 7264 </constant> 7265 <constant id="JVMTI_CLASS_STATUS_INITIALIZED" num="4"> 7266 Class initialization is complete. Static initializer has been run. 7267 </constant> 7268 <constant id="JVMTI_CLASS_STATUS_ERROR" num="8"> 7269 Error during initialization makes class unusable 7270 </constant> 7271 <constant id="JVMTI_CLASS_STATUS_ARRAY" num="16"> 7272 Class is an array. If set, all other bits are zero. 7273 </constant> 7274 <constant id="JVMTI_CLASS_STATUS_PRIMITIVE" num="32"> 7275 Class is a primitive class (for example, <code>java.lang.Integer.TYPE</code>). 7276 If set, all other bits are zero. 7277 </constant> 7278 </constants> 7279 </description> 7280 <origin>jvmdi</origin> 7281 <capabilities> 7282 </capabilities> 7283 <parameters> 7284 <param id="klass"> 7285 <jclass/> 7286 <description> 7287 The class to query. 7288 </description> 7289 </param> 7290 <param id="status_ptr"> 7291 <outptr><jint/></outptr> 7292 <description> 7293 On return, points to the current state of this class as one or 7294 more of the <internallink id="jvmtiClassStatus">class status flags</internallink>. 7295 </description> 7296 </param> 7297 </parameters> 7298 <errors> 7299 </errors> 7300 </function> 7301 7302 <function id="GetSourceFileName" phase="start" num="50"> 7303 <synopsis>Get Source File Name</synopsis> 7304 <description> 7305 For the class indicated by <code>klass</code>, return the source file 7306 name via <code>source_name_ptr</code>. The returned string 7307 is a file name only and never contains a directory name. 7308 <p/> 7309 For primitive classes (for example, <code>java.lang.Integer.TYPE</code>) 7310 and for arrays this function returns 7311 <errorlink id="JVMTI_ERROR_ABSENT_INFORMATION"></errorlink>. 7312 </description> 7313 <origin>jvmdi</origin> 7314 <capabilities> 7315 <required id="can_get_source_file_name"></required> 7316 </capabilities> 7317 <parameters> 7318 <param id="klass"> 7319 <jclass/> 7320 <description> 7321 The class to query. 7322 </description> 7323 </param> 7324 <param id="source_name_ptr"> 7325 <allocbuf><char/></allocbuf> 7326 <description> 7327 On return, points to the class's source file name, encoded as a 7328 <internallink id="mUTF">modified UTF-8</internallink> string. 7329 </description> 7330 </param> 7331 </parameters> 7332 <errors> 7333 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 7334 Class information does not include a source file name. This includes 7335 cases where the class is an array class or primitive class. 7336 </error> 7337 </errors> 7338 </function> 7339 7340 <function id="GetClassModifiers" phase="start" num="51"> 7341 <synopsis>Get Class Modifiers</synopsis> 7342 <description> 7343 For the class indicated by <code>klass</code>, return the access 7344 flags 7345 via <code>modifiers_ptr</code>. 7346 Access flags are defined in <vmspec chapter="4"/>. 7347 <p/> 7348 If the class is an array class, then its public, private, and protected 7349 modifiers are the same as those of its component type. For arrays of 7350 primitives, this component type is represented by one of the primitive 7351 classes (for example, <code>java.lang.Integer.TYPE</code>). 7352 <p/> 7353 If the class is a primitive class, its public modifier is always true, 7354 and its protected and private modifiers are always false. 7355 <p/> 7356 If the class is an array class or a primitive class then its final 7357 modifier is always true and its interface modifier is always false. 7358 The values of its other modifiers are not determined by this specification. 7359 7360 </description> 7361 <origin>jvmdi</origin> 7362 <capabilities> 7363 </capabilities> 7364 <parameters> 7365 <param id="klass"> 7366 <jclass/> 7367 <description> 7368 The class to query. 7369 </description> 7370 </param> 7371 <param id="modifiers_ptr"> 7372 <outptr><jint/></outptr> 7373 <description> 7374 On return, points to the current access flags of this class. 7375 7376 </description> 7377 </param> 7378 </parameters> 7379 <errors> 7380 </errors> 7381 </function> 7382 7383 <function id="GetClassMethods" phase="start" num="52"> 7384 <synopsis>Get Class Methods</synopsis> 7385 <description> 7386 For the class indicated by <code>klass</code>, return a count of 7387 methods via <code>method_count_ptr</code> and a list of 7388 method IDs via <code>methods_ptr</code>. The method list contains 7389 constructors and static initializers as well as true methods. 7390 Only directly declared methods are returned (not inherited methods). 7391 An empty method list is returned for array classes and primitive classes 7392 (for example, <code>java.lang.Integer.TYPE</code>). 7393 </description> 7394 <origin>jvmdi</origin> 7395 <capabilities> 7396 <capability id="can_maintain_original_method_order"/> 7397 </capabilities> 7398 <parameters> 7399 <param id="klass"> 7400 <jclass/> 7401 <description> 7402 The class to query. 7403 </description> 7404 </param> 7405 <param id="method_count_ptr"> 7406 <outptr><jint/></outptr> 7407 <description> 7408 On return, points to the number of methods declared in this class. 7409 </description> 7410 </param> 7411 <param id="methods_ptr"> 7412 <allocbuf outcount="method_count_ptr"><jmethodID class="klass"/></allocbuf> 7413 <description> 7414 On return, points to the method ID array. 7415 </description> 7416 </param> 7417 </parameters> 7418 <errors> 7419 <error id="JVMTI_ERROR_CLASS_NOT_PREPARED"> 7420 <paramlink id="klass"></paramlink> is not prepared. 7421 </error> 7422 </errors> 7423 </function> 7424 7425 <function id="GetClassFields" phase="start" num="53"> 7426 <synopsis>Get Class Fields</synopsis> 7427 <description> 7428 For the class indicated by <code>klass</code>, return a count of fields 7429 via <code>field_count_ptr</code> and a list of field IDs via 7430 <code>fields_ptr</code>. 7431 Only directly declared fields are returned (not inherited fields). 7432 Fields are returned in the order they occur in the class file. 7433 An empty field list is returned for array classes and primitive classes 7434 (for example, <code>java.lang.Integer.TYPE</code>). 7435 Use JNI to determine the length of an array. 7436 </description> 7437 <origin>jvmdi</origin> 7438 <capabilities> 7439 </capabilities> 7440 <parameters> 7441 <param id="klass"> 7442 <jclass/> 7443 <description> 7444 The class to query. 7445 </description> 7446 </param> 7447 <param id="field_count_ptr"> 7448 <outptr><jint/></outptr> 7449 <description> 7450 On return, points to the number of fields declared in this class. 7451 </description> 7452 </param> 7453 <param id="fields_ptr"> 7454 <allocbuf outcount="field_count_ptr"><jfieldID/></allocbuf> 7455 <description> 7456 On return, points to the field ID array. 7457 </description> 7458 </param> 7459 </parameters> 7460 <errors> 7461 <error id="JVMTI_ERROR_CLASS_NOT_PREPARED"> 7462 <paramlink id="klass"></paramlink> is not prepared. 7463 </error> 7464 </errors> 7465 </function> 7466 7467 <function id="GetImplementedInterfaces" phase="start" num="54"> 7468 <synopsis>Get Implemented Interfaces</synopsis> 7469 <description> 7470 Return the direct super-interfaces of this class. For a class, this 7471 function returns the interfaces declared in its <code>implements</code> 7472 clause. For an interface, this function returns the interfaces declared in 7473 its <code>extends</code> clause. 7474 An empty interface list is returned for array classes and primitive classes 7475 (for example, <code>java.lang.Integer.TYPE</code>). 7476 </description> 7477 <origin>jvmdi</origin> 7478 <capabilities> 7479 </capabilities> 7480 <parameters> 7481 <param id="klass"> 7482 <jclass/> 7483 <description> 7484 The class to query. 7485 </description> 7486 </param> 7487 <param id="interface_count_ptr"> 7488 <outptr><jint/></outptr> 7489 <description> 7490 On return, points to the number of interfaces. 7491 </description> 7492 </param> 7493 <param id="interfaces_ptr"> 7494 <allocbuf outcount="interface_count_ptr"><jclass/></allocbuf> 7495 <description> 7496 On return, points to the interface array. 7497 </description> 7498 </param> 7499 </parameters> 7500 <errors> 7501 <error id="JVMTI_ERROR_CLASS_NOT_PREPARED"> 7502 <paramlink id="klass"></paramlink> is not prepared. 7503 </error> 7504 </errors> 7505 </function> 7506 7507 <function id="GetClassVersionNumbers" phase="start" num="145" since="1.1"> 7508 <synopsis>Get Class Version Numbers</synopsis> 7509 <description> 7510 For the class indicated by <code>klass</code>, 7511 return the minor and major version numbers, 7512 as defined in 7513 <vmspec chapter="4"/>. 7514 </description> 7515 <origin>new</origin> 7516 <capabilities> 7517 </capabilities> 7518 <parameters> 7519 <param id="klass"> 7520 <jclass/> 7521 <description> 7522 The class to query. 7523 </description> 7524 </param> 7525 <param id="minor_version_ptr"> 7526 <outptr><jint/></outptr> 7527 <description> 7528 On return, points to the value of the 7529 <code>minor_version</code> item of the 7530 Class File Format. 7531 Note: to be consistent with the Class File Format, 7532 the minor version number is the first parameter. 7533 </description> 7534 </param> 7535 <param id="major_version_ptr"> 7536 <outptr><jint/></outptr> 7537 <description> 7538 On return, points to the value of the 7539 <code>major_version</code> item of the 7540 Class File Format. 7541 </description> 7542 </param> 7543 </parameters> 7544 <errors> 7545 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 7546 The class is a primitive or array class. 7547 </error> 7548 </errors> 7549 </function> 7550 7551 <function id="GetConstantPool" phase="start" num="146" since="1.1"> 7552 <synopsis>Get Constant Pool</synopsis> 7553 <description> 7554 For the class indicated by <code>klass</code>, 7555 return the raw bytes of the constant pool in the format of the 7556 <code>constant_pool</code> item of 7557 <vmspec chapter="4"/>. 7558 The format of the constant pool may differ between versions 7559 of the Class File Format, so, the 7560 <functionlink id="GetClassVersionNumbers">minor and major 7561 class version numbers</functionlink> should be checked for 7562 compatibility. 7563 <p/> 7564 The returned constant pool might not have the same layout or 7565 contents as the constant pool in the defining class file. 7566 The constant pool returned by GetConstantPool() may have 7567 more or fewer entries than the defining constant pool. 7568 Entries may be in a different order. 7569 The constant pool returned by GetConstantPool() will match the 7570 constant pool used by 7571 <functionlink id="GetBytecodes">GetBytecodes()</functionlink>. 7572 That is, the bytecodes returned by GetBytecodes() will have 7573 constant pool indices which refer to constant pool entries returned 7574 by GetConstantPool(). 7575 Note that since <functionlink id="RetransformClasses"/> 7576 and <functionlink id="RedefineClasses"/> can change 7577 the constant pool, the constant pool returned by this function 7578 can change accordingly. Thus, the correspondence between 7579 GetConstantPool() and GetBytecodes() does not hold if there 7580 is an intervening class retransformation or redefinition. 7581 The value of a constant pool entry used by a given bytecode will 7582 match that of the defining class file (even if the indices don't match). 7583 Constant pool entries which are not used directly or indirectly by 7584 bytecodes (for example, UTF-8 strings associated with annotations) are 7585 not required to exist in the returned constant pool. 7586 </description> 7587 <origin>new</origin> 7588 <capabilities> 7589 <required id="can_get_constant_pool"></required> 7590 </capabilities> 7591 <parameters> 7592 <param id="klass"> 7593 <jclass/> 7594 <description> 7595 The class to query. 7596 </description> 7597 </param> 7598 <param id="constant_pool_count_ptr"> 7599 <outptr><jint/></outptr> 7600 <description> 7601 On return, points to the number of entries 7602 in the constant pool table plus one. 7603 This corresponds to the <code>constant_pool_count</code> 7604 item of the Class File Format. 7605 </description> 7606 </param> 7607 <param id="constant_pool_byte_count_ptr"> 7608 <outptr><jint/></outptr> 7609 <description> 7610 On return, points to the number of bytes 7611 in the returned raw constant pool. 7612 </description> 7613 </param> 7614 <param id="constant_pool_bytes_ptr"> 7615 <allocbuf outcount="constant_pool_byte_count_ptr"><uchar/></allocbuf> 7616 <description> 7617 On return, points to the raw constant pool, that is the bytes 7618 defined by the <code>constant_pool</code> item of the 7619 Class File Format 7620 </description> 7621 </param> 7622 </parameters> 7623 <errors> 7624 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 7625 The class is a primitive or array class. 7626 </error> 7627 </errors> 7628 </function> 7629 7630 <function id="IsInterface" phase="start" num="55"> 7631 <synopsis>Is Interface</synopsis> 7632 <description> 7633 Determines whether a class object reference represents an interface. 7634 The <code>jboolean</code> result is 7635 <code>JNI_TRUE</code> if the "class" is actually an interface, 7636 <code>JNI_FALSE</code> otherwise. 7637 </description> 7638 <origin>jvmdi</origin> 7639 <capabilities> 7640 </capabilities> 7641 <parameters> 7642 <param id="klass"> 7643 <jclass/> 7644 <description> 7645 The class to query. 7646 </description> 7647 </param> 7648 <param id="is_interface_ptr"> 7649 <outptr><jboolean/></outptr> 7650 <description> 7651 On return, points to the boolean result of this function. 7652 7653 </description> 7654 </param> 7655 </parameters> 7656 <errors> 7657 </errors> 7658 </function> 7659 7660 <function id="IsArrayClass" phase="start" num="56"> 7661 <synopsis>Is Array Class</synopsis> 7662 <description> 7663 Determines whether a class object reference represents an array. 7664 The <code>jboolean</code> result is 7665 <code>JNI_TRUE</code> if the class is an array, 7666 <code>JNI_FALSE</code> otherwise. 7667 </description> 7668 <origin>jvmdi</origin> 7669 <capabilities> 7670 </capabilities> 7671 <parameters> 7672 <param id="klass"> 7673 <jclass/> 7674 <description> 7675 The class to query. 7676 </description> 7677 </param> 7678 <param id="is_array_class_ptr"> 7679 <outptr><jboolean/></outptr> 7680 <description> 7681 On return, points to the boolean result of this function. 7682 7683 </description> 7684 </param> 7685 </parameters> 7686 <errors> 7687 </errors> 7688 </function> 7689 7690 <function id="IsModifiableClass" jkernel="yes" phase="start" num="45" since="1.1"> 7691 <synopsis>Is Modifiable Class</synopsis> 7692 <description> 7693 Determines whether a class is modifiable. 7694 If a class is modifiable (<paramlink id="is_modifiable_class_ptr"/> 7695 returns <code>JNI_TRUE</code>) the class can be 7696 redefined with <functionlink id="RedefineClasses"/> (assuming 7697 the agent possesses the 7698 <fieldlink id="can_redefine_classes" struct="jvmtiCapabilities"/> 7699 capability) or 7700 retransformed with <functionlink id="RetransformClasses"/> (assuming 7701 the agent possesses the 7702 <fieldlink id="can_retransform_classes" struct="jvmtiCapabilities"/> 7703 capability). 7704 If a class is not modifiable (<paramlink id="is_modifiable_class_ptr"/> 7705 returns <code>JNI_FALSE</code>) the class can be neither 7706 redefined nor retransformed. 7707 <p/> 7708 Primitive classes (for example, <code>java.lang.Integer.TYPE</code>), 7709 array classes, and some implementation defined classes are never modifiable. 7710 <p/> 7711 </description> 7712 <origin>new</origin> 7713 <capabilities> 7714 <capability id="can_redefine_any_class"> 7715 If possessed then all classes (except primitive, array, and some implementation defined 7716 classes) are modifiable with <functionlink id="RedefineClasses"/>. 7717 </capability> 7718 <capability id="can_retransform_any_class"> 7719 If possessed then all classes (except primitive, array, and some implementation defined 7720 classes) are modifiable with <functionlink id="RetransformClasses"/>. 7721 </capability> 7722 <capability id="can_redefine_classes"> 7723 No effect on the result of the function. 7724 But must additionally be possessed to modify the class with 7725 <functionlink id="RedefineClasses"/>. 7726 </capability> 7727 <capability id="can_retransform_classes"> 7728 No effect on the result of the function. 7729 But must additionally be possessed to modify the class with 7730 <functionlink id="RetransformClasses"/>. 7731 </capability> 7732 </capabilities> 7733 <parameters> 7734 <param id="klass"> 7735 <jclass/> 7736 <description> 7737 The class to query. 7738 </description> 7739 </param> 7740 <param id="is_modifiable_class_ptr"> 7741 <outptr><jboolean/></outptr> 7742 <description> 7743 On return, points to the boolean result of this function. 7744 </description> 7745 </param> 7746 </parameters> 7747 <errors> 7748 </errors> 7749 </function> 7750 7751 <function id="GetClassLoader" phase="start" num="57"> 7752 <synopsis>Get Class Loader</synopsis> 7753 <description> 7754 For the class indicated by <code>klass</code>, return via 7755 <code>classloader_ptr</code> a reference to the class loader for the 7756 class. 7757 </description> 7758 <origin>jvmdi</origin> 7759 <capabilities> 7760 </capabilities> 7761 <parameters> 7762 <param id="klass"> 7763 <jclass/> 7764 <description> 7765 The class to query. 7766 </description> 7767 </param> 7768 <param id="classloader_ptr"> 7769 <outptr><jobject/></outptr> 7770 <description> 7771 On return, points to the class loader that loaded 7772 this class. 7773 If the class was not created by a class loader 7774 or if the class loader is the bootstrap class loader, 7775 points to <code>NULL</code>. 7776 </description> 7777 </param> 7778 </parameters> 7779 <errors> 7780 </errors> 7781 7782 </function> 7783 7784 <function id="GetSourceDebugExtension" phase="start" num="90"> 7785 <synopsis>Get Source Debug Extension</synopsis> 7786 <description> 7787 For the class indicated by <code>klass</code>, return the debug 7788 extension via <code>source_debug_extension_ptr</code>. 7789 The returned string 7790 contains exactly the debug extension information present in the 7791 class file of <code>klass</code>. 7792 </description> 7793 <origin>jvmdi</origin> 7794 <capabilities> 7795 <required id="can_get_source_debug_extension"></required> 7796 </capabilities> 7797 <parameters> 7798 <param id="klass"> 7799 <jclass/> 7800 <description> 7801 The class to query. 7802 </description> 7803 </param> 7804 <param id="source_debug_extension_ptr"> 7805 <allocbuf><char/></allocbuf> 7806 <description> 7807 On return, points to the class's debug extension, encoded as a 7808 <internallink id="mUTF">modified UTF-8</internallink> string. 7809 </description> 7810 </param> 7811 </parameters> 7812 <errors> 7813 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 7814 Class information does not include a debug extension. 7815 </error> 7816 </errors> 7817 </function> 7818 7819 <function id="RetransformClasses" jkernel="yes" num="152" since="1.1"> 7820 <synopsis>Retransform Classes</synopsis> 7821 <description> 7822 This function facilitates the 7823 <internallink id="bci">bytecode instrumentation</internallink> 7824 of already loaded classes. 7825 To replace the class definition without reference to the existing 7826 bytecodes, as one might do when recompiling from source for 7827 fix-and-continue debugging, <functionlink id="RedefineClasses"/> 7828 function should be used instead. 7829 <p/> 7830 When classes are initially loaded or when they are 7831 <functionlink id="RedefineClasses">redefined</functionlink>, 7832 the initial class file bytes can be transformed with the 7833 <eventlink id="ClassFileLoadHook"/> event. 7834 This function reruns the transformation process 7835 (whether or not a transformation has previously occurred). 7836 This retransformation follows these steps: 7837 <ul> 7838 <li>starting from the initial class file bytes 7839 </li> 7840 <li>for each <fieldlink id="can_retransform_classes" 7841 struct="jvmtiCapabilities">retransformation 7842 incapable</fieldlink> 7843 agent which received a 7844 <code>ClassFileLoadHook</code> event during the previous 7845 load or redefine, the bytes it returned 7846 (via the <code>new_class_data</code> parameter) 7847 are reused as the output of the transformation; 7848 note that this is equivalent to reapplying 7849 the previous transformation, unaltered. except that 7850 the <code>ClassFileLoadHook</code> event 7851 is <b>not</b> sent to these agents 7852 </li> 7853 <li>for each <fieldlink id="can_retransform_classes" 7854 struct="jvmtiCapabilities">retransformation 7855 capable</fieldlink> 7856 agent, the <code>ClassFileLoadHook</code> event is sent, 7857 allowing a new transformation to be applied 7858 </li> 7859 <li>the transformed class file bytes are installed as the new 7860 definition of the class 7861 </li> 7862 </ul> 7863 See the <eventlink id="ClassFileLoadHook"/> event for more details. 7864 <p/> 7865 The initial class file bytes represent the bytes passed to 7866 <code>ClassLoader.defineClass</code> 7867 or <code>RedefineClasses</code> (before any transformations 7868 were applied), however they may not exactly match them. 7869 The constant pool may differ in ways described in 7870 <functionlink id="GetConstantPool"/>. 7871 Constant pool indices in the bytecodes of methods will correspond. 7872 Some attributes may not be present. 7873 Where order is not meaningful, for example the order of methods, 7874 order may not be preserved. 7875 <p/> 7876 Retransformation can cause new versions of methods to be installed. 7877 Old method versions may become 7878 <internallink id="obsoleteMethods">obsolete</internallink> 7879 The new method version will be used on new invokes. 7880 If a method has active stack frames, those active frames continue to 7881 run the bytecodes of the original method version. 7882 <p/> 7883 This function does not cause any initialization except that which 7884 would occur under the customary JVM semantics. 7885 In other words, retransforming a class does not cause its initializers to be 7886 run. The values of static fields will remain as they were 7887 prior to the call. 7888 <p/> 7889 Threads need not be suspended. 7890 <p/> 7891 All breakpoints in the class are cleared. 7892 <p/> 7893 All attributes are updated. 7894 <p/> 7895 Instances of the retransformed class are not affected -- fields retain their 7896 previous values. 7897 <functionlink id="GetTag">Tags</functionlink> on the instances are 7898 also unaffected. 7899 <p/> 7900 In response to this call, no events other than the 7901 <eventlink id="ClassFileLoadHook"/> event 7902 will be sent. 7903 <p/> 7904 The retransformation may change method bodies, the constant pool and attributes 7905 (unless explicitly prohibited). 7906 The retransformation must not add, remove or rename fields or methods, change the 7907 signatures of methods, change modifiers, or change inheritance. 7908 The retransformation must not change the <code>NestHost</code>, 7909 <code>NestMembers</code>, <code>Record</code>, or <code>PermittedSubclasses</code> 7910 attributes. 7911 These restrictions may be lifted in future versions. 7912 See the error return description below for information on error codes 7913 returned if an unsupported retransformation is attempted. 7914 The class file bytes are not verified or installed until they have passed 7915 through the chain of <eventlink id="ClassFileLoadHook"/> events, thus the 7916 returned error code reflects the result of the transformations. 7917 If any error code is returned other than <code>JVMTI_ERROR_NONE</code>, 7918 none of the classes to be retransformed will have a new definition installed. 7919 When this function returns (with the error code of <code>JVMTI_ERROR_NONE</code>) 7920 all of the classes to be retransformed will have their new definitions installed. 7921 </description> 7922 <origin>new</origin> 7923 <capabilities> 7924 <required id="can_retransform_classes"></required> 7925 <capability id="can_retransform_any_class"></capability> 7926 </capabilities> 7927 <parameters> 7928 <param id="class_count"> 7929 <jint min="0"/> 7930 <description> 7931 The number of classes to be retransformed. 7932 </description> 7933 </param> 7934 <param id="classes"> 7935 <inbuf incount="class_count"><jclass/></inbuf> 7936 <description> 7937 The array of classes to be retransformed. 7938 </description> 7939 </param> 7940 </parameters> 7941 <errors> 7942 <error id="JVMTI_ERROR_UNMODIFIABLE_CLASS"> 7943 One of the <paramlink id="classes"/> cannot be modified. 7944 See <functionlink id="IsModifiableClass"/>. 7945 </error> 7946 <error id="JVMTI_ERROR_INVALID_CLASS"> 7947 One of the <paramlink id="classes"/> is not a valid class. 7948 </error> 7949 <error id="JVMTI_ERROR_UNSUPPORTED_VERSION"> 7950 A retransformed class file has a version number not supported by this VM. 7951 </error> 7952 <error id="JVMTI_ERROR_INVALID_CLASS_FORMAT"> 7953 A retransformed class file is malformed (The VM would return a <code>ClassFormatError</code>). 7954 </error> 7955 <error id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION"> 7956 The retransformed class file definitions would lead to a circular definition 7957 (the VM would return a <code>ClassCircularityError</code>). 7958 </error> 7959 <error id="JVMTI_ERROR_FAILS_VERIFICATION"> 7960 The retransformed class file bytes fail verification. 7961 </error> 7962 <error id="JVMTI_ERROR_NAMES_DONT_MATCH"> 7963 The class name defined in a retransformed class file is 7964 different from the name in the old class object. 7965 </error> 7966 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED"> 7967 A retransformed class file would require adding a method. 7968 </error> 7969 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED"> 7970 A retransformed class file changes a field. 7971 </error> 7972 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED"> 7973 A direct superclass is different for a retransformed class file, 7974 or the set of directly implemented 7975 interfaces is different. 7976 </error> 7977 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED"> 7978 A retransformed class file does not declare a method 7979 declared in the old class version. 7980 </error> 7981 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED"> 7982 A retransformed class file has unsupported differences in class attributes. 7983 </error> 7984 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED"> 7985 A retransformed class file has different class modifiers. 7986 </error> 7987 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED"> 7988 A method in the retransformed class file has different modifiers 7989 than its counterpart in the old class version. 7990 </error> 7991 </errors> 7992 </function> 7993 7994 <function id="RedefineClasses" jkernel="yes" num="87"> 7995 <synopsis>Redefine Classes</synopsis> 7996 <typedef id="jvmtiClassDefinition" label="Class redefinition description"> 7997 <field id="klass"> 7998 <jclass/> 7999 <description> 8000 Class object for this class 8001 </description> 8002 </field> 8003 <field id="class_byte_count"> 8004 <jint/> 8005 <description> 8006 Number of bytes defining class (below) 8007 </description> 8008 </field> 8009 <field id="class_bytes"> 8010 <inbuf incount="class_byte_count"><uchar/></inbuf> 8011 <description> 8012 Bytes defining class (in <vmspec chapter="4"/>) 8013 </description> 8014 </field> 8015 </typedef> 8016 <description> 8017 All classes given are redefined according to the definitions 8018 supplied. 8019 This function is used to replace the definition of a class 8020 with a new definition, as might be needed in fix-and-continue 8021 debugging. 8022 Where the existing class file bytes are to be transformed, for 8023 example in 8024 <internallink id="bci">bytecode instrumentation</internallink>, 8025 <functionlink id="RetransformClasses"/> should be used. 8026 <p/> 8027 Redefinition can cause new versions of methods to be installed. 8028 Old method versions may become 8029 <internallink id="obsoleteMethods">obsolete</internallink> 8030 The new method version will be used on new invokes. 8031 If a method has active stack frames, those active frames continue to 8032 run the bytecodes of the original method version. 8033 If resetting of stack frames is desired, use 8034 <functionlink id="PopFrame"></functionlink> 8035 to pop frames with obsolete method versions. 8036 <p/> 8037 This function does not cause any initialization except that which 8038 would occur under the customary JVM semantics. 8039 In other words, redefining a class does not cause its initializers to be 8040 run. The values of static fields will remain as they were 8041 prior to the call. 8042 <p/> 8043 Threads need not be suspended. 8044 <p/> 8045 All breakpoints in the class are cleared. 8046 <p/> 8047 All attributes are updated. 8048 <p/> 8049 Instances of the redefined class are not affected -- fields retain their 8050 previous values. 8051 <functionlink id="GetTag">Tags</functionlink> on the instances are 8052 also unaffected. 8053 <p/> 8054 In response to this call, the <jvmti/> event 8055 <eventlink id="ClassFileLoadHook">Class File Load Hook</eventlink> 8056 will be sent (if enabled), but no other <jvmti/> events will be sent. 8057 <p/> 8058 The redefinition may change method bodies, the constant pool and attributes 8059 (unless explicitly prohibited). 8060 The redefinition must not add, remove or rename fields or methods, change the 8061 signatures of methods, change modifiers, or change inheritance. 8062 The redefinition must not change the <code>NestHost</code>, 8063 <code>NestMembers</code>, <code>Record</code>, or <code>PermittedSubclasses</code> 8064 attributes. 8065 These restrictions may be lifted in future versions. 8066 See the error return description below for information on error codes 8067 returned if an unsupported redefinition is attempted. 8068 The class file bytes are not verified or installed until they have passed 8069 through the chain of <eventlink id="ClassFileLoadHook"/> events, thus the 8070 returned error code reflects the result of the transformations applied 8071 to the bytes passed into <paramlink id="class_definitions"/>. 8072 If any error code is returned other than <code>JVMTI_ERROR_NONE</code>, 8073 none of the classes to be redefined will have a new definition installed. 8074 When this function returns (with the error code of <code>JVMTI_ERROR_NONE</code>) 8075 all of the classes to be redefined will have their new definitions installed. 8076 </description> 8077 <origin>jvmdi</origin> 8078 <capabilities> 8079 <required id="can_redefine_classes"></required> 8080 <capability id="can_redefine_any_class"></capability> 8081 </capabilities> 8082 <parameters> 8083 <param id="class_count"> 8084 <jint min="0"/> 8085 <description> 8086 The number of classes specified in <code>class_definitions</code> 8087 </description> 8088 </param> 8089 <param id="class_definitions"> 8090 <inbuf incount="class_count"><struct>jvmtiClassDefinition</struct></inbuf> 8091 <description> 8092 The array of new class definitions 8093 </description> 8094 </param> 8095 </parameters> 8096 <errors> 8097 <error id="JVMTI_ERROR_NULL_POINTER"> 8098 One of <code>class_bytes</code> is <code>NULL</code>. 8099 </error> 8100 <error id="JVMTI_ERROR_UNMODIFIABLE_CLASS"> 8101 An element of <code>class_definitions</code> cannot be modified. 8102 See <functionlink id="IsModifiableClass"/>. 8103 </error> 8104 <error id="JVMTI_ERROR_INVALID_CLASS"> 8105 An element of <code>class_definitions</code> is not a valid class. 8106 </error> 8107 <error id="JVMTI_ERROR_UNSUPPORTED_VERSION"> 8108 A new class file has a version number not supported by this VM. 8109 </error> 8110 <error id="JVMTI_ERROR_INVALID_CLASS_FORMAT"> 8111 A new class file is malformed (The VM would return a <code>ClassFormatError</code>). 8112 </error> 8113 <error id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION"> 8114 The new class file definitions would lead to a circular definition 8115 (the VM would return a <code>ClassCircularityError</code>). 8116 </error> 8117 <error id="JVMTI_ERROR_FAILS_VERIFICATION"> 8118 The class bytes fail verification. 8119 </error> 8120 <error id="JVMTI_ERROR_NAMES_DONT_MATCH"> 8121 The class name defined in a new class file is 8122 different from the name in the old class object. 8123 </error> 8124 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED"> 8125 A new class file would require adding a method. 8126 </error> 8127 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED"> 8128 A new class version changes a field. 8129 </error> 8130 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED"> 8131 A direct superclass is different for a new class 8132 version, or the set of directly implemented 8133 interfaces is different. 8134 </error> 8135 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED"> 8136 A new class version does not declare a method 8137 declared in the old class version. 8138 </error> 8139 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED"> 8140 A new class version has unsupported differences in class attributes. 8141 </error> 8142 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED"> 8143 A new class version has different modifiers. 8144 </error> 8145 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED"> 8146 A method in the new class version has different modifiers 8147 than its counterpart in the old class version. 8148 </error> 8149 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE"> 8150 A module cannot be modified. 8151 See <functionlink id="IsModifiableModule"/>. 8152 </error> 8153 </errors> 8154 </function> 8155 8156 </category> 8157 8158 <category id="object" label="Object"> 8159 8160 <function id="GetObjectSize" jkernel="yes" phase="start" num="154"> 8161 <synopsis>Get Object Size</synopsis> 8162 <description> 8163 For the object indicated by <code>object</code>, 8164 return via <code>size_ptr</code> the size of the object. 8165 This size is an implementation-specific approximation of 8166 the amount of storage consumed by this object. 8167 It may include some or all of the object's overhead, and thus 8168 is useful for comparison within an implementation but not 8169 between implementations. 8170 The estimate may change during a single invocation of the JVM. 8171 </description> 8172 <origin>new</origin> 8173 <capabilities> 8174 </capabilities> 8175 <parameters> 8176 <param id="object"> 8177 <jobject/> 8178 <description> 8179 The object to query. 8180 </description> 8181 </param> 8182 <param id="size_ptr"> 8183 <outptr><jlong/></outptr> 8184 <description> 8185 On return, points to the object's size in bytes. 8186 </description> 8187 </param> 8188 </parameters> 8189 <errors> 8190 </errors> 8191 </function> 8192 8193 <function id="GetObjectHashCode" phase="start" num="58"> 8194 <synopsis>Get Object Hash Code</synopsis> 8195 <description> 8196 For the object indicated by <code>object</code>, 8197 return via <code>hash_code_ptr</code> a hash code. 8198 This hash code could be used to maintain a hash table of object references, 8199 however, on some implementations this can cause significant performance 8200 impacts--in most cases 8201 <internallink id="Heap">tags</internallink> 8202 will be a more efficient means of associating information with objects. 8203 This function guarantees 8204 the same hash code value for a particular object throughout its life 8205 </description> 8206 <origin>jvmdi</origin> 8207 <capabilities> 8208 </capabilities> 8209 <parameters> 8210 <param id="object"> 8211 <jobject/> 8212 <description> 8213 The object to query. 8214 </description> 8215 </param> 8216 <param id="hash_code_ptr"> 8217 <outptr><jint/></outptr> 8218 <description> 8219 On return, points to the object's hash code. 8220 </description> 8221 </param> 8222 </parameters> 8223 <errors> 8224 </errors> 8225 </function> 8226 8227 <function id="GetObjectMonitorUsage" num="59"> 8228 <synopsis>Get Object Monitor Usage</synopsis> 8229 <typedef id="jvmtiMonitorUsage" label="Object monitor usage information"> 8230 <field id="owner"> 8231 <jthread/> 8232 <description> 8233 The thread owning this monitor, or <code>NULL</code> if unused 8234 </description> 8235 </field> 8236 <field id="entry_count"> 8237 <jint/> 8238 <description> 8239 The number of times the owning thread has entered the monitor 8240 </description> 8241 </field> 8242 <field id="waiter_count"> 8243 <jint/> 8244 <description> 8245 The number of threads waiting to own this monitor 8246 </description> 8247 </field> 8248 <field id="waiters"> 8249 <allocfieldbuf><jthread/></allocfieldbuf> 8250 <description> 8251 The <code>waiter_count</code> waiting threads 8252 </description> 8253 </field> 8254 <field id="notify_waiter_count"> 8255 <jint/> 8256 <description> 8257 The number of threads waiting to be notified by this monitor 8258 </description> 8259 </field> 8260 <field id="notify_waiters"> 8261 <allocfieldbuf><jthread/></allocfieldbuf> 8262 <description> 8263 The <code>notify_waiter_count</code> threads waiting to be notified 8264 </description> 8265 </field> 8266 </typedef> 8267 <description> 8268 Get information about the object's monitor. 8269 The fields of the <functionlink id="jvmtiMonitorUsage"></functionlink> structure 8270 are filled in with information about usage of the monitor. 8271 <todo> 8272 Decide and then clarify suspend requirements. 8273 </todo> 8274 </description> 8275 <origin>jvmdi</origin> 8276 <capabilities> 8277 <required id="can_get_monitor_info"></required> 8278 </capabilities> 8279 <parameters> 8280 <param id="object"> 8281 <jobject/> 8282 <description> 8283 The object to query. 8284 </description> 8285 </param> 8286 <param id="info_ptr"> 8287 <outptr><struct>jvmtiMonitorUsage</struct></outptr> 8288 <description> 8289 On return, filled with monitor information for the 8290 specified object. 8291 </description> 8292 </param> 8293 </parameters> 8294 <errors> 8295 </errors> 8296 </function> 8297 8298 <elide> 8299 <function id="GetObjectMonitors" num="116"> 8300 <synopsis>Get Object Monitors</synopsis> 8301 <description> 8302 Return the list of object monitors. 8303 <p/> 8304 Note: details about each monitor can be examined with 8305 <functionlink id="GetObjectMonitorUsage"></functionlink>. 8306 </description> 8307 <origin>new</origin> 8308 <capabilities> 8309 <required id="can_get_monitor_info"></required> 8310 </capabilities> 8311 <parameters> 8312 <param id="monitorCnt"> 8313 <outptr><jint/></outptr> 8314 <description> 8315 On return, pointer to the number 8316 of monitors returned in <code>monitors_ptr</code>. 8317 </description> 8318 </param> 8319 <param id="monitors_ptr"> 8320 <allocbuf outcount="monitorCnt"><jobject/></allocbuf> 8321 <description> 8322 On return, pointer to the monitor list. 8323 </description> 8324 </param> 8325 </parameters> 8326 <errors> 8327 </errors> 8328 </function> 8329 </elide> 8330 8331 </category> 8332 8333 <category id="fieldCategory" label="Field"> 8334 8335 <intro> 8336 </intro> 8337 8338 <function id="GetFieldName" phase="start" num="60"> 8339 <synopsis>Get Field Name (and Signature)</synopsis> 8340 <description> 8341 For the field indicated by <paramlink id="klass"/> and <paramlink id="field"/>, 8342 return the field name via <paramlink id="name_ptr"/> and field signature via 8343 <paramlink id="signature_ptr"/>. 8344 <p/> 8345 Field signatures are defined in the 8346 <externallink id="jni/index.html">JNI Specification</externallink> 8347 and are referred to as <code>field descriptors</code> in 8348 <vmspec chapter="4.3.2"/>. 8349 </description> 8350 <origin>jvmdiClone</origin> 8351 <capabilities> 8352 </capabilities> 8353 <parameters> 8354 <param id="klass"> 8355 <jclass field="field"/> 8356 <description> 8357 The class of the field to query. 8358 </description> 8359 </param> 8360 <param id="field"> 8361 <jfieldID class="klass"/> 8362 <description> 8363 The field to query. 8364 </description> 8365 </param> 8366 <param id="name_ptr"> 8367 <allocbuf> 8368 <char/> 8369 <nullok>the name is not returned</nullok> 8370 </allocbuf> 8371 <description> 8372 On return, points to the field name, encoded as a 8373 <internallink id="mUTF">modified UTF-8</internallink> string. 8374 </description> 8375 </param> 8376 <param id="signature_ptr"> 8377 <allocbuf> 8378 <char/> 8379 <nullok>the signature is not returned</nullok> 8380 </allocbuf> 8381 <description> 8382 On return, points to the field signature, encoded as a 8383 <internallink id="mUTF">modified UTF-8</internallink> string. 8384 </description> 8385 </param> 8386 <param id="generic_ptr"> 8387 <allocbuf> 8388 <char/> 8389 <nullok>the generic signature is not returned</nullok> 8390 </allocbuf> 8391 <description> 8392 On return, points to the generic signature of the field, encoded as a 8393 <internallink id="mUTF">modified UTF-8</internallink> string. 8394 If there is no generic signature attribute for the field, then, 8395 on return, points to <code>NULL</code>. 8396 </description> 8397 </param> 8398 </parameters> 8399 <errors> 8400 </errors> 8401 </function> 8402 8403 <function id="GetFieldDeclaringClass" phase="start" num="61"> 8404 <synopsis>Get Field Declaring Class</synopsis> 8405 <description> 8406 For the field indicated by <code>klass</code> and <code>field</code> 8407 return the class that defined it via <code>declaring_class_ptr</code>. 8408 The declaring class will either be <code>klass</code>, a superclass, or 8409 an implemented interface. 8410 </description> 8411 <origin>jvmdi</origin> 8412 <capabilities> 8413 </capabilities> 8414 <parameters> 8415 <param id="klass"> 8416 <jclass field="field"/> 8417 <description> 8418 The class to query. 8419 </description> 8420 </param> 8421 <param id="field"> 8422 <jfieldID class="klass"/> 8423 <description> 8424 The field to query. 8425 </description> 8426 </param> 8427 <param id="declaring_class_ptr"> 8428 <outptr><jclass/></outptr> 8429 <description> 8430 On return, points to the declaring class 8431 </description> 8432 </param> 8433 </parameters> 8434 <errors> 8435 </errors> 8436 </function> 8437 8438 <function id="GetFieldModifiers" phase="start" num="62"> 8439 <synopsis>Get Field Modifiers</synopsis> 8440 <description> 8441 For the field indicated by <code>klass</code> and <code>field</code> 8442 return the access flags via <code>modifiers_ptr</code>. 8443 Access flags are defined in <vmspec chapter="4"/>. 8444 </description> 8445 <origin>jvmdi</origin> 8446 <capabilities> 8447 </capabilities> 8448 <parameters> 8449 <param id="klass"> 8450 <jclass field="field"/> 8451 <description> 8452 The class to query. 8453 </description> 8454 </param> 8455 <param id="field"> 8456 <jfieldID class="klass"/> 8457 <description> 8458 The field to query. 8459 </description> 8460 </param> 8461 <param id="modifiers_ptr"> 8462 <outptr><jint/></outptr> 8463 <description> 8464 On return, points to the access flags. 8465 </description> 8466 </param> 8467 </parameters> 8468 <errors> 8469 </errors> 8470 </function> 8471 8472 <function id="IsFieldSynthetic" phase="start" num="63"> 8473 <synopsis>Is Field Synthetic</synopsis> 8474 <description> 8475 For the field indicated by <code>klass</code> and <code>field</code>, return a 8476 value indicating whether the field is synthetic via <code>is_synthetic_ptr</code>. 8477 Synthetic fields are generated by the compiler but not present in the 8478 original source code. 8479 </description> 8480 <origin>jvmdi</origin> 8481 <capabilities> 8482 <required id="can_get_synthetic_attribute"></required> 8483 </capabilities> 8484 <parameters> 8485 <param id="klass"> 8486 <jclass field="field"/> 8487 <description> 8488 The class of the field to query. 8489 </description> 8490 </param> 8491 <param id="field"> 8492 <jfieldID class="klass"/> 8493 <description> 8494 The field to query. 8495 </description> 8496 </param> 8497 <param id="is_synthetic_ptr"> 8498 <outptr><jboolean/></outptr> 8499 <description> 8500 On return, points to the boolean result of this function. 8501 </description> 8502 </param> 8503 </parameters> 8504 <errors> 8505 </errors> 8506 </function> 8507 8508 </category> 8509 8510 <category id="method" label="Method"> 8511 8512 <intro> 8513 These functions provide information about a method (represented as a 8514 <typelink id="jmethodID"/>) and set how methods are processed. 8515 </intro> 8516 8517 <intro id="obsoleteMethods" label="Obsolete Methods"> 8518 The functions <functionlink id="RetransformClasses"/> and 8519 <functionlink id="RedefineClasses"/> can cause new versions 8520 of methods to be installed. 8521 An original version of a method is considered equivalent 8522 to the new version if: 8523 <ul> 8524 <li>their bytecodes are the same except for indices into the 8525 constant pool and </li> 8526 <li>the referenced constants are equal.</li> 8527 </ul> 8528 An original method version which is not equivalent to the 8529 new method version is called obsolete and is assigned a new method ID; 8530 the original method ID now refers to the new method version. 8531 A method ID can be tested for obsolescence with 8532 <functionlink id="IsMethodObsolete"/>. 8533 </intro> 8534 8535 <function id="GetMethodName" phase="start" num="64"> 8536 <synopsis>Get Method Name (and Signature)</synopsis> 8537 <description> 8538 For the method indicated by <code>method</code>, 8539 return the method name via <code>name_ptr</code> and method signature via 8540 <code>signature_ptr</code>. 8541 <p/> 8542 Method signatures are defined in the 8543 <externallink id="jni/index.html">JNI Specification</externallink> 8544 and are referred to as <code>method descriptors</code> in 8545 <vmspec chapter="4.3.3"/>. 8546 Note this is different 8547 than method signatures as defined in the <i>Java Language Specification</i>. 8548 </description> 8549 <origin>jvmdiClone</origin> 8550 <capabilities> 8551 </capabilities> 8552 <parameters> 8553 <param id="method"> 8554 <jmethodID/> 8555 <description> 8556 The method to query. 8557 </description> 8558 </param> 8559 <param id="name_ptr"> 8560 <allocbuf> 8561 <char/> 8562 <nullok>the name is not returned</nullok> 8563 </allocbuf> 8564 <description> 8565 On return, points to the method name, encoded as a 8566 <internallink id="mUTF">modified UTF-8</internallink> string. 8567 </description> 8568 </param> 8569 <param id="signature_ptr"> 8570 <allocbuf> 8571 <char/> 8572 <nullok>the signature is not returned</nullok> 8573 </allocbuf> 8574 <description> 8575 On return, points to the method signature, encoded as a 8576 <internallink id="mUTF">modified UTF-8</internallink> string. 8577 </description> 8578 </param> 8579 <param id="generic_ptr"> 8580 <allocbuf> 8581 <char/> 8582 <nullok>the generic signature is not returned</nullok> 8583 </allocbuf> 8584 <description> 8585 On return, points to the generic signature of the method, encoded as a 8586 <internallink id="mUTF">modified UTF-8</internallink> string. 8587 If there is no generic signature attribute for the method, then, 8588 on return, points to <code>NULL</code>. 8589 </description> 8590 </param> 8591 </parameters> 8592 <errors> 8593 </errors> 8594 </function> 8595 8596 <function id="GetMethodDeclaringClass" phase="start" num="65"> 8597 <synopsis>Get Method Declaring Class</synopsis> 8598 <description> 8599 For the method indicated by <code>method</code>, 8600 return the class that defined it via <code>declaring_class_ptr</code>. 8601 </description> 8602 <origin>jvmdi</origin> 8603 <capabilities> 8604 </capabilities> 8605 <parameters> 8606 <param id="klass"> 8607 <jclass method="method"/> 8608 <description> 8609 The class to query. 8610 </description> 8611 </param> 8612 <param id="method"> 8613 <jmethodID class="klass"/> 8614 <description> 8615 The method to query. 8616 </description> 8617 </param> 8618 <param id="declaring_class_ptr"> 8619 <outptr><jclass/></outptr> 8620 <description> 8621 On return, points to the declaring class 8622 </description> 8623 </param> 8624 </parameters> 8625 <errors> 8626 </errors> 8627 </function> 8628 8629 <function id="GetMethodModifiers" phase="start" num="66"> 8630 <synopsis>Get Method Modifiers</synopsis> 8631 <description> 8632 For the method indicated by <code>method</code>, 8633 return the access flags via <code>modifiers_ptr</code>. 8634 Access flags are defined in <vmspec chapter="4"/>. 8635 </description> 8636 <origin>jvmdi</origin> 8637 <capabilities> 8638 </capabilities> 8639 <parameters> 8640 <param id="klass"> 8641 <jclass method="method"/> 8642 <description> 8643 The class to query. 8644 </description> 8645 </param> 8646 <param id="method"> 8647 <jmethodID class="klass"/> 8648 <description> 8649 The method to query. 8650 </description> 8651 </param> 8652 <param id="modifiers_ptr"> 8653 <outptr><jint/></outptr> 8654 <description> 8655 On return, points to the access flags. 8656 </description> 8657 </param> 8658 </parameters> 8659 <errors> 8660 </errors> 8661 </function> 8662 8663 <function id="GetMaxLocals" phase="start" num="68"> 8664 <synopsis>Get Max Locals</synopsis> 8665 <description> 8666 For the method indicated by <code>method</code>, 8667 return the number of local variable slots used by the method, 8668 including the local variables used to pass parameters to the 8669 method on its invocation. 8670 <p/> 8671 See <code>max_locals</code> in <vmspec chapter="4.7.3"/>. 8672 </description> 8673 <origin>jvmdi</origin> 8674 <capabilities> 8675 </capabilities> 8676 <parameters> 8677 <param id="klass"> 8678 <jclass method="method"/> 8679 <description> 8680 The class to query. 8681 </description> 8682 </param> 8683 <param id="method"> 8684 <jmethodID class="klass" native="error"/> 8685 <description> 8686 The method to query. 8687 </description> 8688 </param> 8689 <param id="max_ptr"> 8690 <outptr><jint/></outptr> 8691 <description> 8692 On return, points to the maximum number of local slots 8693 </description> 8694 </param> 8695 </parameters> 8696 <errors> 8697 </errors> 8698 </function> 8699 8700 <function id="GetArgumentsSize" phase="start" num="69"> 8701 <synopsis>Get Arguments Size</synopsis> 8702 <description> 8703 For the method indicated by <code>method</code>, 8704 return via <code>max_ptr</code> the number of local variable slots used 8705 by the method's arguments. 8706 Note that two-word arguments use two slots. 8707 </description> 8708 <origin>jvmdi</origin> 8709 <capabilities> 8710 </capabilities> 8711 <parameters> 8712 <param id="klass"> 8713 <jclass method="method"/> 8714 <description> 8715 The class to query. 8716 </description> 8717 </param> 8718 <param id="method"> 8719 <jmethodID class="klass" native="error"/> 8720 <description> 8721 The method to query. 8722 </description> 8723 </param> 8724 <param id="size_ptr"> 8725 <outptr><jint/></outptr> 8726 <description> 8727 On return, points to the number of argument slots 8728 </description> 8729 </param> 8730 </parameters> 8731 <errors> 8732 </errors> 8733 </function> 8734 8735 <function id="GetLineNumberTable" phase="start" num="70"> 8736 <synopsis>Get Line Number Table</synopsis> 8737 <typedef id="jvmtiLineNumberEntry" label="Line number table entry"> 8738 <field id="start_location"> 8739 <jlocation/> 8740 <description> 8741 the <datalink id="jlocation"></datalink> where the line begins 8742 </description> 8743 </field> 8744 <field id="line_number"> 8745 <jint/> 8746 <description> 8747 the line number 8748 </description> 8749 </field> 8750 </typedef> 8751 <description> 8752 For the method indicated by <code>method</code>, 8753 return a table of source line number entries. The size of the table is 8754 returned via <code>entry_count_ptr</code> and the table itself is 8755 returned via <code>table_ptr</code>. 8756 </description> 8757 <origin>jvmdi</origin> 8758 <capabilities> 8759 <required id="can_get_line_numbers"></required> 8760 </capabilities> 8761 <parameters> 8762 <param id="klass"> 8763 <jclass method="method"/> 8764 <description> 8765 The class to query. 8766 </description> 8767 </param> 8768 <param id="method"> 8769 <jmethodID class="klass" native="error"/> 8770 <description> 8771 The method to query. 8772 </description> 8773 </param> 8774 <param id="entry_count_ptr"> 8775 <outptr><jint/></outptr> 8776 <description> 8777 On return, points to the number of entries in the table 8778 </description> 8779 </param> 8780 <param id="table_ptr"> 8781 <allocbuf outcount="entry_count_ptr"><struct>jvmtiLineNumberEntry</struct></allocbuf> 8782 <description> 8783 On return, points to the line number table pointer. 8784 </description> 8785 </param> 8786 </parameters> 8787 <errors> 8788 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 8789 Class information does not include line numbers. 8790 </error> 8791 </errors> 8792 </function> 8793 8794 <function id="GetMethodLocation" phase="start" num="71"> 8795 <synopsis>Get Method Location</synopsis> 8796 <description> 8797 For the method indicated by <code>method</code>, 8798 return the beginning and ending addresses through 8799 <code>start_location_ptr</code> and <code>end_location_ptr</code>. In a 8800 conventional bytecode indexing scheme, 8801 <code>start_location_ptr</code> will always point to zero 8802 and <code>end_location_ptr</code> 8803 will always point to the bytecode count minus one. 8804 </description> 8805 <origin>jvmdi</origin> 8806 <capabilities> 8807 </capabilities> 8808 <parameters> 8809 <param id="klass"> 8810 <jclass method="method"/> 8811 <description> 8812 The class to query. 8813 </description> 8814 </param> 8815 <param id="method"> 8816 <jmethodID class="klass" native="error"/> 8817 <description> 8818 The method to query. 8819 </description> 8820 </param> 8821 <param id="start_location_ptr"> 8822 <outptr><jlocation/></outptr> 8823 <description> 8824 On return, points to the first location, or 8825 <code>-1</code> if location information is not available. 8826 If the information is available and 8827 <functionlink id="GetJLocationFormat"></functionlink> 8828 returns <datalink id="JVMTI_JLOCATION_JVMBCI"></datalink> 8829 then this will always be zero. 8830 </description> 8831 </param> 8832 <param id="end_location_ptr"> 8833 <outptr><jlocation/></outptr> 8834 <description> 8835 On return, points to the last location, 8836 or <code>-1</code> if location information is not available. 8837 </description> 8838 </param> 8839 </parameters> 8840 <errors> 8841 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 8842 Class information does not include method sizes. 8843 </error> 8844 </errors> 8845 </function> 8846 8847 <function id="GetLocalVariableTable" num="72"> 8848 <synopsis>Get Local Variable Table</synopsis> 8849 <typedef id="jvmtiLocalVariableEntry" label="Local variable table entry"> 8850 <field id="start_location"> 8851 <jlocation/> 8852 <description> 8853 The code array index where the local variable is first valid 8854 (that is, where it must have a value). 8855 </description> 8856 </field> 8857 <field id="length"> 8858 <jint/> 8859 <description> 8860 The length of the valid section for this local variable. 8861 The last code array index where the local variable is valid 8862 is <code>start_location + length</code>. 8863 </description> 8864 </field> 8865 <field id="name"> 8866 <allocfieldbuf><char/></allocfieldbuf> 8867 <description> 8868 The local variable name, encoded as a 8869 <internallink id="mUTF">modified UTF-8</internallink> string. 8870 </description> 8871 </field> 8872 <field id="signature"> 8873 <allocfieldbuf><char/></allocfieldbuf> 8874 <description> 8875 The local variable's type signature, encoded as a 8876 <internallink id="mUTF">modified UTF-8</internallink> string. 8877 The signature format is the same as that defined in 8878 <vmspec chapter="4.3.2"/>. 8879 </description> 8880 </field> 8881 <field id="generic_signature"> 8882 <allocfieldbuf><char/></allocfieldbuf> 8883 <description> 8884 The local variable's generic signature, encoded as a 8885 <internallink id="mUTF">modified UTF-8</internallink> string. 8886 The value of this field will be <code>NULL</code> for any local 8887 variable which does not have a generic type. 8888 </description> 8889 </field> 8890 <field id="slot"> 8891 <jint/> 8892 <description> 8893 The local variable's slot. See <internallink id="local">Local Variables</internallink>. 8894 </description> 8895 </field> 8896 </typedef> 8897 <description> 8898 Return local variable information. 8899 </description> 8900 <origin>jvmdiClone</origin> 8901 <capabilities> 8902 <required id="can_access_local_variables"></required> 8903 </capabilities> 8904 <parameters> 8905 <param id="method"> 8906 <jmethodID native="error"/> 8907 <description> 8908 The method to query. 8909 </description> 8910 </param> 8911 <param id="entry_count_ptr"> 8912 <outptr><jint/></outptr> 8913 <description> 8914 On return, points to the number of entries in the table 8915 </description> 8916 </param> 8917 <param id="table_ptr"> 8918 <allocbuf outcount="entry_count_ptr"><struct>jvmtiLocalVariableEntry</struct></allocbuf> 8919 <description> 8920 On return, points to an array of local variable table entries. 8921 </description> 8922 </param> 8923 </parameters> 8924 <errors> 8925 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 8926 Class information does not include local variable 8927 information. 8928 </error> 8929 </errors> 8930 </function> 8931 8932 <function id="GetBytecodes" phase="start" num="75"> 8933 <synopsis>Get Bytecodes</synopsis> 8934 <description> 8935 For the method indicated by <code>method</code>, 8936 return the bytecodes that implement the method. The number of 8937 bytecodes is returned via <code>bytecode_count_ptr</code>. The bytecodes 8938 themselves are returned via <code>bytecodes_ptr</code>. 8939 </description> 8940 <origin>jvmdi</origin> 8941 <capabilities> 8942 <required id="can_get_bytecodes"></required> 8943 </capabilities> 8944 <parameters> 8945 <param id="klass"> 8946 <jclass method="method"/> 8947 <description> 8948 The class to query. 8949 </description> 8950 </param> 8951 <param id="method"> 8952 <jmethodID class="klass" native="error"/> 8953 <description> 8954 The method to query. 8955 </description> 8956 </param> 8957 <param id="bytecode_count_ptr"> 8958 <outptr><jint/></outptr> 8959 <description> 8960 On return, points to the length of the bytecode array 8961 </description> 8962 </param> 8963 <param id="bytecodes_ptr"> 8964 <allocbuf outcount="bytecode_count_ptr"><uchar/></allocbuf> 8965 <description> 8966 On return, points to the pointer to the bytecode array 8967 </description> 8968 </param> 8969 </parameters> 8970 <errors> 8971 </errors> 8972 </function> 8973 8974 <function id="IsMethodNative" phase="start" num="76"> 8975 <synopsis>Is Method Native</synopsis> 8976 <description> 8977 For the method indicated by <code>method</code>, return a 8978 value indicating whether the method is native via <code>is_native_ptr</code> 8979 </description> 8980 <origin>jvmdi</origin> 8981 <capabilities> 8982 </capabilities> 8983 <parameters> 8984 <param id="klass"> 8985 <jclass method="method"/> 8986 <description> 8987 The class to query. 8988 </description> 8989 </param> 8990 <param id="method"> 8991 <jmethodID class="klass"/> 8992 <description> 8993 The method to query. 8994 </description> 8995 </param> 8996 <param id="is_native_ptr"> 8997 <outptr><jboolean/></outptr> 8998 <description> 8999 On return, points to the boolean result of this function. 9000 </description> 9001 </param> 9002 </parameters> 9003 <errors> 9004 </errors> 9005 </function> 9006 9007 <function id="IsMethodSynthetic" phase="start" num="77"> 9008 <synopsis>Is Method Synthetic</synopsis> 9009 <description> 9010 For the method indicated by <code>method</code>, return a 9011 value indicating whether the method is synthetic via <code>is_synthetic_ptr</code>. 9012 Synthetic methods are generated by the compiler but not present in the 9013 original source code. 9014 </description> 9015 <origin>jvmdi</origin> 9016 <capabilities> 9017 <required id="can_get_synthetic_attribute"></required> 9018 </capabilities> 9019 <parameters> 9020 <param id="klass"> 9021 <jclass method="method"/> 9022 <description> 9023 The class to query. 9024 </description> 9025 </param> 9026 <param id="method"> 9027 <jmethodID class="klass"/> 9028 <description> 9029 The method to query. 9030 </description> 9031 </param> 9032 <param id="is_synthetic_ptr"> 9033 <outptr><jboolean/></outptr> 9034 <description> 9035 On return, points to the boolean result of this function. 9036 </description> 9037 </param> 9038 </parameters> 9039 <errors> 9040 </errors> 9041 </function> 9042 9043 <function id="IsMethodObsolete" phase="start" num="91"> 9044 <synopsis>Is Method Obsolete</synopsis> 9045 <description> 9046 Determine if a method ID refers to an 9047 <internallink id="obsoleteMethods">obsolete</internallink> 9048 method version. 9049 </description> 9050 <origin>jvmdi</origin> 9051 <capabilities> 9052 </capabilities> 9053 <parameters> 9054 <param id="klass"> 9055 <jclass method="method"/> 9056 <description> 9057 The class to query. 9058 </description> 9059 </param> 9060 <param id="method"> 9061 <jmethodID class="klass"/> 9062 <description> 9063 The method ID to query. 9064 </description> 9065 </param> 9066 <param id="is_obsolete_ptr"> 9067 <outptr><jboolean/></outptr> 9068 <description> 9069 On return, points to the boolean result of this function. 9070 </description> 9071 </param> 9072 </parameters> 9073 <errors> 9074 </errors> 9075 </function> 9076 9077 <function id="SetNativeMethodPrefix" jkernel="yes" phase="any" num="73" since="1.1"> 9078 <synopsis>Set Native Method Prefix</synopsis> 9079 <description> 9080 This function modifies the failure handling of 9081 native method resolution by allowing retry 9082 with a prefix applied to the name. 9083 When used with the 9084 <eventlink id="ClassFileLoadHook">ClassFileLoadHook 9085 event</eventlink>, it enables native methods to be 9086 <internallink id="bci">instrumented</internallink>. 9087 <p/> 9088 Since native methods cannot be directly instrumented 9089 (they have no bytecodes), they must be wrapped with 9090 a non-native method which can be instrumented. 9091 For example, if we had: 9092 <example> 9093 native boolean foo(int x);</example> 9094 <p/> 9095 We could transform the class file (with the 9096 ClassFileLoadHook event) so that this becomes: 9097 <example> 9098 boolean foo(int x) { 9099 <i>... record entry to foo ...</i> 9100 return wrapped_foo(x); 9101 } 9102 9103 native boolean wrapped_foo(int x);</example> 9104 <p/> 9105 Where foo becomes a wrapper for the actual native method 9106 with the appended prefix "wrapped_". Note that 9107 "wrapped_" would be a poor choice of prefix since it 9108 might conceivably form the name of an existing method 9109 thus something like "$$$MyAgentWrapped$$$_" would be 9110 better but would make these examples less readable. 9111 <p/> 9112 The wrapper will allow data to be collected on the native 9113 method call, but now the problem becomes linking up the 9114 wrapped method with the native implementation. 9115 That is, the method <code>wrapped_foo</code> needs to be 9116 resolved to the native implementation of <code>foo</code>, 9117 which might be: 9118 <example> 9119 Java_somePackage_someClass_foo(JNIEnv* env, jint x)</example> 9120 <p/> 9121 This function allows the prefix to be specified and the 9122 proper resolution to occur. 9123 Specifically, when the standard resolution fails, the 9124 resolution is retried taking the prefix into consideration. 9125 There are two ways that resolution occurs, explicit 9126 resolution with the JNI function <code>RegisterNatives</code> 9127 and the normal automatic resolution. For 9128 <code>RegisterNatives</code>, the VM will attempt this 9129 association: 9130 <example> 9131 method(foo) -> nativeImplementation(foo)</example> 9132 <p/> 9133 When this fails, the resolution will be retried with 9134 the specified prefix prepended to the method name, 9135 yielding the correct resolution: 9136 <example> 9137 method(wrapped_foo) -> nativeImplementation(foo)</example> 9138 <p/> 9139 For automatic resolution, the VM will attempt: 9140 <example> 9141 method(wrapped_foo) -> nativeImplementation(wrapped_foo)</example> 9142 <p/> 9143 When this fails, the resolution will be retried with 9144 the specified prefix deleted from the implementation name, 9145 yielding the correct resolution: 9146 <example> 9147 method(wrapped_foo) -> nativeImplementation(foo)</example> 9148 <p/> 9149 Note that since the prefix is only used when standard 9150 resolution fails, native methods can be wrapped selectively. 9151 <p/> 9152 Since each <jvmti/> environment is independent and 9153 can do its own transformation of the bytecodes, more 9154 than one layer of wrappers may be applied. Thus each 9155 environment needs its own prefix. Since transformations 9156 are applied in order, the prefixes, if applied, will 9157 be applied in the same order. 9158 The order of transformation application is described in 9159 the <eventlink id="ClassFileLoadHook"/> event. 9160 Thus if three environments applied 9161 wrappers, <code>foo</code> might become 9162 <code>$env3_$env2_$env1_foo</code>. But if, say, 9163 the second environment did not apply a wrapper to 9164 <code>foo</code> it would be just 9165 <code>$env3_$env1_foo</code>. To be able to 9166 efficiently determine the sequence of prefixes, 9167 an intermediate prefix is only applied if its non-native 9168 wrapper exists. Thus, in the last example, even though 9169 <code>$env1_foo</code> is not a native method, the 9170 <code>$env1_</code> prefix is applied since 9171 <code>$env1_foo</code> exists. 9172 <p/> 9173 Since the prefixes are used at resolution time 9174 and since resolution may be arbitrarily delayed, a 9175 native method prefix must remain set as long as there 9176 are corresponding prefixed native methods. 9177 </description> 9178 <origin>new</origin> 9179 <capabilities> 9180 <required id="can_set_native_method_prefix"></required> 9181 </capabilities> 9182 <parameters> 9183 <param id="prefix"> 9184 <inbuf> 9185 <char/> 9186 <nullok> 9187 any existing prefix in this environment is cancelled 9188 </nullok> 9189 </inbuf> 9190 <description> 9191 The prefix to apply, encoded as a 9192 <internallink id="mUTF">modified UTF-8</internallink> string. 9193 </description> 9194 </param> 9195 </parameters> 9196 <errors> 9197 </errors> 9198 </function> 9199 9200 <function id="SetNativeMethodPrefixes" jkernel="yes" phase="any" num="74" since="1.1"> 9201 <synopsis>Set Native Method Prefixes</synopsis> 9202 <description> 9203 For a normal agent, <functionlink id="SetNativeMethodPrefix"/> 9204 will provide all needed native method prefixing. 9205 For a meta-agent that performs multiple independent class 9206 file transformations (for example as a proxy for another 9207 layer of agents) this function allows each transformation 9208 to have its own prefix. 9209 The prefixes are applied in the order supplied and are 9210 processed in the same manner as described for the 9211 application of prefixes from multiple <jvmti/> environments 9212 in <functionlink id="SetNativeMethodPrefix"/>. 9213 <p/> 9214 Any previous prefixes are replaced. Thus, calling this 9215 function with a <paramlink id="prefix_count"/> of <code>0</code> 9216 disables prefixing in this environment. 9217 <p/> 9218 <functionlink id="SetNativeMethodPrefix"/> and this function 9219 are the two ways to set the prefixes. 9220 Calling <code>SetNativeMethodPrefix</code> with 9221 a prefix is the same as calling this function with 9222 <paramlink id="prefix_count"/> of <code>1</code>. 9223 Calling <code>SetNativeMethodPrefix</code> with 9224 <code>NULL</code> is the same as calling this function with 9225 <paramlink id="prefix_count"/> of <code>0</code>. 9226 </description> 9227 <origin>new</origin> 9228 <capabilities> 9229 <required id="can_set_native_method_prefix"></required> 9230 </capabilities> 9231 <parameters> 9232 <param id="prefix_count"> 9233 <jint min="0"/> 9234 <description> 9235 The number of prefixes to apply. 9236 </description> 9237 </param> 9238 <param id="prefixes"> 9239 <agentbuf> 9240 <char/> 9241 </agentbuf> 9242 <description> 9243 The prefixes to apply for this environment, each encoded as a 9244 <internallink id="mUTF">modified UTF-8</internallink> string. 9245 </description> 9246 </param> 9247 </parameters> 9248 <errors> 9249 </errors> 9250 </function> 9251 9252 </category> 9253 9254 <category id="RawMonitors" label="Raw Monitor"> 9255 9256 <function id="CreateRawMonitor" phase="onload" callbacksafe="safe" num="31"> 9257 <synopsis>Create Raw Monitor</synopsis> 9258 <description> 9259 Create a raw monitor. 9260 </description> 9261 <origin>jvmdi</origin> 9262 <capabilities> 9263 </capabilities> 9264 <parameters> 9265 <param id="name"> 9266 <inbuf><char/></inbuf> 9267 <description> 9268 A name to identify the monitor, encoded as a 9269 <internallink id="mUTF">modified UTF-8</internallink> string. 9270 </description> 9271 </param> 9272 <param id="monitor_ptr"> 9273 <outptr><jrawMonitorID/></outptr> 9274 <description> 9275 On return, points to the created monitor. 9276 </description> 9277 </param> 9278 </parameters> 9279 <errors> 9280 </errors> 9281 </function> 9282 9283 <function id="DestroyRawMonitor" phase="onload" callbacksafe="safe" num="32"> 9284 <synopsis>Destroy Raw Monitor</synopsis> 9285 <description> 9286 Destroy the raw monitor. 9287 If the monitor being destroyed has been entered by this thread, it will be 9288 exited before it is destroyed. 9289 If the monitor being destroyed has been entered by another thread, 9290 an error will be returned and the monitor will not be destroyed. 9291 </description> 9292 <origin>jvmdi</origin> 9293 <capabilities> 9294 </capabilities> 9295 <parameters> 9296 <param id="monitor"> 9297 <jrawMonitorID/> 9298 <description> 9299 The monitor 9300 </description> 9301 </param> 9302 </parameters> 9303 <errors> 9304 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 9305 Not monitor owner 9306 </error> 9307 </errors> 9308 </function> 9309 9310 <function id="RawMonitorEnter" phase="any" callbacksafe="safe" impl="innative notrace" num="33"> 9311 <synopsis>Raw Monitor Enter</synopsis> 9312 <description> 9313 Gain exclusive ownership of a raw monitor. 9314 The same thread may enter a monitor more then once. 9315 The thread must 9316 <functionlink id="RawMonitorExit">exit</functionlink> 9317 the monitor the same number of times as it is entered. 9318 If a monitor is entered during <code>OnLoad</code> (before attached threads exist) 9319 and has not exited when attached threads come into existence, the enter 9320 is considered to have occurred on the main thread. 9321 </description> 9322 <origin>jvmdi</origin> 9323 <capabilities> 9324 </capabilities> 9325 <parameters> 9326 <param id="monitor"> 9327 <jrawMonitorID/> 9328 <description> 9329 The monitor 9330 </description> 9331 </param> 9332 </parameters> 9333 <errors> 9334 </errors> 9335 </function> 9336 9337 <function id="RawMonitorExit" phase="any" callbacksafe="safe" impl="innative notrace" num="34"> 9338 <synopsis>Raw Monitor Exit</synopsis> 9339 <description> 9340 Release exclusive ownership of a raw monitor. 9341 </description> 9342 <origin>jvmdi</origin> 9343 <capabilities> 9344 </capabilities> 9345 <parameters> 9346 <param id="monitor"> 9347 <jrawMonitorID/> 9348 <description> 9349 The monitor 9350 </description> 9351 </param> 9352 </parameters> 9353 <errors> 9354 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 9355 Not monitor owner 9356 </error> 9357 </errors> 9358 </function> 9359 9360 <function id="RawMonitorWait" phase="any" callbacksafe="safe" impl="innative notrace" num="35"> 9361 <synopsis>Raw Monitor Wait</synopsis> 9362 <description> 9363 Wait for notification of the raw monitor. 9364 <p/> 9365 Causes the current thread to wait until either another thread calls 9366 <functionlink id="RawMonitorNotify"/> or 9367 <functionlink id="RawMonitorNotifyAll"/> 9368 for the specified raw monitor, or the specified 9369 <paramlink id="millis">timeout</paramlink> 9370 has elapsed. 9371 </description> 9372 <origin>jvmdi</origin> 9373 <capabilities> 9374 </capabilities> 9375 <parameters> 9376 <param id="monitor"> 9377 <jrawMonitorID/> 9378 <description> 9379 The monitor 9380 </description> 9381 </param> 9382 <param id="millis"> 9383 <jlong/> 9384 <description> 9385 The timeout, in milliseconds. If the timeout is 9386 zero, then real time is not taken into consideration 9387 and the thread simply waits until notified. 9388 </description> 9389 </param> 9390 </parameters> 9391 <errors> 9392 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 9393 Not monitor owner 9394 </error> 9395 <error id="JVMTI_ERROR_INTERRUPT"> 9396 Wait was interrupted, try again 9397 </error> 9398 </errors> 9399 </function> 9400 9401 <function id="RawMonitorNotify" phase="any" callbacksafe="safe" impl="notrace" num="36"> 9402 <synopsis>Raw Monitor Notify</synopsis> 9403 <description> 9404 Notify a single thread waiting on the raw monitor. 9405 </description> 9406 <origin>jvmdi</origin> 9407 <capabilities> 9408 </capabilities> 9409 <parameters> 9410 <param id="monitor"> 9411 <jrawMonitorID/> 9412 <description> 9413 The monitor 9414 </description> 9415 </param> 9416 </parameters> 9417 <errors> 9418 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 9419 Not monitor owner 9420 </error> 9421 </errors> 9422 </function> 9423 9424 <function id="RawMonitorNotifyAll" phase="any" callbacksafe="safe" impl="notrace" num="37"> 9425 <synopsis>Raw Monitor Notify All</synopsis> 9426 <description> 9427 Notify all threads 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 <elide> 9448 <function id="GetRawMonitorUse" num="118"> 9449 <synopsis>Get Raw Monitor Use</synopsis> 9450 <description> 9451 The fields of the <functionlink id="jvmtiMonitorUsage"></functionlink> structure 9452 are filled in with information about usage of the raw monitor. 9453 </description> 9454 <origin>new</origin> 9455 <capabilities> 9456 <required id="can_get_raw_monitor_usage"></required> 9457 </capabilities> 9458 <parameters> 9459 <param id="monitor"> 9460 <jrawMonitorID/> 9461 <description> 9462 the raw monitor to query. 9463 </description> 9464 </param> 9465 <param id="info_ptr"> 9466 <outptr><struct>jvmtiMonitorUsage</struct></outptr> 9467 <description> 9468 On return, filled with monitor information for the 9469 specified raw monitor. 9470 </description> 9471 </param> 9472 </parameters> 9473 <errors> 9474 </errors> 9475 </function> 9476 9477 <function id="GetRawMonitors" num="119"> 9478 <synopsis>Get Raw Monitors</synopsis> 9479 <description> 9480 Return the list of raw monitors. 9481 <p/> 9482 Note: details about each monitor can be examined with 9483 <functionlink id="GetRawMonitorUse"></functionlink>. 9484 </description> 9485 <origin>new</origin> 9486 <capabilities> 9487 <required id="can_get_raw_monitor_usage"></required> 9488 </capabilities> 9489 <parameters> 9490 <param id="monitorCnt"> 9491 <outptr><jint/></outptr> 9492 <description> 9493 On return, pointer to the number 9494 of monitors returned in <code>monitors_ptr</code>. 9495 </description> 9496 </param> 9497 <param id="monitors_ptr"> 9498 <allocbuf outcount="monitorCnt"><jrawMonitorID/></allocbuf> 9499 <description> 9500 On return, pointer to the monitor list. 9501 </description> 9502 </param> 9503 </parameters> 9504 <errors> 9505 </errors> 9506 </function> 9507 </elide> 9508 </category> 9509 9510 <category id="jniIntercept" label="JNI Function Interception"> 9511 9512 <intro> 9513 Provides the ability to intercept and resend 9514 Java Native Interface (JNI) function calls 9515 by manipulating the JNI function table. 9516 See <externallink id="jni/functions.html">JNI 9517 Functions</externallink> in the <i>Java Native Interface Specification</i>. 9518 <p/> 9519 The following example illustrates intercepting the 9520 <code>NewGlobalRef</code> JNI call in order to count reference 9521 creation. 9522 <example> 9523 JNIEnv original_jni_Functions; 9524 JNIEnv redirected_jni_Functions; 9525 int my_global_ref_count = 0; 9526 9527 jobject 9528 MyNewGlobalRef(JNIEnv *jni_env, jobject lobj) { 9529 ++my_global_ref_count; 9530 return originalJNIFunctions->NewGlobalRef(env, lobj); 9531 } 9532 9533 void 9534 myInit() { 9535 jvmtiError err; 9536 9537 err = (*jvmti_env)->GetJNIFunctionTable(jvmti_env, &original_jni_Functions); 9538 if (err != JVMTI_ERROR_NONE) { 9539 die(); 9540 } 9541 err = (*jvmti_env)->GetJNIFunctionTable(jvmti_env, &redirected_jni_Functions); 9542 if (err != JVMTI_ERROR_NONE) { 9543 die(); 9544 } 9545 redirectedJNIFunctions->NewGlobalRef = MyNewGlobalRef; 9546 err = (*jvmti_env)->SetJNIFunctionTable(jvmti_env, redirected_jni_Functions); 9547 if (err != JVMTI_ERROR_NONE) { 9548 die(); 9549 } 9550 } 9551 </example> 9552 Sometime after <code>myInit</code> is called the user's JNI 9553 code is executed which makes the call to create a new global 9554 reference. Instead of going to the normal JNI implementation 9555 the call goes to <code>myNewGlobalRef</code>. Note that a 9556 copy of the original function table is kept so that the normal 9557 JNI function can be called after the data is collected. 9558 Note also that any JNI functions which are not overwritten 9559 will behave normally. 9560 <todo> 9561 check that the example compiles and executes. 9562 </todo> 9563 </intro> 9564 9565 <function id="SetJNIFunctionTable" phase="start" num="120"> 9566 <synopsis>Set JNI Function Table</synopsis> 9567 <description> 9568 Set the JNI function table 9569 in all current and future JNI environments. 9570 As a result, all future JNI calls are directed to the specified functions. 9571 Use <functionlink id="GetJNIFunctionTable"></functionlink> to get the 9572 function table to pass to this function. 9573 For this function to take effect the updated table entries must be 9574 used by the JNI clients. 9575 Since the table is defined <code>const</code> some compilers may optimize 9576 away the access to the table, thus preventing this function from taking 9577 effect. 9578 The table is copied--changes to the local copy of the 9579 table have no effect. 9580 This function affects only the function table, all other aspects of the environment are 9581 unaffected. 9582 See the examples <internallink id="jniIntercept">above</internallink>. 9583 </description> 9584 <origin>new</origin> 9585 <capabilities> 9586 </capabilities> 9587 <parameters> 9588 <param id="function_table"> 9589 <inptr> 9590 <struct>jniNativeInterface</struct> 9591 </inptr> 9592 <description> 9593 Points to the new JNI function table. 9594 </description> 9595 </param> 9596 </parameters> 9597 <errors> 9598 </errors> 9599 </function> 9600 9601 <function id="GetJNIFunctionTable" phase="start" num="121"> 9602 <synopsis>Get JNI Function Table</synopsis> 9603 <description> 9604 Get the JNI function table. 9605 The JNI function table is copied into allocated memory. 9606 If <functionlink id="SetJNIFunctionTable"></functionlink> 9607 has been called, the modified (not the original) function 9608 table is returned. 9609 Only the function table is copied, no other aspects of the environment 9610 are copied. 9611 See the examples <internallink id="jniIntercept">above</internallink>. 9612 </description> 9613 <origin>new</origin> 9614 <capabilities> 9615 </capabilities> 9616 <parameters> 9617 <param id="function_table"> 9618 <allocbuf> 9619 <struct>jniNativeInterface</struct> 9620 </allocbuf> 9621 <description> 9622 On return, <code>*function_table</code> 9623 points a newly allocated copy of the JNI function table. 9624 </description> 9625 </param> 9626 </parameters> 9627 <errors> 9628 </errors> 9629 </function> 9630 9631 </category> 9632 9633 <category id="eventManagement" label="Event Management"> 9634 9635 <function id="SetEventCallbacks" jkernel="yes" phase="onload" num="122"> 9636 <synopsis>Set Event Callbacks</synopsis> 9637 <description> 9638 Set the functions to be called for each event. 9639 The callbacks are specified by supplying a replacement function table. 9640 The function table is copied--changes to the local copy of the 9641 table have no effect. 9642 This is an atomic action, all callbacks are set at once. 9643 No events are sent before this function is called. 9644 When an entry is <code>NULL</code> or when the event is beyond 9645 <paramlink id="size_of_callbacks"></paramlink> no event is sent. 9646 Details on events are 9647 described <internallink id="EventSection">later</internallink> in this document. 9648 An event must be enabled and have a callback in order to be 9649 sent--the order in which this function and 9650 <functionlink id="SetEventNotificationMode"></functionlink> 9651 are called does not affect the result. 9652 </description> 9653 <origin>new</origin> 9654 <capabilities> 9655 </capabilities> 9656 <parameters> 9657 <param id="callbacks"> 9658 <inptr> 9659 <struct>jvmtiEventCallbacks</struct> 9660 <nullok>remove the existing callbacks</nullok> 9661 </inptr> 9662 <description> 9663 The new event callbacks. 9664 </description> 9665 </param> 9666 <param id="size_of_callbacks"> 9667 <jint min="0"/> 9668 <description> 9669 <code>sizeof(jvmtiEventCallbacks)</code>--for version 9670 compatibility. 9671 </description> 9672 </param> 9673 </parameters> 9674 <errors> 9675 </errors> 9676 </function> 9677 9678 <function id="SetEventNotificationMode" jkernel="yes" phase="onload" num="2"> 9679 <synopsis>Set Event Notification Mode</synopsis> 9680 <description> 9681 Control the generation of events. 9682 <constants id="jvmtiEventMode" label="Event Enable/Disable" kind="enum"> 9683 <constant id="JVMTI_ENABLE" num="1"> 9684 If <paramlink id="mode"></paramlink> is <code>JVMTI_ENABLE</code>, 9685 the event <paramlink id="event_type"></paramlink> will be enabled 9686 </constant> 9687 <constant id="JVMTI_DISABLE" num="0"> 9688 If <paramlink id="mode"></paramlink> is <code>JVMTI_DISABLE</code>, 9689 the event <paramlink id="event_type"></paramlink> will be disabled 9690 </constant> 9691 </constants> 9692 If <code>event_thread</code> is <code>NULL</code>, 9693 the event is enabled or disabled globally; otherwise, it is 9694 enabled or disabled for a particular thread. 9695 An event is generated for 9696 a particular thread if it is enabled either at the thread or global 9697 levels. 9698 <p/> 9699 See <internallink id="EventIndex">below</internallink> for information on specific events. 9700 <p/> 9701 The following events cannot be controlled at the thread 9702 level through this function. 9703 <ul> 9704 <li><eventlink id="VMInit"></eventlink></li> 9705 <li><eventlink id="VMStart"></eventlink></li> 9706 <li><eventlink id="VMDeath"></eventlink></li> 9707 <li><eventlink id="ThreadStart"></eventlink></li> 9708 <li><eventlink id="CompiledMethodLoad"></eventlink></li> 9709 <li><eventlink id="CompiledMethodUnload"></eventlink></li> 9710 <li><eventlink id="DynamicCodeGenerated"></eventlink></li> 9711 <li><eventlink id="DataDumpRequest"></eventlink></li> 9712 </ul> 9713 <p/> 9714 Initially, no events are enabled at either the thread level 9715 or the global level. 9716 <p/> 9717 Any needed capabilities (see Event Enabling Capabilities below) must be possessed 9718 before calling this function. 9719 <p/> 9720 Details on events are 9721 described <internallink id="EventSection">below</internallink>. 9722 </description> 9723 <origin>jvmdiClone</origin> 9724 <eventcapabilities></eventcapabilities> 9725 <parameters> 9726 <param id="mode"> 9727 <enum>jvmtiEventMode</enum> 9728 <description> 9729 <code>JVMTI_ENABLE</code> or <code>JVMTI_DISABLE</code> 9730 </description> 9731 </param> 9732 <param id="event_type"> 9733 <enum>jvmtiEvent</enum> 9734 <description> 9735 the event to control 9736 </description> 9737 </param> 9738 <param id="event_thread"> 9739 <ptrtype> 9740 <jthread impl="noconvert"/> 9741 <nullok>event is controlled at the global level</nullok> 9742 </ptrtype> 9743 <description> 9744 The thread to control 9745 </description> 9746 </param> 9747 <param id="..."> 9748 <varargs/> 9749 <description> 9750 for future expansion 9751 </description> 9752 </param> 9753 </parameters> 9754 <errors> 9755 <error id="JVMTI_ERROR_INVALID_THREAD"> 9756 <paramlink id="event_thread"/> is non-<code>NULL</code> and is not a valid thread. 9757 </error> 9758 <error id="JVMTI_ERROR_THREAD_NOT_ALIVE"> 9759 <paramlink id="event_thread"/> is non-<code>NULL</code> and is not alive 9760 (has not been started or has terminated). 9761 </error> 9762 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 9763 thread level control was attempted on events which do not 9764 permit thread level control. 9765 </error> 9766 <error id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY"> 9767 The Required Event Enabling Capability is not possessed. 9768 </error> 9769 </errors> 9770 </function> 9771 9772 <function id="GenerateEvents" num="123"> 9773 <synopsis>Generate Events</synopsis> 9774 <description> 9775 Generate events to represent the current state of the VM. 9776 For example, if <paramlink id="event_type"/> is 9777 <code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code>, 9778 a <eventlink id="CompiledMethodLoad"></eventlink> event will be 9779 sent for each currently compiled method. 9780 Methods that were loaded and now have been unloaded are not sent. 9781 The history of what events have previously been sent does not 9782 effect what events are sent by this function--for example, 9783 all currently compiled methods 9784 will be sent each time this function is called. 9785 <p/> 9786 This function is useful when 9787 events may have been missed due to the agent attaching after program 9788 execution begins; this function generates the missed events. 9789 <p/> 9790 Attempts to execute Java programming language code or 9791 JNI functions may be paused until this function returns - 9792 so neither should be called from the thread sending the event. 9793 This function returns only after the missed events have been 9794 sent, processed and have returned. 9795 The event may be sent on a different thread than the thread 9796 on which the event occurred. 9797 The callback for the event must be set with 9798 <functionlink id="SetEventCallbacks"></functionlink> 9799 and the event must be enabled with 9800 <functionlink id="SetEventNotificationMode"></functionlink> 9801 or the events will not occur. 9802 If the VM no longer has the information to generate some or 9803 all of the requested events, the events are simply not sent - 9804 no error is returned. 9805 <p/> 9806 Only the following events are supported: 9807 <ul> 9808 <li><eventlink id="CompiledMethodLoad"></eventlink></li> 9809 <li><eventlink id="DynamicCodeGenerated"></eventlink></li> 9810 </ul> 9811 </description> 9812 <origin>new</origin> 9813 <capabilities> 9814 <capability id="can_generate_compiled_method_load_events"></capability> 9815 </capabilities> 9816 <parameters> 9817 <param id="event_type"> 9818 <enum>jvmtiEvent</enum> 9819 <description> 9820 The type of event to generate. Must be one of these: 9821 <ul> 9822 <li><eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink></li> 9823 <li><eventlink id="DynamicCodeGenerated"><code>JVMTI_EVENT_DYNAMIC_CODE_GENERATED</code></eventlink></li> 9824 </ul> 9825 </description> 9826 </param> 9827 </parameters> 9828 <errors> 9829 <error id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY"> 9830 <paramlink id="event_type"/> is 9831 <eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink> 9832 and <fieldlink id="can_generate_compiled_method_load_events" struct="jvmtiCapabilities"></fieldlink> 9833 is <code>false</code>. 9834 </error> 9835 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 9836 <paramlink id="event_type"/> is other than 9837 <eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink> 9838 or <eventlink id="DynamicCodeGenerated"><code>JVMTI_EVENT_DYNAMIC_CODE_GENERATED</code></eventlink>. 9839 </error> 9840 </errors> 9841 </function> 9842 9843 </category> 9844 9845 <category id="extension" label="Extension Mechanism"> 9846 9847 <intro> 9848 These functions 9849 allow a <jvmti/> implementation to provide functions and events 9850 beyond those defined in this specification. 9851 <p/> 9852 Both extension functions and extension events have parameters 9853 each of which has a 'type' and 'kind' chosen from the following tables: 9854 9855 <constants id="jvmtiParamTypes" label="Extension Function/Event Parameter Types" kind="enum"> 9856 <constant id="JVMTI_TYPE_JBYTE" num="101"> 9857 Java programming language primitive type - <code>byte</code>. 9858 JNI type <code>jbyte</code>. 9859 </constant> 9860 <constant id="JVMTI_TYPE_JCHAR" num="102"> 9861 Java programming language primitive type - <code>char</code>. 9862 JNI type <code>jchar</code>. 9863 </constant> 9864 <constant id="JVMTI_TYPE_JSHORT" num="103"> 9865 Java programming language primitive type - <code>short</code>. 9866 JNI type <code>jshort</code>. 9867 </constant> 9868 <constant id="JVMTI_TYPE_JINT" num="104"> 9869 Java programming language primitive type - <code>int</code>. 9870 JNI type <datalink id="jint"></datalink>. 9871 </constant> 9872 <constant id="JVMTI_TYPE_JLONG" num="105"> 9873 Java programming language primitive type - <code>long</code>. 9874 JNI type <datalink id="jlong"></datalink>. 9875 </constant> 9876 <constant id="JVMTI_TYPE_JFLOAT" num="106"> 9877 Java programming language primitive type - <code>float</code>. 9878 JNI type <datalink id="jfloat"></datalink>. 9879 </constant> 9880 <constant id="JVMTI_TYPE_JDOUBLE" num="107"> 9881 Java programming language primitive type - <code>double</code>. 9882 JNI type <datalink id="jdouble"></datalink>. 9883 </constant> 9884 <constant id="JVMTI_TYPE_JBOOLEAN" num="108"> 9885 Java programming language primitive type - <code>boolean</code>. 9886 JNI type <datalink id="jboolean"></datalink>. 9887 </constant> 9888 <constant id="JVMTI_TYPE_JOBJECT" num="109"> 9889 Java programming language object type - <code>java.lang.Object</code>. 9890 JNI type <datalink id="jobject"></datalink>. 9891 Returned values are JNI local references and must be managed. 9892 </constant> 9893 <constant id="JVMTI_TYPE_JTHREAD" num="110"> 9894 Java programming language object type - <code>java.lang.Thread</code>. 9895 <jvmti/> type <datalink id="jthread"></datalink>. 9896 Returned values are JNI local references and must be managed. 9897 </constant> 9898 <constant id="JVMTI_TYPE_JCLASS" num="111"> 9899 Java programming language object type - <code>java.lang.Class</code>. 9900 JNI type <datalink id="jclass"></datalink>. 9901 Returned values are JNI local references and must be managed. 9902 </constant> 9903 <constant id="JVMTI_TYPE_JVALUE" num="112"> 9904 Union of all Java programming language primitive and object types - 9905 JNI type <datalink id="jvalue"></datalink>. 9906 Returned values which represent object types are JNI local references and must be managed. 9907 </constant> 9908 <constant id="JVMTI_TYPE_JFIELDID" num="113"> 9909 Java programming language field identifier - 9910 JNI type <datalink id="jfieldID"></datalink>. 9911 </constant> 9912 <constant id="JVMTI_TYPE_JMETHODID" num="114"> 9913 Java programming language method identifier - 9914 JNI type <datalink id="jmethodID"></datalink>. 9915 </constant> 9916 <constant id="JVMTI_TYPE_CCHAR" num="115"> 9917 C programming language type - <code>char</code>. 9918 </constant> 9919 <constant id="JVMTI_TYPE_CVOID" num="116"> 9920 C programming language type - <code>void</code>. 9921 </constant> 9922 <constant id="JVMTI_TYPE_JNIENV" num="117"> 9923 JNI environment - <code>JNIEnv</code>. 9924 Should be used with the correct <datalink id="jvmtiParamKind"/> to make it a pointer type. 9925 </constant> 9926 </constants> 9927 9928 <constants id="jvmtiParamKind" label="Extension Function/Event Parameter Kinds" kind="enum"> 9929 <constant id="JVMTI_KIND_IN" num="91"> 9930 Ingoing argument - <code>foo</code>. 9931 </constant> 9932 <constant id="JVMTI_KIND_IN_PTR" num="92"> 9933 Ingoing pointer argument - <code>const foo*</code>. 9934 </constant> 9935 <constant id="JVMTI_KIND_IN_BUF" num="93"> 9936 Ingoing array argument - <code>const foo*</code>. 9937 </constant> 9938 <constant id="JVMTI_KIND_ALLOC_BUF" num="94"> 9939 Outgoing allocated array argument - <code>foo**</code>. 9940 Free with <code>Deallocate</code>. 9941 </constant> 9942 <constant id="JVMTI_KIND_ALLOC_ALLOC_BUF" num="95"> 9943 Outgoing allocated array of allocated arrays argument - <code>foo***</code>. 9944 Free with <code>Deallocate</code>. 9945 </constant> 9946 <constant id="JVMTI_KIND_OUT" num="96"> 9947 Outgoing argument - <code>foo*</code>. 9948 </constant> 9949 <constant id="JVMTI_KIND_OUT_BUF" num="97"> 9950 Outgoing array argument (pre-allocated by agent) - <code>foo*</code>. 9951 Do not <code>Deallocate</code>. 9952 </constant> 9953 </constants> 9954 9955 </intro> 9956 9957 <typedef id="jvmtiParamInfo" label="Extension Function/Event Parameter Info"> 9958 <field id="name"> 9959 <allocfieldbuf><char/></allocfieldbuf> 9960 <description> 9961 The parameter name, encoded as a 9962 <internallink id="mUTF">modified UTF-8</internallink> string 9963 </description> 9964 </field> 9965 <field id="kind"> 9966 <enum>jvmtiParamKind</enum> 9967 <description> 9968 The kind of the parameter - type modifiers 9969 </description> 9970 </field> 9971 <field id="base_type"> 9972 <enum>jvmtiParamTypes</enum> 9973 <description> 9974 The base type of the parameter - modified by <code>kind</code> 9975 </description> 9976 </field> 9977 <field id="null_ok"> 9978 <jboolean/> 9979 <description> 9980 Is a <code>NULL</code> argument permitted? Applies only to pointer and object types. 9981 </description> 9982 </field> 9983 </typedef> 9984 9985 <callback id="jvmtiExtensionFunction"> 9986 <enum>jvmtiError</enum> 9987 <synopsis>Extension Function</synopsis> 9988 <description> 9989 This is the implementation-specific extension function. 9990 </description> 9991 <parameters> 9992 <param id="jvmti_env"> 9993 <outptr> 9994 <struct>jvmtiEnv</struct> 9995 </outptr> 9996 <description> 9997 The <jvmti/> environment is the only fixed parameter for extension functions. 9998 </description> 9999 </param> 10000 <param id="..."> 10001 <varargs/> 10002 <description> 10003 The extension function-specific parameters 10004 </description> 10005 </param> 10006 </parameters> 10007 </callback> 10008 10009 <function id="GetExtensionFunctions" phase="onload" num="124"> 10010 <synopsis>Get Extension Functions</synopsis> 10011 10012 <typedef id="jvmtiExtensionFunctionInfo" label="Extension Function Info"> 10013 <field id="func"> 10014 <ptrtype> 10015 <struct>jvmtiExtensionFunction</struct> 10016 </ptrtype> 10017 <description> 10018 The actual function to call 10019 </description> 10020 </field> 10021 <field id="id"> 10022 <allocfieldbuf><char/></allocfieldbuf> 10023 <description> 10024 The identifier for the extension function, encoded as a 10025 <internallink id="mUTF">modified UTF-8</internallink> string. 10026 Uses package name conventions. 10027 For example, <code>com.sun.hotspot.bar</code> 10028 </description> 10029 </field> 10030 <field id="short_description"> 10031 <allocfieldbuf><char/></allocfieldbuf> 10032 <description> 10033 A one sentence description of the function, encoded as a 10034 <internallink id="mUTF">modified UTF-8</internallink> string. 10035 </description> 10036 </field> 10037 <field id="param_count"> 10038 <jint/> 10039 <description> 10040 The number of parameters excluding <code>jvmtiEnv *jvmti_env</code> 10041 </description> 10042 </field> 10043 <field id="params"> 10044 <allocfieldbuf outcount="param_count"> 10045 <struct>jvmtiParamInfo</struct> 10046 </allocfieldbuf> 10047 <description> 10048 Array of 10049 <fieldlink id="param_count" struct="jvmtiExtensionFunctionInfo"></fieldlink> 10050 parameters (<code>jvmtiEnv *jvmti_env</code> excluded) 10051 </description> 10052 </field> 10053 <field id="error_count"> 10054 <jint/> 10055 <description> 10056 The number of possible error returns (excluding universal errors) 10057 </description> 10058 </field> 10059 <field id="errors"> 10060 <allocfieldbuf outcount="error_count"> 10061 <enum>jvmtiError</enum> 10062 </allocfieldbuf> 10063 <description> 10064 Array of <fieldlink id="error_count" struct="jvmtiExtensionFunctionInfo"></fieldlink> 10065 possible errors 10066 </description> 10067 </field> 10068 </typedef> 10069 10070 <description> 10071 Returns the set of extension functions. 10072 </description> 10073 <origin>new</origin> 10074 <capabilities> 10075 </capabilities> 10076 <parameters> 10077 <param id="extension_count_ptr"> 10078 <outptr><jint/></outptr> 10079 <description> 10080 On return, points to the number of extension functions 10081 </description> 10082 </param> 10083 <param id="extensions"> 10084 <allocbuf outcount="extension_count_ptr"><struct>jvmtiExtensionFunctionInfo</struct></allocbuf> 10085 <description> 10086 Returns an array of extension function info, one per function 10087 </description> 10088 </param> 10089 </parameters> 10090 <errors> 10091 </errors> 10092 </function> 10093 10094 <function id="GetExtensionEvents" phase="onload" num="125"> 10095 <synopsis>Get Extension Events</synopsis> 10096 10097 <typedef id="jvmtiExtensionEventInfo" label="Extension Event Info"> 10098 <field id="extension_event_index"> 10099 <jint/> 10100 <description> 10101 The identifying index of the event 10102 </description> 10103 </field> 10104 <field id="id"> 10105 <allocfieldbuf><char/></allocfieldbuf> 10106 <description> 10107 The identifier for the extension event, encoded as a 10108 <internallink id="mUTF">modified UTF-8</internallink> string. 10109 Uses package name conventions. 10110 For example, <code>com.sun.hotspot.bar</code> 10111 </description> 10112 </field> 10113 <field id="short_description"> 10114 <allocfieldbuf><char/></allocfieldbuf> 10115 <description> 10116 A one sentence description of the event, encoded as a 10117 <internallink id="mUTF">modified UTF-8</internallink> string. 10118 </description> 10119 </field> 10120 <field id="param_count"> 10121 <jint/> 10122 <description> 10123 The number of parameters excluding <code>jvmtiEnv *jvmti_env</code> 10124 </description> 10125 </field> 10126 <field id="params"> 10127 <allocfieldbuf outcount="param_count"> 10128 <struct>jvmtiParamInfo</struct> 10129 </allocfieldbuf> 10130 <description> 10131 Array of 10132 <fieldlink id="param_count" struct="jvmtiExtensionEventInfo"></fieldlink> 10133 parameters (<code>jvmtiEnv *jvmti_env</code> excluded) 10134 </description> 10135 </field> 10136 </typedef> 10137 10138 <description> 10139 Returns the set of extension events. 10140 </description> 10141 <origin>new</origin> 10142 <capabilities> 10143 </capabilities> 10144 <parameters> 10145 <param id="extension_count_ptr"> 10146 <outptr><jint/></outptr> 10147 <description> 10148 On return, points to the number of extension events 10149 </description> 10150 </param> 10151 <param id="extensions"> 10152 <allocbuf outcount="extension_count_ptr"><struct>jvmtiExtensionEventInfo</struct></allocbuf> 10153 <description> 10154 Returns an array of extension event info, one per event 10155 </description> 10156 </param> 10157 </parameters> 10158 <errors> 10159 </errors> 10160 </function> 10161 10162 <callback id="jvmtiExtensionEvent"> 10163 <void/> 10164 <synopsis>Extension Event</synopsis> 10165 <description> 10166 This is the implementation-specific event. 10167 The event handler is set with 10168 <functionlink id="SetExtensionEventCallback"/>. 10169 <p/> 10170 Event handlers for extension events must be declared varargs to match this definition. 10171 Failure to do so could result in calling convention mismatch and undefined behavior 10172 on some platforms. 10173 <p/> 10174 For example, if the <code>jvmtiParamInfo</code> 10175 returned by <functionlink id="GetExtensionEvents"/> indicates that 10176 there is a <code>jint</code> parameter, the event handler should be 10177 declared: 10178 <example> 10179 void JNICALL myHandler(jvmtiEnv* jvmti_env, ...) 10180 </example> 10181 Note the terminal "<code>...</code>" which indicates varargs. 10182 The <code>jint</code> argument inside <code>myHandler</code> needs to be extracted using 10183 the <code>va_*</code> syntax of the C programming language. 10184 </description> 10185 <parameters> 10186 <param id="jvmti_env"> 10187 <outptr> 10188 <struct>jvmtiEnv</struct> 10189 </outptr> 10190 <description> 10191 The <jvmti/> environment is the only fixed parameter for extension events. 10192 </description> 10193 </param> 10194 <param id="..."> 10195 <varargs/> 10196 <description> 10197 The extension event-specific parameters 10198 </description> 10199 </param> 10200 </parameters> 10201 </callback> 10202 10203 <function id="SetExtensionEventCallback" phase="onload" num="126"> 10204 <synopsis>Set Extension Event Callback</synopsis> 10205 10206 <description> 10207 Sets the callback function for an extension event and 10208 enables the event. Or, if the callback is <code>NULL</code>, disables 10209 the event. Note that unlike standard events, setting 10210 the callback and enabling the event are a single operation. 10211 </description> 10212 <origin>new</origin> 10213 <capabilities> 10214 </capabilities> 10215 <parameters> 10216 <param id="extension_event_index"> 10217 <jint/> 10218 <description> 10219 Identifies which callback to set. 10220 This index is the 10221 <fieldlink id="extension_event_index" struct="jvmtiExtensionEventInfo"></fieldlink> 10222 field of 10223 <datalink id="jvmtiExtensionEventInfo"/>. 10224 </description> 10225 </param> 10226 <param id="callback"> 10227 <ptrtype> 10228 <struct>jvmtiExtensionEvent</struct> 10229 <nullok>disable the event</nullok> 10230 </ptrtype> 10231 <description> 10232 If <code>callback</code> is non-<code>NULL</code>, 10233 set <code>callback</code> to be the event callback function 10234 and enable the event. 10235 </description> 10236 </param> 10237 </parameters> 10238 <errors> 10239 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 10240 <paramlink id="extension_event_index"/> is not an 10241 <fieldlink id="extension_event_index" 10242 struct="jvmtiExtensionEventInfo"/> 10243 returned by 10244 <functionlink id="GetExtensionEvents"/> 10245 </error> 10246 </errors> 10247 </function> 10248 10249 </category> 10250 10251 <category id="capability" label="Capability"> 10252 10253 <intro> 10254 The capabilities functions allow you to change the 10255 functionality available to <jvmti/>--that is, 10256 which <jvmti/> 10257 functions can be called, what events can be generated, 10258 and what functionality these events and functions can 10259 provide. 10260 <p/> 10261 The "Capabilities" section of each function and event describe which 10262 capabilities, if any, they are associated with. "Required Functionality" 10263 means it is available for use and no capabilities must be added to use it. 10264 "Optional Functionality" means the agent must possess the capability 10265 before it can be used. 10266 To possess a capability, the agent must 10267 <functionlink id="AddCapabilities">add the capability</functionlink>. 10268 "Optional Features" describe capabilities which, 10269 if added, extend the feature set. 10270 <p/> 10271 The potentially available capabilities of each <jvmti/> implementation are different. 10272 Depending on the implementation, a capability: 10273 <ul> 10274 <li>may never be added</li> 10275 <li>may be added in either the <code>OnLoad</code> or live phase in any environment</li> 10276 <li>may be added only during the <code>OnLoad</code> phase</li> 10277 <li>may be possessed by only one environment at a time</li> 10278 <li>may be possessed by only one environment at a time, 10279 and only during the <code>OnLoad</code> phase</li> 10280 <li>and so on ...</li> 10281 </ul> 10282 Frequently, the addition of a capability may incur a cost in execution speed, start up 10283 time, and/or memory footprint. Note that the overhead of using a capability 10284 is completely different than the overhead of possessing a capability. 10285 Take single stepping as an example. When single stepping is on (that 10286 is, when the event is enabled and thus actively sending events) 10287 the overhead of sending and processing an event 10288 on each instruction is huge in any implementation. 10289 However, the overhead of possessing the capability may be small or large, 10290 depending on the implementation. Also, when and if a capability is potentially 10291 available depends on the implementation. Some examples: 10292 <ul> 10293 <li>One VM might perform all execution by compiling bytecodes into 10294 native code and be unable to generate single step instructions. 10295 In this implementation the capability can not be added.</li> 10296 <li>Another VM may be able to switch execution to a single stepping 10297 interpreter at any time. In this implementation, having the capability has no 10298 overhead and could be added at any time.</li> 10299 <li>Yet another VM might be able to choose a bytecode compiling or single stepping capable interpreted 10300 execution engine at start up, but be unable to switch between them. 10301 In this implementation the capability would need to be added 10302 during the <code>OnLoad</code> phase (before bytecode 10303 execution begins) and would have a large impact on execution speed 10304 even if single stepping was never used.</li> 10305 <li>Still another VM might be able to add an "is single stepping on" check 10306 into compiled bytecodes or a generated interpreter. Again in this implementation 10307 the capability would need to be added during the <code>OnLoad</code> phase but the overhead (a test 10308 and branch on each instruction) would be considerably less.</li> 10309 </ul> 10310 <p/> 10311 Each <jvmti/> <internallink id="environments">environment</internallink> 10312 has its own set of capabilities. 10313 Initially, that set is empty. 10314 Any desired capability must be added. 10315 If possible, capabilities should be added during the <code>OnLoad</code> phase. For most 10316 virtual machines certain capabilities require special set up for 10317 the virtual machine and this set up must happen 10318 during the <code>OnLoad</code> phase, before the virtual machine begins execution. 10319 Once a capability is added, it can 10320 only be removed if explicitly relinquished by the environment. 10321 <p/> 10322 The agent can, 10323 <functionlink id="GetPotentialCapabilities">determine what 10324 capabilities this VM can potentially provide</functionlink>, 10325 <functionlink id="AddCapabilities">add the capabilities 10326 to be used</functionlink>, 10327 <functionlink id="RelinquishCapabilities">release capabilities 10328 which are no longer needed</functionlink>, and 10329 <functionlink id="GetCapabilities">examine the currently available 10330 capabilities</functionlink>. 10331 </intro> 10332 10333 <intro id="capabilityExamples" label="Capability Examples"> 10334 For example, a freshly started agent (in the <code>OnLoad</code> function) 10335 wants to enable all possible capabilities. 10336 Note that, in general, this is not advisable as the agent may suffer 10337 a performance penalty for functionality it is not using. 10338 The code might look like this in C: 10339 <example> 10340 jvmtiCapabilities capa; 10341 jvmtiError err; 10342 10343 err = (*jvmti)->GetPotentialCapabilities(jvmti, &capa); 10344 if (err == JVMTI_ERROR_NONE) { 10345 err = (*jvmti)->AddCapabilities(jvmti, &capa); 10346 </example> 10347 For example, if an agent wants to check if it can get 10348 the bytecodes of a method (that is, it wants to check 10349 if it previously added this capability and has not 10350 relinquished it), the code might 10351 look like this in C: 10352 <example> 10353 jvmtiCapabilities capa; 10354 jvmtiError err; 10355 10356 err = (*jvmti)->GetCapabilities(jvmti, &capa); 10357 if (err == JVMTI_ERROR_NONE) { 10358 if (capa.can_get_bytecodes) { ... } } 10359 </example> 10360 </intro> 10361 10362 <capabilitiestypedef id="jvmtiCapabilities" label="The Capabilities Structure"> 10363 <description> 10364 The functions in this category use this capabilities structure 10365 which contains boolean flags corresponding to each capability: 10366 </description> 10367 <capabilityfield id="can_tag_objects"> 10368 <description> 10369 Can set and get tags, as described in the 10370 <internallink id="Heap">Heap category</internallink>. 10371 </description> 10372 </capabilityfield> 10373 <capabilityfield id="can_generate_field_modification_events"> 10374 <description> 10375 Can set watchpoints on field modification - 10376 <functionlink id="SetFieldModificationWatch"></functionlink> 10377 </description> 10378 </capabilityfield> 10379 <capabilityfield id="can_generate_field_access_events"> 10380 <description> 10381 Can set watchpoints on field access - 10382 <functionlink id="SetFieldAccessWatch"></functionlink> 10383 </description> 10384 </capabilityfield> 10385 <capabilityfield id="can_get_bytecodes"> 10386 <description> 10387 Can get bytecodes of a method <functionlink id="GetBytecodes"></functionlink> 10388 </description> 10389 </capabilityfield> 10390 <capabilityfield id="can_get_synthetic_attribute"> 10391 <description> 10392 Can test if a field or method is synthetic - 10393 <functionlink id="IsFieldSynthetic"></functionlink> and 10394 <functionlink id="IsMethodSynthetic"></functionlink> 10395 </description> 10396 </capabilityfield> 10397 <capabilityfield id="can_get_owned_monitor_info"> 10398 <description> 10399 Can get information about ownership of monitors - 10400 <functionlink id="GetOwnedMonitorInfo"></functionlink> 10401 </description> 10402 </capabilityfield> 10403 <capabilityfield id="can_get_current_contended_monitor"> 10404 <description> 10405 Can <functionlink id="GetCurrentContendedMonitor"></functionlink> 10406 </description> 10407 </capabilityfield> 10408 <capabilityfield id="can_get_monitor_info"> 10409 <description> 10410 Can <functionlink id="GetObjectMonitorUsage"></functionlink> 10411 </description> 10412 </capabilityfield> 10413 <capabilityfield id="can_pop_frame"> 10414 <description> 10415 Can pop frames off the stack - <functionlink id="PopFrame"></functionlink> 10416 </description> 10417 </capabilityfield> 10418 <capabilityfield id="can_redefine_classes"> 10419 <description> 10420 Can redefine classes with <functionlink id="RedefineClasses"/>. 10421 </description> 10422 </capabilityfield> 10423 <capabilityfield id="can_signal_thread"> 10424 <description> 10425 Can send stop or interrupt to threads 10426 </description> 10427 </capabilityfield> 10428 <capabilityfield id="can_get_source_file_name"> 10429 <description> 10430 Can get the source file name of a class 10431 </description> 10432 </capabilityfield> 10433 <capabilityfield id="can_get_line_numbers"> 10434 <description> 10435 Can get the line number table of a method 10436 </description> 10437 </capabilityfield> 10438 <capabilityfield id="can_get_source_debug_extension"> 10439 <description> 10440 Can get the source debug extension of a class 10441 </description> 10442 </capabilityfield> 10443 <capabilityfield id="can_access_local_variables"> 10444 <description> 10445 Can set and get local variables 10446 </description> 10447 </capabilityfield> 10448 <capabilityfield id="can_maintain_original_method_order"> 10449 <description> 10450 Can return methods in the order they occur in the class file 10451 </description> 10452 </capabilityfield> 10453 <capabilityfield id="can_generate_single_step_events"> 10454 <description> 10455 Can get <eventlink id="SingleStep">single step</eventlink> events 10456 </description> 10457 </capabilityfield> 10458 <capabilityfield id="can_generate_exception_events"> 10459 <description> 10460 Can get <eventlink id="Exception">exception thrown</eventlink> and 10461 <eventlink id="ExceptionCatch">exception catch</eventlink> events 10462 </description> 10463 </capabilityfield> 10464 <capabilityfield id="can_generate_frame_pop_events"> 10465 <description> 10466 Can <functionlink id="NotifyFramePop">set</functionlink> and thus get 10467 <eventlink id="FramePop"></eventlink> events 10468 </description> 10469 </capabilityfield> 10470 <capabilityfield id="can_generate_breakpoint_events"> 10471 <description> 10472 Can <functionlink id="SetBreakpoint">set</functionlink> and thus get 10473 <eventlink id="Breakpoint"></eventlink> events 10474 </description> 10475 </capabilityfield> 10476 <capabilityfield id="can_suspend"> 10477 <description> 10478 Can suspend and resume threads 10479 </description> 10480 </capabilityfield> 10481 <capabilityfield id="can_redefine_any_class"> 10482 <description> 10483 <functionlink id="RedefineClasses"/> can be called on any modifiable class. 10484 See <functionlink id="IsModifiableClass"/>. 10485 (<fieldlink id="can_redefine_classes" struct="jvmtiCapabilities"/> 10486 must also be set) 10487 </description> 10488 </capabilityfield> 10489 <capabilityfield id="can_get_current_thread_cpu_time"> 10490 <description> 10491 Can <functionlink id="GetCurrentThreadCpuTime">get</functionlink> 10492 current thread CPU time 10493 </description> 10494 </capabilityfield> 10495 <capabilityfield id="can_get_thread_cpu_time"> 10496 <description> 10497 Can <functionlink id="GetThreadCpuTime">get</functionlink> 10498 thread CPU time 10499 </description> 10500 </capabilityfield> 10501 <capabilityfield id="can_generate_method_entry_events" 10502 disp1="can_generate" disp2="_method_entry_events" 10503 > 10504 <description> 10505 Can generate method entry events on entering a method 10506 </description> 10507 </capabilityfield> 10508 <capabilityfield id="can_generate_method_exit_events" 10509 disp1="can_generate" disp2="_method_exit_events" 10510 > 10511 <description> 10512 Can generate method exit events on leaving a method 10513 </description> 10514 </capabilityfield> 10515 <capabilityfield id="can_generate_all_class_hook_events" 10516 disp1="can_generate" disp2="_all_class_hook_events" 10517 > 10518 <description> 10519 Can generate ClassFileLoadHook events for every loaded class. 10520 </description> 10521 </capabilityfield> 10522 <capabilityfield id="can_generate_compiled_method_load_events" 10523 disp1="can_generate" disp2="_compiled_method_load_events" 10524 > 10525 <description> 10526 Can generate events when a method is compiled or unloaded 10527 </description> 10528 </capabilityfield> 10529 <capabilityfield id="can_generate_monitor_events" 10530 disp1="can_generate" disp2="_monitor_events" 10531 > 10532 <description> 10533 Can generate events on monitor activity 10534 </description> 10535 </capabilityfield> 10536 <capabilityfield id="can_generate_vm_object_alloc_events" 10537 disp1="can_generate" disp2="_vm_object_alloc_events" 10538 > 10539 <description> 10540 Can generate events on VM allocation of an object 10541 </description> 10542 </capabilityfield> 10543 <capabilityfield id="can_generate_native_method_bind_events" 10544 disp1="can_generate" disp2="_native_method_bind_events" 10545 > 10546 <description> 10547 Can generate events when a native method is bound to its 10548 implementation 10549 </description> 10550 </capabilityfield> 10551 <capabilityfield id="can_generate_garbage_collection_events" 10552 disp1="can_generate" disp2="_garbage_collection_events" 10553 > 10554 <description> 10555 Can generate events when garbage collection begins or ends 10556 </description> 10557 </capabilityfield> 10558 <capabilityfield id="can_generate_object_free_events" 10559 disp1="can_generate" disp2="_object_free_events" 10560 > 10561 <description> 10562 Can generate events when the garbage collector frees an object 10563 </description> 10564 </capabilityfield> 10565 <capabilityfield id="can_force_early_return" since="1.1"> 10566 <description> 10567 Can return early from a method, as described in the 10568 <internallink id="ForceEarlyReturn">Force Early Return category</internallink>. 10569 </description> 10570 </capabilityfield> 10571 <capabilityfield id="can_get_owned_monitor_stack_depth_info" since="1.1"> 10572 <description> 10573 Can get information about owned monitors with stack depth - 10574 <functionlink id="GetOwnedMonitorStackDepthInfo"></functionlink> 10575 </description> 10576 </capabilityfield> 10577 <capabilityfield id="can_get_constant_pool" since="1.1"> 10578 <description> 10579 Can get the constant pool of a class - 10580 <functionlink id="GetConstantPool"></functionlink> 10581 </description> 10582 </capabilityfield> 10583 <capabilityfield id="can_set_native_method_prefix" since="1.1"> 10584 <description> 10585 Can set prefix to be applied when native method cannot be resolved - 10586 <functionlink id="SetNativeMethodPrefix"/> and 10587 <functionlink id="SetNativeMethodPrefixes"/> 10588 </description> 10589 </capabilityfield> 10590 <capabilityfield id="can_retransform_classes" since="1.1"> 10591 <description> 10592 Can retransform classes with <functionlink id="RetransformClasses"/>. 10593 In addition to the restrictions imposed by the specific 10594 implementation on this capability (see the 10595 <internallink id="capability">Capability</internallink> section), 10596 this capability must be set before the 10597 <eventlink id="ClassFileLoadHook"/> event is enabled for the 10598 first time in this environment. 10599 An environment that possesses this capability at the time that 10600 <code>ClassFileLoadHook</code> is enabled for the first time is 10601 said to be <i>retransformation capable</i>. 10602 An environment that does not possess this capability at the time that 10603 <code>ClassFileLoadHook</code> is enabled for the first time is 10604 said to be <i>retransformation incapable</i>. 10605 </description> 10606 </capabilityfield> 10607 <capabilityfield id="can_retransform_any_class" since="1.1"> 10608 <description> 10609 <functionlink id="RetransformClasses"/> can be called on any modifiable class. 10610 See <functionlink id="IsModifiableClass"/>. 10611 (<fieldlink id="can_retransform_classes" struct="jvmtiCapabilities"/> 10612 must also be set) 10613 </description> 10614 </capabilityfield> 10615 <capabilityfield id="can_generate_resource_exhaustion_heap_events" since="1.1"> 10616 <description> 10617 Can generate events when the VM is unable to allocate memory from 10618 the <tm>Java</tm> platform heap. 10619 See <eventlink id="ResourceExhausted"/>. 10620 </description> 10621 </capabilityfield> 10622 <capabilityfield id="can_generate_resource_exhaustion_threads_events" since="1.1"> 10623 <description> 10624 Can generate events when the VM is unable to create a thread. 10625 See <eventlink id="ResourceExhausted"/>. 10626 </description> 10627 </capabilityfield> 10628 <capabilityfield id="can_generate_early_vmstart" since="9"> 10629 <description> 10630 Can generate the <code>VMStart</code> event early. 10631 See <eventlink id="VMStart"/>. 10632 </description> 10633 </capabilityfield> 10634 <capabilityfield id="can_generate_early_class_hook_events" since="9"> 10635 <description> 10636 Can generate the <eventlink id="ClassFileLoadHook"/> events 10637 in the primordial phase. If this capability and 10638 <internallink id="jvmtiCapabilities.can_generate_all_class_hook_events"> 10639 <code>can_generate_all_class_hook_events</code></internallink> 10640 are enabled then the <eventlink id="ClassFileLoadHook"/> events 10641 can be posted for classes loaded in the primordial phase. 10642 See <eventlink id="ClassFileLoadHook"/>. 10643 </description> 10644 </capabilityfield> 10645 <capabilityfield id="can_generate_sampled_object_alloc_events" since="11"> 10646 <description> 10647 Can generate sampled allocation events. 10648 If this capability is enabled then the heap sampling method 10649 <functionlink id="SetHeapSamplingInterval"></functionlink> can be 10650 called and <eventlink id="SampledObjectAlloc"></eventlink> events can be generated. 10651 </description> 10652 </capabilityfield> 10653 <capabilityfield id="can_support_virtual_threads" since="19"> 10654 <description> 10655 <b> can_support_virtual_threads is a preview API of the Java platform. </b> 10656 <i>Preview features may be removed in a future release, or upgraded to 10657 permanent features of the Java platform.</i> 10658 <p/> 10659 Can support virtual threads. 10660 If this capability is enabled then the following functions can be called: 10661 <functionlink id="SuspendAllVirtualThreads"></functionlink>, 10662 <functionlink id="ResumeAllVirtualThreads"></functionlink>, 10663 and the following events can be enabled: 10664 <eventlink id="VirtualThreadStart"></eventlink>, 10665 <eventlink id="VirtualThreadEnd"></eventlink>. 10666 </description> 10667 </capabilityfield> 10668 </capabilitiestypedef> 10669 10670 <function id="GetPotentialCapabilities" jkernel="yes" phase="onload" num="140"> 10671 <synopsis>Get Potential Capabilities</synopsis> 10672 <description> 10673 Returns via <paramlink id="capabilities_ptr"></paramlink> the <jvmti/> 10674 features that can potentially be possessed by this environment 10675 at this time. 10676 The returned capabilities differ from the complete set of capabilities 10677 implemented by the VM in two cases: another environment possesses 10678 capabilities that can only be possessed by one environment, or the 10679 current <functionlink id="GetPhase">phase</functionlink> is live, 10680 and certain capabilities can only be added during the <code>OnLoad</code> phase. 10681 The <functionlink id="AddCapabilities"></functionlink> function 10682 may be used to set any or all or these capabilities. 10683 Currently possessed capabilities are included. 10684 <p/> 10685 Typically this function is used in the <code>OnLoad</code> function. 10686 Some virtual machines may allow a limited set of capabilities to be 10687 added in the live phase. 10688 In this case, the set of potentially available capabilities 10689 will likely differ from the <code>OnLoad</code> phase set. 10690 <p/> 10691 See the 10692 <internallink id="capabilityExamples">Capability Examples</internallink>. 10693 </description> 10694 <origin>new</origin> 10695 <capabilities> 10696 </capabilities> 10697 <parameters> 10698 <param id="capabilities_ptr"> 10699 <outptr><struct>jvmtiCapabilities</struct></outptr> 10700 <description> 10701 On return, points to the <jvmti/> capabilities that may be added. 10702 </description> 10703 </param> 10704 </parameters> 10705 <errors> 10706 </errors> 10707 </function> 10708 10709 <elide> 10710 <function id="EstimateCostOfCapabilities" phase="onload" num="141"> 10711 <synopsis>Estimate Cost Of Capabilities</synopsis> 10712 <description> 10713 <issue>There is strong opposition to this function. The concern is 10714 that it would be difficult or impossible to provide meaningful 10715 numbers, as the amount of impact is conditional on many factors 10716 that a single number could not represent. There is doubt that 10717 conditional implementations would be used or are even a good idea. 10718 The thought is that release documentation for the implementation 10719 would be the best means of exposing this information. 10720 Unless new arguments are presented, I intend to remove this 10721 function in the next revision. 10722 </issue> 10723 <p/> 10724 Return via the <paramlink id="time_impact_ptr"></paramlink> and 10725 <paramlink id="space_impact_ptr"></paramlink> an estimate of the impact 10726 of adding the capabilities pointed to by 10727 <paramlink id="capabilities_ptr"></paramlink>. 10728 The returned estimates are in percentage of additional overhead, thus 10729 a time impact of 100 mean the application might run 10730 at half the speed. 10731 The estimates are very rough approximations and are not guaranteed. 10732 Note also, that the estimates are of the impact of having the 10733 capability available--when and if it is used the impact may be 10734 much greater. 10735 Estimates can be for a single capability or for a set of 10736 capabilities. Note that the costs are not necessarily additive, 10737 adding support for one capability might make another available 10738 for free or conversely having two capabilities at once may 10739 have multiplicative impact. 10740 Estimates are relative to the current set of capabilities - 10741 that is, how much more impact given the currently possessed capabilities. 10742 <p/> 10743 Typically this function is used in the OnLoad function, 10744 some virtual machines may allow a limited set of capabilities to be 10745 added in the live phase. 10746 In this case, the set of potentially available capabilities 10747 will likely differ from the OnLoad phase set. 10748 <p/> 10749 See the 10750 <internallink id="capabilityExamples">Capability Examples</internallink>. 10751 </description> 10752 <origin>new</origin> 10753 <capabilities> 10754 </capabilities> 10755 <parameters> 10756 <param id="capabilities_ptr"> 10757 <inptr><struct>jvmtiCapabilities</struct></inptr> 10758 <description> 10759 points to the <jvmti/> capabilities to evaluate. 10760 </description> 10761 </param> 10762 <param id="time_impact_ptr"> 10763 <outptr><jint/></outptr> 10764 <description> 10765 On return, points to the estimated percentage increase in 10766 run time if this capability was added. 10767 </description> 10768 </param> 10769 <param id="space_impact_ptr"> 10770 <outptr><jint/></outptr> 10771 <description> 10772 On return, points to the estimated percentage increase in 10773 memory space used if this capability was added. 10774 </description> 10775 </param> 10776 </parameters> 10777 <errors> 10778 <error id="JVMTI_ERROR_NOT_AVAILABLE"> 10779 The desired capabilities are not even potentially available. 10780 </error> 10781 </errors> 10782 </function> 10783 </elide> 10784 10785 <function id="AddCapabilities" jkernel="yes" phase="onload" num="142"> 10786 <synopsis>Add Capabilities</synopsis> 10787 <description> 10788 Set new capabilities by adding the capabilities 10789 whose values are set to one (<code>1</code>) in 10790 <code>*</code><paramlink id="capabilities_ptr"></paramlink>. 10791 All previous capabilities are retained. 10792 Typically this function is used in the <code>OnLoad</code> function. 10793 Some virtual machines may allow a limited set of capabilities to be 10794 added in the live phase. 10795 <p/> 10796 See the 10797 <internallink id="capabilityExamples">Capability Examples</internallink>. 10798 </description> 10799 <origin>new</origin> 10800 <capabilities> 10801 </capabilities> 10802 <parameters> 10803 <param id="capabilities_ptr"> 10804 <inptr><struct>jvmtiCapabilities</struct></inptr> 10805 <description> 10806 Points to the <jvmti/> capabilities to add. 10807 </description> 10808 </param> 10809 </parameters> 10810 <errors> 10811 <error id="JVMTI_ERROR_NOT_AVAILABLE"> 10812 The desired capabilities are not even potentially available. 10813 </error> 10814 </errors> 10815 </function> 10816 10817 10818 <function id="RelinquishCapabilities" phase="onload" num="143"> 10819 <synopsis>Relinquish Capabilities</synopsis> 10820 <description> 10821 Relinquish the capabilities 10822 whose values are set to one (<code>1</code>) in 10823 <code>*</code><paramlink id="capabilities_ptr"></paramlink>. 10824 Some implementations may allow only one environment to have a capability 10825 (see the <internallink id="capability">capability introduction</internallink>). 10826 This function releases capabilities 10827 so that they may be used by other agents. 10828 All other capabilities are retained. 10829 The capability will no longer be present in <functionlink id="GetCapabilities"></functionlink>. 10830 Attempting to relinquish a capability that the agent does not possess is not an error. 10831 <issue> 10832 It is possible for the agent to be actively using capabilities 10833 which are being relinquished. For example, a thread is currently 10834 suspended and can_suspend is being relinquished or an event is currently 10835 enabled and can_generate_whatever is being relinquished. 10836 There are three possible ways we could spec this: 10837 <ul> 10838 <li>relinquish automatically releases them</li> 10839 <li>relinquish checks and returns some error code if held</li> 10840 <li>it is the agent's responsibility and it is not checked</li> 10841 </ul> 10842 One of these should be chosen. 10843 </issue> 10844 </description> 10845 <origin>new</origin> 10846 <capabilities> 10847 </capabilities> 10848 <parameters> 10849 <param id="capabilities_ptr"> 10850 <inptr><struct>jvmtiCapabilities</struct></inptr> 10851 <description> 10852 Points to the <jvmti/> capabilities to relinquish. 10853 </description> 10854 </param> 10855 </parameters> 10856 <errors> 10857 </errors> 10858 </function> 10859 10860 10861 10862 <function id="GetCapabilities" jkernel="yes" phase="any" num="89"> 10863 <synopsis>Get Capabilities</synopsis> 10864 <description> 10865 Returns via <paramlink id="capabilities_ptr"></paramlink> the optional <jvmti/> 10866 features which this environment currently possesses. 10867 Each possessed capability is indicated by a one (<code>1</code>) in the 10868 corresponding field of the <internallink id="jvmtiCapabilities">capabilities 10869 structure</internallink>. 10870 An environment does not possess a capability unless it has been successfully added with 10871 <functionlink id="AddCapabilities"/>. 10872 An environment only loses possession of a capability if it has been relinquished with 10873 <functionlink id="RelinquishCapabilities"/>. Thus, this function returns the net result 10874 of the <code>AddCapabilities</code> and <code>RelinquishCapabilities</code> calls which 10875 have been made. 10876 <p/> 10877 See the 10878 <internallink id="capabilityExamples">Capability Examples</internallink>. 10879 </description> 10880 <origin>jvmdiClone</origin> 10881 <capabilities> 10882 </capabilities> 10883 <parameters> 10884 <param id="capabilities_ptr"> 10885 <outptr><struct>jvmtiCapabilities</struct></outptr> 10886 <description> 10887 On return, points to the <jvmti/> capabilities. 10888 </description> 10889 </param> 10890 </parameters> 10891 <errors> 10892 </errors> 10893 </function> 10894 10895 </category> 10896 10897 10898 <category id="timers" label="Timers"> 10899 10900 <intro> 10901 These functions provide timing information. 10902 The resolution at which the time is updated is not specified. 10903 They provides nanosecond precision, but not necessarily nanosecond accuracy. 10904 Details about the timers, such as their maximum values, can be accessed with 10905 the timer information functions. 10906 </intro> 10907 10908 <typedef id="jvmtiTimerInfo" label="Timer Info"> 10909 <description> 10910 The information function for each timer returns this data structure. 10911 </description> 10912 <field id="max_value"> 10913 <jlong/> 10914 <description> 10915 The maximum value the timer can reach. 10916 After this value is reached the timer wraps back to zero. 10917 This is an unsigned value. If tested or printed as a jlong (signed value) 10918 it may appear to be a negative number. 10919 </description> 10920 </field> 10921 <field id="may_skip_forward"> 10922 <jboolean/> 10923 <description> 10924 If true, the timer can be externally adjusted and as a result skip forward. 10925 If false, the timer value will never increase faster than real time. 10926 </description> 10927 </field> 10928 <field id="may_skip_backward"> 10929 <jboolean/> 10930 <description> 10931 If true, the timer can be externally adjusted and as a result skip backward. 10932 If false, the timer value will be monotonically increasing. 10933 </description> 10934 </field> 10935 <field id="kind"> 10936 <enum>jvmtiTimerKind</enum> 10937 <description> 10938 The kind of timer. 10939 On a platform that does not distinguish between user and system time, <datalink 10940 id="JVMTI_TIMER_TOTAL_CPU"><code>JVMTI_TIMER_TOTAL_CPU</code></datalink> 10941 is returned. 10942 </description> 10943 </field> 10944 <field id="reserved1"> 10945 <jlong/> 10946 <description> 10947 Reserved for future use. 10948 </description> 10949 </field> 10950 <field id="reserved2"> 10951 <jlong/> 10952 <description> 10953 Reserved for future use. 10954 </description> 10955 </field> 10956 </typedef> 10957 10958 <intro> 10959 Where the timer kind is -- 10960 10961 <constants id="jvmtiTimerKind" label="Timer Kinds" kind="enum"> 10962 <constant id="JVMTI_TIMER_USER_CPU" num="30"> 10963 CPU time that a thread is in user mode. 10964 </constant> 10965 <constant id="JVMTI_TIMER_TOTAL_CPU" num="31"> 10966 CPU time that a thread is in user or system mode. 10967 </constant> 10968 <constant id="JVMTI_TIMER_ELAPSED" num="32"> 10969 Elapsed time. 10970 </constant> 10971 </constants> 10972 </intro> 10973 10974 <function id="GetCurrentThreadCpuTimerInfo" callbacksafe="safe" impl="innative notrace" phase="start" num="134"> 10975 <synopsis>Get Current Thread CPU Timer Information</synopsis> 10976 <description> 10977 Get information about the 10978 <functionlink id="GetCurrentThreadCpuTime"/> timer. 10979 The fields of the <datalink id="jvmtiTimerInfo"/> structure 10980 are filled in with details about the timer. 10981 This information is specific to the platform and the implementation of 10982 <functionlink id="GetCurrentThreadCpuTime"/> and thus 10983 does not vary by thread nor does it vary 10984 during a particular invocation of the VM. 10985 <p/> 10986 Note that the implementations of <functionlink id="GetCurrentThreadCpuTime"/> 10987 and <functionlink id="GetThreadCpuTime"/> may differ, and thus the values 10988 returned by <code>GetCurrentThreadCpuTimerInfo</code> 10989 and <functionlink id="GetThreadCpuTimerInfo"/> 10990 may differ -- see <functionlink id="GetCurrentThreadCpuTime"/> for more information. 10991 </description> 10992 <origin>new</origin> 10993 <capabilities> 10994 <required id="can_get_current_thread_cpu_time"> 10995 Can get current thread CPU time. 10996 </required> 10997 </capabilities> 10998 <parameters> 10999 <param id="info_ptr"> 11000 <outptr><struct>jvmtiTimerInfo</struct></outptr> 11001 <description> 11002 On return, filled with information describing the time 11003 returned by <functionlink id="GetCurrentThreadCpuTime"/>. 11004 </description> 11005 </param> 11006 </parameters> 11007 <errors> 11008 </errors> 11009 </function> 11010 11011 <function id="GetCurrentThreadCpuTime" callbacksafe="safe" impl="innative notrace" phase="start" num="135"> 11012 <synopsis>Get Current Thread CPU Time</synopsis> 11013 <description> 11014 Return the CPU time utilized by the current thread. 11015 <p/> 11016 Note that the <functionlink id="GetThreadCpuTime"/> 11017 function provides CPU time for any thread, including 11018 the current thread. <code>GetCurrentThreadCpuTime</code> 11019 exists to support platforms which cannot 11020 supply CPU time for threads other than the current 11021 thread or which have more accurate information for 11022 the current thread (see 11023 <functionlink id="GetCurrentThreadCpuTimerInfo"/> vs 11024 <functionlink id="GetThreadCpuTimerInfo"/>). 11025 The current thread may not be a virtual thread. Otherwise, the error code 11026 <errorlink id="JVMTI_ERROR_UNSUPPORTED_OPERATION"></errorlink> will be returned. 11027 On many platforms this call will be equivalent to: 11028 <example> 11029 GetThreadCpuTime(env, NULL, nanos_ptr) 11030 </example> 11031 </description> 11032 <origin>new</origin> 11033 <capabilities> 11034 <required id="can_get_current_thread_cpu_time"> 11035 Can get current thread CPU time. 11036 <p/> 11037 If this capability is enabled after threads have started, 11038 the implementation may choose any time up 11039 to and including the time that the capability is enabled 11040 as the point where CPU time collection starts. 11041 <p/> 11042 This capability must be potentially available on any 11043 platform where 11044 <internallink id="jvmtiCapabilities.can_get_thread_cpu_time"><code>can_get_thread_cpu_time</code></internallink> 11045 is potentially available. 11046 </required> 11047 </capabilities> 11048 <parameters> 11049 <param id="nanos_ptr"> 11050 <outptr><jlong/></outptr> 11051 <description> 11052 On return, points to the CPU time used by this thread 11053 in nanoseconds. 11054 This is an unsigned value. If tested or printed as a jlong (signed value) 11055 it may appear to be a negative number. 11056 </description> 11057 </param> 11058 </parameters> 11059 <errors> 11060 <error id="JVMTI_ERROR_UNSUPPORTED_OPERATION"> 11061 The current thread is a virtual thread and the implementation does not support 11062 getting the current thread CPU time when the current thread is a virtual thread. 11063 </error> 11064 </errors> 11065 </function> 11066 11067 <function id="GetThreadCpuTimerInfo" num="136"> 11068 <synopsis>Get Thread CPU Timer Information</synopsis> 11069 <description> 11070 Get information about the 11071 <functionlink id="GetThreadCpuTime"/> timer. 11072 The fields of the <datalink id="jvmtiTimerInfo"/> structure 11073 are filled in with details about the timer. 11074 This information is specific to the platform and the implementation of 11075 <functionlink id="GetThreadCpuTime"/> and thus 11076 does not vary by thread nor does it vary 11077 during a particular invocation of the VM. 11078 <p/> 11079 Note that the implementations of <functionlink id="GetCurrentThreadCpuTime"/> 11080 and <functionlink id="GetThreadCpuTime"/> may differ, and thus the values 11081 returned by <functionlink id="GetCurrentThreadCpuTimerInfo"/> 11082 and <code>GetThreadCpuTimerInfo</code> 11083 may differ -- see <functionlink id="GetCurrentThreadCpuTime"/> for more information. 11084 </description> 11085 <origin>new</origin> 11086 <capabilities> 11087 <required id="can_get_thread_cpu_time"> 11088 Can get thread CPU time. 11089 </required> 11090 </capabilities> 11091 <parameters> 11092 <param id="info_ptr"> 11093 <outptr><struct>jvmtiTimerInfo</struct></outptr> 11094 <description> 11095 On return, filled with information describing the time 11096 returned by <functionlink id="GetThreadCpuTime"/>. 11097 </description> 11098 </param> 11099 </parameters> 11100 <errors> 11101 </errors> 11102 </function> 11103 11104 <function id="GetThreadCpuTime" num="137"> 11105 <synopsis>Get Thread CPU Time</synopsis> 11106 <description> 11107 Return the CPU time utilized by the specified thread. 11108 <p/> 11109 Get information about this timer with 11110 <functionlink id="GetThreadCpuTimerInfo"/>. 11111 </description> 11112 <origin>new</origin> 11113 <capabilities> 11114 <required id="can_get_thread_cpu_time"> 11115 Can get thread CPU time. 11116 <p/> 11117 If this capability is enabled after threads have started, 11118 the implementation may choose any time up 11119 to and including the time that the capability is enabled 11120 as the point where CPU time collection starts. 11121 </required> 11122 </capabilities> 11123 <parameters> 11124 <param id="thread"> 11125 <jthread null="current" impl="noconvert"/> 11126 <description> 11127 The thread to query. 11128 The <code>thread</code> may not be a virtual thread. Otherwise, the error code 11129 <errorlink id="JVMTI_ERROR_UNSUPPORTED_OPERATION"></errorlink> will be returned. 11130 </description> 11131 </param> 11132 <param id="nanos_ptr"> 11133 <outptr impl="nonullcheck"><jlong/></outptr> 11134 <description> 11135 On return, points to the CPU time used by the specified thread 11136 in nanoseconds. 11137 This is an unsigned value. If tested or printed as a jlong (signed value) 11138 it may appear to be a negative number. 11139 </description> 11140 </param> 11141 </parameters> 11142 <errors> 11143 <error id="JVMTI_ERROR_UNSUPPORTED_OPERATION"> 11144 <paramlink id="thread"/> is a virtual thread and the implementation does not 11145 support getting the thread CPU time of a virtual thread. 11146 </error> 11147 </errors> 11148 </function> 11149 11150 <function id="GetTimerInfo" phase="any" callbacksafe="safe" num="138"> 11151 <synopsis>Get Timer Information</synopsis> 11152 <description> 11153 Get information about the 11154 <functionlink id="GetTime"/> timer. 11155 The fields of the <datalink id="jvmtiTimerInfo"/> structure 11156 are filled in with details about the timer. 11157 This information will not change during a particular invocation of the VM. 11158 </description> 11159 <origin>new</origin> 11160 <capabilities> 11161 </capabilities> 11162 <parameters> 11163 <param id="info_ptr"> 11164 <outptr><struct>jvmtiTimerInfo</struct></outptr> 11165 <description> 11166 On return, filled with information describing the time 11167 returned by <functionlink id="GetTime"/>. 11168 </description> 11169 </param> 11170 </parameters> 11171 <errors> 11172 </errors> 11173 </function> 11174 11175 <function id="GetTime" phase="any" callbacksafe="safe" num="139"> 11176 <synopsis>Get Time</synopsis> 11177 <description> 11178 Return the current value of the system timer, in nanoseconds. 11179 <p/> 11180 The value returned represents nanoseconds since some fixed but 11181 arbitrary time (perhaps in the future, so values may be 11182 negative). This function provides nanosecond precision, but not 11183 necessarily nanosecond accuracy. No guarantees are made about 11184 how frequently values change. 11185 <p/> 11186 Get information about this timer with 11187 <functionlink id="GetTimerInfo"/>. 11188 </description> 11189 <origin>new</origin> 11190 <capabilities> 11191 </capabilities> 11192 <parameters> 11193 <param id="nanos_ptr"> 11194 <outptr><jlong/></outptr> 11195 <description> 11196 On return, points to the time in nanoseconds. 11197 This is an unsigned value. If tested or printed as a jlong (signed value) 11198 it may appear to be a negative number. 11199 </description> 11200 </param> 11201 </parameters> 11202 <errors> 11203 </errors> 11204 </function> 11205 11206 <function id="GetAvailableProcessors" phase="any" num="144"> 11207 <synopsis>Get Available Processors</synopsis> 11208 <description> 11209 Returns the number of processors available to the Java virtual machine. 11210 <p/> 11211 This value may change during a particular invocation of the virtual machine. 11212 Applications that are sensitive to the number of available processors should 11213 therefore occasionally poll this property. 11214 </description> 11215 <origin>new</origin> 11216 <capabilities> 11217 </capabilities> 11218 <parameters> 11219 <param id="processor_count_ptr"> 11220 <outptr><jint/></outptr> 11221 <description> 11222 On return, points to the maximum number of processors available to the 11223 virtual machine; never smaller than one. 11224 </description> 11225 </param> 11226 </parameters> 11227 <errors> 11228 </errors> 11229 </function> 11230 11231 </category> 11232 11233 11234 <category id="classLoaderSearch" label="Class Loader Search"> 11235 11236 <intro> 11237 These functions allow the agent to add to the locations that a class loader searches for a class. 11238 This is useful for installing instrumentation under the correct class loader. 11239 </intro> 11240 11241 <function id="AddToBootstrapClassLoaderSearch" jkernel="yes" phase="onload" num="149"> 11242 <synopsis>Add To Bootstrap Class Loader Search</synopsis> 11243 <description> 11244 This function can be used to cause instrumentation classes to be defined by the 11245 bootstrap class loader. See <vmspec chapter="5.3.1"/>. 11246 After the bootstrap 11247 class loader unsuccessfully searches for a class, the specified platform-dependent 11248 search path <paramlink id="segment"/> will be searched as well. Only one segment may be specified in 11249 the <paramlink id="segment"/>. This function may be called multiple times to add multiple segments, 11250 the segments will be searched in the order that this function was called. 11251 <p/> 11252 In the <code>OnLoad</code> phase the function may be used to specify any platform-dependent 11253 search path segment to be searched after the bootstrap class loader unsuccessfully searches 11254 for a class. The segment is typically a directory or JAR file. 11255 <p/> 11256 In the live phase the <paramlink id="segment"/> may be used to specify any platform-dependent 11257 path to a <externallink id="jar/jar.html"> 11258 JAR file</externallink>. The agent should take care that the JAR file does not 11259 contain any classes or resources other than those to be defined by the bootstrap 11260 class loader for the purposes of instrumentation. 11261 <p/> 11262 <vmspec/> specifies that a subsequent attempt to resolve a symbolic 11263 reference that the Java virtual machine has previously unsuccessfully attempted 11264 to resolve always fails with the same error that was thrown as a result of the 11265 initial resolution attempt. Consequently, if the JAR file contains an entry 11266 that corresponds to a class for which the Java virtual machine has 11267 unsuccessfully attempted to resolve a reference, then subsequent attempts to 11268 resolve that reference will fail with the same error as the initial attempt. 11269 </description> 11270 <origin>new</origin> 11271 <capabilities> 11272 </capabilities> 11273 <parameters> 11274 <param id="segment"> 11275 <inbuf><char/></inbuf> 11276 <description> 11277 The platform-dependent search path segment, encoded as a 11278 <internallink id="mUTF">modified UTF-8</internallink> string. 11279 </description> 11280 </param> 11281 </parameters> 11282 <errors> 11283 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 11284 <paramlink id="segment"/> is an invalid path. In the live phase, anything other than an 11285 existing JAR file is an invalid path. 11286 </error> 11287 </errors> 11288 </function> 11289 11290 <function id="AddToSystemClassLoaderSearch" jkernel="yes" phase="onload" num="151" since="1.1"> 11291 <synopsis>Add To System Class Loader Search</synopsis> 11292 <description> 11293 This function can be used to cause instrumentation classes to be 11294 defined by the system class loader. See <vmspec chapter="5.3.2"/>. 11295 After the class loader unsuccessfully searches for a class, the specified platform-dependent search 11296 path <paramlink id="segment"/> will be searched as well. Only one segment may be specified in the 11297 <paramlink id="segment"/>. This function may be called multiple times to add multiple segments, the 11298 segments will be searched in the order that this function was called. 11299 <p/> 11300 In the <code>OnLoad</code> phase the function may be used to specify any platform-dependent 11301 search path segment to be searched after the system class loader unsuccessfully searches 11302 for a class. The segment is typically a directory or JAR file. 11303 <p/> 11304 In the live phase the <paramlink id="segment"/> is a platform-dependent path to a 11305 <externallink id="jar/jar.html">JAR file</externallink> to be 11306 searched after the system class loader unsuccessfully searches for a class. The agent should 11307 take care that the JAR file does not contain any classes or resources other than those to be 11308 defined by the system class loader for the purposes of instrumentation. 11309 <p/> 11310 In the live phase the system class loader supports adding a JAR file to be searched if 11311 the system class loader implements a method name <code>appendToClassPathForInstrumentation</code> 11312 which takes a single parameter of type <code>java.lang.String</code>. The method is not required 11313 to have <code>public</code> access. 11314 <p/> 11315 <vmspec/> specifies that a subsequent attempt to resolve a symbolic 11316 reference that the Java virtual machine has previously unsuccessfully attempted 11317 to resolve always fails with the same error that was thrown as a result of the 11318 initial resolution attempt. Consequently, if the JAR file contains an entry 11319 that corresponds to a class for which the Java virtual machine has 11320 unsuccessfully attempted to resolve a reference, then subsequent attempts to 11321 resolve that reference will fail with the same error as the initial attempt. 11322 </description> 11323 <origin>new</origin> 11324 <capabilities> 11325 </capabilities> 11326 <parameters> 11327 <param id="segment"> 11328 <inbuf><char/></inbuf> 11329 <description> 11330 The platform-dependent search path segment, encoded as a 11331 <internallink id="mUTF">modified UTF-8</internallink> string. 11332 </description> 11333 </param> 11334 </parameters> 11335 <errors> 11336 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 11337 <paramlink id="segment"/> is an invalid path. In the live phase, anything other than an 11338 existing JAR file is an invalid path. 11339 </error> 11340 <error id="JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED"> 11341 Operation not supported by the system class loader. 11342 </error> 11343 </errors> 11344 </function> 11345 11346 </category> 11347 11348 11349 <category id="props" label="System Properties"> 11350 11351 <intro> 11352 These functions get and set system properties. 11353 </intro> 11354 11355 <function id="GetSystemProperties" phase="onload" num="130"> 11356 <synopsis>Get System Properties</synopsis> 11357 <description> 11358 The list of VM system property keys which may be used with 11359 <functionlink id="GetSystemProperty"/> is returned. 11360 It is strongly recommended that virtual machines provide the 11361 following property keys: 11362 <ul> 11363 <li><code>java.vm.vendor</code></li> 11364 <li><code>java.vm.version</code></li> 11365 <li><code>java.vm.name</code></li> 11366 <li><code>java.vm.info</code></li> 11367 <li><code>java.library.path</code></li> 11368 <li><code>java.class.path</code></li> 11369 </ul> 11370 Provides access to system properties defined by and used 11371 by the VM. 11372 Properties set on the command-line are included. 11373 This allows getting and setting of these properties 11374 before the VM even begins executing bytecodes. 11375 Since this is a VM view of system properties, the set of available 11376 properties will usually be different than that 11377 in <code>java.lang.System.getProperties</code>. 11378 JNI method invocation may be used to access 11379 <code>java.lang.System.getProperties</code>. 11380 <p/> 11381 The set of properties may grow during execution. 11382 </description> 11383 <origin>new</origin> 11384 <capabilities> 11385 </capabilities> 11386 <parameters> 11387 <param id="count_ptr"> 11388 <outptr><jint/></outptr> 11389 <description> 11390 On return, points to the number of property keys returned. 11391 </description> 11392 </param> 11393 <param id="property_ptr"> 11394 <allocallocbuf outcount="count_ptr"><char/></allocallocbuf> 11395 <description> 11396 On return, points to an array of property keys, encoded as 11397 <internallink id="mUTF">modified UTF-8</internallink> strings. 11398 </description> 11399 </param> 11400 </parameters> 11401 <errors> 11402 </errors> 11403 </function> 11404 11405 <function id="GetSystemProperty" phase="onload" num="131"> 11406 <synopsis>Get System Property</synopsis> 11407 <description> 11408 Return a VM system property value given the property key. 11409 <p/> 11410 The function <functionlink id="GetSystemProperties"/> 11411 returns the set of property keys which may be used. 11412 The properties which can be retrieved may grow during 11413 execution. 11414 <p/> 11415 Since this is a VM view of system properties, the values 11416 of properties may differ from that returned by 11417 <code>java.lang.System.getProperty(String)</code>. 11418 A typical VM might copy the values of the VM system 11419 properties into the <code>Properties</code> held by 11420 <code>java.lang.System</code> during the initialization 11421 of that class. Thereafter any changes to the VM system 11422 properties (with <functionlink id="SetSystemProperty"/>) 11423 or the <code>java.lang.System</code> system properties 11424 (with <code>java.lang.System.setProperty(String,String)</code>) 11425 would cause the values to diverge. 11426 JNI method invocation may be used to access 11427 <code>java.lang.System.getProperty(String)</code>. 11428 </description> 11429 <origin>new</origin> 11430 <capabilities> 11431 </capabilities> 11432 <parameters> 11433 <param id="property"> 11434 <inbuf><char/></inbuf> 11435 <description> 11436 The key of the property to retrieve, encoded as a 11437 <internallink id="mUTF">modified UTF-8</internallink> string. 11438 </description> 11439 </param> 11440 <param id="value_ptr"> 11441 <allocbuf><char/></allocbuf> 11442 <description> 11443 On return, points to the property value, encoded as a 11444 <internallink id="mUTF">modified UTF-8</internallink> string. 11445 </description> 11446 </param> 11447 </parameters> 11448 <errors> 11449 <error id="JVMTI_ERROR_NOT_AVAILABLE"> 11450 This property is not available. 11451 Use <functionlink id="GetSystemProperties"/> to find available properties. 11452 </error> 11453 </errors> 11454 </function> 11455 11456 <function id="SetSystemProperty" phase="onloadOnly" num="132"> 11457 <synopsis>Set System Property</synopsis> 11458 <description> 11459 Set a VM system property value. 11460 <p/> 11461 The function <functionlink id="GetSystemProperties"/> 11462 returns the set of property keys, some of these may be settable. 11463 See <functionlink id="GetSystemProperty"/>. 11464 </description> 11465 <origin>new</origin> 11466 <capabilities> 11467 </capabilities> 11468 <parameters> 11469 <param id="property"> 11470 <inbuf><char/></inbuf> 11471 <description> 11472 The key of the property, encoded as a 11473 <internallink id="mUTF">modified UTF-8</internallink> string. 11474 </description> 11475 </param> 11476 <param id="value_ptr"> 11477 <inbuf> 11478 <char/> 11479 <nullok> 11480 do not set the value, but return <errorlink id="JVMTI_ERROR_NOT_AVAILABLE"/> 11481 if the property is not writeable 11482 </nullok> 11483 </inbuf> 11484 <description> 11485 The property value to set, encoded as a 11486 <internallink id="mUTF">modified UTF-8</internallink> string. 11487 </description> 11488 </param> 11489 </parameters> 11490 <errors> 11491 <error id="JVMTI_ERROR_NOT_AVAILABLE"> 11492 This property is not available or is not writeable. 11493 </error> 11494 </errors> 11495 </function> 11496 11497 </category> 11498 11499 <category id="general" label="General"> 11500 11501 <intro> 11502 </intro> 11503 11504 <function id="GetPhase" jkernel="yes" phase="any" num="133"> 11505 <synopsis>Get Phase</synopsis> 11506 <description> 11507 Return the current phase of VM execution. 11508 The phases proceed in sequence: 11509 <constants id="jvmtiPhase" label="Phases of execution" kind="enum"> 11510 <constant id="JVMTI_PHASE_ONLOAD" num="1"> 11511 <code>OnLoad</code> phase: while in the 11512 <internallink id="onload"><code>Agent_OnLoad</code></internallink> 11513 or, for statically linked agents, the <internallink id="onload"> 11514 <code>Agent_OnLoad_<agent-lib-name> 11515 </code></internallink> function. 11516 </constant> 11517 <constant id="JVMTI_PHASE_PRIMORDIAL" num="2"> 11518 Primordial phase: between return from <code>Agent_OnLoad</code> 11519 or <code>Agent_OnLoad_<agent-lib-name></code> and the 11520 <code>VMStart</code> event. 11521 </constant> 11522 <constant id="JVMTI_PHASE_START" num="6"> 11523 Start phase: when the <eventlink id="VMStart"><code>VMStart</code></eventlink> event 11524 is sent and until the <code>VMInit</code> event is sent. 11525 </constant> 11526 <constant id="JVMTI_PHASE_LIVE" num="4"> 11527 Live phase: when the <eventlink id="VMInit"><code>VMInit</code></eventlink> event is sent 11528 and until the <eventlink id="VMDeath"></eventlink> event returns. 11529 </constant> 11530 <constant id="JVMTI_PHASE_DEAD" num="8"> 11531 Dead phase: after the <eventlink id="VMDeath"></eventlink> event returns or after 11532 start-up failure. 11533 </constant> 11534 </constants> 11535 In the case of start-up failure the VM will proceed directly to the dead 11536 phase skipping intermediate phases and neither a <code>VMInit</code> nor 11537 <code>VMDeath</code> event will be sent. 11538 <p/> 11539 Most <jvmti/> functions operate only in the live phase. 11540 The following functions operate in either the <code>OnLoad</code> or live phases: 11541 <functionphaselist phase="onload"/> 11542 The following functions operate in only the <code>OnLoad</code> phase: 11543 <functionphaselist phase="onloadOnly"/> 11544 The following functions operate in the start or live phases: 11545 <functionphaselist phase="start"/> 11546 The following functions operate in any phase: 11547 <functionphaselist phase="any"/> 11548 JNI functions (except the Invocation API) must only be used in the start or live phases. 11549 <p/> 11550 Most <jvmti/> events are sent only in the live phase. 11551 The following events operate in others phases: 11552 <eventphaselist phase="start"/> 11553 <eventphaselist phase="any"/> 11554 </description> 11555 <origin>new</origin> 11556 <capabilities> 11557 </capabilities> 11558 <parameters> 11559 <param id="phase_ptr"> 11560 <outptr><enum>jvmtiPhase</enum></outptr> 11561 <description> 11562 On return, points to the phase. 11563 </description> 11564 </param> 11565 </parameters> 11566 <errors> 11567 </errors> 11568 </function> 11569 11570 <function id="DisposeEnvironment" jkernel="yes" phase="any" num="127"> 11571 <synopsis>Dispose Environment</synopsis> 11572 <description> 11573 Shutdown a <jvmti/> connection created with JNI <code>GetEnv</code> 11574 (see <internallink id="environments"><jvmti/> Environments</internallink>). 11575 Dispose of any resources held by the environment. 11576 <issue> 11577 What resources are reclaimed? What is undone? 11578 Breakpoints,watchpoints removed? 11579 </issue> 11580 Threads suspended by this environment are not resumed by this call, 11581 this must be done explicitly by the agent. 11582 Memory allocated by this environment via calls to <jvmti/> functions 11583 is not released, this can be done explicitly by the agent 11584 by calling <functionlink id="Deallocate"/>. 11585 Raw monitors created by this environment are not destroyed, 11586 this can be done explicitly by the agent 11587 by calling <functionlink id="DestroyRawMonitor"/>. 11588 The state of threads waiting on raw monitors created by this environment 11589 are not affected. 11590 <p/> 11591 Any <functionlink id="SetNativeMethodPrefix">native method 11592 prefixes</functionlink> for this environment will be unset; 11593 the agent must remove any prefixed native methods before 11594 dispose is called. 11595 <p/> 11596 Any <internallink id="capability">capabilities</internallink> 11597 held by this environment are relinquished. 11598 <p/> 11599 Events enabled by this environment will no longer be sent, however 11600 event handlers currently running will continue to run. Caution must 11601 be exercised in the design of event handlers whose environment may 11602 be disposed and thus become invalid during their execution. 11603 <p/> 11604 This environment may not be used after this call. 11605 This call returns to the caller. 11606 </description> 11607 <origin>new</origin> 11608 <capabilities> 11609 </capabilities> 11610 <parameters> 11611 </parameters> 11612 <errors> 11613 </errors> 11614 </function> 11615 11616 <function id="SetEnvironmentLocalStorage" jkernel="yes" phase="any" callbacksafe="safe" impl="innative notrace" num="148"> 11617 <synopsis>Set Environment Local Storage</synopsis> 11618 <description> 11619 The VM stores a pointer value associated with each environment. 11620 This pointer value is called <i>environment-local storage</i>. 11621 This value is <code>NULL</code> unless set with this function. 11622 Agents can allocate memory in which they store environment specific 11623 information. By setting environment-local storage it can then be 11624 accessed with 11625 <functionlink id="GetEnvironmentLocalStorage"></functionlink>. 11626 <p/> 11627 Called by the agent to set the value of the <jvmti/> 11628 environment-local storage. <jvmti/> supplies to the agent a pointer-size 11629 environment-local storage that can be used to record per-environment 11630 information. 11631 </description> 11632 <origin>new</origin> 11633 <capabilities> 11634 </capabilities> 11635 <parameters> 11636 <param id="data"> 11637 <inbuf> 11638 <void/> 11639 <nullok>value is set to <code>NULL</code></nullok> 11640 </inbuf> 11641 <description> 11642 The value to be entered into the environment-local storage. 11643 </description> 11644 </param> 11645 </parameters> 11646 <errors> 11647 </errors> 11648 </function> 11649 11650 <function id="GetEnvironmentLocalStorage" jkernel="yes" phase="any" callbacksafe="safe" impl="innative notrace" num="147"> 11651 <synopsis>Get Environment Local Storage</synopsis> 11652 <description> 11653 Called by the agent to get the value of the <jvmti/> environment-local 11654 storage. 11655 </description> 11656 <origin>new</origin> 11657 <capabilities> 11658 </capabilities> 11659 <parameters> 11660 <param id="data_ptr"> 11661 <agentbuf><void/></agentbuf> 11662 <description> 11663 Pointer through which the value of the environment local 11664 storage is returned. 11665 If environment-local storage has not been set with 11666 <functionlink id="SetEnvironmentLocalStorage"></functionlink> returned 11667 pointer is <code>NULL</code>. 11668 </description> 11669 </param> 11670 </parameters> 11671 <errors> 11672 </errors> 11673 </function> 11674 11675 <function id="GetVersionNumber" jkernel="yes" phase="any" num="88"> 11676 <synopsis>Get Version Number</synopsis> 11677 <description> 11678 Return the <jvmti/> version via <code>version_ptr</code>. 11679 The return value is the version identifier. 11680 The version identifier includes major, minor and micro 11681 version as well as the interface type. 11682 <constants id="jvmtiVersionInterfaceTypes" label="Version Interface Types" kind="bits"> 11683 <constant id="JVMTI_VERSION_INTERFACE_JNI" num="0x00000000"> 11684 Value of <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> for JNI. 11685 </constant> 11686 <constant id="JVMTI_VERSION_INTERFACE_JVMTI" num="0x30000000"> 11687 Value of <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> for <jvmti/>. 11688 </constant> 11689 </constants> 11690 <constants id="jvmtiVersionMasks" label="Version Masks" kind="bits"> 11691 <constant id="JVMTI_VERSION_MASK_INTERFACE_TYPE" num="0x70000000"> 11692 Mask to extract interface type. 11693 The value of the version returned by this function masked with 11694 <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> is always 11695 <code>JVMTI_VERSION_INTERFACE_JVMTI</code> 11696 since this is a <jvmti/> function. 11697 </constant> 11698 <constant id="JVMTI_VERSION_MASK_MAJOR" num="0x0FFF0000"> 11699 Mask to extract major version number. 11700 </constant> 11701 <constant id="JVMTI_VERSION_MASK_MINOR" num="0x0000FF00"> 11702 Mask to extract minor version number. 11703 </constant> 11704 <constant id="JVMTI_VERSION_MASK_MICRO" num="0x000000FF"> 11705 Mask to extract micro version number. 11706 </constant> 11707 </constants> 11708 <constants id="jvmtiVersionShifts" label="Version Shifts" kind="bits"> 11709 <constant id="JVMTI_VERSION_SHIFT_MAJOR" num="16"> 11710 Shift to extract major version number. 11711 </constant> 11712 <constant id="JVMTI_VERSION_SHIFT_MINOR" num="8"> 11713 Shift to extract minor version number. 11714 </constant> 11715 <constant id="JVMTI_VERSION_SHIFT_MICRO" num="0"> 11716 Shift to extract micro version number. 11717 </constant> 11718 </constants> 11719 </description> 11720 <origin>jvmdi</origin> 11721 <capabilities> 11722 </capabilities> 11723 <parameters> 11724 <param id="version_ptr"> 11725 <outptr><jint/></outptr> 11726 <description> 11727 On return, points to the <jvmti/> version. 11728 </description> 11729 </param> 11730 </parameters> 11731 <errors> 11732 </errors> 11733 </function> 11734 11735 11736 <function id="GetErrorName" phase="any" num="128"> 11737 <synopsis>Get Error Name</synopsis> 11738 <description> 11739 Return the symbolic name for an 11740 <internallink id="ErrorSection">error code</internallink>. 11741 <p/> 11742 For example 11743 <code>GetErrorName(env, JVMTI_ERROR_NONE, &err_name)</code> 11744 would return in <code>err_name</code> the string 11745 <code>"JVMTI_ERROR_NONE"</code>. 11746 </description> 11747 <origin>new</origin> 11748 <capabilities> 11749 </capabilities> 11750 <parameters> 11751 <param id="error"> 11752 <enum>jvmtiError</enum> 11753 <description> 11754 The error code. 11755 </description> 11756 </param> 11757 <param id="name_ptr"> 11758 <allocbuf><char/></allocbuf> 11759 <description> 11760 On return, points to the error name. 11761 The name is encoded as a 11762 <internallink id="mUTF">modified UTF-8</internallink> string, 11763 but is restricted to the ASCII subset. 11764 </description> 11765 </param> 11766 </parameters> 11767 <errors> 11768 </errors> 11769 </function> 11770 11771 <function id="SetVerboseFlag" phase="any" num="150"> 11772 <synopsis>Set Verbose Flag</synopsis> 11773 <description> 11774 <constants id="jvmtiVerboseFlag" label="Verbose Flag Enumeration" kind="enum"> 11775 <constant id="JVMTI_VERBOSE_OTHER" num="0"> 11776 Verbose output other than the below. 11777 </constant> 11778 <constant id="JVMTI_VERBOSE_GC" num="1"> 11779 Verbose garbage collector output, like that specified with <code>-verbose:gc</code>. 11780 </constant> 11781 <constant id="JVMTI_VERBOSE_CLASS" num="2"> 11782 Verbose class loading output, like that specified with <code>-verbose:class</code>. 11783 </constant> 11784 <constant id="JVMTI_VERBOSE_JNI" num="4"> 11785 Verbose JNI output, like that specified with <code>-verbose:jni</code>. 11786 </constant> 11787 </constants> 11788 Control verbose output. 11789 This is the output which typically is sent to <code>stderr</code>. 11790 </description> 11791 <origin>new</origin> 11792 <capabilities> 11793 </capabilities> 11794 <parameters> 11795 <param id="flag"> 11796 <enum>jvmtiVerboseFlag</enum> 11797 <description> 11798 Which verbose flag to set. 11799 </description> 11800 </param> 11801 <param id="value"> 11802 <jboolean/> 11803 <description> 11804 New value of the flag. 11805 </description> 11806 </param> 11807 </parameters> 11808 <errors> 11809 </errors> 11810 </function> 11811 11812 11813 <function id="GetJLocationFormat" phase="any" num="129"> 11814 <synopsis>Get JLocation Format</synopsis> 11815 <description> 11816 Although the greatest functionality is achieved with location information 11817 referencing the virtual machine bytecode index, the definition of 11818 <code>jlocation</code> has intentionally been left unconstrained to allow VM 11819 implementations that do not have this information. 11820 <p/> 11821 This function describes the representation of <code>jlocation</code> used in this VM. 11822 If the returned format is <datalink id="JVMTI_JLOCATION_JVMBCI"></datalink>, 11823 <code>jlocation</code>s can 11824 be used as in indices into the array returned by 11825 <functionlink id="GetBytecodes"></functionlink>. 11826 <constants id="jvmtiJlocationFormat" label="JLocation Format Enumeration" kind="enum"> 11827 <constant id="JVMTI_JLOCATION_JVMBCI" num="1"> 11828 <code>jlocation</code> values represent virtual machine 11829 bytecode indices--that is, offsets into the 11830 virtual machine code for a method. 11831 </constant> 11832 <constant id="JVMTI_JLOCATION_MACHINEPC" num="2"> 11833 <code>jlocation</code> values represent native machine 11834 program counter values. 11835 </constant> 11836 <constant id="JVMTI_JLOCATION_OTHER" num="0"> 11837 <code>jlocation</code> values have some other representation. 11838 </constant> 11839 </constants> 11840 </description> 11841 <origin>new</origin> 11842 <capabilities> 11843 </capabilities> 11844 <parameters> 11845 <param id="format_ptr"> 11846 <outptr><enum>jvmtiJlocationFormat</enum></outptr> 11847 <description> 11848 On return, points to the format identifier for <code>jlocation</code> values. 11849 </description> 11850 </param> 11851 </parameters> 11852 <errors> 11853 </errors> 11854 </function> 11855 11856 </category> 11857 11858 <category id="heap_monitoring" label="Heap Monitoring"> 11859 <function id="SetHeapSamplingInterval" phase="onload" num="156" since="11"> 11860 <synopsis>Set Heap Sampling Interval</synopsis> 11861 <description> 11862 Generate a <eventlink id="SampledObjectAlloc"/> event when objects are allocated. 11863 Each thread keeps a counter of bytes allocated. The event will only be generated 11864 when that counter exceeds an average of <paramlink id="sampling_interval"></paramlink> 11865 since the last sample. 11866 <p/> 11867 Setting <paramlink id="sampling_interval"></paramlink> to 0 will cause an event to be 11868 generated by each allocation supported by the system once the new interval is taken into account. 11869 <p/> 11870 Note that updating the new sampling interval might take various number of allocations 11871 to provoke internal data structure updates. Therefore it is important to 11872 consider the sampling interval as an average. This includes the interval 0, where events 11873 might not be generated straight away for each allocation. 11874 </description> 11875 <origin>new</origin> 11876 <capabilities> 11877 <required id="can_generate_sampled_object_alloc_events"></required> 11878 </capabilities> 11879 <parameters> 11880 <param id="sampling_interval"> 11881 <jint/> 11882 <description> 11883 The sampling interval in bytes. The sampler uses a statistical approach to 11884 generate an event, on average, once for every <paramlink id="sampling_interval"/> bytes of 11885 memory allocated by a given thread. 11886 <p/> 11887 Once the new sampling interval is taken into account, 0 as a sampling interval will generate 11888 a sample for every allocation. 11889 <p/> 11890 Note: The overhead of this feature is directly correlated with the sampling interval. 11891 A high sampling interval, such as 1024 bytes, will incur a high overhead. 11892 A lower interval, such as 1024KB, will have a much lower overhead. Sampling should only 11893 be used with an understanding that it may impact performance. 11894 </description> 11895 </param> 11896 </parameters> 11897 <errors> 11898 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 11899 <paramlink id="sampling_interval"></paramlink> is less than zero. 11900 </error> 11901 </errors> 11902 </function> 11903 </category> 11904 11905 </functionsection> 11906 11907 <errorsection label="Error Reference"> 11908 <intro> 11909 Every <jvmti/> function returns a <b><code>jvmtiError</code></b> error code. 11910 <p/> 11911 It is the responsibility of the agent to call <jvmti/> functions with 11912 valid parameters and in the proper context (calling thread is attached, 11913 phase is correct, etc.). 11914 Detecting some error conditions may be difficult, inefficient, or 11915 impossible for an implementation. 11916 The errors listed in 11917 <internallink id="reqerrors">Function Specific Required Errors</internallink> 11918 must be detected by the implementation. 11919 All other errors represent the recommended response to the error 11920 condition. 11921 </intro> 11922 11923 <errorcategory id="universal-error" label="Universal Errors"> 11924 <intro> 11925 The following errors may be returned by any function 11926 </intro> 11927 11928 <errorid id="JVMTI_ERROR_NONE" num="0"> 11929 No error has occurred. This is the error code that is returned 11930 on successful completion of the function. 11931 </errorid> 11932 <errorid id="JVMTI_ERROR_NULL_POINTER" num="100"> 11933 Pointer is unexpectedly <code>NULL</code>. 11934 </errorid> 11935 <errorid id="JVMTI_ERROR_OUT_OF_MEMORY" num="110"> 11936 The function attempted to allocate memory and no more memory was 11937 available for allocation. 11938 </errorid> 11939 <errorid id="JVMTI_ERROR_ACCESS_DENIED" num="111"> 11940 The desired functionality has not been enabled in this virtual machine. 11941 </errorid> 11942 <errorid id="JVMTI_ERROR_UNATTACHED_THREAD" num="115"> 11943 The thread being used to call this function is not attached 11944 to the virtual machine. Calls must be made from attached threads. 11945 See <code>AttachCurrentThread</code> in the JNI invocation API. 11946 </errorid> 11947 <errorid id="JVMTI_ERROR_INVALID_ENVIRONMENT" num="116"> 11948 The <jvmti/> environment provided is no longer connected or is 11949 not an environment. 11950 </errorid> 11951 <errorid id="JVMTI_ERROR_WRONG_PHASE" num="112"> 11952 The desired functionality is not available in the current 11953 <functionlink id="GetPhase">phase</functionlink>. 11954 Always returned if the virtual machine has completed running. 11955 </errorid> 11956 <errorid id="JVMTI_ERROR_INTERNAL" num="113"> 11957 An unexpected internal error has occurred. 11958 </errorid> 11959 </errorcategory> 11960 11961 <errorcategory id="reqerrors" label="Function Specific Required Errors"> 11962 <intro> 11963 The following errors are returned by some <jvmti/> functions and must 11964 be returned by the implementation when the condition occurs. 11965 </intro> 11966 11967 <errorid id="JVMTI_ERROR_INVALID_PRIORITY" num="12"> 11968 Invalid priority. 11969 </errorid> 11970 <errorid id="JVMTI_ERROR_THREAD_NOT_SUSPENDED" num="13"> 11971 Thread was not suspended. 11972 </errorid> 11973 <errorid id="JVMTI_ERROR_THREAD_SUSPENDED" num="14"> 11974 Thread already suspended. 11975 </errorid> 11976 <errorid id="JVMTI_ERROR_THREAD_NOT_ALIVE" num="15"> 11977 This operation requires the thread to be alive--that is, 11978 it must be started and not yet terminated. 11979 </errorid> 11980 <errorid id="JVMTI_ERROR_CLASS_NOT_PREPARED" num="22"> 11981 The class has been loaded but not yet prepared. 11982 </errorid> 11983 <errorid id="JVMTI_ERROR_NO_MORE_FRAMES" num="31"> 11984 There are no Java programming language or JNI stack frames at the specified depth. 11985 </errorid> 11986 <errorid id="JVMTI_ERROR_OPAQUE_FRAME" num="32"> 11987 Information about the frame is not available (e.g. for native frames). 11988 </errorid> 11989 <errorid id="JVMTI_ERROR_DUPLICATE" num="40"> 11990 Item already set. 11991 </errorid> 11992 <errorid id="JVMTI_ERROR_NOT_FOUND" num="41"> 11993 Desired element (e.g. field or breakpoint) not found 11994 </errorid> 11995 <errorid id="JVMTI_ERROR_NOT_MONITOR_OWNER" num="51"> 11996 This thread doesn't own the raw monitor. 11997 </errorid> 11998 <errorid id="JVMTI_ERROR_INTERRUPT" num="52"> 11999 The call has been interrupted before completion. 12000 </errorid> 12001 <errorid id="JVMTI_ERROR_UNMODIFIABLE_CLASS" num="79"> 12002 The class cannot be modified. 12003 </errorid> 12004 <errorid id="JVMTI_ERROR_UNMODIFIABLE_MODULE" num="80"> 12005 The module cannot be modified. 12006 </errorid> 12007 <errorid id="JVMTI_ERROR_NOT_AVAILABLE" num="98"> 12008 The functionality is not available in this virtual machine. 12009 </errorid> 12010 <errorid id="JVMTI_ERROR_ABSENT_INFORMATION" num="101"> 12011 The requested information is not available. 12012 </errorid> 12013 <errorid id="JVMTI_ERROR_INVALID_EVENT_TYPE" num="102"> 12014 The specified event type ID is not recognized. 12015 </errorid> 12016 <errorid id="JVMTI_ERROR_NATIVE_METHOD" num="104"> 12017 The requested information is not available for native method. 12018 </errorid> 12019 <errorid id="JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED" num="106"> 12020 The class loader does not support this operation. 12021 </errorid> 12022 </errorcategory> 12023 12024 <errorcategory id="function-specific-errors" label="Function Specific Agent Errors"> 12025 <intro> 12026 The following errors are returned by some <jvmti/> functions. 12027 They are returned in the event of invalid parameters passed by the 12028 agent or usage in an invalid context. 12029 An implementation is not required to detect these errors. 12030 </intro> 12031 12032 <errorid id="JVMTI_ERROR_INVALID_THREAD" num="10"> 12033 The passed thread is not a valid thread. 12034 </errorid> 12035 <errorid id="JVMTI_ERROR_INVALID_FIELDID" num="25"> 12036 Invalid field. 12037 </errorid> 12038 <errorid id="JVMTI_ERROR_INVALID_MODULE" num="26"> 12039 Invalid module. 12040 </errorid> 12041 <errorid id="JVMTI_ERROR_INVALID_METHODID" num="23"> 12042 Invalid method. 12043 </errorid> 12044 <errorid id="JVMTI_ERROR_INVALID_LOCATION" num="24"> 12045 Invalid location. 12046 </errorid> 12047 <errorid id="JVMTI_ERROR_INVALID_OBJECT" num="20"> 12048 Invalid object. 12049 </errorid> 12050 <errorid id="JVMTI_ERROR_INVALID_CLASS" num="21"> 12051 Invalid class. 12052 </errorid> 12053 <errorid id="JVMTI_ERROR_TYPE_MISMATCH" num="34"> 12054 The variable is not an appropriate type for the function used. 12055 </errorid> 12056 <errorid id="JVMTI_ERROR_INVALID_SLOT" num="35"> 12057 Invalid slot. 12058 </errorid> 12059 <errorid id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY" num="99"> 12060 The capability being used is false in this environment. 12061 </errorid> 12062 <errorid id="JVMTI_ERROR_INVALID_THREAD_GROUP" num="11"> 12063 Thread group invalid. 12064 </errorid> 12065 <errorid id="JVMTI_ERROR_INVALID_MONITOR" num="50"> 12066 Invalid raw monitor. 12067 </errorid> 12068 <errorid id="JVMTI_ERROR_ILLEGAL_ARGUMENT" num="103"> 12069 Illegal argument. 12070 </errorid> 12071 <errorid id="JVMTI_ERROR_INVALID_TYPESTATE" num="65"> 12072 The state of the thread has been modified, and is now inconsistent. 12073 </errorid> 12074 <errorid id="JVMTI_ERROR_UNSUPPORTED_VERSION" num="68"> 12075 A new class file has a version number not supported by this VM. 12076 </errorid> 12077 <errorid id="JVMTI_ERROR_INVALID_CLASS_FORMAT" num="60"> 12078 A new class file is malformed (the VM would return a <code>ClassFormatError</code>). 12079 </errorid> 12080 <errorid id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION" num="61"> 12081 The new class file definitions would lead to a circular 12082 definition (the VM would return a <code>ClassCircularityError</code>). 12083 </errorid> 12084 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED" num="63"> 12085 A new class file would require adding a method. 12086 </errorid> 12087 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED" num="64"> 12088 A new class version changes a field. 12089 </errorid> 12090 <errorid id="JVMTI_ERROR_FAILS_VERIFICATION" num="62"> 12091 The class bytes fail verification. 12092 </errorid> 12093 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED" num="66"> 12094 A direct superclass is different for the new class 12095 version, or the set of directly implemented 12096 interfaces is different. 12097 </errorid> 12098 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED" num="67"> 12099 A new class version does not declare a method 12100 declared in the old class version. 12101 </errorid> 12102 <errorid id="JVMTI_ERROR_NAMES_DONT_MATCH" num="69"> 12103 The class name defined in the new class file is 12104 different from the name in the old class object. 12105 </errorid> 12106 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED" num="70"> 12107 A new class version has different modifiers. 12108 </errorid> 12109 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED" num="71"> 12110 A method in the new class version has different modifiers 12111 than its counterpart in the old class version. 12112 </errorid> 12113 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED" num="72"> 12114 A new class version has unsupported differences in class attributes. 12115 </errorid> 12116 <errorid id="JVMTI_ERROR_UNSUPPORTED_OPERATION" num="73"> 12117 Functionality is unsupported in this implementation. 12118 </errorid> 12119 </errorcategory> 12120 </errorsection> 12121 12122 <eventsection label="Events"> 12123 <intro label="Handling Events" id="eventIntro"> 12124 Agents can be informed of many events that occur in application 12125 programs. 12126 <p/> 12127 To handle events, designate a set of callback functions with 12128 <functionlink id="SetEventCallbacks"></functionlink>. 12129 For each event the corresponding callback function will be 12130 called. 12131 Arguments to the callback function provide additional 12132 information about the event. 12133 <p/> 12134 The callback function is usually called from within an application 12135 thread. The <jvmti/> implementation does not 12136 queue events in any way. This means 12137 that event callback functions must be written 12138 carefully. Here are some general guidelines. See 12139 the individual event descriptions for further 12140 suggestions. 12141 <p/> 12142 <ul> 12143 <li>Any exception thrown during the execution of an event callback can 12144 overwrite any current pending exception in the current application thread. 12145 Care must be taken to preserve a pending exception 12146 when an event callback makes a JNI call that might generate an exception. 12147 </li> 12148 <li>Event callback functions must be re-entrant. The <jvmti/> implementation does 12149 not queue events. If an agent needs to process events one at a time, it 12150 can use a raw monitor inside the 12151 event callback functions to serialize event processing. 12152 </li> 12153 <li>Event callback functions that execute JNI's FindClass function to load 12154 classes need to note that FindClass locates the class loader associated 12155 with the current native method. For the purposes of class loading, an 12156 event callback that includes a JNI environment as a parameter to the 12157 callback will treated as if it is a native call, where the native method 12158 is in the class of the event thread's current frame. 12159 </li> 12160 </ul> 12161 <p/> 12162 Some <jvmti/> events identify objects with JNI references. 12163 All references 12164 in <jvmti/> events are JNI local references and will become invalid 12165 after the event callback returns. 12166 Unless stated otherwise, memory referenced by pointers sent in event 12167 callbacks may not be referenced after the event callback returns. 12168 <p/> 12169 Except where stated otherwise, events are delivered on the thread 12170 that caused the event. 12171 Events are sent at the time they occur. 12172 The specification for each event includes the set of 12173 <functionlink id="GetPhase">phases</functionlink> in which it can be sent; 12174 if an event triggering activity occurs during another phase, no event 12175 is sent. 12176 <p/> 12177 A thread that generates an event does not change its execution status 12178 (for example, the event does not cause the thread to be suspended). 12179 If an agent wishes the event to result in suspension, then the agent 12180 is responsible for explicitly suspending the thread with 12181 <functionlink id="SuspendThread"></functionlink>. 12182 <p/> 12183 If an event is enabled in multiple environments, the event will be sent 12184 to each agent in the order that the environments were created. 12185 </intro> 12186 12187 <intro label="Enabling Events" id="enablingevents"> 12188 All events are initially disabled. In order to receive any 12189 event: 12190 <ul> 12191 <li> 12192 If the event requires a capability, that capability must 12193 be added with 12194 <functionlink id="AddCapabilities"></functionlink>. 12195 </li> 12196 <li> 12197 A callback for the event must be set with 12198 <functionlink id="SetEventCallbacks"></functionlink>. 12199 </li> 12200 <li> 12201 The event must be enabled with 12202 <functionlink id="SetEventNotificationMode"></functionlink>. 12203 </li> 12204 </ul> 12205 </intro> 12206 12207 <intro label="Multiple Co-located Events" id="eventorder"> 12208 In many situations it is possible for multiple events to occur 12209 at the same location in one thread. When this happens, all the events 12210 are reported through the event callbacks in the order specified in this section. 12211 <p/> 12212 If the current location is at the entry point of a method, the 12213 <eventlink id="MethodEntry"></eventlink> event is reported before 12214 any other event at the current location in the same thread. 12215 <p/> 12216 If an exception catch has been detected at the current location, 12217 either because it is the beginning of a catch clause or a native method 12218 that cleared a pending exception has returned, the 12219 <code>exceptionCatch</code> event is reported before 12220 any other event at the current location in the same thread. 12221 <p/> 12222 If a <code>singleStep</code> event or 12223 <code>breakpoint</code> event is triggered at the 12224 current location, the event is defined to occur 12225 immediately before the code at the current location is executed. 12226 These events are reported before any events which are triggered 12227 by the execution of code at the current location in the same 12228 thread (specifically: 12229 <code>exception</code>, 12230 <code>fieldAccess</code>, and 12231 <code>fieldModification</code>). 12232 If both a step and breakpoint event are triggered for the same thread and 12233 location, the step event is reported before the breakpoint event. 12234 <p/> 12235 If the current location is the exit point of a method (that is, the last 12236 location before returning to the caller), the 12237 <eventlink id="MethodExit"></eventlink> event and 12238 the <eventlink id="FramePop"></eventlink> event (if requested) 12239 are reported after all other events at the current location in the same 12240 thread. There is no specified ordering of these two events 12241 with respect to each other. 12242 <p/> 12243 Co-located events can be triggered during the processing of some other 12244 event by the agent at the same location in the same thread. 12245 If such an event, of type <i>y</i>, is triggered during the processing of 12246 an event of type <i>x</i>, and if <i>x</i> 12247 precedes <i>y</i> in the ordering specified above, the co-located event 12248 <i>y</i> is reported for the current thread and location. If <i>x</i> does not precede 12249 <i>y</i>, <i>y</i> is not reported for the current thread and location. 12250 For example, if a breakpoint is set at the current location 12251 during the processing of <eventlink id="SingleStep"></eventlink>, 12252 that breakpoint will be reported before the thread moves off the current 12253 location. 12254 <p/>The following events are never considered to be co-located with 12255 other events. 12256 <ul> 12257 <li><eventlink id="VMStart"></eventlink></li> 12258 <li><eventlink id="VMInit"></eventlink></li> 12259 <li><eventlink id="VMDeath"></eventlink></li> 12260 <li><eventlink id="ThreadStart"></eventlink></li> 12261 <li><eventlink id="ThreadEnd"></eventlink></li> 12262 <li><eventlink id="ClassLoad"></eventlink></li> 12263 <li><eventlink id="ClassPrepare"></eventlink></li> 12264 </ul> 12265 </intro> 12266 12267 <intro label="Event Callbacks" id="jvmtiEventCallbacks"> 12268 The event callback structure below is used to specify the handler function 12269 for events. It is set with the 12270 <functionlink id="SetEventCallbacks"></functionlink> function. 12271 </intro> 12272 12273 <event label="Single Step" 12274 id="SingleStep" const="JVMTI_EVENT_SINGLE_STEP" filtered="thread" num="60"> 12275 <description> 12276 Single step events allow the agent to trace thread execution 12277 at the finest granularity allowed by the VM. A single step event is 12278 generated whenever a thread reaches a new location. 12279 Typically, single step events represent the completion of one VM 12280 instruction as defined in <vmspec/>. However, some implementations 12281 may define locations differently. In any case the 12282 <code>method</code> and <code>location</code> 12283 parameters uniquely identify the current location and allow 12284 the mapping to source file and line number when that information is 12285 available. 12286 <p/> 12287 No single step events are generated from within native methods. 12288 </description> 12289 <origin>jvmdi</origin> 12290 <capabilities> 12291 <required id="can_generate_single_step_events"></required> 12292 </capabilities> 12293 <parameters> 12294 <param id="jni_env"> 12295 <outptr> 12296 <struct>JNIEnv</struct> 12297 </outptr> 12298 <description> 12299 The JNI environment of the event (current) thread 12300 </description> 12301 </param> 12302 <param id="thread"> 12303 <jthread/> 12304 <description> 12305 Thread about to execution a new instruction 12306 </description> 12307 </param> 12308 <param id="klass"> 12309 <jclass method="method"/> 12310 <description> 12311 Class of the method about to execute a new instruction 12312 </description> 12313 </param> 12314 <param id="method"> 12315 <jmethodID class="klass"/> 12316 <description> 12317 Method about to execute a new instruction 12318 </description> 12319 </param> 12320 <param id="location"> 12321 <jlocation/> 12322 <description> 12323 Location of the new instruction 12324 </description> 12325 </param> 12326 </parameters> 12327 </event> 12328 12329 <event label="Breakpoint" 12330 id="Breakpoint" const="JVMTI_EVENT_BREAKPOINT" filtered="thread" num="62"> 12331 <description> 12332 Breakpoint events are generated whenever a thread reaches a location 12333 designated as a breakpoint with <functionlink id="SetBreakpoint"></functionlink>. 12334 The <code>method</code> and <code>location</code> 12335 parameters uniquely identify the current location and allow 12336 the mapping to source file and line number when that information is 12337 available. 12338 </description> 12339 <origin>jvmdi</origin> 12340 <capabilities> 12341 <required id="can_generate_breakpoint_events"></required> 12342 </capabilities> 12343 <parameters> 12344 <param id="jni_env"> 12345 <outptr> 12346 <struct>JNIEnv</struct> 12347 </outptr> 12348 <description> 12349 The JNI environment of the event (current) thread. 12350 </description> 12351 </param> 12352 <param id="thread"> 12353 <jthread/> 12354 <description> 12355 Thread that hit the breakpoint 12356 </description> 12357 </param> 12358 <param id="klass"> 12359 <jclass method="method"/> 12360 <description> 12361 Class of the method that hit the breakpoint 12362 </description> 12363 </param> 12364 <param id="method"> 12365 <jmethodID class="klass"/> 12366 <description> 12367 Method that hit the breakpoint 12368 </description> 12369 </param> 12370 <param id="location"> 12371 <jlocation/> 12372 <description> 12373 location of the breakpoint 12374 </description> 12375 </param> 12376 </parameters> 12377 </event> 12378 12379 <event label="Field Access" 12380 id="FieldAccess" const="JVMTI_EVENT_FIELD_ACCESS" filtered="thread" num="63"> 12381 <description> 12382 Field access events are generated whenever a thread accesses 12383 a field that was designated as a watchpoint 12384 with <functionlink id="SetFieldAccessWatch"></functionlink>. 12385 The <code>method</code> and <code>location</code> 12386 parameters uniquely identify the current location and allow 12387 the mapping to source file and line number when that information is 12388 available. 12389 </description> 12390 <origin>jvmdi</origin> 12391 <capabilities> 12392 <required id="can_generate_field_access_events"></required> 12393 </capabilities> 12394 <parameters> 12395 <param id="jni_env"> 12396 <outptr> 12397 <struct>JNIEnv</struct> 12398 </outptr> 12399 <description> 12400 The JNI environment of the event (current) thread 12401 </description> 12402 </param> 12403 <param id="thread"> 12404 <jthread/> 12405 <description> 12406 Thread accessing the field 12407 </description> 12408 </param> 12409 <param id="klass"> 12410 <jclass method="method"/> 12411 <description> 12412 Class of the method where the access is occurring 12413 </description> 12414 </param> 12415 <param id="method"> 12416 <jmethodID class="klass"/> 12417 <description> 12418 Method where the access is occurring 12419 </description> 12420 </param> 12421 <param id="location"> 12422 <jlocation/> 12423 <description> 12424 Location where the access is occurring 12425 </description> 12426 </param> 12427 <param id="field_klass"> 12428 <jclass field="field"/> 12429 <description> 12430 Class of the field being accessed 12431 </description> 12432 </param> 12433 <param id="object"> 12434 <jobject/> 12435 <description> 12436 Object with the field being accessed if the field is an 12437 instance field; <code>NULL</code> otherwise 12438 </description> 12439 </param> 12440 <param id="field"> 12441 <jfieldID class="field_klass"/> 12442 <description> 12443 Field being accessed 12444 </description> 12445 </param> 12446 </parameters> 12447 </event> 12448 12449 <event label="Field Modification" 12450 id="FieldModification" const="JVMTI_EVENT_FIELD_MODIFICATION" filtered="thread" num="64"> 12451 <description> 12452 Field modification events are generated whenever a thread modifies 12453 a field that was designated as a watchpoint 12454 with <functionlink id="SetFieldModificationWatch"></functionlink>. 12455 The <code>method</code> and <code>location</code> 12456 parameters uniquely identify the current location and allow 12457 the mapping to source file and line number when that information is 12458 available. 12459 </description> 12460 <origin>jvmdi</origin> 12461 <capabilities> 12462 <required id="can_generate_field_modification_events"></required> 12463 </capabilities> 12464 <parameters> 12465 <param id="jni_env"> 12466 <outptr> 12467 <struct>JNIEnv</struct> 12468 </outptr> 12469 <description> 12470 The JNI environment of the event (current) thread 12471 </description> 12472 </param> 12473 <param id="thread"> 12474 <jthread/> 12475 <description> 12476 Thread modifying the field 12477 </description> 12478 </param> 12479 <param id="klass"> 12480 <jclass method="method"/> 12481 <description> 12482 Class of the method where the modification is occurring 12483 </description> 12484 </param> 12485 <param id="method"> 12486 <jmethodID class="klass"/> 12487 <description> 12488 Method where the modification is occurring 12489 </description> 12490 </param> 12491 <param id="location"> 12492 <jlocation/> 12493 <description> 12494 Location where the modification is occurring 12495 </description> 12496 </param> 12497 <param id="field_klass"> 12498 <jclass field="field"/> 12499 <description> 12500 Class of the field being modified 12501 </description> 12502 </param> 12503 <param id="object"> 12504 <jobject/> 12505 <description> 12506 Object with the field being modified if the field is an 12507 instance field; <code>NULL</code> otherwise 12508 </description> 12509 </param> 12510 <param id="field"> 12511 <jfieldID class="field_klass"/> 12512 <description> 12513 Field being modified 12514 </description> 12515 </param> 12516 <param id="signature_type"> 12517 <char/> 12518 <description> 12519 Signature type of the new value 12520 </description> 12521 </param> 12522 <param id="new_value"> 12523 <jvalue/> 12524 <description> 12525 The new value 12526 </description> 12527 </param> 12528 </parameters> 12529 </event> 12530 12531 <event label="Frame Pop" 12532 id="FramePop" const="JVMTI_EVENT_FRAME_POP" filtered="thread" num="61"> 12533 <description> 12534 Frame pop events are generated upon exit from a single method 12535 in a single frame as specified 12536 in a call to <functionlink id="NotifyFramePop"></functionlink>. 12537 This is true whether termination is caused by 12538 executing its return instruction 12539 or by throwing an exception to its caller 12540 (see <paramlink id="was_popped_by_exception"></paramlink>). 12541 However, frame pops caused by the <functionlink id="PopFrame"/> 12542 function are not reported. 12543 <p/> 12544 The location reported by <functionlink id="GetFrameLocation"></functionlink> 12545 for the depth 0 identifies the executable location in the returning method, 12546 immediately prior to the return. 12547 </description> 12548 <origin>jvmdi</origin> 12549 <capabilities> 12550 <required id="can_generate_frame_pop_events"></required> 12551 </capabilities> 12552 <parameters> 12553 <param id="jni_env"> 12554 <outptr> 12555 <struct>JNIEnv</struct> 12556 </outptr> 12557 <description> 12558 The JNI environment of the event (current) thread 12559 </description> 12560 </param> 12561 <param id="thread"> 12562 <jthread/> 12563 <description> 12564 Thread that is popping the frame 12565 </description> 12566 </param> 12567 <param id="klass"> 12568 <jclass method="method"/> 12569 <description> 12570 Class of the method being popped 12571 </description> 12572 </param> 12573 <param id="method"> 12574 <jmethodID class="klass"/> 12575 <description> 12576 Method being popped 12577 </description> 12578 </param> 12579 <param id="was_popped_by_exception"> 12580 <jboolean/> 12581 <description> 12582 True if frame was popped by a thrown exception. 12583 False if method exited through its return instruction. 12584 </description> 12585 </param> 12586 </parameters> 12587 </event> 12588 12589 <event label="Method Entry" 12590 id="MethodEntry" const="JVMTI_EVENT_METHOD_ENTRY" filtered="thread" num="65"> 12591 <description> 12592 Method entry events are generated upon entry of Java 12593 programming language methods (including native methods). 12594 <p/> 12595 The location reported by <functionlink id="GetFrameLocation"></functionlink> 12596 for the depth 0 identifies the initial executable location in the method. 12597 <p/> 12598 Enabling method 12599 entry or exit events will significantly degrade performance on many platforms and is thus 12600 not advised for performance critical usage (such as profiling). 12601 <internallink id="bci">Bytecode instrumentation</internallink> should be 12602 used in these cases. 12603 </description> 12604 <origin>jvmdi</origin> 12605 <capabilities> 12606 <required id="can_generate_method_entry_events"></required> 12607 </capabilities> 12608 <parameters> 12609 <param id="jni_env"> 12610 <outptr> 12611 <struct>JNIEnv</struct> 12612 </outptr> 12613 <description> 12614 The JNI environment of the event (current) thread 12615 </description> 12616 </param> 12617 <param id="thread"> 12618 <jthread/> 12619 <description> 12620 Thread entering the method 12621 </description> 12622 </param> 12623 <param id="klass"> 12624 <jclass method="method"/> 12625 <description> 12626 Class of the method being entered 12627 </description> 12628 </param> 12629 <param id="method"> 12630 <jmethodID class="klass"/> 12631 <description> 12632 Method being entered 12633 </description> 12634 </param> 12635 </parameters> 12636 </event> 12637 12638 <event label="Method Exit" 12639 id="MethodExit" const="JVMTI_EVENT_METHOD_EXIT" filtered="thread" num="66"> 12640 <description> 12641 Method exit events are generated upon exit from Java 12642 programming language methods (including native methods). 12643 This is true whether termination is caused by 12644 executing its return instruction 12645 or by throwing an exception to its caller 12646 (see <paramlink id="was_popped_by_exception"></paramlink>). 12647 <p/> 12648 The location reported by <functionlink id="GetFrameLocation"></functionlink> 12649 for the depth 0 identifies the executable location in the returning method 12650 immediately prior to the return. 12651 <p/> 12652 Enabling method 12653 entry or exit events will significantly degrade performance on many platforms and is thus 12654 not advised for performance critical usage (such as profiling). 12655 <internallink id="bci">Bytecode instrumentation</internallink> should be 12656 used in these cases. 12657 </description> 12658 <origin>jvmdi</origin> 12659 <capabilities> 12660 <required id="can_generate_method_exit_events"></required> 12661 </capabilities> 12662 <parameters> 12663 <param id="jni_env"> 12664 <outptr> 12665 <struct>JNIEnv</struct> 12666 </outptr> 12667 <description> 12668 The JNI environment of the event (current) thread 12669 </description> 12670 </param> 12671 <param id="thread"> 12672 <jthread/> 12673 <description> 12674 Thread exiting the method 12675 </description> 12676 </param> 12677 <param id="klass"> 12678 <jclass method="method"/> 12679 <description> 12680 Class of the method being exited 12681 </description> 12682 </param> 12683 <param id="method"> 12684 <jmethodID class="klass"/> 12685 <description> 12686 Method being exited 12687 </description> 12688 </param> 12689 <param id="was_popped_by_exception"> 12690 <jboolean/> 12691 <description> 12692 True if frame was popped by a thrown exception. 12693 False if method exited through its return instruction. 12694 </description> 12695 </param> 12696 <param id="return_value"> 12697 <jvalue/> 12698 <description> 12699 The return value of the method being exited. 12700 Undefined and should not be used if 12701 <paramlink id="was_popped_by_exception"></paramlink> 12702 is true. 12703 </description> 12704 </param> 12705 </parameters> 12706 </event> 12707 12708 <event label="Native Method Bind" phase="any" 12709 id="NativeMethodBind" const="JVMTI_EVENT_NATIVE_METHOD_BIND" num="67"> 12710 <description> 12711 A Native Method Bind event is sent when a VM binds a 12712 Java programming language native method 12713 to the address of a function that implements the native method. 12714 This will occur when the native method is called for the first time 12715 and also occurs when the JNI function <code>RegisterNatives</code> is called. 12716 This event allows the bind to be redirected to an agent-specified 12717 proxy function. 12718 This event is not sent when the native method is unbound. 12719 Typically, this proxy function will need to be specific to a 12720 particular method or, to handle the general case, automatically 12721 generated assembly code, since after instrumentation code is 12722 executed the function at the original binding 12723 address will usually be invoked. 12724 The original binding can be restored or the redirection changed 12725 by use of the JNI function <code>RegisterNatives</code>. 12726 Some events may be sent during the primordial phase, JNI and 12727 most of <jvmti/> cannot be used at this time but the method and 12728 address can be saved for use later. 12729 </description> 12730 <origin>new</origin> 12731 <capabilities> 12732 <required id="can_generate_native_method_bind_events"></required> 12733 </capabilities> 12734 <parameters> 12735 <param id="jni_env"> 12736 <outptr> 12737 <struct>JNIEnv</struct> 12738 </outptr> 12739 <description> 12740 The JNI environment of the event (current) thread 12741 Will be <code>NULL</code> if sent during the primordial 12742 <functionlink id="GetPhase">phase</functionlink>. 12743 </description> 12744 </param> 12745 <param id="thread"> 12746 <jthread/> 12747 <description> 12748 Thread requesting the bind 12749 </description> 12750 </param> 12751 <param id="klass"> 12752 <jclass method="method"/> 12753 <description> 12754 Class of the method being bound 12755 </description> 12756 </param> 12757 <param id="method"> 12758 <jmethodID class="klass"/> 12759 <description> 12760 Native method being bound 12761 </description> 12762 </param> 12763 <param id="address"> 12764 <outptr><void/></outptr> 12765 <description> 12766 The address the VM is about to bind to--that is, the 12767 address of the implementation of the native method 12768 </description> 12769 </param> 12770 <param id="new_address_ptr"> 12771 <agentbuf><void/></agentbuf> 12772 <description> 12773 if the referenced address is changed (that is, if 12774 <code>*new_address_ptr</code> is set), the binding 12775 will instead be made to the supplied address. 12776 </description> 12777 </param> 12778 </parameters> 12779 </event> 12780 12781 <event label="Exception" 12782 id="Exception" const="JVMTI_EVENT_EXCEPTION" filtered="thread" num="58"> 12783 <description> 12784 Exception events are generated whenever an exception is first detected 12785 in a Java programming language method. 12786 Where "exception" means any <code>java.lang.Throwable</code>. 12787 The exception may have been thrown by a Java programming language or native 12788 method, but in the case of native methods, the event is not generated 12789 until the exception is first seen by a Java programming language method. If an exception is 12790 set and cleared in a native method (and thus is never visible to Java programming language code), 12791 no exception event is generated. 12792 <p/> 12793 The <code>method</code> and <code>location</code> 12794 parameters uniquely identify the current location 12795 (where the exception was detected) and allow 12796 the mapping to source file and line number when that information is 12797 available. The <code>exception</code> field identifies the thrown 12798 exception object. The <code>catch_method</code> 12799 and <code>catch_location</code> identify the location of the catch clause, 12800 if any, that handles the thrown exception. If there is no such catch clause, 12801 each field is set to 0. There is no guarantee that the thread will ever 12802 reach this catch clause. If there are native methods on the call stack 12803 between the throw location and the catch clause, the exception may 12804 be reset by one of those native methods. 12805 Similarly, exceptions that are reported as uncaught (<code>catch_klass</code> 12806 et al. set to 0) may in fact be caught by native code. 12807 Agents can check for these occurrences by monitoring 12808 <eventlink id="ExceptionCatch"></eventlink> events. 12809 Note that finally clauses are implemented as catch and re-throw. Therefore they 12810 will be reported in the catch location. 12811 </description> 12812 <origin>jvmdi</origin> 12813 <capabilities> 12814 <required id="can_generate_exception_events"></required> 12815 </capabilities> 12816 <parameters> 12817 <param id="jni_env"> 12818 <outptr> 12819 <struct>JNIEnv</struct> 12820 </outptr> 12821 <description> 12822 The JNI environment of the event (current) thread 12823 </description> 12824 </param> 12825 <param id="thread"> 12826 <jthread/> 12827 <description> 12828 Thread generating the exception 12829 </description> 12830 </param> 12831 <param id="klass"> 12832 <jclass method="method"/> 12833 <description> 12834 Class generating the exception 12835 </description> 12836 </param> 12837 <param id="method"> 12838 <jmethodID class="klass"/> 12839 <description> 12840 Method generating the exception 12841 </description> 12842 </param> 12843 <param id="location"> 12844 <jlocation/> 12845 <description> 12846 Location where exception occurred 12847 </description> 12848 </param> 12849 <param id="exception"> 12850 <jobject/> 12851 <description> 12852 The exception being thrown 12853 </description> 12854 </param> 12855 <param id="catch_klass"> 12856 <jclass method="catch_method"/> 12857 <description> 12858 Class that will catch the exception, or <code>NULL</code> if no known catch 12859 </description> 12860 </param> 12861 <param id="catch_method"> 12862 <jmethodID class="catch_klass"/> 12863 <description> 12864 Method that will catch the exception, or <code>NULL</code> if no known catch 12865 </description> 12866 </param> 12867 <param id="catch_location"> 12868 <jlocation/> 12869 <description> 12870 location which will catch the exception or zero if no known catch 12871 </description> 12872 </param> 12873 </parameters> 12874 </event> 12875 12876 <event label="Exception Catch" 12877 id="ExceptionCatch" const="JVMTI_EVENT_EXCEPTION_CATCH" filtered="thread" num="59"> 12878 <description> 12879 Exception catch events are generated whenever a thrown exception is caught. 12880 Where "exception" means any <code>java.lang.Throwable</code>. 12881 If the exception is caught in a Java programming language method, the event is generated 12882 when the catch clause is reached. If the exception is caught in a native 12883 method, the event is generated as soon as control is returned to a Java programming language 12884 method. Exception catch events are generated for any exception for which 12885 a throw was detected in a Java programming language method. 12886 Note that finally clauses are implemented as catch and re-throw. Therefore they 12887 will generate exception catch events. 12888 <p/> 12889 The <code>method</code> and <code>location</code> 12890 parameters uniquely identify the current location 12891 and allow the mapping to source file and line number when that information is 12892 available. For exceptions caught in a Java programming language method, the 12893 <code>exception</code> object identifies the exception object. Exceptions 12894 caught in native methods are not necessarily available by the time the 12895 exception catch is reported, so the <code>exception</code> field is set 12896 to <code>NULL</code>. 12897 </description> 12898 <origin>jvmdi</origin> 12899 <capabilities> 12900 <required id="can_generate_exception_events"></required> 12901 </capabilities> 12902 <parameters> 12903 <param id="jni_env"> 12904 <outptr> 12905 <struct>JNIEnv</struct> 12906 </outptr> 12907 <description> 12908 The JNI environment of the event (current) thread 12909 </description> 12910 </param> 12911 <param id="thread"> 12912 <jthread/> 12913 <description> 12914 Thread catching the exception 12915 </description> 12916 </param> 12917 <param id="klass"> 12918 <jclass method="method"/> 12919 <description> 12920 Class catching the exception 12921 </description> 12922 </param> 12923 <param id="method"> 12924 <jmethodID class="klass"/> 12925 <description> 12926 Method catching the exception 12927 </description> 12928 </param> 12929 <param id="location"> 12930 <jlocation/> 12931 <description> 12932 Location where exception is being caught 12933 </description> 12934 </param> 12935 <param id="exception"> 12936 <jobject/> 12937 <description> 12938 Exception being caught 12939 </description> 12940 </param> 12941 </parameters> 12942 </event> 12943 12944 <event label="Thread Start" 12945 id="ThreadStart" const="JVMTI_EVENT_THREAD_START" num="52" phase="start"> 12946 <description> 12947 A thread start event is generated by a new thread before its initial 12948 method executes. 12949 <p/> 12950 This event is generated by platform threads. It is also generated by 12951 virtual threads when the capability 12952 <internallink id="jvmtiCapabilities.can_support_virtual_threads"> 12953 <code>can_support_virtual_threads</code></internallink> is not enabled. 12954 Agents without support for virtual threads that enable this event will 12955 therefore be notified by all newly started threads. 12956 <p/> 12957 If the capability <code>can_support_virtual_threads</code> is enabled then 12958 this event is not generated by virtual threads. Agents with support for 12959 virtual threads can enable <eventlink id="VirtualThreadStart"></eventlink> 12960 to be notified by newly started virtual threads. 12961 <p/> 12962 A platform thread may be listed in the array returned by 12963 <functionlink id="GetAllThreads"></functionlink> 12964 before its thread start event is generated. 12965 It is possible for other events to be generated 12966 on a thread before its thread start event. 12967 <p/> 12968 The event is sent on the newly started <paramlink id="thread"></paramlink>. 12969 </description> 12970 <origin>jvmdi</origin> 12971 <capabilities> 12972 </capabilities> 12973 <parameters> 12974 <param id="jni_env"> 12975 <outptr> 12976 <struct>JNIEnv</struct> 12977 </outptr> 12978 <description> 12979 The JNI environment of the event (current) thread. 12980 </description> 12981 </param> 12982 <param id="thread"> 12983 <jthread/> 12984 <description> 12985 Thread starting 12986 </description> 12987 </param> 12988 </parameters> 12989 </event> 12990 12991 <event label="Thread End" 12992 id="ThreadEnd" const="JVMTI_EVENT_THREAD_END" filtered="thread" num="53" phase="start"> 12993 <description> 12994 A thread end event is generated by a terminating thread after its 12995 initial method has finished execution. 12996 <p/> 12997 This event is generated by platform threads. It is also generated by 12998 virtual threads when the capability 12999 <internallink id="jvmtiCapabilities.can_support_virtual_threads"> 13000 <code>can_support_virtual_threads</code></internallink> is not enabled. 13001 Agents without support for virtual threads that enable this event for 13002 all threads will therefore be notified by all terminating threads. 13003 <p/> 13004 If the capability <code>can_support_virtual_threads</code> is enabled then 13005 this event is not generated by virtual threads. Agents with support for 13006 virtual threads can enable <eventlink id="VirtualThreadEnd"></eventlink> 13007 to be notified by terminating virtual threads. 13008 <p/> 13009 A platform thread may be listed in the array returned by 13010 <functionlink id="GetAllThreads"></functionlink> 13011 after its thread end event is generated. 13012 No events are generated on a thread 13013 after its thread end event. 13014 <p/> 13015 The event is sent on the terminating <paramlink id="thread"></paramlink>. 13016 </description> 13017 <origin>jvmdi</origin> 13018 <capabilities> 13019 </capabilities> 13020 <parameters> 13021 <param id="jni_env"> 13022 <outptr> 13023 <struct>JNIEnv</struct> 13024 </outptr> 13025 <description> 13026 The JNI environment of the event (current) thread. 13027 </description> 13028 </param> 13029 <param id="thread"> 13030 <jthread/> 13031 <description> 13032 Thread ending 13033 </description> 13034 </param> 13035 </parameters> 13036 </event> 13037 13038 <event label="Virtual Thread Start" 13039 id="VirtualThreadStart" const="JVMTI_EVENT_VIRTUAL_THREAD_START" filtered="thread" num="87" phase="start" since="19"> 13040 <description> 13041 <b> VirtualThreadStart is a preview API of the Java platform. </b> 13042 <i>Preview features may be removed in a future release, or upgraded to 13043 permanent features of the Java platform.</i> 13044 <p/> 13045 A virtual thread start event is generated before its initial method executes. 13046 <p/> 13047 The event is sent on the newly started <paramlink id="virtual_thread"></paramlink>. 13048 </description> 13049 <origin>new</origin> 13050 <capabilities> 13051 <required id="can_support_virtual_threads">Can support virtual threads</required> 13052 </capabilities> 13053 <parameters> 13054 <param id="jni_env"> 13055 <outptr> 13056 <struct>JNIEnv</struct> 13057 </outptr> 13058 <description> 13059 The JNI environment of the event (current) thread. 13060 </description> 13061 </param> 13062 <param id="virtual_thread"> 13063 <jthread/> 13064 <description> 13065 Virtual thread started for execution. 13066 </description> 13067 </param> 13068 </parameters> 13069 </event> 13070 13071 <event label="Virtual Thread End" 13072 id="VirtualThreadEnd" const="JVMTI_EVENT_VIRTUAL_THREAD_END" filtered="thread" num="88" phase="start" since="19"> 13073 <description> 13074 <b> VirtualThreadEnd is a preview API of the Java platform. </b> 13075 <i>Preview features may be removed in a future release, or upgraded to 13076 permanent features of the Java platform.</i> 13077 <p/> 13078 A virtual thread end event is generated after its initial method has finished execution. 13079 <p/> 13080 The event is sent on the terminating <paramlink id="virtual_thread"></paramlink>. 13081 </description> 13082 <origin>new</origin> 13083 <capabilities> 13084 <required id="can_support_virtual_threads">Can support virtual threads</required> 13085 </capabilities> 13086 <parameters> 13087 <param id="jni_env"> 13088 <outptr> 13089 <struct>JNIEnv</struct> 13090 </outptr> 13091 <description> 13092 The JNI environment of the event (current) thread. 13093 </description> 13094 </param> 13095 <param id="virtual_thread"> 13096 <jthread/> 13097 <description> 13098 Virtual thread being ended. 13099 </description> 13100 </param> 13101 </parameters> 13102 </event> 13103 13104 <elide> 13105 <event label="Virtual Thread Mount" 13106 id="VirtualThreadMount" const="JVMTI_EVENT_VIRTUAL_THREAD_MOUNT" filtered="thread" num="89" phase="start" since="99"> 13107 <description> 13108 A virtual thread mount event is generated before its method continue to execute on the mounted thread. 13109 <p/> 13110 The event is sent on the <paramlink id="thread"></paramlink> the virtual thread is mounted to. 13111 </description> 13112 <origin>new</origin> 13113 <capabilities> 13114 <required id="can_support_virtual_threads">Can support virtual threads</required> 13115 </capabilities> 13116 <parameters> 13117 <param id="jni_env"> 13118 <outptr> 13119 <struct>JNIEnv</struct> 13120 </outptr> 13121 <description> 13122 The JNI environment of the event (current) thread. 13123 </description> 13124 </param> 13125 <param id="virtual_thread"> 13126 <jthread/> 13127 <description> 13128 Virtual thread that is mounted. 13129 </description> 13130 </param> 13131 </parameters> 13132 </event> 13133 </elide> 13134 13135 <elide> 13136 <event label="Virtual Thread Unmount" 13137 id="VirtualThreadUnmount" const="JVMTI_EVENT_VIRTUAL_THREAD_UNMOUNT" filtered="thread" num="90" phase="start" since="99"> 13138 <description> 13139 A virtual thread unmount event is generated when the virtual thread is about to be unmounted from the carrier thread. 13140 <p/> 13141 The event is sent on the <paramlink id="thread"></paramlink> the virtual thread is unmounted from. 13142 </description> 13143 <origin>new</origin> 13144 <capabilities> 13145 <required id="can_support_virtual_threads">Can support virtual threads</required> 13146 </capabilities> 13147 <parameters> 13148 <param id="jni_env"> 13149 <outptr> 13150 <struct>JNIEnv</struct> 13151 </outptr> 13152 <description> 13153 The JNI environment of the event (current) thread. 13154 </description> 13155 </param> 13156 <param id="virtual_thread"> 13157 <jthread/> 13158 <description> 13159 Virtual thread that is unmounted. 13160 </description> 13161 </param> 13162 </parameters> 13163 </event> 13164 </elide> 13165 13166 <event label="Class Load" 13167 id="ClassLoad" const="JVMTI_EVENT_CLASS_LOAD" filtered="thread" phase="start" num="55"> 13168 <description> 13169 A class load event is generated 13170 <functionlink id="GetLoadedClasses">when a class or interface is created.</functionlink>. 13171 <p/> 13172 Array class creation does not generate a class load event. 13173 The creation of a primitive class (for example, java.lang.Integer.TYPE) 13174 does not generate a class load event. 13175 <p/> 13176 The order of class load events generated by a particular thread is guaranteed 13177 to match the order of class loading within that thread. 13178 <p/> 13179 This event is sent at an early stage in loading the class. As 13180 a result the class should be used carefully. Note, for example, 13181 that methods and fields are not yet loaded, so queries for methods, 13182 fields, subclasses, and so on will not give correct results. 13183 See "Loading of Classes and Interfaces" in the <i>Java Language 13184 Specification</i>. For most 13185 purposes the <eventlink id="ClassPrepare"></eventlink> event will 13186 be more useful. 13187 </description> 13188 <origin>jvmdi</origin> 13189 <capabilities> 13190 </capabilities> 13191 <parameters> 13192 <param id="jni_env"> 13193 <outptr> 13194 <struct>JNIEnv</struct> 13195 </outptr> 13196 <description> 13197 The JNI environment of the event (current) thread 13198 </description> 13199 </param> 13200 <param id="thread"> 13201 <jthread/> 13202 <description> 13203 Thread loading the class 13204 </description> 13205 </param> 13206 <param id="klass"> 13207 <jclass/> 13208 <description> 13209 Class being loaded 13210 </description> 13211 </param> 13212 </parameters> 13213 </event> 13214 13215 <elide> 13216 <event label="Class Unload" 13217 id="ClassUnload" const="JVMTI_EVENT_CLASS_UNLOAD" num="57"> 13218 <description> 13219 A class unload event is generated when the class is about to be unloaded. 13220 Class unload events take place during garbage collection and must be 13221 handled extremely carefully. The garbage collector holds many locks 13222 and has suspended all other threads, so the event handler cannot depend 13223 on the ability to acquire any locks. The class unload event handler should 13224 do as little as possible, perhaps by queuing information to be processed 13225 later. In particular, the <code>jclass</code> should be used only in 13226 the JNI function <code>isSameObject</code> or in the following <jvmti/> functions: 13227 <ul> 13228 <li><functionlink id="GetClassSignature"></functionlink></li> 13229 <li><functionlink id="GetSourceFileName"></functionlink></li> 13230 <li><functionlink id="IsInterface"></functionlink></li> 13231 <li><functionlink id="IsArrayClass"></functionlink></li> 13232 </ul> 13233 </description> 13234 <origin>jvmdi</origin> 13235 <capabilities> 13236 </capabilities> 13237 <parameters> 13238 <param id="jni_env"> 13239 <outptr> 13240 <struct>JNIEnv</struct> 13241 </outptr> 13242 <description> 13243 The JNI environment of the event (current) thread 13244 </description> 13245 </param> 13246 <param id="thread"> 13247 <jthread/> 13248 <description> 13249 Thread generating the class unload 13250 </description> 13251 </param> 13252 <param id="klass"> 13253 <jclass/> 13254 <description> 13255 Class being unloaded 13256 </description> 13257 </param> 13258 </parameters> 13259 </event> 13260 </elide> 13261 13262 <event label="Class Prepare" 13263 id="ClassPrepare" const="JVMTI_EVENT_CLASS_PREPARE" filtered="thread" phase="start" num="56"> 13264 <description> 13265 A class prepare event is generated when class preparation is complete. 13266 At this point, class fields, methods, and implemented interfaces are 13267 available, and no code from the class has been executed. Since array 13268 classes never have fields or methods, class prepare events are not 13269 generated for them. Class prepare events are not generated for 13270 primitive classes (for example, <code>java.lang.Integer.TYPE</code>). 13271 </description> 13272 <origin>jvmdi</origin> 13273 <capabilities> 13274 </capabilities> 13275 <parameters> 13276 <param id="jni_env"> 13277 <outptr> 13278 <struct>JNIEnv</struct> 13279 </outptr> 13280 <description> 13281 The JNI environment of the event (current) thread 13282 </description> 13283 </param> 13284 <param id="thread"> 13285 <jthread/> 13286 <description> 13287 Thread generating the class prepare 13288 </description> 13289 </param> 13290 <param id="klass"> 13291 <jclass/> 13292 <description> 13293 Class being prepared 13294 </description> 13295 </param> 13296 </parameters> 13297 </event> 13298 13299 <event label="Class File Load Hook" phase="any" 13300 id="ClassFileLoadHook" const="JVMTI_EVENT_CLASS_FILE_LOAD_HOOK" num="54"> 13301 <description> 13302 This event is sent when the VM obtains class file data, 13303 but before it constructs 13304 the in-memory representation for that class. 13305 This event is also sent when the class is being modified by the 13306 <functionlink id="RetransformClasses"/> function or 13307 the <functionlink id="RedefineClasses"/> function, 13308 called in any <jvmti/> environment. 13309 The agent can instrument 13310 the existing class file data sent by the VM to include profiling/debugging hooks. 13311 See the description of 13312 <internallink id="bci">bytecode instrumentation</internallink> 13313 for usage information. 13314 <p/> 13315 When the capabilities 13316 <internallink id="jvmtiCapabilities.can_generate_early_class_hook_events"> 13317 <code>can_generate_early_class_hook_events</code></internallink> and 13318 <internallink id="jvmtiCapabilities.can_generate_all_class_hook_events"> 13319 <code>can_generate_all_class_hook_events</code></internallink> 13320 are enabled then this event may be sent in the primordial phase. 13321 Otherwise, this event may be sent before the VM is initialized (the start 13322 <functionlink id="GetPhase">phase</functionlink>). 13323 Some classes might not be compatible 13324 with the function (eg. ROMized classes or implementation defined classes) and this event will 13325 not be generated for these classes. 13326 <p/> 13327 The agent must allocate the space for the modified 13328 class file data buffer 13329 using the memory allocation function 13330 <functionlink id="Allocate"></functionlink> because the 13331 VM is responsible for freeing the new class file data buffer 13332 using <functionlink id="Deallocate"></functionlink>. 13333 <p/> 13334 If the agent wishes to modify the class file, it must set 13335 <code>new_class_data</code> to point 13336 to the newly instrumented class file data buffer and set 13337 <code>new_class_data_len</code> to the length of that 13338 buffer before returning 13339 from this call. If no modification is desired, the agent simply 13340 does not set <code>new_class_data</code>. If multiple agents 13341 have enabled this event the results are chained. That is, if 13342 <code>new_class_data</code> has been set, it becomes the 13343 <code>class_data</code> for the next agent. 13344 <p/> 13345 When handling a class load in the live phase, then the 13346 <functionlink id="GetNamedModule"></functionlink> 13347 function can be used to map class loader and a package name to a module. 13348 When a class is being redefined or retransformed then 13349 <code>class_being_redefined</code> is non <code>NULL</code> and so 13350 the JNI <code>GetModule</code> function can also be used 13351 to obtain the Module. 13352 <p/> 13353 The order that this event is sent to each environment differs 13354 from other events. 13355 This event is sent to environments in the following order: 13356 <ul> 13357 <li><fieldlink id="can_retransform_classes" 13358 struct="jvmtiCapabilities">retransformation 13359 incapable</fieldlink> 13360 environments, in the 13361 order in which they were created 13362 </li> 13363 <li><fieldlink id="can_retransform_classes" 13364 struct="jvmtiCapabilities">retransformation 13365 capable</fieldlink> 13366 environments, in the 13367 order in which they were created 13368 </li> 13369 </ul> 13370 When triggered by <functionlink id="RetransformClasses"/>, 13371 this event is sent only to <fieldlink id="can_retransform_classes" 13372 struct="jvmtiCapabilities">retransformation 13373 capable</fieldlink> 13374 environments. 13375 </description> 13376 <origin>jvmpi</origin> 13377 <capabilities> 13378 <capability id="can_generate_all_class_hook_events"></capability> 13379 <capability id="can_generate_early_class_hook_events"></capability> 13380 </capabilities> 13381 <parameters> 13382 <param id="jni_env"> 13383 <outptr> 13384 <struct>JNIEnv</struct> 13385 </outptr> 13386 <description> 13387 The JNI environment of the event (current) thread. 13388 </description> 13389 </param> 13390 <param id="class_being_redefined"> 13391 <jclass/> 13392 <description> 13393 The class being 13394 <functionlink id="RedefineClasses">redefined</functionlink> or 13395 <functionlink id="RetransformClasses">retransformed</functionlink>. 13396 <code>NULL</code> if sent by class load. 13397 </description> 13398 </param> 13399 <param id="loader"> 13400 <jobject/> 13401 <description> 13402 The class loader loading the class. 13403 <code>NULL</code> if the bootstrap class loader. 13404 </description> 13405 </param> 13406 <param id="name"> 13407 <vmbuf><char/></vmbuf> 13408 <description> 13409 Name of class being loaded as a VM internal qualified name 13410 (for example, "java/util/List"), encoded as a 13411 <internallink id="mUTF">modified UTF-8</internallink> string. 13412 Note: if the class is defined with a <code>NULL</code> name or 13413 without a name specified, <code>name</code> will be <code>NULL</code>. 13414 </description> 13415 </param> 13416 <param id="protection_domain"> 13417 <jobject/> 13418 <description> 13419 The <code>ProtectionDomain</code> of the class. 13420 </description> 13421 </param> 13422 <param id="class_data_len"> 13423 <jint/> 13424 <description> 13425 Length of current class file data buffer. 13426 </description> 13427 </param> 13428 <param id="class_data"> 13429 <vmbuf><uchar/></vmbuf> 13430 <description> 13431 Pointer to the current class file data buffer. 13432 </description> 13433 </param> 13434 <param id="new_class_data_len"> 13435 <outptr><jint/></outptr> 13436 <description> 13437 Pointer to the length of the new class file data buffer. 13438 </description> 13439 </param> 13440 <param id="new_class_data"> 13441 <agentbuf incount="new_class_data_len"><uchar/></agentbuf> 13442 <description> 13443 Pointer to the pointer to the instrumented class file data buffer. 13444 </description> 13445 </param> 13446 </parameters> 13447 </event> 13448 13449 <event label="VM Start Event" 13450 id="VMStart" const="JVMTI_EVENT_VM_START" num="57" phase="start"> 13451 <description> 13452 The VM start event signals the start of the VM. 13453 At this time JNI is live but the VM is not yet fully initialized. 13454 Once this event is generated, the agent is free to call any JNI function. 13455 This event signals the beginning of the start phase, 13456 <jvmti/> functions permitted in the start phase may be called. 13457 <p/> 13458 The timing of this event may depend on whether the agent has added the 13459 <internallink id="jvmtiCapabilities.can_generate_early_vmstart"> 13460 <code>can_generate_early_vmstart</code></internallink> capability or not. 13461 If the capability has been added then the VM posts the event as early 13462 as possible. The VM is capable of executing bytecode but it may not have 13463 initialized to the point where it can load classes in modules other than 13464 <code>java.base</code>, or even arbitrary classes in <code>java.base</code>. 13465 Agents that do load-time instrumentation in this 13466 phase must take great care when instrumenting code that potentially 13467 executes in this phase. Extreme care should also be taken with JNI 13468 <code>FindClass</code> as it may not be possible to load classes and attempts 13469 to do so may result in unpredictable behavior, maybe even stability issues 13470 on some VM implementations. 13471 If the capability has not been added then the VM delays posting this 13472 event until it is capable of loading classes in modules other than 13473 <code>java.base</code> or the VM has completed its initialization. 13474 Agents that create more than one JVM TI environment, where the 13475 capability is added to some but not all environments, may observe the 13476 start phase beginning earlier in the JVM TI environments that possess 13477 the capability. 13478 <p/> 13479 In the case of VM start-up failure, this event will not be sent. 13480 </description> 13481 <origin>jvmdi</origin> 13482 <capabilities> 13483 </capabilities> 13484 <parameters> 13485 <param id="jni_env"> 13486 <outptr> 13487 <struct>JNIEnv</struct> 13488 </outptr> 13489 <description> 13490 The JNI environment of the event (current) thread. 13491 </description> 13492 </param> 13493 </parameters> 13494 </event> 13495 13496 <event label="VM Initialization Event" 13497 id="VMInit" const="JVMTI_EVENT_VM_INIT" num="50"> 13498 <description> 13499 The VM initialization event signals the completion of VM initialization. Once 13500 this event is generated, the agent is free to call any JNI or <jvmti/> 13501 function. The VM initialization event can be preceded by or can be concurrent 13502 with other events, but 13503 the preceding events should be handled carefully, if at all, because the 13504 VM has not completed its initialization. The thread start event for the 13505 main application thread is guaranteed not to occur until after the 13506 handler for the VM initialization event returns. 13507 <p/> 13508 In the case of VM start-up failure, this event will not be sent. 13509 </description> 13510 <origin>jvmdi</origin> 13511 <capabilities> 13512 </capabilities> 13513 <parameters> 13514 <param id="jni_env"> 13515 <outptr> 13516 <struct>JNIEnv</struct> 13517 </outptr> 13518 <description> 13519 The JNI environment of the event (current) thread. 13520 </description> 13521 </param> 13522 <param id="thread"> 13523 <jthread/> 13524 <description> 13525 The initial thread 13526 </description> 13527 </param> 13528 </parameters> 13529 </event> 13530 13531 <event label="VM Death Event" 13532 id="VMDeath" const="JVMTI_EVENT_VM_DEATH" num="51"> 13533 <description> 13534 The VM death event notifies the agent of the termination of the VM. 13535 No events will occur after the VMDeath event. 13536 <p/> 13537 In the case of VM start-up failure, this event will not be sent. 13538 Note that <internallink id="onunload">Agent_OnUnload</internallink> 13539 will still be called in these cases. 13540 </description> 13541 <origin>jvmdi</origin> 13542 <capabilities> 13543 </capabilities> 13544 <parameters> 13545 <param id="jni_env"> 13546 <outptr> 13547 <struct>JNIEnv</struct> 13548 </outptr> 13549 <description> 13550 The JNI environment of the event (current) thread 13551 </description> 13552 </param> 13553 </parameters> 13554 </event> 13555 13556 <event label="Compiled Method Load" phase="start" 13557 id="CompiledMethodLoad" const="JVMTI_EVENT_COMPILED_METHOD_LOAD" num="68"> 13558 <description> 13559 Sent when a method is compiled and loaded into memory by the VM. 13560 If it is unloaded, the <eventlink id="CompiledMethodUnload"/> event is sent. 13561 If it is moved, the <eventlink id="CompiledMethodUnload"/> event is sent, 13562 followed by a new <code>CompiledMethodLoad</code> event. 13563 Note that a single method may have multiple compiled forms, and that 13564 this event will be sent for each form. 13565 Note also that several methods may be inlined into a single 13566 address range, and that this event will be sent for each method. 13567 <p/> 13568 These events can be sent after their initial occurrence with 13569 <functionlink id="GenerateEvents"></functionlink>. 13570 </description> 13571 <origin>jvmpi</origin> 13572 <typedef id="jvmtiAddrLocationMap" label="Native address to location entry"> 13573 <field id="start_address"> 13574 <vmbuf><void/></vmbuf> 13575 <description> 13576 Starting native address of code corresponding to a location 13577 </description> 13578 </field> 13579 <field id="location"> 13580 <jlocation/> 13581 <description> 13582 Corresponding location. See 13583 <functionlink id="GetJLocationFormat"></functionlink> 13584 for the meaning of location. 13585 </description> 13586 </field> 13587 </typedef> 13588 <capabilities> 13589 <required id="can_generate_compiled_method_load_events"></required> 13590 </capabilities> 13591 <parameters> 13592 <param id="klass"> 13593 <jclass method="method"/> 13594 <description> 13595 Class of the method being compiled and loaded 13596 </description> 13597 </param> 13598 <param id="method"> 13599 <jmethodID class="klass"/> 13600 <description> 13601 Method being compiled and loaded 13602 </description> 13603 </param> 13604 <param id="code_size"> 13605 <jint/> 13606 <description> 13607 Size of compiled code 13608 </description> 13609 </param> 13610 <param id="code_addr"> 13611 <vmbuf><void/></vmbuf> 13612 <description> 13613 Address where compiled method code is loaded 13614 </description> 13615 </param> 13616 <param id="map_length"> 13617 <jint/> 13618 <description> 13619 Number of <typelink id="jvmtiAddrLocationMap"></typelink> 13620 entries in the address map. 13621 Zero if mapping information cannot be supplied. 13622 </description> 13623 </param> 13624 <param id="map"> 13625 <vmbuf><struct>jvmtiAddrLocationMap</struct></vmbuf> 13626 <description> 13627 Map from native addresses to location. 13628 The native address range of each entry is from 13629 <fieldlink id="start_address" struct="jvmtiAddrLocationMap"></fieldlink> 13630 to <code>start_address-1</code> of the next entry. 13631 <code>NULL</code> if mapping information cannot be supplied. 13632 </description> 13633 </param> 13634 <param id="compile_info"> 13635 <vmbuf><void/></vmbuf> 13636 <description> 13637 VM-specific compilation information. 13638 The referenced compile information is managed by the VM 13639 and must not depend on the agent for collection. 13640 A VM implementation defines the content and lifetime 13641 of the information. 13642 </description> 13643 </param> 13644 </parameters> 13645 </event> 13646 13647 <event label="Compiled Method Unload" phase="start" 13648 id="CompiledMethodUnload" const="JVMTI_EVENT_COMPILED_METHOD_UNLOAD" num="69"> 13649 <description> 13650 Sent when a compiled method is unloaded from memory. 13651 This event might not be sent on the thread which performed the unload. 13652 This event may be sent sometime after the unload occurs, but 13653 will be sent before the memory is reused 13654 by a newly generated compiled method. This event may be sent after 13655 the class is unloaded. 13656 </description> 13657 <origin>jvmpi</origin> 13658 <capabilities> 13659 <required id="can_generate_compiled_method_load_events"></required> 13660 </capabilities> 13661 <parameters> 13662 <param id="klass"> 13663 <jclass method="method"/> 13664 <description> 13665 Class of the compiled method being unloaded. 13666 </description> 13667 </param> 13668 <param id="method"> 13669 <jmethodID class="klass"/> 13670 <description> 13671 Compiled method being unloaded. 13672 For identification of the compiled method only -- the class 13673 may be unloaded and therefore the method should not be used 13674 as an argument to further JNI or <jvmti/> functions. 13675 </description> 13676 </param> 13677 <param id="code_addr"> 13678 <vmbuf><void/></vmbuf> 13679 <description> 13680 Address where compiled method code was loaded. 13681 For identification of the compiled method only -- 13682 the space may have been reclaimed. 13683 </description> 13684 </param> 13685 </parameters> 13686 </event> 13687 13688 <event label="Dynamic Code Generated" phase="any" 13689 id="DynamicCodeGenerated" const="JVMTI_EVENT_DYNAMIC_CODE_GENERATED" num="70"> 13690 <description> 13691 Sent when a component of the virtual machine is generated dynamically. 13692 This does not correspond to Java programming language code that is 13693 compiled--see <eventlink id="CompiledMethodLoad"></eventlink>. 13694 This is for native code--for example, an interpreter that is generated 13695 differently depending on command-line options. 13696 <p/> 13697 Note that this event has no controlling capability. 13698 If a VM cannot generate these events, it simply does not send any. 13699 <p/> 13700 These events can be sent after their initial occurrence with 13701 <functionlink id="GenerateEvents"></functionlink>. 13702 </description> 13703 <origin>jvmpi</origin> 13704 <capabilities> 13705 </capabilities> 13706 <parameters> 13707 <param id="name"> 13708 <vmbuf><char/></vmbuf> 13709 <description> 13710 Name of the code, encoded as a 13711 <internallink id="mUTF">modified UTF-8</internallink> string. 13712 Intended for display to an end-user. 13713 The name might not be unique. 13714 </description> 13715 </param> 13716 <param id="address"> 13717 <vmbuf><void/></vmbuf> 13718 <description> 13719 Native address of the code 13720 </description> 13721 </param> 13722 <param id="length"> 13723 <jint/> 13724 <description> 13725 Length in bytes of the code 13726 </description> 13727 </param> 13728 </parameters> 13729 </event> 13730 13731 <event label="Data Dump Request" 13732 id="DataDumpRequest" const="JVMTI_EVENT_DATA_DUMP_REQUEST" num="71"> 13733 <description> 13734 Sent by the VM to request the agent to dump its data. This 13735 is just a hint and the agent need not react to this event. 13736 This is useful for processing command-line signals from users. For 13737 example, in the Java 2 SDK a CTRL-Break on Win32 and a CTRL-\ on Linux 13738 causes the VM to send this event to the agent. 13739 </description> 13740 <origin>jvmpi</origin> 13741 <capabilities> 13742 </capabilities> 13743 <parameters> 13744 </parameters> 13745 </event> 13746 13747 <event label="Monitor Contended Enter" 13748 id="MonitorContendedEnter" const="JVMTI_EVENT_MONITOR_CONTENDED_ENTER" filtered="thread" num="75"> 13749 <description> 13750 Sent when a thread is attempting to enter a Java programming language 13751 monitor already acquired by another thread. 13752 </description> 13753 <origin>jvmpi</origin> 13754 <capabilities> 13755 <required id="can_generate_monitor_events"></required> 13756 </capabilities> 13757 <parameters> 13758 <param id="jni_env"> 13759 <outptr> 13760 <struct>JNIEnv</struct> 13761 </outptr> 13762 <description> 13763 The JNI environment of the event (current) thread 13764 </description> 13765 </param> 13766 <param id="thread"> 13767 <jthread/> 13768 <description> 13769 JNI local reference to the thread 13770 attempting to enter the monitor 13771 </description> 13772 </param> 13773 <param id="object"> 13774 <jobject/> 13775 <description> 13776 JNI local reference to the monitor 13777 </description> 13778 </param> 13779 </parameters> 13780 </event> 13781 13782 <event label="Monitor Contended Entered" 13783 id="MonitorContendedEntered" const="JVMTI_EVENT_MONITOR_CONTENDED_ENTERED" filtered="thread" num="76"> 13784 <description> 13785 Sent when a thread enters a Java programming language 13786 monitor after waiting for it to be released by another thread. 13787 </description> 13788 <origin>jvmpi</origin> 13789 <capabilities> 13790 <required id="can_generate_monitor_events"></required> 13791 </capabilities> 13792 <parameters> 13793 <param id="jni_env"> 13794 <outptr> 13795 <struct>JNIEnv</struct> 13796 </outptr> 13797 <description> 13798 The JNI environment of the event (current) thread 13799 </description> 13800 </param> 13801 <param id="thread"> 13802 <jthread/> 13803 <description> 13804 JNI local reference to the thread entering 13805 the monitor 13806 </description> 13807 </param> 13808 <param id="object"> 13809 <jobject/> 13810 <description> 13811 JNI local reference to the monitor 13812 </description> 13813 </param> 13814 </parameters> 13815 </event> 13816 13817 <event label="Monitor Wait" 13818 id="MonitorWait" const="JVMTI_EVENT_MONITOR_WAIT" filtered="thread" num="73"> 13819 <description> 13820 Sent when a thread is about to wait on an object. 13821 </description> 13822 <origin>jvmpi</origin> 13823 <capabilities> 13824 <required id="can_generate_monitor_events"></required> 13825 </capabilities> 13826 <parameters> 13827 <param id="jni_env"> 13828 <outptr> 13829 <struct>JNIEnv</struct> 13830 </outptr> 13831 <description> 13832 The JNI environment of the event (current) thread 13833 </description> 13834 </param> 13835 <param id="thread"> 13836 <jthread/> 13837 <description> 13838 JNI local reference to the thread about to wait 13839 </description> 13840 </param> 13841 <param id="object"> 13842 <jobject/> 13843 <description> 13844 JNI local reference to the monitor 13845 </description> 13846 </param> 13847 <param id="timeout"> 13848 <jlong/> 13849 <description> 13850 The number of milliseconds the thread will wait 13851 </description> 13852 </param> 13853 </parameters> 13854 </event> 13855 13856 <event label="Monitor Waited" 13857 id="MonitorWaited" const="JVMTI_EVENT_MONITOR_WAITED" filtered="thread" num="74"> 13858 <description> 13859 Sent when a thread finishes waiting on an object. 13860 </description> 13861 <origin>jvmpi</origin> 13862 <capabilities> 13863 <required id="can_generate_monitor_events"></required> 13864 </capabilities> 13865 <parameters> 13866 <param id="jni_env"> 13867 <outptr> 13868 <struct>JNIEnv</struct> 13869 </outptr> 13870 <description> 13871 The JNI environment of the event (current) thread 13872 </description> 13873 </param> 13874 <param id="thread"> 13875 <jthread/> 13876 <description> 13877 JNI local reference to the thread that was finished waiting 13878 </description> 13879 </param> 13880 <param id="object"> 13881 <jobject/> 13882 <description> 13883 JNI local reference to the monitor. 13884 </description> 13885 </param> 13886 <param id="timed_out"> 13887 <jboolean/> 13888 <description> 13889 True if the monitor timed out 13890 </description> 13891 </param> 13892 </parameters> 13893 </event> 13894 13895 <event label="Resource Exhausted" 13896 id="ResourceExhausted" const="JVMTI_EVENT_RESOURCE_EXHAUSTED" num="80" 13897 since="1.1"> 13898 <description> 13899 Sent when a VM resource needed by a running application has been exhausted. 13900 Except as required by the optional capabilities, the set of resources 13901 which report exhaustion is implementation dependent. 13902 <p/> 13903 The following bit flags define the properties of the resource exhaustion: 13904 <constants id="jvmtiResourceExhaustionFlags" 13905 label="Resource Exhaustion Flags" 13906 kind="bits" 13907 since="1.1"> 13908 <constant id="JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR" num="0x0001"> 13909 After this event returns, the VM will throw a 13910 <code>java.lang.OutOfMemoryError</code>. 13911 </constant> 13912 <constant id="JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP" num="0x0002"> 13913 The VM was unable to allocate memory from the <tm>Java</tm> 13914 platform <i>heap</i>. 13915 The <i>heap</i> is the runtime 13916 data area from which memory for all class instances and 13917 arrays are allocated. 13918 </constant> 13919 <constant id="JVMTI_RESOURCE_EXHAUSTED_THREADS" num="0x0004"> 13920 The VM was unable to create a thread. 13921 </constant> 13922 </constants> 13923 </description> 13924 <origin>new</origin> 13925 <capabilities> 13926 <capability id="can_generate_resource_exhaustion_heap_events"> 13927 Can generate events when the VM is unable to allocate memory from the 13928 <internallink id="JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP">heap</internallink>. 13929 </capability> 13930 <capability id="can_generate_resource_exhaustion_threads_events"> 13931 Can generate events when the VM is unable to 13932 <internallink id="JVMTI_RESOURCE_EXHAUSTED_THREADS">create 13933 a thread</internallink>. 13934 </capability> 13935 </capabilities> 13936 <parameters> 13937 <param id="jni_env"> 13938 <outptr> 13939 <struct>JNIEnv</struct> 13940 </outptr> 13941 <description> 13942 The JNI environment of the event (current) thread 13943 </description> 13944 </param> 13945 <param id="flags"> 13946 <jint/> 13947 <description> 13948 Flags defining the properties of the of resource exhaustion 13949 as specified by the 13950 <internallink id="jvmtiResourceExhaustionFlags">Resource 13951 Exhaustion Flags</internallink>. 13952 </description> 13953 </param> 13954 <param id="reserved"> 13955 <vmbuf><void/></vmbuf> 13956 <description> 13957 Reserved. 13958 </description> 13959 </param> 13960 <param id="description"> 13961 <vmbuf><char/></vmbuf> 13962 <description> 13963 Description of the resource exhaustion, encoded as a 13964 <internallink id="mUTF">modified UTF-8</internallink> string. 13965 </description> 13966 </param> 13967 </parameters> 13968 </event> 13969 13970 <event label="VM Object Allocation" 13971 id="VMObjectAlloc" const="JVMTI_EVENT_VM_OBJECT_ALLOC" num="84"> 13972 <description> 13973 Sent when a method causes the virtual machine to directly allocate an 13974 Object visible to Java programming language code. 13975 Generally object allocation should be detected by instrumenting 13976 the bytecodes of allocating methods. 13977 Object allocation generated in native code by JNI function 13978 calls should be detected using 13979 <internallink id="jniIntercept">JNI function interception</internallink>. 13980 Some methods might not have associated bytecodes and are not 13981 native methods, they instead are executed directly by the 13982 VM. These methods should send this event. 13983 Virtual machines which are incapable of bytecode instrumentation 13984 for some or all of their methods can send this event. 13985 13986 Note that the <internallink 13987 id="SampledObjectAlloc">SampledObjectAlloc</internallink> 13988 event is triggered on all Java object allocations, including those 13989 caused by bytecode method execution, JNI method execution, and 13990 directly by VM methods. 13991 <p/> 13992 Typical examples where this event might be sent: 13993 <ul> 13994 <li>Reflection -- for example, <code>java.lang.Class.newInstance()</code></li> 13995 <li>Methods not represented by bytecodes -- for example, VM intrinsics and 13996 J2ME preloaded classes</li> 13997 </ul> 13998 Cases where this event would not be generated: 13999 <ul> 14000 <li>Allocation due to bytecodes -- for example, the <code>new</code> 14001 and <code>newarray</code> VM instructions</li> 14002 <li>Allocation due to JNI function calls -- for example, 14003 <code>AllocObject</code></li> 14004 <li>Allocations during VM initialization</li> 14005 <li>VM internal objects</li> 14006 </ul> 14007 </description> 14008 <origin>new</origin> 14009 <capabilities> 14010 <required id="can_generate_vm_object_alloc_events"></required> 14011 </capabilities> 14012 <parameters> 14013 <param id="jni_env"> 14014 <outptr> 14015 <struct>JNIEnv</struct> 14016 </outptr> 14017 <description> 14018 The JNI environment of the event (current) thread 14019 </description> 14020 </param> 14021 <param id="thread"> 14022 <jthread/> 14023 <description> 14024 Thread allocating the object. 14025 </description> 14026 </param> 14027 <param id="object"> 14028 <jobject/> 14029 <description> 14030 JNI local reference to the object that was allocated. 14031 </description> 14032 </param> 14033 <param id="object_klass"> 14034 <jclass/> 14035 <description> 14036 JNI local reference to the class of the object. 14037 </description> 14038 </param> 14039 <param id="size"> 14040 <jlong/> 14041 <description> 14042 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 14043 </description> 14044 </param> 14045 </parameters> 14046 </event> 14047 14048 <event label="Sampled Object Allocation" 14049 id="SampledObjectAlloc" const="JVMTI_EVENT_SAMPLED_OBJECT_ALLOC" filtered="thread" num="86" since="11"> 14050 <description> 14051 Sent when an allocated object is sampled. 14052 By default, the sampling interval is set to 512KB. The sampling is semi-random to avoid 14053 pattern-based bias and provides an approximate overall average interval over long periods of 14054 sampling. 14055 <p/> 14056 Each thread tracks how many bytes it has allocated since it sent the last event. 14057 When the number of bytes exceeds the sampling interval, it will send another event. 14058 This implies that, on average, one object will be sampled every time a thread has 14059 allocated 512KB bytes since the last sample. 14060 <p/> 14061 Note that the sampler is pseudo-random: it will not sample every 512KB precisely. 14062 The goal of this is to ensure high quality sampling even if allocation is 14063 happening in a fixed pattern (i.e., the same set of objects are being allocated 14064 every 512KB). 14065 <p/> 14066 If another sampling interval is required, the user can call 14067 <functionlink id="SetHeapSamplingInterval"></functionlink> with a strictly positive integer value, 14068 representing the new sampling interval. 14069 <p/> 14070 This event is sent once the sampled allocation has been performed. It provides the object, stack trace 14071 of the allocation, the thread allocating, the size of allocation, and the object's class. 14072 <p/> 14073 A typical use case of this system is to determine where heap allocations originate. 14074 In conjunction with weak references and the function 14075 <functionlink id="GetStackTrace"></functionlink>, a user can track which objects were allocated from which 14076 stack trace, and which are still live during the execution of the program. 14077 </description> 14078 <origin>new</origin> 14079 <capabilities> 14080 <required id="can_generate_sampled_object_alloc_events"></required> 14081 </capabilities> 14082 <parameters> 14083 <param id="jni_env"> 14084 <outptr> 14085 <struct>JNIEnv</struct> 14086 </outptr> 14087 <description> 14088 The JNI environment of the event (current) thread. 14089 </description> 14090 </param> 14091 <param id="thread"> 14092 <jthread/> 14093 <description> 14094 Thread allocating the object. 14095 </description> 14096 </param> 14097 <param id="object"> 14098 <jobject/> 14099 <description> 14100 JNI local reference to the object that was allocated. 14101 </description> 14102 </param> 14103 <param id="object_klass"> 14104 <jclass/> 14105 <description> 14106 JNI local reference to the class of the object 14107 </description> 14108 </param> 14109 <param id="size"> 14110 <jlong/> 14111 <description> 14112 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 14113 </description> 14114 </param> 14115 </parameters> 14116 </event> 14117 14118 <event label="Object Free" 14119 id="ObjectFree" const="JVMTI_EVENT_OBJECT_FREE" num="83"> 14120 <description> 14121 An Object Free event is sent when the garbage collector frees an object. 14122 Events are only sent for tagged objects--see 14123 <internallink id="Heap">heap functions</internallink>. 14124 <p/> 14125 The event handler must not use JNI functions and 14126 must not use <jvmti/> functions except those which 14127 specifically allow such use (see the raw monitor, memory management, 14128 and environment local storage functions). 14129 </description> 14130 <origin>new</origin> 14131 <capabilities> 14132 <required id="can_generate_object_free_events"></required> 14133 </capabilities> 14134 <parameters> 14135 <param id="tag"> 14136 <jlong/> 14137 <description> 14138 The freed object's tag 14139 </description> 14140 </param> 14141 </parameters> 14142 </event> 14143 14144 <event label="Garbage Collection Start" 14145 id="GarbageCollectionStart" const="JVMTI_EVENT_GARBAGE_COLLECTION_START" num="81"> 14146 <description> 14147 A Garbage Collection Start event is sent when a 14148 garbage collection pause begins. 14149 Only stop-the-world collections are reported--that is, collections during 14150 which all threads cease to modify the state of the Java virtual machine. 14151 This means that some collectors will never generate these events. 14152 This event is sent while the VM is still stopped, thus 14153 the event handler must not use JNI functions and 14154 must not use <jvmti/> functions except those which 14155 specifically allow such use (see the raw monitor, memory management, 14156 and environment local storage functions). 14157 <p/> 14158 This event is always sent as a matched pair with 14159 <eventlink id="GarbageCollectionFinish"/> 14160 (assuming both events are enabled) and no garbage collection 14161 events will occur between them. 14162 </description> 14163 <origin>new</origin> 14164 <capabilities> 14165 <required id="can_generate_garbage_collection_events"></required> 14166 </capabilities> 14167 <parameters> 14168 </parameters> 14169 </event> 14170 14171 <event label="Garbage Collection Finish" 14172 id="GarbageCollectionFinish" const="JVMTI_EVENT_GARBAGE_COLLECTION_FINISH" num="82"> 14173 <description> 14174 A Garbage Collection Finish event is sent when a 14175 garbage collection pause ends. 14176 This event is sent while the VM is still stopped, thus 14177 the event handler must not use JNI functions and 14178 must not use <jvmti/> functions except those which 14179 specifically allow such use (see the raw monitor, memory management, 14180 and environment local storage functions). 14181 <p/> 14182 Some agents may need to do post garbage collection operations that 14183 require the use of the disallowed <jvmti/> or JNI functions. For these 14184 cases an agent thread can be created which waits on a raw monitor, 14185 and the handler for the Garbage Collection Finish event simply 14186 notifies the raw monitor 14187 <p/> 14188 This event is always sent as a matched pair with 14189 <eventlink id="GarbageCollectionStart"/> (assuming both events are enabled). 14190 <issue> 14191 The most important use of this event is to provide timing information, 14192 and thus additional information is not required. However, 14193 information about the collection which is "free" should be included - 14194 what that information is needs to be determined. 14195 </issue> 14196 </description> 14197 <origin>new</origin> 14198 <capabilities> 14199 <required id="can_generate_garbage_collection_events"></required> 14200 </capabilities> 14201 <parameters> 14202 </parameters> 14203 </event> 14204 14205 <elide> 14206 <event label="Verbose Output" phase="any" 14207 id="VerboseOutput" const="JVMTI_EVENT_VERBOSE_OUTPUT" num="85"> 14208 <description> 14209 Send verbose messages as strings. 14210 <issue> 14211 This format is extremely fragile, as it can change with each 14212 platform, collector and version. Alternatives include: 14213 <ul> 14214 <li>building off Java programming language M and M APIs</li> 14215 <li>XML</li> 14216 <li>key/value pairs</li> 14217 <li>removing it</li> 14218 </ul> 14219 </issue> 14220 <issue> 14221 Though this seemed trivial to implement. 14222 In the RI it appears this will be quite complex. 14223 </issue> 14224 </description> 14225 <origin>new</origin> 14226 <capabilities> 14227 </capabilities> 14228 <parameters> 14229 <param id="flag"> 14230 <enum>jvmtiVerboseFlag</enum> 14231 <description> 14232 Which verbose output is being sent. 14233 </description> 14234 </param> 14235 <param id="message"> 14236 <vmbuf><char/></vmbuf> 14237 <description> 14238 Message text, encoded as a 14239 <internallink id="mUTF">modified UTF-8</internallink> string. 14240 </description> 14241 </param> 14242 </parameters> 14243 </event> 14244 </elide> 14245 14246 </eventsection> 14247 14248 <datasection> 14249 <intro> 14250 <jvmti/> extends the data types defined by JNI. 14251 </intro> 14252 <basetypes id="jniTypes" label="JNI Types Used in the JVM Tool Interface"> 14253 <basetype id="jboolean"> 14254 <description> 14255 Holds a Java programming language <code>boolean</code>. 14256 Unsigned 8 bits. 14257 </description> 14258 </basetype> 14259 <basetype id="jchar"> 14260 <description> 14261 Holds a Java programming language <code>char</code>. 14262 Unsigned 16 bits. 14263 </description> 14264 </basetype> 14265 <basetype id="jint"> 14266 <description> 14267 Holds a Java programming language <code>int</code>. 14268 Signed 32 bits. 14269 </description> 14270 </basetype> 14271 <basetype id="jlong"> 14272 <description> 14273 Holds a Java programming language <code>long</code>. 14274 Signed 64 bits. 14275 </description> 14276 </basetype> 14277 <basetype id="jfloat"> 14278 <description> 14279 Holds a Java programming language <code>float</code>. 14280 32 bits. 14281 </description> 14282 </basetype> 14283 <basetype id="jdouble"> 14284 <description> 14285 Holds a Java programming language <code>double</code>. 14286 64 bits. 14287 </description> 14288 </basetype> 14289 <basetype id="jobject"> 14290 <description> 14291 Holds a Java programming language object. 14292 </description> 14293 </basetype> 14294 <basetype id="jclass"> 14295 <description> 14296 Holds a Java programming language class. 14297 </description> 14298 </basetype> 14299 <basetype id="jvalue"> 14300 <description> 14301 Is a union of all primitive types and <code>jobject</code>. Thus, holds any Java 14302 programming language value. 14303 </description> 14304 </basetype> 14305 <basetype id="jfieldID"> 14306 <description> 14307 Identifies a Java programming language field. 14308 <code>jfieldID</code>s returned by <jvmti/> functions and events may be 14309 safely stored. 14310 </description> 14311 </basetype> 14312 <basetype id="jmethodID"> 14313 <description> 14314 Identifies a Java programming language method, initializer, or constructor. 14315 <code>jmethodID</code>s returned by <jvmti/> functions and events may be 14316 safely stored. However, if the class is unloaded, they become invalid 14317 and must not be used. 14318 </description> 14319 </basetype> 14320 <basetype id="JNIEnv"> 14321 <description> 14322 Pointer to the JNI function table. Pointer to this (<code>JNIEnv *</code>) 14323 is a JNI environment. 14324 </description> 14325 </basetype> 14326 </basetypes> 14327 14328 <basetypes id="jvmtiTypes" label="JVM Tool Interface Base Types"> 14329 <basetype id="jvmtiEnv"> 14330 <description> 14331 The <jvmti/> <internallink id="environments">environment</internallink> pointer. 14332 See the <internallink id="FunctionSection">Function Section</internallink>. 14333 <code>jvmtiEnv</code> points to the 14334 <internallink id="FunctionTable">function table</internallink> pointer. 14335 </description> 14336 </basetype> 14337 <basetype id="jthread"> 14338 <definition>typedef jobject jthread;</definition> 14339 <description> 14340 Subtype of <datalink id="jobject"></datalink> that holds a thread. 14341 </description> 14342 </basetype> 14343 <basetype id="jthreadGroup"> 14344 <definition>typedef jobject jthreadGroup;</definition> 14345 <description> 14346 Subtype of <datalink id="jobject"></datalink> that holds a thread group. 14347 </description> 14348 </basetype> 14349 <basetype id="jlocation"> 14350 <definition>typedef jlong jlocation;</definition> 14351 <description> 14352 A 64 bit value, representing a monotonically increasing 14353 executable position within a method. 14354 <code>-1</code> indicates a native method. 14355 See <functionlink id="GetJLocationFormat"></functionlink> for the format on a 14356 given VM. 14357 </description> 14358 </basetype> 14359 <basetype id="jrawMonitorID"> 14360 <definition>struct _jrawMonitorID; 14361 typedef struct _jrawMonitorID *jrawMonitorID;</definition> 14362 <description> 14363 A raw monitor. 14364 </description> 14365 </basetype> 14366 <basetype id="jvmtiError"> 14367 <description> 14368 Holds an error return code. 14369 See the <internallink id="ErrorSection">Error section</internallink> for possible values. 14370 <example> 14371 typedef enum { 14372 JVMTI_ERROR_NONE = 0, 14373 JVMTI_ERROR_INVALID_THREAD = 10, 14374 ... 14375 } jvmtiError; 14376 </example> 14377 </description> 14378 </basetype> 14379 <basetype id="jvmtiEvent"> 14380 <description> 14381 An identifier for an event type. 14382 See the <internallink id="EventSection">Event section</internallink> for possible values. 14383 It is guaranteed that future versions of this specification will 14384 never assign zero as an event type identifier. 14385 <example> 14386 typedef enum { 14387 JVMTI_EVENT_SINGLE_STEP = 1, 14388 JVMTI_EVENT_BREAKPOINT = 2, 14389 ... 14390 } jvmtiEvent; 14391 </example> 14392 </description> 14393 </basetype> 14394 <basetype id="jvmtiEventCallbacks" name="eventCallbacks"> 14395 <description> 14396 The callbacks used for events. 14397 <example> 14398 typedef struct { 14399 jvmtiEventVMInit VMInit; 14400 jvmtiEventVMDeath VMDeath; 14401 ... 14402 } jvmtiEventCallbacks; 14403 </example> 14404 See <internallink id="jvmtiEventCallbacks">event callbacks</internallink> 14405 for the complete structure. 14406 <p/> 14407 Where, for example, the VM initialization callback is defined: 14408 <example> 14409 typedef void (JNICALL *jvmtiEventVMInit) 14410 (jvmtiEnv *jvmti_env, 14411 JNIEnv* jni_env, 14412 jthread thread); 14413 </example> 14414 See the individual events for the callback function definition. 14415 </description> 14416 </basetype> 14417 <basetype id="jniNativeInterface"> 14418 <definition>typedef struct JNINativeInterface_ jniNativeInterface;</definition> 14419 <description> 14420 Typedef for the JNI function table <code>JNINativeInterface</code> 14421 defined in the 14422 <externallink id="jni/functions.html#interface-function-table"> 14423 JNI Specification</externallink>. 14424 The JNI reference implementation defines this with an underscore. 14425 </description> 14426 </basetype> 14427 </basetypes> 14428 14429 </datasection> 14430 14431 <issuessection label="Issues"> 14432 <intro id="suspendRequired" label="Resolved Issue: Suspend - Required or Automatic"> 14433 JVMDI requires that the agent suspend threads before calling 14434 certain sensitive functions. JVMPI requires garbage collection to be 14435 disabled before calling certain sensitive functions. 14436 It was suggested that rather than have this requirement, that 14437 VM place itself in a suitable state before performing an 14438 operation. This makes considerable sense since each VM 14439 knows its requirements and can most easily arrange a 14440 safe state. 14441 <p/> 14442 The ability to externally suspend/resume threads will, of 14443 course, remain. The ability to enable/disable garbage collection will not. 14444 <p/> 14445 This issue is resolved--suspend will not 14446 be required. The spec has been updated to reflect this. 14447 </intro> 14448 14449 <intro id="stackSampling" label="Resolved Issue: Call Stack Sampling"> 14450 There are a variety of approaches to sampling call stacks. 14451 The biggest bifurcation is between VM controlled and agent 14452 controlled. 14453 <p/> 14454 This issue is resolved--agent controlled 14455 sampling will be the approach. 14456 </intro> 14457 14458 <intro id="threadRepresentation" label="Resolved Issue: Thread Representation"> 14459 JVMDI represents threads as jthread. JVMPI primarily 14460 uses JNIEnv* to represent threads. 14461 <p/> 14462 The Expert Group has chosen jthread as the representation 14463 for threads in <jvmti/>. 14464 JNIEnv* is sent by 14465 events since it is needed to JNI functions. JNIEnv, per the 14466 JNI spec, are not supposed to be used outside their thread. 14467 </intro> 14468 14469 <intro id="design" label="Resolved Issue: Method Representation"> 14470 The JNI spec allows an implementation to depend on jclass/jmethodID 14471 pairs, rather than simply a jmethodID, to reference a method. 14472 JVMDI, for consistency, choose the same representation. 14473 JVMPI, however, specifies that a jmethodID alone maps to a 14474 method. Both of the Sun <tm>J2SE</tm> virtual machines (Classic and <tm>HotSpot</tm>) store 14475 pointers in jmethodIDs, and as a result, a jmethodID is sufficient. 14476 In fact, any JVM implementation that supports JVMPI must have 14477 such a representation. 14478 <jvmti/> will use jmethodID as a unique representation of a method 14479 (no jclass is used). 14480 There should be efficiency gains, particularly in 14481 functionality like stack dumping, to this representation. 14482 <p/> 14483 Note that fields were not used in JVMPI and that the access profile 14484 of fields differs from methods--for implementation efficiency 14485 reasons, a jclass/jfieldID pair will still be needed for field 14486 reference. 14487 </intro> 14488 14489 <intro id="localReferenceIssue" label="Resolved Issue: Local References"> 14490 Functions return local references. 14491 </intro> 14492 14493 <intro id="frameRep" label="Resolved Issue: Representation of frames"> 14494 In JVMDI, a frame ID is used to represent a frame. Problem with this 14495 is that a VM must track when a frame becomes invalid, a far better 14496 approach, and the one used in <jvmti/>, is to reference frames by depth. 14497 </intro> 14498 14499 <intro id="requiredCapabilities" label="Issue: Required Capabilities"> 14500 Currently, having a required capabilities means that the functionality 14501 is optional. Capabilities are useful even for required functionality 14502 since they can inform the VM is needed set-up. Thus, there should be 14503 a set of capabilities that a conformant implementation must provide 14504 (if requested during Agent_OnLoad). 14505 </intro> 14506 14507 <intro id="taghint" label="Proposal: add tag hint function"> 14508 A hint of the percentage of objects that will be tagged would 14509 help the VM pick a good implementation. 14510 </intro> 14511 14512 <intro id="moreMonitorQueries" label="Request: More Monitor Quires"> 14513 How difficult or easy would be to extend the monitor_info category to include 14514 <pre> 14515 - current number of monitors 14516 - enumeration of monitors 14517 - enumeration of threads waiting on a given monitor 14518 </pre> 14519 The reason for my question is the fact that current get_monitor_info support 14520 requires the agent to specify a given thread to get the info which is probably 14521 OK in the profiling/debugging space, while in the monitoring space the agent 14522 could be watching the monitor list and then decide which thread to ask for 14523 the info. You might ask why is this important for monitoring .... I think it 14524 can aid in the detection/prediction of application contention caused by hot-locks. 14525 </intro> 14526 </issuessection> 14527 14528 <changehistory id="ChangeHistory" update="09/05/07"> 14529 <intro> 14530 The <jvmti/> specification is an evolving document with major, minor, 14531 and micro version numbers. 14532 A released version of the specification is uniquely identified 14533 by its major and minor version. 14534 The functions, events, and capabilities in this specification 14535 indicate a "Since" value which is the major and minor version in 14536 which it was introduced. 14537 The version of the specification implemented by the VM can 14538 be retrieved at runtime with the <functionlink id="GetVersionNumber"/> 14539 function. 14540 </intro> 14541 <change date="14 Nov 2002"> 14542 Converted to XML document. 14543 </change> 14544 <change date="14 Nov 2002"> 14545 Elided heap dump functions (for now) since what was there 14546 was wrong. 14547 </change> 14548 <change date="18 Nov 2002"> 14549 Added detail throughout. 14550 </change> 14551 <change date="18 Nov 2002"> 14552 Changed JVMTI_THREAD_STATUS_RUNNING to JVMTI_THREAD_STATUS_RUNNABLE. 14553 </change> 14554 <change date="19 Nov 2002"> 14555 Added AsyncGetStackTrace. 14556 </change> 14557 <change date="19 Nov 2002"> 14558 Added jframeID return to GetStackTrace. 14559 </change> 14560 <change date="19 Nov 2002"> 14561 Elided GetCurrentFrame and GetCallingFrame functions (for now) since what was there 14562 since they are redundant with GetStackTrace. 14563 </change> 14564 <change date="19 Nov 2002"> 14565 Elided ClearAllBreakpoints since it has always been redundant. 14566 </change> 14567 <change date="19 Nov 2002"> 14568 Added GetSystemProperties. 14569 </change> 14570 <change date="19 Nov 2002"> 14571 Changed the thread local storage functions to use jthread. 14572 </change> 14573 <change date="20 Nov 2002"> 14574 Added GetJLocationFormat. 14575 </change> 14576 <change date="22 Nov 2002"> 14577 Added events and introductory text. 14578 </change> 14579 <change date="22 Nov 2002"> 14580 Cross reference type and constant definitions. 14581 </change> 14582 <change date="24 Nov 2002"> 14583 Added DTD. 14584 </change> 14585 <change date="24 Nov 2002"> 14586 Added capabilities function section. 14587 </change> 14588 <change date="29 Nov 2002"> 14589 Assign capabilities to each function and event. 14590 </change> 14591 <change date="29 Nov 2002"> 14592 Add <internallink id="jniIntercept">JNI interception functions</internallink>. 14593 </change> 14594 <change date="30 Nov 2002"> 14595 Auto generate SetEventNotificationMode capabilities. 14596 </change> 14597 <change date="30 Nov 2002"> 14598 Add <eventlink id="VMObjectAlloc"></eventlink> event. 14599 </change> 14600 <change date="30 Nov 2002"> 14601 Add <eventlink id="DynamicCodeGenerated"></eventlink> event. 14602 </change> 14603 <change date="30 Nov 2002"> 14604 Add const to declarations. 14605 </change> 14606 <change date="30 Nov 2002"> 14607 Change method exit and frame pop to send on exception. 14608 </change> 14609 <change date="1 Dec 2002"> 14610 Add ForceGarbageCollection. 14611 </change> 14612 <change date="2 Dec 2002"> 14613 Redo Xrun section; clarify GetStackTrace and add example; 14614 Fix width problems; use "agent" consistently. 14615 </change> 14616 <change date="8 Dec 2002"> 14617 Remove previous start-up intro. 14618 Add <internallink id="environments"><jvmti/> Environments</internallink> 14619 section. 14620 </change> 14621 <change date="8 Dec 2002"> 14622 Add <functionlink id="DisposeEnvironment"></functionlink>. 14623 </change> 14624 <change date="9 Dec 2002"> 14625 Numerous minor updates. 14626 </change> 14627 <change date="15 Dec 2002"> 14628 Add heap profiling functions added: 14629 get/set annotation, iterate live objects/heap. 14630 Add heap profiling functions place holder added: 14631 heap roots. 14632 Heap profiling event added: object free. 14633 Heap profiling event redesigned: vm object allocation. 14634 Heap profiling event placeholders added: garbage collection start/finish. 14635 Native method bind event added. 14636 </change> 14637 <change date="19 Dec 2002"> 14638 Revamp suspend/resume functions. 14639 Add origin information with jvmdi tag. 14640 Misc fixes. 14641 </change> 14642 <change date="24 Dec 2002"> 14643 Add semantics to types. 14644 </change> 14645 <change date="27 Dec 2002"> 14646 Add local reference section. 14647 Autogenerate parameter descriptions from types. 14648 </change> 14649 <change date="28 Dec 2002"> 14650 Document that RunAgentThread sends threadStart. 14651 </change> 14652 <change date="29 Dec 2002"> 14653 Remove redundant local ref and dealloc warning. 14654 Convert GetRawMonitorName to allocated buffer. 14655 Add GenerateEvents. 14656 </change> 14657 <change date="30 Dec 2002"> 14658 Make raw monitors a type and rename to "jrawMonitorID". 14659 </change> 14660 <change date="1 Jan 2003"> 14661 Include origin information. 14662 Clean-up JVMDI issue references. 14663 Remove Deallocate warnings which are now automatically generated. 14664 </change> 14665 <change date="2 Jan 2003"> 14666 Fix representation issues for jthread. 14667 </change> 14668 <change date="3 Jan 2003"> 14669 Make capabilities buffered out to 64 bits - and do it automatically. 14670 </change> 14671 <change date="4 Jan 2003"> 14672 Make constants which are enumeration into enum types. 14673 Parameters now of enum type. 14674 Clean-up and index type section. 14675 Replace remaining datadef entities with callback. 14676 </change> 14677 <change date="7 Jan 2003"> 14678 Correct GenerateEvents description. 14679 More internal semantics work. 14680 </change> 14681 <change date="9 Jan 2003"> 14682 Replace previous GetSystemProperties with two functions 14683 which use allocated information instead fixed. 14684 Add SetSystemProperty. 14685 More internal semantics work. 14686 </change> 14687 <change date="12 Jan 2003"> 14688 Add varargs to end of SetEventNotificationMode. 14689 </change> 14690 <change date="20 Jan 2003"> 14691 Finish fixing spec to reflect that alloc sizes are jlong. 14692 </change> 14693 <change date="22 Jan 2003"> 14694 Allow NULL as RunAgentThread arg. 14695 </change> 14696 <change date="22 Jan 2003"> 14697 Fixed names to standardized naming convention 14698 Removed AsyncGetStackTrace. 14699 </change> 14700 <change date="29 Jan 2003"> 14701 Since we are using jthread, removed GetThread. 14702 </change> 14703 <change date="31 Jan 2003"> 14704 Change GetFieldName to allow NULLs like GetMethodName. 14705 </change> 14706 <change date="29 Feb 2003" version="v40"> 14707 Rewrite the introductory text, adding sections on 14708 start-up, environments and bytecode instrumentation. 14709 Change the command line arguments per EG discussions. 14710 Add an introduction to the capabilities section. 14711 Add the extension mechanism category and functions. 14712 Mark for deletion, but clarified anyhow, SuspendAllThreads. 14713 Rename IterateOverLiveObjects to IterateOverReachableObjects and 14714 change the text accordingly. 14715 Clarify IterateOverHeap. 14716 Clarify CompiledMethodLoad. 14717 Discuss prerequisite state for Calling Functions. 14718 Clarify SetAllocationHooks. 14719 Added issues ("To be resolved:") through-out. 14720 And so on... 14721 </change> 14722 <change date="6 Mar 2003" version="v41"> 14723 Remove struct from the call to GetOwnedMonitorInfo. 14724 Automatically generate most error documentation, remove 14725 (rather broken) hand written error doc. 14726 Better describe capability use (empty initial set). 14727 Add min value to jint params. 14728 Remove the capability can_access_thread_local_storage. 14729 Rename error JVMTI_ERROR_NOT_IMPLEMENTED to JVMTI_ERROR_MUST_POSSESS_CAPABILITY; 14730 same for *NOT_IMPLEMENTED. 14731 Description fixes. 14732 </change> 14733 <change date="8 Mar 2003" version="v42"> 14734 Rename GetClassSignature to GetClassName. 14735 Rename IterateOverClassObjects to IterateOverInstancesOfClass. 14736 Remove GetMaxStack (operand stack isn't used in <jvmti/>). 14737 Description fixes: define launch-time, remove native frame pop 14738 from PopFrame, and assorted clarifications. 14739 </change> 14740 <change date="8 Mar 2003" version="v43"> 14741 Fix minor editing problem. 14742 </change> 14743 <change date="10 Mar 2003" version="v44"> 14744 Add phase information. 14745 Remap (compact) event numbers. 14746 </change> 14747 <change date="11 Mar 2003" version="v45"> 14748 More phase information - allow "any". 14749 Elide raw monitor queries and events. 14750 Minor description fixes. 14751 </change> 14752 <change date="12 Mar 2003" version="v46"> 14753 Add GetPhase. 14754 Use "phase" through document. 14755 Elide GetRawMonitorName. 14756 Elide GetObjectMonitors. 14757 </change> 14758 <change date="12 Mar 2003" version="v47"> 14759 Fixes from link, XML, and spell checking. 14760 Auto-generate the callback structure. 14761 </change> 14762 <change date="13 Mar 2003" version="v48"> 14763 One character XML fix. 14764 </change> 14765 <change date="13 Mar 2003" version="v49"> 14766 Change function parameter names to be consistent with 14767 event parameters (fooBarBaz becomes foo_bar_baz). 14768 </change> 14769 <change date="14 Mar 2003" version="v50"> 14770 Fix broken link. Fix thread markers. 14771 </change> 14772 <change date="14 Mar 2003" version="v51"> 14773 Change constants so they are under 128 to workaround 14774 compiler problems. 14775 </change> 14776 <change date="23 Mar 2003" version="v52"> 14777 Overhaul capabilities. Separate GetStackTrace into 14778 GetStackTrace and GetStackFrames. 14779 </change> 14780 <change date="8 Apr 2003" version="v54"> 14781 Use depth instead of jframeID to reference frames. 14782 Remove the now irrelevant GetCurrentFrame, GetCallerFrame and GetStackFrames. 14783 Remove frame arg from events. 14784 </change> 14785 <change date="9 Apr 2003" version="v55"> 14786 Remove GetObjectWithAnnotation since tests show buffered approach more efficient. 14787 Add missing annotation_count to GetObjectsWithAnnotations 14788 </change> 14789 <change date="10 Apr 2003" version="v56"> 14790 Remove confusing parenthetical statement in GetObjectsWithAnnotations 14791 </change> 14792 <change date="13 Apr 2003" version="v58"> 14793 Replace jclass/jmethodID representation of method with simply jmethodID; 14794 Pass JvmtiEnv* as first arg of every event; remove JNIEnv* where inappropriate. 14795 Replace can_access_frames with can_access_local_variables; remove from purely stack access. 14796 Use can_get_synthetic_attribute; fix description. 14797 Clarify that zero length arrays must be deallocated. 14798 Clarify RelinquishCapabilities. 14799 Generalize JVMTI_ERROR_VM_DEAD to JVMTI_ERROR_WRONG_PHASE. 14800 </change> 14801 <change date="27 Apr 2003" version="v59"> 14802 Remove lingering indirect references to OBSOLETE_METHOD_ID. 14803 </change> 14804 <change date="4 May 2003" version="v60"> 14805 Allow DestroyRawMonitor during OnLoad. 14806 </change> 14807 <change date="7 May 2003" version="v61"> 14808 Added not monitor owner error return to DestroyRawMonitor. 14809 </change> 14810 <change date="13 May 2003" version="v62"> 14811 Clarify semantics of raw monitors. 14812 Change flags on <code>GetThreadStatus</code>. 14813 <code>GetClassLoader</code> return NULL for the bootstrap class loader. 14814 Add <code>GetClassName</code> issue. 14815 Define local variable signature. 14816 Disallow zero in annotations array of <code>GetObjectsWithAnnotations</code>. 14817 Remove over specification in <code>GetObjectsWithAnnotations</code>. 14818 Elide <code>SetAllocationHooks</code>. 14819 Elide <code>SuspendAllThreads</code>. 14820 </change> 14821 <change date="14 May 2003" version="v63"> 14822 Define the data type <code>jvmtiEventCallbacks</code>. 14823 Zero length allocations return NULL. 14824 Keep SetAllocationHooks in JVMDI, but remove from <jvmti/>. 14825 Add JVMTI_THREAD_STATUS_FLAG_INTERRUPTED. 14826 </change> 14827 <change date="15 May 2003" version="v64"> 14828 Better wording, per review. 14829 </change> 14830 <change date="15 May 2003" version="v65"> 14831 First Alpha. 14832 Make jmethodID and jfieldID unique, jclass not used. 14833 </change> 14834 <change date="27 May 2003" version="v66"> 14835 Fix minor XSLT errors. 14836 </change> 14837 <change date="13 June 2003" version="v67"> 14838 Undo making jfieldID unique (jmethodID still is). 14839 </change> 14840 <change date="17 June 2003" version="v68"> 14841 Changes per June 11th Expert Group meeting -- 14842 Overhaul Heap functionality: single callback, 14843 remove GetHeapRoots, add reachable iterators, 14844 and rename "annotation" to "tag". 14845 NULL thread parameter on most functions is current 14846 thread. 14847 Add timers. 14848 Remove ForceExit. 14849 Add GetEnvironmentLocalStorage. 14850 Add verbose flag and event. 14851 Add AddToBootstrapClassLoaderSearch. 14852 Update ClassFileLoadHook. 14853 </change> 14854 <change date="18 June 2003" version="v69"> 14855 Clean up issues sections. 14856 Rename GetClassName back to GetClassSignature and 14857 fix description. 14858 Add generic signature to GetClassSignature, 14859 GetFieldSignature, GetMethodSignature, and 14860 GetLocalVariableTable. 14861 Elide EstimateCostOfCapabilities. 14862 Clarify that the system property functions operate 14863 on the VM view of system properties. 14864 Clarify Agent_OnLoad. 14865 Remove "const" from JNIEnv* in events. 14866 Add metadata accessors. 14867 </change> 14868 <change date="18 June 2003" version="v70"> 14869 Add start_depth to GetStackTrace. 14870 Move system properties to a new category. 14871 Add GetObjectSize. 14872 Remove "X" from command line flags. 14873 XML, HTML, and spell check corrections. 14874 </change> 14875 <change date="19 June 2003" version="v71"> 14876 Fix JVMTI_HEAP_ROOT_THREAD to be 6. 14877 Make each synopsis match the function name. 14878 Fix unclear wording. 14879 </change> 14880 <change date="26 June 2003" version="v72"> 14881 SetThreadLocalStorage and SetEnvironmentLocalStorage should allow value 14882 to be set to NULL. 14883 NotifyFramePop, GetFrameLocationm and all the local variable operations 14884 needed to have their wording about frames fixed. 14885 Grammar and clarity need to be fixed throughout. 14886 Capitalization and puntuation need to be consistent. 14887 Need micro version number and masks for accessing major, minor, and micro. 14888 The error code lists should indicate which must be returned by 14889 an implementation. 14890 The command line properties should be visible in the properties functions. 14891 Disallow popping from the current thread. 14892 Allow implementations to return opaque frame error when they cannot pop. 14893 The NativeMethodBind event should be sent during any phase. 14894 The DynamicCodeGenerated event should be sent during any phase. 14895 The following functions should be allowed to operate before VMInit: 14896 Set/GetEnvironmentLocalStorage 14897 GetMethodDeclaringClass 14898 GetClassSignature 14899 GetClassModifiers 14900 IsInterface 14901 IsArrayClass 14902 GetMethodName 14903 GetMethodModifiers 14904 GetMaxLocals 14905 GetArgumentsSize 14906 GetLineNumberTable 14907 GetMethodLocation 14908 IsMethodNative 14909 IsMethodSynthetic. 14910 Other changes (to XSL): 14911 Argument description should show asterisk after not before pointers. 14912 NotifyFramePop, GetFrameLocationm and all the local variable operations 14913 should hsve the NO_MORE_FRAMES error added. 14914 Not alive threads should have a different error return than invalid thread. 14915 </change> 14916 <change date="7 July 2003" version="v73"> 14917 VerboseOutput event was missing message parameter. 14918 Minor fix-ups. 14919 </change> 14920 <change date="14 July 2003" version="v74"> 14921 Technical Publications Department corrections. 14922 Allow thread and environment local storage to be set to NULL. 14923 </change> 14924 <change date="23 July 2003" version="v75"> 14925 Use new Agent_OnLoad rather than overloaded JVM_OnLoad. 14926 Add JNICALL to callbacks (XSL). 14927 Document JNICALL requirement for both events and callbacks (XSL). 14928 Restrict RedefineClasses to methods and attributes. 14929 Elide the VerboseOutput event. 14930 VMObjectAlloc: restrict when event is sent and remove method parameter. 14931 Finish loose ends from Tech Pubs edit. 14932 </change> 14933 <change date="24 July 2003" version="v76"> 14934 Change ClassFileLoadHook event to send the class instead of a boolean of redefine. 14935 </change> 14936 <change date="24 July 2003" version="v77"> 14937 XML fixes. 14938 Minor text clarifications and corrections. 14939 </change> 14940 <change date="24 July 2003" version="v78"> 14941 Remove GetExceptionHandlerTable and GetThrownExceptions from <jvmti/>. 14942 Clarify that stack frames are JVM Spec frames. 14943 Split can_get_source_info into can_get_source_file_name, can_get_line_numbers, 14944 and can_get_source_debug_extension. 14945 PopFrame cannot have a native calling method. 14946 Removed incorrect statement in GetClassloaderClasses 14947 (see <vmspec chapter="4.4"/>). 14948 </change> 14949 <change date="24 July 2003" version="v79"> 14950 XML and text fixes. 14951 Move stack frame description into Stack Frame category. 14952 </change> 14953 <change date="26 July 2003" version="v80"> 14954 Allow NULL (means bootstrap loader) for GetClassloaderClasses. 14955 Add new heap reference kinds for references from classes. 14956 Add timer information struct and query functions. 14957 Add AvailableProcessors. 14958 Rename GetOtherThreadCpuTime to GetThreadCpuTime. 14959 Explicitly add JVMTI_ERROR_INVALID_THREAD and JVMTI_ERROR_THREAD_NOT_ALIVE 14960 to SetEventNotification mode. 14961 Add initial thread to the VM_INIT event. 14962 Remove platform assumptions from AddToBootstrapClassLoaderSearch. 14963 </change> 14964 <change date="26 July 2003" version="v81"> 14965 Grammar and clarity changes per review. 14966 </change> 14967 <change date="27 July 2003" version="v82"> 14968 More grammar and clarity changes per review. 14969 Add Agent_OnUnload. 14970 </change> 14971 <change date="28 July 2003" version="v83"> 14972 Change return type of Agent_OnUnload to void. 14973 </change> 14974 <change date="28 July 2003" version="v84"> 14975 Rename JVMTI_REFERENCE_ARRAY to JVMTI_REFERENCE_ARRAY_ELEMENT. 14976 </change> 14977 <change date="28 July 2003" version="v85"> 14978 Steal java.lang.Runtime.availableProcessors() wording for 14979 AvailableProcessors(). 14980 Guarantee that zero will never be an event ID. 14981 Remove some issues which are no longer issues. 14982 Per review, rename and more completely document the timer 14983 information functions. 14984 </change> 14985 <change date="29 July 2003" version="v86"> 14986 Non-spec visible change to XML controlled implementation: 14987 SetThreadLocalStorage must run in VM mode. 14988 </change> 14989 <change date="5 August 2003" version="0.1.87"> 14990 Add GetErrorName. 14991 Add varargs warning to jvmtiExtensionEvent. 14992 Remove "const" on the jvmtiEnv* of jvmtiExtensionEvent. 14993 Remove unused can_get_exception_info capability. 14994 Pass jvmtiEnv* and JNIEnv* to the jvmtiStartFunction. 14995 Fix jvmtiExtensionFunctionInfo.func declared type. 14996 Extension function returns error code. 14997 Use new version numbering. 14998 </change> 14999 <change date="5 August 2003" version="0.2.88"> 15000 Remove the ClassUnload event. 15001 </change> 15002 <change date="8 August 2003" version="0.2.89"> 15003 Heap reference iterator callbacks return an enum that 15004 allows outgoing object references to be ignored. 15005 Allow JNIEnv as a param type to extension events/functions. 15006 </change> 15007 <change date="15 August 2003" version="0.2.90"> 15008 Fix a typo. 15009 </change> 15010 <change date="2 September 2003" version="0.2.91"> 15011 Remove all metadata functions: GetClassMetadata, 15012 GetFieldMetadata, and GetMethodMetadata. 15013 </change> 15014 <change date="1 October 2003" version="0.2.92"> 15015 Mark the functions Allocate. Deallocate, RawMonitor*, 15016 SetEnvironmentLocalStorage, and GetEnvironmentLocalStorage 15017 as safe for use in heap callbacks and GC events. 15018 </change> 15019 <change date="24 November 2003" version="0.2.93"> 15020 Add pass through opaque user data pointer to heap iterate 15021 functions and callbacks. 15022 In the CompiledMethodUnload event, send the code address. 15023 Add GarbageCollectionOccurred event. 15024 Add constant pool reference kind. 15025 Mark the functions CreateRawMonitor and DestroyRawMonitor 15026 as safe for use in heap callbacks and GC events. 15027 Clarify: VMDeath, GetCurrentThreadCpuTimerInfo, 15028 GetThreadCpuTimerInfo, IterateOverReachableObjects, 15029 IterateOverObjectsReachableFromObject, GetTime and 15030 JVMTI_ERROR_NULL_POINTER. 15031 Add missing errors to: GenerateEvents and 15032 AddToBootstrapClassLoaderSearch. 15033 Fix description of ClassFileLoadHook name parameter. 15034 In heap callbacks and GC/ObjectFree events, specify 15035 that only explicitly allowed functions can be called. 15036 Allow GetCurrentThreadCpuTimerInfo, GetCurrentThreadCpuTime, 15037 GetTimerInfo, and GetTime during callback. 15038 Allow calling SetTag/GetTag during the onload phase. 15039 SetEventNotificationMode, add: error attempted inappropriate 15040 thread level control. 15041 Remove jvmtiExceptionHandlerEntry. 15042 Fix handling of native methods on the stack -- 15043 location_ptr param of GetFrameLocation, remove 15044 JVMTI_ERROR_OPAQUE_FRAME from GetFrameLocation, 15045 jvmtiFrameInfo.location, and jlocation. 15046 Remove typo (from JVMPI) implying that the MonitorWaited 15047 event is sent on sleep. 15048 </change> 15049 <change date="25 November 2003" version="0.2.94"> 15050 Clarifications and typos. 15051 </change> 15052 <change date="3 December 2003" version="0.2.95"> 15053 Allow NULL user_data in heap iterators. 15054 </change> 15055 <change date="28 January 2004" version="0.2.97"> 15056 Add GetThreadState, deprecate GetThreadStatus. 15057 </change> 15058 <change date="29 January 2004" version="0.2.98"> 15059 INVALID_SLOT and TYPE_MISMATCH errors should be optional. 15060 </change> 15061 <change date="12 February 2004" version="0.2.102"> 15062 Remove MonitorContendedExit. 15063 Added JNIEnv parameter to VMObjectAlloc. 15064 Clarified definition of class_tag and referrer_index 15065 parameters to heap callbacks. 15066 </change> 15067 <change date="16 February 2004" version="0.2.103"> 15068 Document JAVA_TOOL_OPTIONS. 15069 </change> 15070 <change date="17 February 2004" version="0.2.105"> 15071 Divide start phase into primordial and start. 15072 Add VMStart event 15073 Change phase associations of functions and events. 15074 </change> 15075 <change date="18 February 2004" version="0.3.6"> 15076 Elide deprecated GetThreadStatus. 15077 Bump minor version, subtract 100 from micro version 15078 </change> 15079 <change date="18 February 2004" version="0.3.7"> 15080 Document that timer nanosecond values are unsigned. 15081 Clarify text having to do with native methods. 15082 </change> 15083 <change date="19 February 2004" version="0.3.8"> 15084 Fix typos. 15085 Remove elided deprecated GetThreadStatus. 15086 </change> 15087 <change date="23 February 2004" version="0.3.9"> 15088 Require NotifyFramePop to act on suspended threads. 15089 </change> 15090 <change date="24 February 2004" version="0.3.10"> 15091 Add capabilities 15092 (<internallink id="jvmtiCapabilities.can_redefine_any_class" 15093 ><code>can_redefine_any_class</code></internallink> 15094 and 15095 <internallink id="jvmtiCapabilities.can_generate_all_class_hook_events" 15096 ><code>can_generate_all_class_hook_events</code></internallink>) 15097 and an error (<errorlink id="JVMTI_ERROR_UNMODIFIABLE_CLASS"></errorlink>) 15098 which allow some classes to be unmodifiable. 15099 </change> 15100 <change date="28 February 2004" version="0.3.11"> 15101 Add JVMTI_ERROR_MUST_POSSESS_CAPABILITY to SetEventNotificationMode. 15102 </change> 15103 <change date="8 March 2004" version="0.3.12"> 15104 Clarified CompiledMethodUnload so that it is clear the event 15105 may be posted after the class has been unloaded. 15106 </change> 15107 <change date="5 March 2004" version="0.3.13"> 15108 Change the size parameter of VMObjectAlloc to jlong to match GetObjectSize. 15109 </change> 15110 <change date="13 March 2004" version="0.3.14"> 15111 Added guideline for the use of the JNI FindClass function in event 15112 callback functions. 15113 </change> 15114 <change date="15 March 2004" version="0.3.15"> 15115 Add GetAllStackTraces and GetThreadListStackTraces. 15116 </change> 15117 <change date="19 March 2004" version="0.3.16"> 15118 ClassLoad and ClassPrepare events can be posted during start phase. 15119 </change> 15120 <change date="25 March 2004" version="0.3.17"> 15121 Add JVMTI_ERROR_NATIVE_METHOD to GetLineNumberTable, GetLocalVariableTable, 15122 GetMaxLocals, GetArgumentsSize, GetMethodLocation, GetBytecodes. 15123 </change> 15124 <change date="29 March 2004" version="0.3.18"> 15125 Return the timer kind in the timer information structure. 15126 </change> 15127 <change date="31 March 2004" version="0.3.19"> 15128 Spec clarifications: 15129 JVMTI_THREAD_STATE_IN_NATIVE might not include JNI or <jvmti/>. 15130 ForceGarbageCollection does not run finalizers. 15131 The context of the specification is the Java platform. 15132 Warn about early instrumentation. 15133 </change> 15134 <change date="1 April 2004" version="0.3.20"> 15135 Refinements to the above clarifications and 15136 Clarify that an error returned by Agent_OnLoad terminates the VM. 15137 </change> 15138 <change date="1 April 2004" version="0.3.21"> 15139 Array class creation does not generate a class load event. 15140 </change> 15141 <change date="7 April 2004" version="0.3.22"> 15142 Align thread state hierarchy more closely with java.lang.Thread.State. 15143 </change> 15144 <change date="12 April 2004" version="0.3.23"> 15145 Clarify the documentation of thread state. 15146 </change> 15147 <change date="19 April 2004" version="0.3.24"> 15148 Remove GarbageCollectionOccurred event -- can be done by agent. 15149 </change> 15150 <change date="22 April 2004" version="0.3.25"> 15151 Define "command-line option". 15152 </change> 15153 <change date="29 April 2004" version="0.3.26"> 15154 Describe the intended use of bytecode instrumentation. 15155 Fix description of extension event first parameter. 15156 </change> 15157 <change date="30 April 2004" version="0.3.27"> 15158 Clarification and typos. 15159 </change> 15160 <change date="18 May 2004" version="0.3.28"> 15161 Remove DataDumpRequest event. 15162 </change> 15163 <change date="18 May 2004" version="0.3.29"> 15164 Clarify RawMonitorWait with zero timeout. 15165 Clarify thread state after RunAgentThread. 15166 </change> 15167 <change date="24 May 2004" version="0.3.30"> 15168 Clean-up: fix bad/old links, etc. 15169 </change> 15170 <change date="30 May 2004" version="0.3.31"> 15171 Clarifications including: 15172 All character strings are modified UTF-8. 15173 Agent thread visibiity. 15174 Meaning of obsolete method version. 15175 Thread invoking heap callbacks, 15176 </change> 15177 <change date="1 June 2004" version="1.0.32"> 15178 Bump major.minor version numbers to "1.0". 15179 </change> 15180 <change date="2 June 2004" version="1.0.33"> 15181 Clarify interaction between ForceGarbageCollection 15182 and ObjectFree. 15183 </change> 15184 <change date="6 June 2004" version="1.0.34"> 15185 Restrict AddToBootstrapClassLoaderSearch and 15186 SetSystemProperty to the OnLoad phase only. 15187 </change> 15188 <change date="11 June 2004" version="1.0.35"> 15189 Fix typo in SetTag. 15190 </change> 15191 <change date="18 June 2004" version="1.0.36"> 15192 Fix trademarks. 15193 Add missing parameter in example GetThreadState usage. 15194 </change> 15195 <change date="4 August 2004" version="1.0.37"> 15196 Copyright updates. 15197 </change> 15198 <change date="5 November 2004" version="1.0.38"> 15199 Add missing function table layout. 15200 Add missing description of C++ member function format of functions. 15201 Clarify that name in CFLH can be NULL. 15202 Released as part of <tm>J2SE</tm> 5.0. 15203 </change> 15204 <change date="24 April 2005" version="1.1.47"> 15205 Bump major.minor version numbers to "1.1". 15206 Add ForceEarlyReturn* functions. 15207 Add GetOwnedMonitorStackDepthInfo function. 15208 Add GetCurrentThread function. 15209 Add "since" version marker. 15210 Add AddToSystemClassLoaderSearch. 15211 Allow AddToBootstrapClassLoaderSearch be used in live phase. 15212 Fix historic rubbish in the descriptions of the heap_object_callback 15213 parameter of IterateOverHeap and IterateOverInstancesOfClass functions; 15214 disallow NULL for this parameter. 15215 Clarify, correct and make consistent: wording about current thread, 15216 opaque frames and insufficient number of frames in PopFrame. 15217 Consistently use "current frame" rather than "topmost". 15218 Clarify the JVMTI_ERROR_TYPE_MISMATCH errors in GetLocal* and SetLocal* 15219 by making them compatible with those in ForceEarlyReturn*. 15220 Many other clarifications and wording clean ups. 15221 </change> 15222 <change date="25 April 2005" version="1.1.48"> 15223 Add GetConstantPool. 15224 Switch references to the first edition of the VM Spec, to the seconds edition. 15225 </change> 15226 <change date="26 April 2005" version="1.1.49"> 15227 Clarify minor/major version order in GetConstantPool. 15228 </change> 15229 <change date="26 April 2005" version="1.1.50"> 15230 Add SetNativeMethodPrefix and SetNativeMethodPrefixes. 15231 Reassign GetOwnedMonitorStackDepthInfo to position 153. 15232 Break out Class Loader Search in its own documentation category. 15233 Deal with overly long lines in XML source. 15234 </change> 15235 <change date="29 April 2005" version="1.1.51"> 15236 Allow agents be started in the live phase. 15237 Added paragraph about deploying agents. 15238 </change> 15239 <change date="30 April 2005" version="1.1.52"> 15240 Add specification description to SetNativeMethodPrefix(es). 15241 Better define the conditions on GetConstantPool. 15242 </change> 15243 <change date="30 April 2005" version="1.1.53"> 15244 Break out the GetClassVersionNumber function from GetConstantPool. 15245 Clean-up the references to the VM Spec. 15246 </change> 15247 <change date="1 May 2005" version="1.1.54"> 15248 Allow SetNativeMethodPrefix(es) in any phase. 15249 Add clarifications about the impact of redefinition on GetConstantPool. 15250 </change> 15251 <change date="2 May 2005" version="1.1.56"> 15252 Various clarifications to SetNativeMethodPrefix(es). 15253 </change> 15254 <change date="2 May 2005" version="1.1.57"> 15255 Add missing performance warning to the method entry event. 15256 </change> 15257 <change date="5 May 2005" version="1.1.58"> 15258 Remove internal JVMDI support. 15259 </change> 15260 <change date="8 May 2005" version="1.1.59"> 15261 Add <functionlink id="RetransformClasses"/>. 15262 Revamp the bytecode instrumentation documentation. 15263 Change <functionlink id="IsMethodObsolete"/> to no longer 15264 require the can_redefine_classes capability. 15265 </change> 15266 <change date="11 May 2005" version="1.1.63"> 15267 Clarifications for retransformation. 15268 </change> 15269 <change date="11 May 2005" version="1.1.64"> 15270 Clarifications for retransformation, per review. 15271 Lock "retransformation (in)capable" at class load enable time. 15272 </change> 15273 <change date="4 June 2005" version="1.1.67"> 15274 Add new heap functionity which supports reporting primitive values, 15275 allows setting the referrer tag, and has more powerful filtering: 15276 FollowReferences, IterateThroughHeap, and their associated 15277 callbacks, structs, enums, and constants. 15278 </change> 15279 <change date="4 June 2005" version="1.1.68"> 15280 Clarification. 15281 </change> 15282 <change date="6 June 2005" version="1.1.69"> 15283 FollowReferences, IterateThroughHeap: Put callbacks in a struct; 15284 Add missing error codes; reduce bits in the visit control flags. 15285 </change> 15286 <change date="14 June 2005" version="1.1.70"> 15287 More on new heap functionity: spec clean-up per review. 15288 </change> 15289 <change date="15 June 2005" version="1.1.71"> 15290 More on new heap functionity: Rename old heap section to Heap (1.0). 15291 </change> 15292 <change date="21 June 2005" version="1.1.72"> 15293 Fix typos. 15294 </change> 15295 <change date="27 June 2005" version="1.1.73"> 15296 Make referrer info structure a union. 15297 </change> 15298 <change date="9 September 2005" version="1.1.74"> 15299 In new heap functions: 15300 Add missing superclass reference kind. 15301 Use a single scheme for computing field indexes. 15302 Remove outdated references to struct based referrer info. 15303 </change> 15304 <change date="12 September 2005" version="1.1.75"> 15305 Don't callback during FollowReferences on frivolous java.lang.Object superclass. 15306 </change> 15307 <change date="13 September 2005" version="1.1.76"> 15308 In string primitive callback, length now Unicode length. 15309 In array and string primitive callbacks, value now "const". 15310 Note possible compiler impacts on setting JNI function table. 15311 </change> 15312 <change date="13 September 2005" version="1.1.77"> 15313 GetClassVersionNumbers() and GetConstantPool() should return 15314 error on array or primitive class. 15315 </change> 15316 <change date="14 September 2005" version="1.1.78"> 15317 Grammar fixes. 15318 </change> 15319 <change date="26 September 2005" version="1.1.79"> 15320 Add IsModifiableClass query. 15321 </change> 15322 <change date="9 February 2006" version="1.1.81"> 15323 Add referrer_class_tag parameter to jvmtiHeapReferenceCallback. 15324 </change> 15325 <change date="13 February 2006" version="1.1.82"> 15326 Doc fixes: update can_redefine_any_class to include retransform. 15327 Clarify that exception events cover all Throwables. 15328 In GetStackTrace, no test is done for start_depth too big if start_depth is zero, 15329 Clarify fields reported in Primitive Field Callback -- static vs instance. 15330 Repair confusing names of heap types, including callback names. 15331 Require consistent usage of stack depth in the face of thread launch methods. 15332 Note incompatibility of <jvmti/> memory management with other systems. 15333 </change> 15334 <change date="14 February 2006" version="1.1.85"> 15335 Fix typos and missing renames. 15336 </change> 15337 <change date="13 March 2006" version="1.1.86"> 15338 Clarify that jmethodIDs and jfieldIDs can be saved. 15339 Clarify that Iterate Over Instances Of Class includes subclasses. 15340 </change> 15341 <change date="14 March 2006" version="1.1.87"> 15342 Better phrasing. 15343 </change> 15344 <change date="16 March 2006" version="1.1.88"> 15345 Match the referrer_index for static fields in Object Reference Callback 15346 with the Reference Implementation (and all other known implementations); 15347 that is, make it match the definition for instance fields. 15348 In GetThreadListStackTraces, add JVMTI_ERROR_INVALID_THREAD to cover 15349 an invalid thread in the list; and specify that not started threads 15350 return empty stacks. 15351 </change> 15352 <change date="17 March 2006" version="1.1.89"> 15353 Typo. 15354 </change> 15355 <change date="25 March 2006" version="1.1.90"> 15356 Typo. 15357 </change> 15358 <change date="6 April 2006" version="1.1.91"> 15359 Remove restrictions on AddToBootstrapClassLoaderSearch and 15360 AddToSystemClassLoaderSearch. 15361 </change> 15362 <change date="1 May 2006" version="1.1.93"> 15363 Changed spec to return -1 for monitor stack depth for the 15364 implementation which can not determine stack depth. 15365 </change> 15366 <change date="3 May 2006" version="1.1.94"> 15367 Corrections for readability and accuracy courtesy of Alan Pratt of IBM. 15368 List the object relationships reported in FollowReferences. 15369 </change> 15370 <change date="5 May 2006" version="1.1.95"> 15371 Clarify the object relationships reported in FollowReferences. 15372 </change> 15373 <change date="28 June 2006" version="1.1.98"> 15374 Clarify DisposeEnvironment; add warning. 15375 Fix typos in SetLocalXXX "retrieve" => "set". 15376 Clarify that native method prefixes must remain set while used. 15377 Clarify that exactly one Agent_OnXXX is called per agent. 15378 Clarify that library loading is independent from start-up. 15379 Remove ambiguous reference to Agent_OnLoad in the Agent_OnUnload spec. 15380 </change> 15381 <change date="31 July 2006" version="1.1.99"> 15382 Clarify the interaction between functions and exceptions. 15383 Clarify and give examples of field indices. 15384 Remove confusing "That is" sentence from MonitorWait and MonitorWaited events. 15385 Update links to point to Java 6. 15386 </change> 15387 <change date="6 August 2006" version="1.1.102"> 15388 Add ResourceExhaustedEvent. 15389 </change> 15390 <change date="11 October 2012" version="1.2.2"> 15391 Fixed the "HTTP" and "Missing Anchor" errors reported by the LinkCheck tool. 15392 </change> 15393 <change date="19 June 2013" version="1.2.3"> 15394 Added support for statically linked agents. 15395 </change> 15396 <change date="13 October 2016" version="9.0.0"> 15397 Support for modules: 15398 - The majorversion is 9 now 15399 - The ClassFileLoadHook events are not sent during the primordial phase anymore. 15400 - Allow CompiledMethodLoad events at start phase 15401 - Add new capabilities: 15402 - can_generate_early_vmstart 15403 - can_generate_early_class_hook_events 15404 - Add new functions: 15405 - GetAllModules 15406 - AddModuleReads, AddModuleExports, AddModuleOpens, AddModuleUses, AddModuleProvides 15407 - IsModifiableModule 15408 Clarified can_redefine_any_classes, can_retransform_any_classes and IsModifiableClass API to 15409 disallow some implementation defined classes. 15410 </change> 15411 <change date="12 February 2017" version="9.0.0"> 15412 Minor update for GetCurrentThread function: 15413 - The function may return NULL in the start phase if the 15414 can_generate_early_vmstart capability is enabled. 15415 </change> 15416 <change date="7 February 2018" version="11.0.0"> 15417 Minor update for new class file NestHost and NestMembers attributes: 15418 - Specify that RedefineClasses and RetransformClasses are not allowed 15419 to change the class file NestHost and NestMembers attributes. 15420 - Add new error JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED 15421 that can be returned by RedefineClasses and RetransformClasses. 15422 </change> 15423 <change date="15 June 2018" version="11.0.0"> 15424 Support for Low Overhead Heap Sampling: 15425 - Add new capability: 15426 - can_generate_sampled_object_alloc_events 15427 - Add new function: 15428 - SetHeapSamplingInterval 15429 - Add new event type: 15430 - JVMTI_EVENT_SAMPLED_OBJECT_ALLOC 15431 </change> 15432 <change date="20 May 2019" version="13.0.0"> 15433 Minor spec update for the capability "can_redefine_any_class". 15434 It now says: 15435 "RedefineClasses can be called on any modifiable class. See IsModifiableClass. 15436 (can_redefine_classes must also be set)" 15437 </change> 15438 <change date="5 June 2019" version="13.0.0"> 15439 Minor PopFrame spec update: 15440 - The specified thread must be suspended or must be the current thread. 15441 (It was not allowed to be the current thread before.) 15442 </change> 15443 <change date="10 October 2019" version="14.0.0"> 15444 Minor update for new class file Record attribute: 15445 - Specify that RedefineClasses and RetransformClasses are not allowed 15446 to change the class file Record attribute. 15447 </change> 15448 <change date="13 May 2020" version="15.0.0"> 15449 Minor update for new class file PermittedSubclasses attribute: 15450 - Specify that RedefineClasses and RetransformClasses are not allowed 15451 to change the class file PermittedSubclasses attribute. 15452 </change> 15453 <change date="15 January 2021" version="17.0.0"> 15454 Minor clarification in the section "Agent Shutdown" that says the 15455 implementation may choose to not call the Agent_OnUnload function 15456 if the Agent_OnAttach/Agent_OnAttach_L function reported an error. 15457 </change> 15458 <change date="8 June 2021" version="17.0.0"> 15459 Minor update to deprecate Heap functions 1.0. 15460 </change> 15461 <change date="27 April 2022" version="19.0.0"> 15462 Support for virtual threads: 15463 - Add new capability: 15464 - can_support_virtual_threads 15465 - Add new functions: 15466 - SuspendAllVirtualThreads 15467 - ResumeAllVirtualThreads 15468 - Add new event types: 15469 - JVMTI_EVENT_VIRTUAL_THREAD_START 15470 - JVMTI_EVENT_VIRTUAL_THREAD_END 15471 - Add new error code: 15472 - JVMTI_ERROR_UNSUPPORTED_OPERATION 15473 </change> 15474 </changehistory> 15475 15476 </specification> 15477 <!-- Keep this comment at the end of the file 15478 Local variables: 15479 mode: sgml 15480 sgml-omittag:t 15481 sgml-shorttag:t 15482 sgml-namecase-general:t 15483 sgml-general-insert-case:lower 15484 sgml-minimize-attributes:nil 15485 sgml-always-quote-attributes:t 15486 sgml-indent-step:2 15487 sgml-indent-data:t 15488 sgml-parent-document:nil 15489 sgml-exposed-tags:nil 15490 sgml-local-catalogs:nil 15491 sgml-local-ecat-files:nil 15492 End: 15493 -->