1 <?xml version="1.0" encoding="ISO-8859-1"?> 2 <?xml-stylesheet type="text/xsl" href="jvmti.xsl"?> 3 <!-- 4 Copyright (c) 2002, 2018, 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, copyright, intro*, functionsection, errorsection, 28 eventsection, datasection, issuessection, changehistory)> 29 <!ATTLIST specification label CDATA #REQUIRED 30 majorversion CDATA #REQUIRED 31 minorversion CDATA #REQUIRED 32 microversion CDATA #REQUIRED> 33 34 <!ELEMENT title (#PCDATA|jvmti|tm)*> 35 <!ATTLIST title subtitle CDATA #REQUIRED> 36 37 <!ELEMENT copyright ANY> 38 39 <!ELEMENT intro ANY> 40 <!ATTLIST intro id CDATA #IMPLIED 41 label CDATA ""> 42 43 <!ELEMENT functionsection (intro*, category*)> 44 <!ATTLIST functionsection label CDATA #REQUIRED> 45 46 <!ELEMENT category ((intro|typedef|uniontypedef|capabilitiestypedef)*, 47 (function|callback|elide)*)> 48 <!ATTLIST category id CDATA #REQUIRED 49 label CDATA #REQUIRED> 50 51 <!ELEMENT function (synopsis, typedef*, description?, origin, 52 (capabilities|eventcapabilities), 53 parameters, errors)> 54 <!ATTLIST function id CDATA #REQUIRED 55 num CDATA #REQUIRED 56 phase (onload|onloadOnly|start|live|any) #IMPLIED 57 callbacksafe (safe|unsafe) #IMPLIED 58 impl CDATA #IMPLIED 59 hide CDATA #IMPLIED 60 jkernel (yes|no) #IMPLIED 61 since CDATA "1.0"> 62 63 <!ELEMENT callback ((jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|jthreadGroup|jobject| 64 jvalue|enum|jint|jlong|jfloat|jdouble|jlocation|jboolean|char|uchar|size_t|void), 65 synopsis, description?, parameters)> 66 <!ATTLIST callback id CDATA #REQUIRED 67 since CDATA "1.0"> 68 69 <!ELEMENT synopsis (#PCDATA|jvmti)*> 70 71 <!ELEMENT typedef (description?, field*)> 72 <!ATTLIST typedef id CDATA #REQUIRED 73 label CDATA #REQUIRED 74 since CDATA "1.0"> 75 76 <!ELEMENT uniontypedef (description?, field*)> 77 <!ATTLIST uniontypedef id CDATA #REQUIRED 78 label CDATA #REQUIRED 79 since CDATA "1.0"> 80 81 <!ELEMENT field ((jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|jthreadGroup|jobject| 82 jvalue|enum|jint|jlong|jfloat|jdouble|jlocation|jboolean|char|uchar|size_t|void|allocfieldbuf|inptr|inbuf|outbuf|vmbuf|ptrtype|struct), 83 description)> 84 <!ATTLIST field id CDATA #REQUIRED> 85 86 <!ELEMENT capabilitiestypedef (description?, capabilityfield*)> 87 <!ATTLIST capabilitiestypedef id CDATA #REQUIRED 88 label CDATA #REQUIRED> 89 90 <!ELEMENT capabilityfield (description)> 91 <!ATTLIST capabilityfield id CDATA #REQUIRED 92 disp1 CDATA "" 93 disp2 CDATA "" 94 since CDATA "1.0"> 95 96 <!ELEMENT description ANY> 97 98 <!ELEMENT capabilities (required*, capability*)> 99 100 <!ELEMENT eventcapabilities EMPTY> 101 102 <!ELEMENT required ANY> 103 <!ATTLIST required id CDATA #REQUIRED> 104 105 <!ELEMENT capability ANY> 106 <!ATTLIST capability id CDATA #REQUIRED> 107 108 <!ELEMENT parameters (param*)> 109 110 <!ELEMENT param ((jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|jthreadGroup|jobject| 111 jvalue|enum|jint|jlong|jfloat|jdouble|jlocation|jboolean|char|uchar|size_t|void|varargs|struct|ptrtype| 112 outptr|allocbuf|allocallocbuf|inptr|inbuf|outbuf|vmbuf|agentbuf), 113 description)> 114 <!ATTLIST param id CDATA #REQUIRED> 115 116 <!ELEMENT jmethodID EMPTY> 117 <!ATTLIST jmethodID class CDATA #IMPLIED 118 native CDATA #IMPLIED> 119 120 <!ELEMENT jfieldID EMPTY> 121 <!ATTLIST jfieldID class CDATA #IMPLIED> 122 123 <!ELEMENT jclass EMPTY> 124 <!ATTLIST jclass method CDATA #IMPLIED 125 field CDATA #IMPLIED> 126 127 <!ELEMENT jframeID EMPTY> 128 <!ATTLIST jframeID thread CDATA #IMPLIED> 129 130 <!ELEMENT jrawMonitorID EMPTY> 131 132 <!ELEMENT jthread EMPTY> 133 <!ATTLIST jthread started CDATA #IMPLIED 134 null CDATA #IMPLIED 135 frame CDATA #IMPLIED 136 impl CDATA #IMPLIED> 137 138 <!ELEMENT varargs EMPTY> 139 140 <!ELEMENT jthreadGroup EMPTY> 141 <!ELEMENT jobject EMPTY> 142 <!ELEMENT jvalue EMPTY> 143 <!ELEMENT jchar EMPTY> 144 <!ELEMENT jint EMPTY> 145 <!ATTLIST jint min CDATA #IMPLIED> 146 <!ELEMENT jlong EMPTY> 147 <!ELEMENT jfloat EMPTY> 148 <!ELEMENT jdouble EMPTY> 149 <!ELEMENT jlocation EMPTY> 150 <!ELEMENT jboolean EMPTY> 151 <!ELEMENT char EMPTY> 152 <!ELEMENT uchar EMPTY> 153 <!ELEMENT size_t EMPTY> 154 <!ELEMENT void EMPTY> 155 <!ELEMENT enum (#PCDATA)*> 156 <!ELEMENT struct (#PCDATA)*> 157 158 <!ELEMENT nullok ANY> 159 160 <!ELEMENT ptrtype ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread| 161 jthreadGroup|jobject|jvalue), nullok?)> 162 163 <!ELEMENT outptr ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread| 164 jthreadGroup|jobject|jvalue|enum|jchar|jint|jlong|jfloat|jdouble| 165 jlocation|jboolean|char|uchar|size_t|void), nullok?)> 166 167 <!ELEMENT allocbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread| 168 jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble| 169 jlocation|jboolean|char|uchar|size_t|void), nullok?)> 170 <!ATTLIST allocbuf incount CDATA #IMPLIED 171 outcount CDATA #IMPLIED> 172 173 <!ELEMENT allocallocbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread| 174 jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble| 175 jlocation|jboolean|char|uchar|size_t|void), nullok?)> 176 <!ATTLIST allocallocbuf incount CDATA #IMPLIED 177 outcount CDATA #IMPLIED> 178 179 <!ELEMENT inptr (struct, nullok?)> 180 181 <!ELEMENT inbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread| 182 jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble| 183 jlocation|jboolean|char|uchar|size_t|void), nullok?)> 184 <!ATTLIST inbuf incount CDATA #IMPLIED> 185 186 <!ELEMENT outbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread| 187 jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble| 188 jlocation|jboolean|char|uchar|size_t|void|outbuf), nullok?)> 189 <!ATTLIST outbuf incount CDATA #IMPLIED 190 outcount CDATA #IMPLIED> 191 192 <!ELEMENT vmbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread| 193 jthreadGroup|jobject|jvalue|enum|jchar|jint|jlong|jfloat|jdouble| 194 jlocation|jboolean|char|uchar|size_t|void), nullok?)> 195 <!ATTLIST vmbuf incount CDATA #IMPLIED 196 outcount CDATA #IMPLIED> 197 198 <!ELEMENT agentbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread| 199 jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble| 200 jlocation|jboolean|char|uchar|size_t|void), nullok?)> 201 <!ATTLIST agentbuf incount CDATA #IMPLIED 202 outcount CDATA #IMPLIED> 203 204 <!ELEMENT allocfieldbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread| 205 jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble| 206 jlocation|jboolean|char|uchar|size_t|void))> 207 <!ATTLIST allocfieldbuf outcount CDATA #IMPLIED> 208 209 <!ELEMENT errors (error*)> 210 211 <!ELEMENT error ANY> 212 <!ATTLIST error id CDATA #REQUIRED> 213 214 <!ELEMENT errorsection (intro*, errorcategory*)> 215 <!ATTLIST errorsection label CDATA #REQUIRED> 216 217 <!ELEMENT errorcategory (intro*, errorid*)> 218 <!ATTLIST errorcategory id CDATA #REQUIRED 219 label CDATA #REQUIRED> 220 221 <!ELEMENT errorid ANY> 222 <!ATTLIST errorid id CDATA #REQUIRED 223 num CDATA #REQUIRED> 224 225 <!ELEMENT datasection (intro*, basetypes*)> 226 227 <!ELEMENT basetypes (intro*, basetype*)> 228 <!ATTLIST basetypes id CDATA #REQUIRED 229 label CDATA #REQUIRED> 230 231 <!ELEMENT basetype (definition?,description)> 232 <!ATTLIST basetype id CDATA #REQUIRED 233 name CDATA #IMPLIED> 234 235 <!ELEMENT definition (#PCDATA|jvmti)*> 236 237 <!ELEMENT eventsection (intro*, (event|elide)*)> 238 <!ATTLIST eventsection label CDATA #REQUIRED> 239 240 <!ELEMENT event (description, origin, typedef*, capabilities, parameters)> 241 <!ATTLIST event id CDATA #REQUIRED 242 label CDATA #REQUIRED 243 const CDATA #REQUIRED 244 num CDATA #REQUIRED 245 phase (onload|start|live|any) #IMPLIED 246 filtered (thread|global) #IMPLIED 247 since CDATA "1.0"> 248 249 <!ELEMENT issuessection (intro*)> 250 <!ATTLIST issuessection label CDATA #REQUIRED> 251 252 <!ELEMENT changehistory (intro*, change*)> 253 <!ATTLIST changehistory update CDATA #REQUIRED 254 id CDATA #REQUIRED> 255 256 <!ELEMENT change ANY> 257 <!ATTLIST change date CDATA #REQUIRED 258 version CDATA #IMPLIED> 259 260 <!ELEMENT functionlink (#PCDATA|jvmti|code|i|b)*> 261 <!ATTLIST functionlink id CDATA #REQUIRED> 262 263 <!ELEMENT datalink (#PCDATA|jvmti|code|i|b)*> 264 <!ATTLIST datalink id CDATA #REQUIRED> 265 266 <!ELEMENT typelink (#PCDATA|jvmti|code|i|b)*> 267 <!ATTLIST typelink id CDATA #REQUIRED> 268 269 <!ELEMENT fieldlink (#PCDATA|jvmti|code|i|b)*> 270 <!ATTLIST fieldlink id CDATA #REQUIRED 271 struct CDATA #REQUIRED> 272 273 <!ELEMENT paramlink (#PCDATA|jvmti|code|i|b)*> 274 <!ATTLIST paramlink id CDATA #REQUIRED> 275 276 <!ELEMENT eventlink (#PCDATA|jvmti|code|i|b)*> 277 <!ATTLIST eventlink id CDATA #REQUIRED> 278 279 <!ELEMENT errorlink (#PCDATA|jvmti|code|i|b|tm)*> 280 <!ATTLIST errorlink id CDATA #REQUIRED> 281 282 <!ELEMENT externallink (#PCDATA|jvmti|code|i|b|tm)*> 283 <!ATTLIST externallink id CDATA #REQUIRED> 284 285 <!ELEMENT vmspec EMPTY> 286 <!ATTLIST vmspec chapter CDATA #IMPLIED> 287 288 <!ELEMENT internallink (#PCDATA|jvmti|code|i|b)*> 289 <!ATTLIST internallink id CDATA #REQUIRED> 290 291 <!ELEMENT functionphaselist EMPTY> 292 <!ATTLIST functionphaselist phase (onload|onloadOnly|start|live|any) #REQUIRED> 293 294 <!ELEMENT eventphaselist EMPTY> 295 <!ATTLIST eventphaselist phase (onload|start|live|any) #REQUIRED> 296 297 <!ELEMENT issue ANY> 298 299 <!ELEMENT rationale ANY> 300 301 <!ELEMENT todo ANY> 302 303 <!ELEMENT origin (#PCDATA)*> 304 305 <!ELEMENT elide (intro|function|callback|event)*> 306 <!ATTLIST elide why CDATA #IMPLIED> 307 308 <!ELEMENT constants (constant*)> 309 <!ATTLIST constants id CDATA #REQUIRED 310 label CDATA #REQUIRED 311 kind (enum|bits|const) #REQUIRED 312 since CDATA "1.0"> 313 314 <!ELEMENT constant ANY> 315 <!ATTLIST constant id CDATA #REQUIRED 316 num CDATA #REQUIRED> 317 318 <!ELEMENT tm (#PCDATA)> 319 320 <!ELEMENT i (#PCDATA|jvmti|tm)*> 321 322 <!ELEMENT b (#PCDATA|jvmti|code)*> 323 324 <!ELEMENT code (#PCDATA|space)*> 325 326 <!ELEMENT pre ANY> 327 328 <!ELEMENT space EMPTY> 329 330 <!ELEMENT jvmti EMPTY> 331 332 <!ELEMENT example (#PCDATA|i)*> 333 334 <!ELEMENT br EMPTY> 335 336 <!ELEMENT p EMPTY> 337 338 <!ELEMENT blockquote ANY> 339 340 <!ELEMENT dl (dt|dd)+> 341 342 <!ELEMENT dd ANY> 343 344 <!ELEMENT dt (#PCDATA|jvmti|code|i|b)*> 345 346 <!ELEMENT table (tr)+> 347 348 <!ELEMENT tr (td|th)*> 349 350 <!ELEMENT td ANY> 351 <!ATTLIST td class CDATA #IMPLIED> 352 353 <!ELEMENT th ANY> 354 <!ATTLIST th class CDATA #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 majorversion="11" 364 minorversion="0" 365 microversion="0"> 366 <title subtitle="Version"> 367 <tm>JVM</tm> Tool Interface 368 </title> 369 370 <copyright> 371 Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. 372 </copyright> 373 374 <intro id="whatIs" label="What is the JVM Tool Interface?"> 375 The <tm>JVM</tm> Tool Interface (<jvmti/>) 376 is a programming interface used by development and monitoring tools. 377 It provides both a way to inspect the state and 378 to control the execution of applications running in the 379 <tm>Java</tm> virtual machine (VM). 380 <p/> 381 <jvmti/> is intended to provide a VM interface for the full breadth of tools 382 that need access to VM state, including but not limited to: profiling, 383 debugging, monitoring, thread analysis, and coverage analysis tools. 384 <p/> 385 <jvmti/> may not be available in all implementations of the <tm>Java</tm> virtual 386 machine. 387 <p/> 388 <jvmti/> is a two-way interface. 389 A client of <jvmti/>, hereafter called an <i>agent</i>, 390 can be notified of 391 interesting occurrences through <internallink id="EventSection">events</internallink>. 392 <jvmti/> 393 can query and control the application through many 394 <internallink id="FunctionSection">functions</internallink>, 395 either in response to events or 396 independent of them. 397 <p/> 398 Agents run in the same process with and communicate directly with 399 the virtual machine executing 400 the application being examined. This communication is 401 through a native interface (<jvmti/>). The native in-process interface allows 402 maximal control with minimal intrusion on the part of a tool. 403 Typically, agents are relatively compact. They can be controlled 404 by a separate process which implements the bulk of a tool's 405 function without interfering with the target application's normal execution. 406 </intro> 407 408 <intro id="architecture" label="Architecture"> 409 Tools can be written directly to <jvmti/> or indirectly 410 through higher level interfaces. 411 The Java Platform Debugger Architecture includes <jvmti/>, but also 412 contains higher-level, out-of-process debugger interfaces. The higher-level 413 interfaces are more appropriate than <jvmti/> for many tools. 414 For more information on the Java Platform Debugger Architecture, 415 see the 416 <externallink id="jpda/architecture.html">Java 417 Platform Debugger Architecture website</externallink>. 418 </intro> 419 420 <intro id="writingAgents" label="Writing Agents"> 421 Agents can be written in any native language that supports C 422 language calling conventions and C or C++ 423 definitions. 424 <p/> 425 The function, event, data type, and constant definitions needed for 426 using <jvmti/> are defined in the include file <code>jvmti.h</code>. 427 To use these definitions add the <tm>J2SE</tm> include directory 428 to your include path and add 429 <example> 430 #include <jvmti.h> 431 </example> 432 to your source code. 433 </intro> 434 435 <intro id="deployingAgents" label="Deploying Agents"> 436 An agent is deployed in a platform specific manner but is typically the 437 platform equivalent of a dynamic library. On the <tm>Windows</tm> operating 438 system, for example, an agent library is a "Dynamic Linked Library" (DLL). 439 On the <tm>Solaris</tm> Operating Environment, an agent library is a shared 440 object (<code>.so</code> file). 441 <p/> 442 443 An agent may be started at VM startup by specifying the agent library 444 name using a <internallink id="starting">command line option</internallink>. 445 Some implementations may support a mechanism to <internallink id="onattach"> 446 start agents</internallink> in the live <functionlink id="GetPhase">phase</functionlink>. 447 The details of how this is initiated are implementation specific. 448 </intro> 449 450 <intro id="entryPoint" label="Statically Linked Agents (since version 1.2.3)"> 451 452 A native JVMTI Agent may be <i>statically linked</i> with the VM. 453 The manner in which the library and VM image are combined is 454 implementation-dependent. 455 An agent L whose image has been combined with the VM is defined as 456 <i>statically linked</i> if and only if the agent exports a function 457 called Agent_OnLoad_L. 458 <p/> 459 If a <i>statically linked</i> agent L exports a function called 460 Agent_OnLoad_L and a function called Agent_OnLoad, the Agent_OnLoad 461 function will be ignored. 462 If an agent L is <i>statically linked</i>, an Agent_OnLoad_L 463 function will be invoked with the same arguments and expected return 464 value as specified for the Agent_OnLoad function. 465 An agent L that is <i>statically linked</i> will prohibit an agent of 466 the same name from being loaded dynamically. 467 <p/> 468 The VM will invoke the Agent_OnUnload_L function of the agent, if such 469 a function is exported, at the same point during VM execution as it would 470 have called the dynamic entry point Agent_OnUnLoad. A statically loaded 471 agent cannot be unloaded. The Agent_OnUnload_L function will still be 472 called to do any other agent shutdown related tasks. 473 If a <i>statically linked</i> agent L exports a function called 474 Agent_OnUnLoad_L and a function called Agent_OnUnLoad, the Agent_OnUnLoad 475 function will be ignored. 476 <p/> 477 If an agent L is <i>statically linked</i>, an Agent_OnAttach_L function 478 will be invoked with the same arguments and expected return value as 479 specified for the Agent_OnAttach function. 480 If a <i>statically linked</i> agent L exports a function called 481 Agent_OnAttach_L and a function called Agent_OnAttach, the Agent_OnAttach 482 function will be ignored. 483 </intro> 484 485 <intro id="starting" label="Agent Command Line Options"> 486 The term "command-line option" is used below to 487 mean options supplied in the <code>JavaVMInitArgs</code> argument 488 to the <code>JNI_CreateJavaVM</code> function of the JNI 489 Invocation API. 490 <p/> 491 One of the two following 492 command-line options is used on VM startup to 493 properly load and run agents. 494 These arguments identify the library containing 495 the agent as well as an options 496 string to be passed in at startup. 497 <dl> 498 <dt><code>-agentlib:</code><i><agent-lib-name></i><code>=</code><i><options></i></dt> 499 <dd> 500 The name following <code>-agentlib:</code> is the name of the 501 library to load. Lookup of the library, both its full name and location, 502 proceeds in a platform-specific manner. 503 Typically, the <i><agent-lib-name></i> is expanded to an 504 operating system specific file name. 505 The <i><options></i> will be passed to the agent on start-up. 506 For example, if the option 507 <code>-agentlib:foo=opt1,opt2</code> is specified, the VM will attempt to 508 load the shared library <code>foo.dll</code> from the system <code>PATH</code> 509 under <tm>Windows</tm> or <code>libfoo.so</code> from the 510 <code>LD_LIBRARY_PATH</code> under the <tm>Solaris</tm> operating 511 environment. 512 If the agent library is statically linked into the executable 513 then no actual loading takes place. 514 <p/> 515 </dd> 516 <dt><code>-agentpath:</code><i><path-to-agent></i><code>=</code><i><options></i></dt> 517 <dd> 518 The path following <code>-agentpath:</code> is the absolute path from which 519 to load the library. 520 No library name expansion will occur. 521 The <i><options></i> will be passed to the agent on start-up. 522 For example, if the option 523 <code>-agentpath:c:\myLibs\foo.dll=opt1,opt2</code> is specified, the VM will attempt to 524 load the shared library <code>c:\myLibs\foo.dll</code>. If the agent 525 library is statically linked into the executable 526 then no actual loading takes place. 527 <p/> 528 </dd> 529 </dl> 530 For a dynamic shared library agent, the start-up routine 531 <internallink id="onload"><code>Agent_OnLoad</code></internallink> 532 in the library will be invoked. If the agent library is statically linked 533 into the executable then the system will attempt to invoke the 534 <code>Agent_OnLoad_<agent-lib-name></code> entry point where 535 <agent-lib-name> is the basename of the 536 agent. In the above example <code>-agentpath:c:\myLibs\foo.dll=opt1,opt2</code>, 537 the system will attempt to find and call the <code>Agent_OnLoad_foo</code> start-up routine. 538 <p/> 539 Libraries loaded with <code>-agentlib:</code> or <code>-agentpath:</code> 540 will be searched for JNI native method implementations to facilitate the 541 use of Java programming language code in tools, as is needed for 542 <internallink id="bci">bytecode instrumentation</internallink>. 543 <p/> 544 The agent libraries will be searched after all other libraries have been 545 searched (agents wishing to override or intercept the native method 546 implementations of non-agent methods can use the 547 <eventlink id="NativeMethodBind">NativeMethodBind event</eventlink>). 548 <p/> 549 These switches do the above and nothing more - they do not change the 550 state of the VM or <jvmti/>. No command line options are needed 551 to enable <jvmti/> 552 or aspects of <jvmti/>, this is handled programmatically 553 by the use of 554 <internallink id="capability">capabilities</internallink>. 555 </intro> 556 557 <intro id="startup" label="Agent Start-Up"> 558 The VM starts each agent by invoking a start-up function. 559 If the agent is started in the <code>OnLoad</code> 560 <functionlink id="GetPhase">phase</functionlink> the function 561 <internallink id="onload"><code>Agent_OnLoad</code></internallink> 562 or <internallink id="onload"><code>Agent_OnLoad_L</code></internallink> 563 for statically linked agents will be invoked. 564 If the agent is started in the live 565 <functionlink id="GetPhase">phase</functionlink> the function 566 <internallink id="onattach"><code>Agent_OnAttach</code></internallink> 567 or <internallink id="onattach"><code>Agent_OnAttach_L</code></internallink> 568 for statically linked agents will be invoked. 569 Exactly one call to a start-up function is made per agent. 570 </intro> 571 572 <intro id="onload" label="Agent Start-Up (OnLoad phase)"> 573 If an agent is started during the <code>OnLoad</code> phase then its 574 agent library must export a start-up function with the following prototype: 575 <example> 576 JNIEXPORT jint JNICALL 577 Agent_OnLoad(JavaVM *vm, char *options, void *reserved)</example> 578 Or for a statically linked agent named 'L': 579 <example> 580 JNIEXPORT jint JNICALL 581 Agent_OnLoad_L(JavaVM *vm, char *options, void *reserved)</example> 582 583 The VM will start the agent by calling this function. 584 It will be called early enough in VM initialization that: 585 <ul> 586 <li><functionlink id="SetSystemProperty">system properties</functionlink> 587 may be set before they have been used in the start-up of the VM</li> 588 <li>the full set of 589 <internallink id="capability">capabilities</internallink> 590 is still available (note that capabilities that configure the VM 591 may only be available at this time--see the 592 <internallink id="capability">Capability function section</internallink>)</li> 593 <li>no bytecodes have executed</li> 594 <li>no classes have been loaded</li> 595 <li>no objects have been created</li> 596 </ul> 597 <p/> 598 The VM will call the <code>Agent_OnLoad</code> or 599 <code>Agent_OnLoad_<agent-lib-name></code> function with 600 <i><options></i> as the second argument - 601 that is, using the command-line option examples, 602 <code>"opt1,opt2"</code> will be passed to the <code>char *options</code> 603 argument of <code>Agent_OnLoad</code>. 604 The <code>options</code> argument is encoded as a 605 <internallink id="mUTF">modified UTF-8</internallink> string. 606 If <i>=<options></i> is not specified, 607 a zero length string is passed to <code>options</code>. 608 The lifespan of the <code>options</code> string is the 609 <code>Agent_OnLoad</code> or <code>Agent_OnLoad_<agent-lib-name></code> 610 call. If needed beyond this time the string or parts of the string must 611 be copied. 612 The period between when <code>Agent_OnLoad</code> is called and when it 613 returns is called the <i>OnLoad phase</i>. 614 Since the VM is not initialized during the OnLoad 615 <functionlink id="GetPhase">phase</functionlink>, 616 the set of allowed operations 617 inside <code>Agent_OnLoad</code> is restricted (see the function descriptions for the 618 functionality available at this time). 619 The agent can safely process the options and set 620 event callbacks with <functionlink id="SetEventCallbacks"></functionlink>. Once 621 the VM initialization event is received 622 (that is, the <eventlink id="VMInit">VMInit</eventlink> 623 callback is invoked), the agent 624 can complete its initialization. 625 <rationale> 626 Early startup is required so that agents can set the desired capabilities, 627 many of which must be set before the VM is initialized. 628 In JVMDI, the -Xdebug command-line option provided 629 very coarse-grain control of capabilities. 630 JVMPI implementations use various tricks to provide a single "JVMPI on" switch. 631 No reasonable command-line 632 option could provide the fine-grain of control required to balance needed capabilities vs 633 performance impact. 634 Early startup is also needed so that agents can control the execution 635 environment - modifying the file system and system properties to install 636 their functionality. 637 </rationale> 638 <p/> 639 The return value from <code>Agent_OnLoad</code> or 640 <code>Agent_OnLoad_<agent-lib-name></code> is used to indicate an error. 641 Any value other than zero indicates an error and causes termination of the VM. 642 </intro> 643 644 <intro id="onattach" label="Agent Start-Up (Live phase)"> 645 A VM may support a mechanism that allows agents to be started in the VM during the live 646 <functionlink id="GetPhase">phase</functionlink>. The details of how this is supported, 647 are implementation specific. For example, a tool may use some platform specific mechanism, 648 or implementation specific API, to attach to the running VM, and request it start a given 649 agent. 650 <p/> 651 If an agent is started during the live phase then its agent library 652 must export a start-up function 653 with the following prototype: 654 <example> 655 JNIEXPORT jint JNICALL 656 Agent_OnAttach(JavaVM* vm, char *options, void *reserved)</example> 657 Or for a statically linked agent named 'L': 658 <example> 659 JNIEXPORT jint JNICALL 660 Agent_OnAttach_L(JavaVM* vm, char *options, void *reserved)</example> 661 662 <p/> 663 The VM will start the agent by calling this function. 664 It will be called in the context of a thread 665 that is attached to the VM. The first argument <i><vm></i> is the Java VM. 666 The <i><options></i> argument is the startup options provided to the agent. 667 <i><options></i> is encoded as a <internallink id="mUTF">modified UTF-8 668 </internallink> string. 669 If startup options were not provided, a zero length string is passed to 670 <code>options</code>. The lifespan of the <code>options</code> string is the 671 <code>Agent_OnAttach</code> or <code>Agent_OnAttach_<agent-lib-name></code> call. 672 If needed beyond this time the string or parts of the string must be copied. 673 <p/> 674 Note that some <internallink id="capability">capabilities</internallink> 675 may not be available in the live phase. 676 <p/> 677 The <code>Agent_OnAttach</code> or <code>Agent_OnAttach_<agent-lib-name 678 ></code> function initializes the agent and returns a value 679 to the VM to indicate if an error occurred. Any value other than zero indicates an error. 680 An error does not cause the VM to terminate. Instead the VM ignores the error, or takes 681 some implementation specific action -- for example it might print an error to standard error, 682 or record the error in a system log. 683 </intro> 684 685 <intro id="onunload" label="Agent Shutdown"> 686 The library may optionally export a 687 shutdown function with the following prototype: 688 <example> 689 JNIEXPORT void JNICALL 690 Agent_OnUnload(JavaVM *vm)</example> 691 Or for a statically linked agent named 'L': 692 <example> 693 JNIEXPORT void JNICALL 694 Agent_OnUnload_L(JavaVM *vm)</example> 695 696 This function will be called by the VM when the library is about to be unloaded. 697 The library will be unloaded (unless it is statically linked into the 698 executable) and this function will be called if some platform specific 699 mechanism causes the unload (an unload mechanism is not specified in this document) 700 or the library is (in effect) unloaded by the termination of the VM whether through 701 normal termination or VM failure, including start-up failure. 702 Uncontrolled shutdown is, of course, an exception to this rule. 703 Note the distinction between this function and the 704 <eventlink id="VMDeath">VM Death event</eventlink>: for the VM Death event 705 to be sent, the VM must have run at least to the point of initialization and a valid 706 <jvmti/> environment must exist which has set a callback for VMDeath 707 and enabled the event. 708 None of these are required for <code>Agent_OnUnload</code> or 709 <code>Agent_OnUnload_<agent-lib-name></code> and this function 710 is also called if the library is unloaded for other reasons. 711 In the case that a VM Death event is sent, it will be sent before this 712 function is called (assuming this function is called due to VM termination). 713 This function can be used to clean-up resources allocated by the agent. 714 </intro> 715 716 <intro id="tooloptions" label="JAVA_TOOL_OPTIONS"> 717 Since the command-line cannot always be accessed or modified, for example in embedded VMs 718 or simply VMs launched deep within scripts, a <code>JAVA_TOOL_OPTIONS</code> variable is 719 provided so that agents may be launched in these cases. 720 <p/> 721 Platforms which support environment variables or other named strings, may support the 722 <code>JAVA_TOOL_OPTIONS</code> variable. This variable will be broken into options at white-space 723 boundaries. White-space characters include space, tab, carriage-return, new-line, 724 vertical-tab, and form-feed. Sequences of white-space characters are considered 725 equivalent to a single white-space character. No white-space is included in the options 726 unless quoted. Quoting is as follows: 727 <ul> 728 <li>All characters enclosed between a pair of single quote marks (''), except a single 729 quote, are quoted.</li> 730 <li>Double quote characters have no special meaning inside a pair of single quote marks.</li> 731 <li>All characters enclosed between a pair of double quote marks (""), except a double 732 quote, are quoted.</li> 733 <li>Single quote characters have no special meaning inside a pair of double quote marks.</li> 734 <li>A quoted part can start or end anywhere in the variable.</li> 735 <li>White-space characters have no special meaning when quoted -- they are included in 736 the option like any other character and do not mark white-space boundaries.</li> 737 <li>The pair of quote marks is not included in the option.</li> 738 </ul> 739 <code>JNI_CreateJavaVM</code> (in the JNI Invocation API) will prepend these options to the options supplied 740 in its <code>JavaVMInitArgs</code> argument. Platforms may disable this feature in cases where security is 741 a concern; for example, the Reference Implementation disables this feature on Unix systems when 742 the effective user or group ID differs from the real ID. 743 This feature is intended to support the initialization of tools -- specifically including the 744 launching of native or Java programming language agents. Multiple tools may wish to use this 745 feature, so the variable should not be overwritten, instead, options should be appended to 746 the variable. Note that since the variable is processed at the time of the JNI Invocation 747 API create VM call, options processed by a launcher (e.g., VM selection options) will not be handled. 748 </intro> 749 750 <intro id="environments" label="Environments"> 751 The <jvmti/> specification supports the use of multiple simultaneous 752 <jvmti/> agents. 753 Each agent has its own <jvmti/> environment. 754 That is, the <jvmti/> state is 755 separate for each agent - changes to one environment do not affect the 756 others. The state of a <jvmti/> 757 environment includes: 758 <ul> 759 <li><functionlink id="SetEventCallbacks">the event callbacks</functionlink></li> 760 <li><functionlink id="SetEventNotificationMode">the set of events which are enabled</functionlink></li> 761 <li><internallink id="capability">the capabilities</internallink></li> 762 <li><internallink id="memory">the memory allocation/deallocation hooks</internallink></li> 763 </ul> 764 Although their <jvmti/> state 765 is separate, agents inspect and modify the shared state 766 of the VM, they also share the native environment in which they execute. 767 As such, an agent can perturb the results of other agents or cause them 768 to fail. It is the responsibility of the agent writer to specify the level 769 of compatibility with other agents. <jvmti/> implementations are not capable 770 of preventing destructive interactions between agents. Techniques to reduce 771 the likelihood of these occurrences are beyond the scope of this document. 772 <p/> 773 An agent creates a <jvmti/> environment 774 by passing a <jvmti/> version 775 as the interface ID to the JNI Invocation API function 776 <externallink id="jni/invocation.html#getenv"> 777 <code>GetEnv</code></externallink>. 778 See <internallink id="jvmtiEnvAccess">Accessing <jvmti/> Functions</internallink> 779 for more details on the creation and use of 780 <jvmti/> environments. 781 Typically, <jvmti/> environments are created by calling <code>GetEnv</code> from 782 <internallink id="onload"><code>Agent_OnLoad</code></internallink>. 783 </intro> 784 785 <intro id="bci" label="Bytecode Instrumentation"> 786 This interface does not include some events that one might expect in an interface with 787 profiling support. Some examples include full speed 788 method enter and exit events. The interface instead provides support for 789 <i>bytecode instrumentation</i>, the ability to alter the Java virtual machine 790 bytecode instructions which comprise the target program. Typically, these alterations 791 are to add "events" to the code of a method - for example, to add, at the beginning of a method, 792 a call to <code>MyProfiler.methodEntered()</code>. 793 Since the changes are purely additive, they do not modify application 794 state or behavior. 795 Because the inserted agent code is standard bytecodes, the VM can run at full speed, 796 optimizing not only the target program but also the instrumentation. If the 797 instrumentation does not involve switching from bytecode execution, no expensive 798 state transitions are needed. The result is high performance events. 799 This approach also provides complete control to the agent: instrumentation can be 800 restricted to "interesting" portions of the code (e.g., the end user's code) and 801 can be conditional. Instrumentation can run entirely in Java programming language 802 code or can call into the native agent. Instrumentation can simply maintain 803 counters or can statistically sample events. 804 <p/> 805 Instrumentation can be inserted in one of three ways: 806 <ul> 807 <li> 808 Static Instrumentation: The class file is instrumented before it 809 is loaded into the VM - for example, by creating a duplicate directory of 810 <code>*.class</code> files which have been modified to add the instrumentation. 811 This method is extremely awkward and, in general, an agent cannot know 812 the origin of the class files which will be loaded. 813 </li> 814 <li> 815 Load-Time Instrumentation: When a class file is loaded by the VM, the raw 816 bytes of the class file are sent for instrumentation to the agent. 817 The <eventlink id="ClassFileLoadHook"/> 818 event, triggered by the class load, 819 provides this functionality. This mechanism provides efficient 820 and complete access to one-time instrumentation. 821 </li> 822 <li> 823 Dynamic Instrumentation: A class which is already loaded (and possibly 824 even running) is modified. This optional feature is provided by the 825 <eventlink id="ClassFileLoadHook"/> event, triggered by calling the 826 <functionlink id="RetransformClasses"/> function. 827 Classes can be modified multiple times and can be returned to their 828 original state. 829 The mechanism allows instrumentation which changes during the 830 course of execution. 831 </li> 832 </ul> 833 <p/> 834 The class modification functionality provided in this interface 835 is intended to provide a mechanism for instrumentation 836 (the <eventlink id="ClassFileLoadHook"/> event 837 and the <functionlink id="RetransformClasses"/> function) 838 and, during development, for fix-and-continue debugging 839 (the <functionlink id="RedefineClasses"/> function). 840 <p/> 841 Care must be taken to avoid perturbing dependencies, especially when 842 instrumenting core classes. For example, an approach to getting notification 843 of every object allocation is to instrument the constructor on 844 <code>Object</code>. Assuming that the constructor is initially 845 empty, the constructor could be changed to: 846 <example> 847 public Object() { 848 MyProfiler.allocationTracker(this); 849 } 850 </example> 851 However, if this change was made using the 852 <eventlink id="ClassFileLoadHook"/> 853 event then this might impact a typical VM as follows: 854 the first created object will call the constructor causing a class load of 855 <code>MyProfiler</code>; which will then cause 856 object creation, and since <code>MyProfiler</code> isn't loaded yet, 857 infinite recursion; resulting in a stack overflow. A refinement of this 858 would be to delay invoking the tracking method until a safe time. For 859 example, <code>trackAllocations</code> could be set in the 860 handler for the <code>VMInit</code> event. 861 <example> 862 static boolean trackAllocations = false; 863 864 public Object() { 865 if (trackAllocations) { 866 MyProfiler.allocationTracker(this); 867 } 868 } 869 </example> 870 <p/> 871 The <functionlink id="SetNativeMethodPrefix"/> allows native methods 872 to be instrumented by the use of wrapper methods. 873 </intro> 874 875 <intro id="bcimodules" label="Bytecode Instrumentation of code in modules"> 876 Agents can use the functions <functionlink id="AddModuleReads"/>, 877 <functionlink id="AddModuleExports"/>, <functionlink id="AddModuleOpens"/>, 878 <functionlink id="AddModuleUses"/> and <functionlink id="AddModuleProvides"/> 879 to update a module to expand the set of modules that it reads, the set of 880 packages that it exports or opens to other modules, or the services that it 881 uses and provides. 882 <p/> 883 As an aid to agents that deploy supporting classes on the search path of 884 the bootstrap class loader, or the search path of the class loader that 885 loads the main class, the Java virtual machine arranges for the module 886 of classes transformed by the <eventlink id="ClassFileLoadHook"/> event to 887 read the unnamed module of both class loaders. 888 </intro> 889 890 <intro id="mUTF" label="Modified UTF-8 String Encoding"> 891 <jvmti/> uses modified UTF-8 to encode character strings. 892 This is the same encoding used by JNI. 893 Modified UTF-8 differs 894 from standard UTF-8 in the representation of supplementary characters 895 and of the null character. See the 896 <externallink id="jni/types.html#modified-utf-8-strings"> 897 Modified UTF-8 Strings</externallink> 898 section of the JNI specification for details. 899 </intro> 900 901 <intro id="context" label="Specification Context"> 902 Since this interface provides access to the state of applications running in the 903 Java virtual machine; 904 terminology refers to the Java platform and not the native 905 platform (unless stated otherwise). For example: 906 <ul> 907 <li>"thread" means Java programming language thread.</li> 908 <li>"stack frame" means Java virtual machine stack frame.</li> 909 <li>"class" means Java programming language class.</li> 910 <li>"heap" means Java virtual machine heap.</li> 911 <li>"monitor" means Java programming language object monitor.</li> 912 </ul> 913 <p/> 914 Sun, Sun Microsystems, the Sun logo, Java, and JVM 915 are trademarks or registered trademarks of Oracle 916 and/or its affiliates, in the U.S. and other countries. 917 </intro> 918 919 920 <functionsection label="Functions"> 921 <intro id="jvmtiEnvAccess" label="Accessing Functions"> 922 Native code accesses <jvmti/> features 923 by calling <jvmti/> functions. 924 Access to <jvmti/> functions is by use of an interface pointer 925 in the same manner as 926 <externallink id="jni/design.html">Java 927 Native Interface (JNI) functions</externallink> are accessed. 928 The <jvmti/> interface pointer is called the 929 <i>environment pointer</i>. 930 <p/> 931 An environment pointer is a pointer to an environment and has 932 the type <code>jvmtiEnv*</code>. 933 An environment has information about its <jvmti/> connection. 934 The first value in the environment is a pointer to the function table. 935 The function table is an array of pointers to <jvmti/> functions. 936 Every function pointer is at a predefined offset inside the 937 array. 938 <p/> 939 When used from the C language: 940 double indirection is used to access the functions; 941 the environment pointer provides context and is the first 942 parameter of each function call; for example: 943 <example> 944 jvmtiEnv *jvmti; 945 ... 946 jvmtiError err = (*jvmti)->GetLoadedClasses(jvmti, &class_count, &classes); 947 </example> 948 <p/> 949 When used from the C++ language: 950 functions are accessed as member functions of <code>jvmtiEnv</code>; 951 the environment pointer is not passed to the function call; for example: 952 <example> 953 jvmtiEnv *jvmti; 954 ... 955 jvmtiError err = jvmti->GetLoadedClasses(&class_count, &classes); 956 </example> 957 Unless otherwise stated, all examples and declarations in this 958 specification use the C language. 959 <p/> 960 A <jvmti/> environment can be obtained through the JNI Invocation API 961 <code>GetEnv</code> function: 962 <example> 963 jvmtiEnv *jvmti; 964 ... 965 (*jvm)->GetEnv(jvm, &jvmti, JVMTI_VERSION_1_0); 966 </example> 967 Each call to <code>GetEnv</code> 968 creates a new <jvmti/> connection and thus 969 a new <jvmti/> environment. 970 The <code>version</code> argument of <code>GetEnv</code> must be 971 a <jvmti/> version. 972 The returned environment may have a different version than the 973 requested version but the returned environment must be compatible. 974 <code>GetEnv</code> will return <code>JNI_EVERSION</code> if a 975 compatible version is not available, if <jvmti/> is not supported or 976 <jvmti/> is not supported in the current VM configuration. 977 Other interfaces may be added for creating <jvmti/> environments 978 in specific contexts. 979 Each environment has its own state (for example, 980 <functionlink id="SetEventNotificationMode">desired events</functionlink>, 981 <functionlink id="SetEventCallbacks">event handling functions</functionlink>, and 982 <functionlink id="AddCapabilities">capabilities</functionlink>). 983 An environment is released with 984 <functionlink id="DisposeEnvironment"></functionlink>. 985 Thus, unlike JNI which has one environment per thread, <jvmti/> environments work 986 across threads and are created dynamically. 987 </intro> 988 989 <intro id="functionReturn" label="Function Return Values"> 990 <jvmti/> functions always return an 991 <internallink id="ErrorSection">error code</internallink> via the 992 <datalink id="jvmtiError"/> function return value. 993 Some functions can return additional 994 values through pointers provided by the calling function. 995 In some cases, <jvmti/> functions allocate memory that your program must 996 explicitly deallocate. This is indicated in the individual <jvmti/> 997 function descriptions. Empty lists, arrays, sequences, etc are 998 returned as <code>NULL</code>. 999 <p/> 1000 In the event that the <jvmti/> function encounters 1001 an error (any return value other than <code>JVMTI_ERROR_NONE</code>) the values 1002 of memory referenced by argument pointers is undefined, but no memory 1003 will have been allocated and no global references will have been allocated. 1004 If the error occurs because of invalid input, no action will have occurred. 1005 </intro> 1006 1007 <intro id="refs" label="Managing JNI Object References"> 1008 <jvmti/> functions identify objects with JNI references 1009 (<datalink id="jobject"/> and <datalink id="jclass"/>) 1010 and their derivatives 1011 (<datalink id="jthread"/> and <datalink id="jthreadGroup"/>). 1012 References passed to 1013 <jvmti/> functions can be either global or local, but they must be 1014 strong references. All references returned by <jvmti/> functions are 1015 local references--these local references are created 1016 during the <jvmti/> call. 1017 Local references are a resource that must be managed (see the 1018 <externallink id="jni/functions.html#local-references"> 1019 JNI Documentation</externallink>). 1020 When threads return from native code all local references 1021 are freed. Note that some threads, including typical 1022 agent threads, will never return from native code. 1023 A thread is ensured the ability to create sixteen local 1024 references without the need for any explicit management. 1025 For threads executing a limited number of <jvmti/> calls before 1026 returning from native code 1027 (for example, threads processing events), 1028 it may be determined that no explicit management 1029 is needed. 1030 However, long running agent threads will need explicit 1031 local reference management--usually with the JNI functions 1032 <code>PushLocalFrame</code> and <code>PopLocalFrame</code>. 1033 Conversely, to preserve references beyond the 1034 return from native code, they must be converted to global references. 1035 These rules do not apply to <datalink id="jmethodID"/> and <datalink id="jfieldID"/> 1036 as they are not <datalink id="jobject"/>s. 1037 </intro> 1038 1039 <intro id="prereqState" label="Prerequisite State for Calling Functions"> 1040 Unless the function explicitly states that the agent must bring 1041 a thread or the VM to a particular state (for example, suspended), 1042 the <jvmti/> implementation is responsible for bringing the VM to a 1043 safe and consistent state for performing the function. 1044 </intro> 1045 1046 <intro id="functionsExceptions" label="Exceptions and Functions"> 1047 <jvmti/> functions never throw exceptions; error conditions are 1048 communicated via the 1049 <internallink id="functionReturn">function return value</internallink>. 1050 Any existing exception state is preserved across a call to a 1051 <jvmti/> function. 1052 See the 1053 <externallink 1054 id="jni/design.html#java-exceptions" 1055 >Java Exceptions</externallink> 1056 section of the JNI specification for information on handling exceptions. 1057 </intro> 1058 1059 <category id="memory" label="Memory Management"> 1060 <intro> 1061 These functions provide for the allocation and deallocation of 1062 memory used by <jvmti/> functionality and can be used to provide 1063 working memory for agents. 1064 Memory managed by <jvmti/> is not compatible with other memory 1065 allocation libraries and mechanisms. 1066 </intro> 1067 1068 <function id="Allocate" jkernel="yes" phase="any" callbacksafe="safe" impl="notrace" num="46"> 1069 <synopsis>Allocate</synopsis> 1070 <description> 1071 Allocate an area of memory through the <jvmti/> allocator. 1072 The allocated 1073 memory should be freed with <functionlink id="Deallocate"></functionlink>. 1074 </description> 1075 <origin>jvmdi</origin> 1076 <capabilities> 1077 </capabilities> 1078 <parameters> 1079 <param id="size"> 1080 <jlong/> 1081 <description> 1082 The number of bytes to allocate. 1083 <rationale> 1084 <code>jlong</code> is used for compatibility with JVMDI. 1085 </rationale> 1086 </description> 1087 </param> 1088 <param id="mem_ptr"> 1089 <allocbuf incount="size"><uchar/></allocbuf> 1090 <description> 1091 On return, a pointer to the beginning of the allocated memory. 1092 If <code>size</code> is zero, <code>NULL</code> is returned. 1093 </description> 1094 </param> 1095 </parameters> 1096 <errors> 1097 <error id="JVMTI_ERROR_OUT_OF_MEMORY"> 1098 Memory request cannot be honored. 1099 </error> 1100 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 1101 <paramlink id="size"></paramlink> is less than zero. 1102 </error> 1103 </errors> 1104 </function> 1105 1106 <function id="Deallocate" jkernel="yes" phase="any" callbacksafe="safe" impl="notrace" num="47"> 1107 <synopsis>Deallocate</synopsis> 1108 <description> 1109 Deallocate <code>mem</code> using the <jvmti/> allocator. 1110 This function should 1111 be used to deallocate any memory allocated and returned 1112 by a <jvmti/> function 1113 (including memory allocated with <functionlink id="Allocate"></functionlink>). 1114 All allocated memory must be deallocated 1115 or the memory cannot be reclaimed. 1116 </description> 1117 <origin>jvmdi</origin> 1118 <capabilities> 1119 </capabilities> 1120 <parameters> 1121 <param id="mem"> 1122 <outbuf> 1123 <uchar/> 1124 <nullok>the call is ignored</nullok> 1125 </outbuf> 1126 <description> 1127 A pointer to the beginning of the allocated memory. 1128 Please ignore "On return, the elements are set." 1129 <todo>keep it from generating "On return, the elements are set"</todo> 1130 </description> 1131 </param> 1132 </parameters> 1133 <errors> 1134 </errors> 1135 </function> 1136 </category> 1137 1138 <category id="threadCategory" label="Thread"> 1139 <intro> 1140 </intro> 1141 1142 <function id="GetThreadState" num="17"> 1143 <synopsis>Get Thread State</synopsis> 1144 <description> 1145 Get the state of a thread. The state of the thread is represented by the 1146 answers to the hierarchical set of questions below: 1147 <ul type="circle"> 1148 <li><i>Alive?</i> 1149 <ul> 1150 <li>Not alive. 1151 <ul type="circle"> 1152 <li><i>Why not alive?</i> 1153 <ul> 1154 <li>New.</li> 1155 <li>Terminated (<datalink 1156 id="JVMTI_THREAD_STATE_TERMINATED"><code>JVMTI_THREAD_STATE_TERMINATED</code></datalink>)</li> 1157 </ul> 1158 </li> 1159 </ul> 1160 </li> 1161 <li>Alive (<datalink 1162 id="JVMTI_THREAD_STATE_ALIVE"><code>JVMTI_THREAD_STATE_ALIVE</code></datalink>) 1163 <ul type="circle"> 1164 <li><i>Suspended?</i> 1165 <ul> 1166 <li>Suspended (<datalink 1167 id="JVMTI_THREAD_STATE_SUSPENDED"><code>JVMTI_THREAD_STATE_SUSPENDED</code></datalink>)</li> 1168 <li>Not suspended</li> 1169 </ul> 1170 </li> 1171 <li><i>Interrupted?</i> 1172 <ul> 1173 <li>Interrupted (<datalink 1174 id="JVMTI_THREAD_STATE_INTERRUPTED"><code>JVMTI_THREAD_STATE_INTERRUPTED</code></datalink>)</li> 1175 <li>Not interrupted.</li> 1176 </ul> 1177 </li> 1178 <li><i>In native?</i> 1179 <ul> 1180 <li>In native code (<datalink 1181 id="JVMTI_THREAD_STATE_IN_NATIVE"><code>JVMTI_THREAD_STATE_IN_NATIVE</code></datalink>)</li> 1182 <li>In Java programming language code</li> 1183 </ul> 1184 </li> 1185 <li><i>What alive state?</i> 1186 <ul> 1187 <li>Runnable (<datalink 1188 id="JVMTI_THREAD_STATE_RUNNABLE"><code>JVMTI_THREAD_STATE_RUNNABLE</code></datalink>)</li> 1189 <li>Blocked (<datalink 1190 id="JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER"><code>JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER</code></datalink>)</li> 1191 <li>Waiting (<datalink 1192 id="JVMTI_THREAD_STATE_WAITING"><code>JVMTI_THREAD_STATE_WAITING</code></datalink>) 1193 <ul type="circle"> 1194 <li><i>Timed wait?</i> 1195 <ul> 1196 <li>Indefinite (<datalink 1197 id="JVMTI_THREAD_STATE_WAITING_INDEFINITELY"><code>JVMTI_THREAD_STATE_WAITING_INDEFINITELY</code></datalink></li> 1198 <li>Timed (<datalink 1199 id="JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT"><code>JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT</code></datalink>)</li> 1200 </ul> 1201 </li> 1202 <li><i>Why waiting?</i> 1203 <ul> 1204 <li>Object.wait (<datalink 1205 id="JVMTI_THREAD_STATE_IN_OBJECT_WAIT"><code>JVMTI_THREAD_STATE_IN_OBJECT_WAIT</code></datalink>)</li> 1206 <li>LockSupport.park (<datalink 1207 id="JVMTI_THREAD_STATE_PARKED"><code>JVMTI_THREAD_STATE_PARKED</code></datalink>)</li> 1208 <li>Sleeping (<datalink 1209 id="JVMTI_THREAD_STATE_SLEEPING"><code>JVMTI_THREAD_STATE_SLEEPING</code></datalink>)</li> 1210 </ul> 1211 </li> 1212 </ul> 1213 </li> 1214 </ul> 1215 </li> 1216 </ul> 1217 </li> 1218 </ul> 1219 </li> 1220 </ul> 1221 <p/> 1222 The answers are represented by the following bit vector. 1223 <constants id="jvmtiThreadState" label="Thread State Flags" kind="bits"> 1224 <constant id="JVMTI_THREAD_STATE_ALIVE" num="0x0001"> 1225 Thread is alive. Zero if thread is new (not started) or terminated. 1226 </constant> 1227 <constant id="JVMTI_THREAD_STATE_TERMINATED" num="0x0002"> 1228 Thread has completed execution. 1229 </constant> 1230 <constant id="JVMTI_THREAD_STATE_RUNNABLE" num="0x0004"> 1231 Thread is runnable. 1232 </constant> 1233 <constant id="JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER" num="0x0400"> 1234 Thread is waiting to enter a synchronization block/method or, 1235 after an <code>Object.wait()</code>, waiting to re-enter a 1236 synchronization block/method. 1237 </constant> 1238 <constant id="JVMTI_THREAD_STATE_WAITING" num="0x0080"> 1239 Thread is waiting. 1240 </constant> 1241 <constant id="JVMTI_THREAD_STATE_WAITING_INDEFINITELY" num="0x0010"> 1242 Thread is waiting without a timeout. 1243 For example, <code>Object.wait()</code>. 1244 </constant> 1245 <constant id="JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT" num="0x0020"> 1246 Thread is waiting with a maximum time to wait specified. 1247 For example, <code>Object.wait(long)</code>. 1248 </constant> 1249 <constant id="JVMTI_THREAD_STATE_SLEEPING" num="0x0040"> 1250 Thread is sleeping -- <code>Thread.sleep(long)</code>. 1251 </constant> 1252 <constant id="JVMTI_THREAD_STATE_IN_OBJECT_WAIT" num="0x0100"> 1253 Thread is waiting on an object monitor -- <code>Object.wait</code>. 1254 </constant> 1255 <constant id="JVMTI_THREAD_STATE_PARKED" num="0x0200"> 1256 Thread is parked, for example: <code>LockSupport.park</code>, 1257 <code>LockSupport.parkUtil</code> and <code>LockSupport.parkNanos</code>. 1258 </constant> 1259 <constant id="JVMTI_THREAD_STATE_SUSPENDED" num="0x100000"> 1260 Thread suspended. 1261 <code>java.lang.Thread.suspend()</code> 1262 or a <jvmti/> suspend function 1263 (such as <functionlink id="SuspendThread"></functionlink>) 1264 has been called on the thread. If this bit 1265 is set, the other bits refer to the thread state before suspension. 1266 </constant> 1267 <constant id="JVMTI_THREAD_STATE_INTERRUPTED" num="0x200000"> 1268 Thread has been interrupted. 1269 </constant> 1270 <constant id="JVMTI_THREAD_STATE_IN_NATIVE" num="0x400000"> 1271 Thread is in native code--that is, a native method is running 1272 which has not called back into the VM or Java programming 1273 language code. 1274 <p/> 1275 This flag is not set when running VM compiled Java programming 1276 language code nor is it set when running VM code or 1277 VM support code. Native VM interface functions, such as JNI and 1278 <jvmti/> functions, may be implemented as VM code. 1279 </constant> 1280 <constant id="JVMTI_THREAD_STATE_VENDOR_1" num="0x10000000"> 1281 Defined by VM vendor. 1282 </constant> 1283 <constant id="JVMTI_THREAD_STATE_VENDOR_2" num="0x20000000"> 1284 Defined by VM vendor. 1285 </constant> 1286 <constant id="JVMTI_THREAD_STATE_VENDOR_3" num="0x40000000"> 1287 Defined by VM vendor. 1288 </constant> 1289 </constants> 1290 The following definitions are used to convert <jvmti/> thread state 1291 to <code>java.lang.Thread.State</code> style states. 1292 <constants id="jvmtiJavaLangThreadState" label="java.lang.Thread.State Conversion Masks" kind="bits"> 1293 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_MASK" 1294 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"> 1295 Mask the state with this before comparison 1296 </constant> 1297 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_NEW" 1298 num="0"> 1299 <code>java.lang.Thread.State.NEW</code> 1300 </constant> 1301 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_TERMINATED" 1302 num="JVMTI_THREAD_STATE_TERMINATED"> 1303 <code>java.lang.Thread.State.TERMINATED</code> 1304 </constant> 1305 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_RUNNABLE" 1306 num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_RUNNABLE"> 1307 <code>java.lang.Thread.State.RUNNABLE</code> 1308 </constant> 1309 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_BLOCKED" 1310 num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER"> 1311 <code>java.lang.Thread.State.BLOCKED</code> 1312 </constant> 1313 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_WAITING" 1314 num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_INDEFINITELY"> 1315 <code>java.lang.Thread.State.WAITING</code> 1316 </constant> 1317 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_TIMED_WAITING" 1318 num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT"> 1319 <code>java.lang.Thread.State.TIMED_WAITING</code> 1320 </constant> 1321 </constants> 1322 <b>Rules</b> 1323 <p/> 1324 There can be no more than one answer to a question, although there can be no 1325 answer (because the answer is unknown, does not apply, or none of the answers is 1326 correct). An answer is set only when the enclosing answers match. 1327 That is, no more than one of 1328 <ul type="circle"> 1329 <li><code>JVMTI_THREAD_STATE_RUNNABLE</code></li> 1330 <li><code>JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER</code></li> 1331 <li><code>JVMTI_THREAD_STATE_WAITING</code></li> 1332 </ul> 1333 can be set (a <tm>J2SE</tm> compliant implementation will always set 1334 one of these if <code>JVMTI_THREAD_STATE_ALIVE</code> is set). 1335 And if any of these are set, the enclosing answer 1336 <code>JVMTI_THREAD_STATE_ALIVE</code> is set. 1337 No more than one of 1338 <ul type="circle"> 1339 <li><code>JVMTI_THREAD_STATE_WAITING_INDEFINITELY</code></li> 1340 <li><code>JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT</code></li> 1341 </ul> 1342 can be set (a <tm>J2SE</tm> compliant implementation will always set 1343 one of these if <code>JVMTI_THREAD_STATE_WAITING</code> is set). 1344 And if either is set, the enclosing answers 1345 <code>JVMTI_THREAD_STATE_ALIVE</code> and 1346 <code>JVMTI_THREAD_STATE_WAITING</code> are set. 1347 No more than one of 1348 <ul type="circle"> 1349 <li><code>JVMTI_THREAD_STATE_IN_OBJECT_WAIT</code></li> 1350 <li><code>JVMTI_THREAD_STATE_PARKED</code></li> 1351 <li><code>JVMTI_THREAD_STATE_SLEEPING</code></li> 1352 </ul> 1353 can be set. And if any of these is set, the enclosing answers 1354 <code>JVMTI_THREAD_STATE_ALIVE</code> and 1355 <code>JVMTI_THREAD_STATE_WAITING</code> are set. 1356 Also, if <code>JVMTI_THREAD_STATE_SLEEPING</code> is set, 1357 then <code>JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT</code> is set. 1358 If a state <i>A</i> is implemented using the mechanism of 1359 state <i>B</i> then it is state <i>A</i> which 1360 is returned by this function. 1361 For example, if <code>Thread.sleep(long)</code> 1362 is implemented using <code>Object.wait(long)</code> 1363 then it is still <code>JVMTI_THREAD_STATE_SLEEPING</code> 1364 which is returned. 1365 More than one of 1366 <ul type="circle"> 1367 <li><code>JVMTI_THREAD_STATE_SUSPENDED</code></li> 1368 <li><code>JVMTI_THREAD_STATE_INTERRUPTED</code></li> 1369 <li><code>JVMTI_THREAD_STATE_IN_NATIVE</code></li> 1370 </ul> 1371 can be set, but if any is set, 1372 <code>JVMTI_THREAD_STATE_ALIVE</code> is set. 1373 <p/> 1374 And finally, 1375 <code>JVMTI_THREAD_STATE_TERMINATED</code> cannot be set unless 1376 <code>JVMTI_THREAD_STATE_ALIVE</code> is not set. 1377 <p/> 1378 The thread state representation is designed for extension in future versions 1379 of the specification; thread state values should be used accordingly, that is 1380 they should not be used as ordinals. 1381 Most queries can be made by testing a single bit, if use in a switch statement is desired, 1382 the state bits should be masked with the interesting bits. 1383 All bits not defined above are reserved for future use. 1384 A VM, compliant to the current specification, must set reserved bits to zero. 1385 An agent should ignore reserved bits -- 1386 they should not be assumed to be zero and thus should not be included in comparisons. 1387 <p/> 1388 <b>Examples</b> 1389 <p/> 1390 Note that the values below exclude reserved and vendor bits. 1391 <p/> 1392 The state of a thread blocked at a <code>synchronized</code>-statement would be: 1393 <example> 1394 JVMTI_THREAD_STATE_ALIVE + JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER 1395 </example> 1396 The state of a thread which hasn't started yet would be: 1397 <example> 1398 0 1399 </example> 1400 The state of a thread at a <code>Object.wait(3000)</code> would be: 1401 <example> 1402 JVMTI_THREAD_STATE_ALIVE + JVMTI_THREAD_STATE_WAITING + 1403 JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT + 1404 JVMTI_THREAD_STATE_MONITOR_WAITING 1405 </example> 1406 The state of a thread suspended while runnable would be: 1407 <example> 1408 JVMTI_THREAD_STATE_ALIVE + JVMTI_THREAD_STATE_RUNNABLE + JVMTI_THREAD_STATE_SUSPENDED 1409 </example> 1410 <p/> 1411 <b>Testing the State</b> 1412 <p/> 1413 In most cases, the thread state can be determined by testing the one bit corresponding 1414 to that question. For example, the code to test if a thread is sleeping: 1415 <example> 1416 jint state; 1417 jvmtiError err; 1418 1419 err = (*jvmti)->GetThreadState(jvmti, thread, &state); 1420 if (err == JVMTI_ERROR_NONE) { 1421 if (state & JVMTI_THREAD_STATE_SLEEPING) { ... 1422 </example> 1423 <p/> 1424 For waiting (that is, in <code>Object.wait</code>, parked, or sleeping) it would be: 1425 <example> 1426 if (state & JVMTI_THREAD_STATE_WAITING) { ... 1427 </example> 1428 For some states, more than one bit will need to be tested as is the case 1429 when testing if a thread has not yet been started: 1430 <example> 1431 if ((state & (JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_TERMINATED)) == 0) { ... 1432 </example> 1433 To distinguish timed from untimed <code>Object.wait</code>: 1434 <example> 1435 if (state & JVMTI_THREAD_STATE_IN_OBJECT_WAIT) { 1436 if (state & JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT) { 1437 printf("in Object.wait(long timeout)\n"); 1438 } else { 1439 printf("in Object.wait()\n"); 1440 } 1441 } 1442 </example> 1443 <p/> 1444 <b>Relationship to <code>java.lang.Thread.State</code></b> 1445 <p/> 1446 The thread state represented by <code>java.lang.Thread.State</code> 1447 returned from <code>java.lang.Thread.getState()</code> is a subset of the 1448 information returned from this function. 1449 The corresponding <code>java.lang.Thread.State</code> can be determined 1450 by using the provided conversion masks. 1451 For example, this returns the name of the <code>java.lang.Thread.State</code> thread state: 1452 <example> 1453 err = (*jvmti)->GetThreadState(jvmti, thread, &state); 1454 abortOnError(err); 1455 switch (state & JVMTI_JAVA_LANG_THREAD_STATE_MASK) { 1456 case JVMTI_JAVA_LANG_THREAD_STATE_NEW: 1457 return "NEW"; 1458 case JVMTI_JAVA_LANG_THREAD_STATE_TERMINATED: 1459 return "TERMINATED"; 1460 case JVMTI_JAVA_LANG_THREAD_STATE_RUNNABLE: 1461 return "RUNNABLE"; 1462 case JVMTI_JAVA_LANG_THREAD_STATE_BLOCKED: 1463 return "BLOCKED"; 1464 case JVMTI_JAVA_LANG_THREAD_STATE_WAITING: 1465 return "WAITING"; 1466 case JVMTI_JAVA_LANG_THREAD_STATE_TIMED_WAITING: 1467 return "TIMED_WAITING"; 1468 } 1469 </example> 1470 </description> 1471 <origin>new</origin> 1472 <capabilities> 1473 </capabilities> 1474 <parameters> 1475 <param id="thread"> 1476 <jthread null="current" started="maybe" impl="noconvert"/> 1477 <description> 1478 The thread to query. 1479 </description> 1480 </param> 1481 <param id="thread_state_ptr"> 1482 <outptr><jint/></outptr> 1483 <description> 1484 On return, points to state flags, 1485 as defined by the <internallink id="jvmtiThreadState">Thread State Flags</internallink>. 1486 </description> 1487 </param> 1488 </parameters> 1489 <errors> 1490 </errors> 1491 </function> 1492 1493 <function id="GetCurrentThread" phase="start" num="18" since="1.1"> 1494 <synopsis>Get Current Thread</synopsis> 1495 <description> 1496 Get the current thread. 1497 The current thread is the Java programming language thread which has called the function. 1498 The function may return <code>NULL</code> in the start phase if the 1499 <internallink id="jvmtiCapabilities.can_generate_early_vmstart"> 1500 <code>can_generate_early_vmstart</code></internallink> capability is enabled 1501 and the <code>java.lang.Thread</code> class has not been initialized yet. 1502 <p/> 1503 Note that most <jvmti/> functions that take a thread 1504 as an argument will accept <code>NULL</code> to mean 1505 the current thread. 1506 </description> 1507 <origin>new</origin> 1508 <capabilities> 1509 </capabilities> 1510 <parameters> 1511 <param id="thread_ptr"> 1512 <outptr><jthread/></outptr> 1513 <description> 1514 On return, points to the current thread, or <code>NULL</code>. 1515 </description> 1516 </param> 1517 </parameters> 1518 <errors> 1519 </errors> 1520 </function> 1521 1522 <function id="GetAllThreads" num="4"> 1523 <synopsis>Get All Threads</synopsis> 1524 <description> 1525 Get all live threads. 1526 The threads are Java programming language threads; 1527 that is, threads that are attached to the VM. 1528 A thread is live if <code>java.lang.Thread.isAlive()</code> 1529 would return <code>true</code>, that is, the thread has 1530 been started and has not yet died. 1531 The universe of threads is determined by the context of the <jvmti/> 1532 environment, which typically is all threads attached to the VM. 1533 Note that this includes <jvmti/> agent threads 1534 (see <functionlink id="RunAgentThread"/>). 1535 </description> 1536 <origin>jvmdi</origin> 1537 <capabilities> 1538 </capabilities> 1539 <parameters> 1540 <param id="threads_count_ptr"> 1541 <outptr><jint/></outptr> 1542 <description> 1543 On return, points to the number of running threads. 1544 </description> 1545 </param> 1546 <param id="threads_ptr"> 1547 <allocbuf outcount="threads_count_ptr"><jthread/></allocbuf> 1548 <description> 1549 On return, points to an array of references, one 1550 for each running thread. 1551 </description> 1552 </param> 1553 </parameters> 1554 <errors> 1555 </errors> 1556 </function> 1557 1558 <function id="SuspendThread" num="5"> 1559 <synopsis>Suspend Thread</synopsis> 1560 <description> 1561 Suspend the specified thread. If the calling thread is specified, 1562 this function will not return until some other thread calls 1563 <functionlink id="ResumeThread"></functionlink>. 1564 If the thread is currently suspended, this function 1565 does nothing and returns an error. 1566 </description> 1567 <origin>jvmdi</origin> 1568 <capabilities> 1569 <required id="can_suspend"></required> 1570 </capabilities> 1571 <parameters> 1572 <param id="thread"> 1573 <jthread null="current"/> 1574 <description> 1575 The thread to suspend. 1576 </description> 1577 </param> 1578 </parameters> 1579 <errors> 1580 <error id="JVMTI_ERROR_THREAD_SUSPENDED"> 1581 Thread already suspended. 1582 </error> 1583 </errors> 1584 </function> 1585 1586 <elide> 1587 <function id="SuspendAllThreads" num="101"> 1588 <synopsis>Suspend All Threads</synopsis> 1589 <description> 1590 <issue> 1591 There has been no explicit call for this function, and it will 1592 thus be removed if there is no interest. 1593 </issue> 1594 Suspend all live threads except: 1595 <ul> 1596 <li>already suspended threads</li> 1597 <li>those listed in <paramlink id="except_list"></paramlink></li> 1598 <li>certain system (non application) threads, as determined 1599 by the VM implementation</li> 1600 </ul> 1601 The threads are Java programming language threads; 1602 native threads which are not attached to the VM are not 1603 Java programming language threads. 1604 A thread is live if <code>java.lang.Thread.isAlive()</code> 1605 would return <code>true</code>, that is, the thread has 1606 been started and has not yet died. 1607 The universe of threads is determined 1608 by the context of the <jvmti/> 1609 environment, which, typically, is all threads attached to the VM, 1610 except critical VM internal threads and <jvmti/> agent threads 1611 (see <functionlink id="RunAgentThread"/>). 1612 <p/> 1613 If the calling thread is specified, 1614 all other threads are suspended first then the caller thread is suspended - 1615 this function will not return until some other thread calls 1616 <functionlink id="ResumeThread"></functionlink>. 1617 <p/> 1618 The list of actually 1619 suspended threads is returned in 1620 <paramlink id="suspended_list_ptr"></paramlink>. 1621 Suspension is as defined in <functionlink id="SuspendThread"></functionlink>. 1622 <functionlink id="ResumeThreadList"></functionlink> 1623 can be used to resume the suspended threads. 1624 </description> 1625 <origin>new</origin> 1626 <capabilities> 1627 <required id="can_suspend"></required> 1628 </capabilities> 1629 <parameters> 1630 <param id="except_count"> 1631 <jint min="0"/> 1632 <description> 1633 The number of threads in the list of threads not to be suspended. 1634 </description> 1635 </param> 1636 <param id="except_list"> 1637 <inbuf incount="except_count"> 1638 <jthread/> 1639 <nullok>not an error if <code>except_count == 0</code></nullok> 1640 </inbuf> 1641 <description> 1642 The list of threads not to be suspended. 1643 </description> 1644 </param> 1645 <param id="suspended_count_ptr"> 1646 <outptr><jint/></outptr> 1647 <description> 1648 On return, points to the number of threads suspended by this call. 1649 </description> 1650 </param> 1651 <param id="suspended_list_ptr"> 1652 <allocbuf outcount="suspended_count_ptr"><jthread/></allocbuf> 1653 <description> 1654 On return, points to an array of references, one 1655 for each thread suspended. 1656 </description> 1657 </param> 1658 </parameters> 1659 <errors> 1660 <error id="JVMTI_ERROR_INVALID_THREAD"> 1661 A thread in <paramlink id="except_list"></paramlink> was invalid. 1662 </error> 1663 <error id="JVMTI_ERROR_NULL_POINTER"> 1664 Both <paramlink id="except_list"></paramlink> was <code>NULL</code> 1665 and <paramlink id="except_count"></paramlink> was non-zero. 1666 </error> 1667 </errors> 1668 </function> 1669 </elide> 1670 1671 <function id="SuspendThreadList" num="92"> 1672 <synopsis>Suspend Thread List</synopsis> 1673 <description> 1674 Suspend the <paramlink id="request_count"></paramlink> 1675 threads specified in the 1676 <paramlink id="request_list"></paramlink> array. 1677 Threads may be resumed with 1678 <functionlink id="ResumeThreadList"></functionlink> or 1679 <functionlink id="ResumeThread"></functionlink>. 1680 If the calling thread is specified in the 1681 <paramlink id="request_list"></paramlink> array, this function will 1682 not return until some other thread resumes it. 1683 Errors encountered in the suspension of a thread 1684 are returned in the <paramlink id="results"></paramlink> 1685 array, <b>not</b> in the return value of this function. 1686 Threads that are currently suspended do not change state. 1687 </description> 1688 <origin>jvmdi</origin> 1689 <capabilities> 1690 <required id="can_suspend"></required> 1691 </capabilities> 1692 <parameters> 1693 <param id="request_count"> 1694 <jint min="0"/> 1695 <description> 1696 The number of threads to suspend. 1697 </description> 1698 </param> 1699 <param id="request_list"> 1700 <inbuf incount="request_count"><jthread/></inbuf> 1701 <description> 1702 The list of threads to suspend. 1703 </description> 1704 </param> 1705 <param id="results"> 1706 <outbuf incount="request_count"><enum>jvmtiError</enum></outbuf> 1707 <description> 1708 An agent supplied array of 1709 <paramlink id="request_count"></paramlink> elements. 1710 On return, filled with the error code for 1711 the suspend of the corresponding thread. 1712 The error code will be 1713 <errorlink id="JVMTI_ERROR_NONE"></errorlink> 1714 if the thread was suspended by this call. 1715 Possible error codes are those specified 1716 for <functionlink id="SuspendThread"></functionlink>. 1717 </description> 1718 </param> 1719 </parameters> 1720 <errors> 1721 </errors> 1722 </function> 1723 1724 <function id="ResumeThread" num="6"> 1725 <synopsis>Resume Thread</synopsis> 1726 <description> 1727 Resume a suspended thread. 1728 Any threads currently suspended through 1729 a <jvmti/> suspend function (eg. 1730 <functionlink id="SuspendThread"></functionlink>) 1731 or <code>java.lang.Thread.suspend()</code> 1732 will resume execution; 1733 all other threads are unaffected. 1734 </description> 1735 <origin>jvmdi</origin> 1736 <capabilities> 1737 <required id="can_suspend"></required> 1738 </capabilities> 1739 <parameters> 1740 <param id="thread"> 1741 <jthread/> 1742 <description> 1743 The thread to resume. 1744 </description> 1745 </param> 1746 </parameters> 1747 <errors> 1748 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 1749 Thread was not suspended. 1750 </error> 1751 <error id="JVMTI_ERROR_INVALID_TYPESTATE"> 1752 The state of the thread has been modified, and is now inconsistent. 1753 </error> 1754 </errors> 1755 </function> 1756 1757 <function id="ResumeThreadList" num="93"> 1758 <synopsis>Resume Thread List</synopsis> 1759 <description> 1760 Resume the <paramlink id="request_count"></paramlink> 1761 threads specified in the 1762 <paramlink id="request_list"></paramlink> array. 1763 Any thread suspended through 1764 a <jvmti/> suspend function (eg. 1765 <functionlink id="SuspendThreadList"></functionlink>) 1766 or <code>java.lang.Thread.suspend()</code> 1767 will resume execution. 1768 </description> 1769 <origin>jvmdi</origin> 1770 <capabilities> 1771 <required id="can_suspend"></required> 1772 </capabilities> 1773 <parameters> 1774 <param id="request_count"> 1775 <jint min="0"/> 1776 <description> 1777 The number of threads to resume. 1778 </description> 1779 </param> 1780 <param id="request_list"> 1781 <inbuf incount="request_count"><jthread/></inbuf> 1782 <description> 1783 The threads to resume. 1784 </description> 1785 </param> 1786 <param id="results"> 1787 <outbuf incount="request_count"><enum>jvmtiError</enum></outbuf> 1788 <description> 1789 An agent supplied array of 1790 <paramlink id="request_count"></paramlink> elements. 1791 On return, filled with the error code for 1792 the resume of the corresponding thread. 1793 The error code will be 1794 <errorlink id="JVMTI_ERROR_NONE"></errorlink> 1795 if the thread was suspended by this call. 1796 Possible error codes are those specified 1797 for <functionlink id="ResumeThread"></functionlink>. 1798 </description> 1799 </param> 1800 </parameters> 1801 <errors> 1802 </errors> 1803 </function> 1804 1805 <function id="StopThread" num="7"> 1806 <synopsis>Stop Thread</synopsis> 1807 <description> 1808 Send the specified asynchronous exception to the specified thread. 1809 Normally, this function is used to kill the specified thread with an 1810 instance of the exception <code>ThreadDeath</code>, similar to 1811 <code>java.lang.Thread.stop</code>. 1812 </description> 1813 <origin>jvmdi</origin> 1814 <capabilities> 1815 <required id="can_signal_thread"></required> 1816 </capabilities> 1817 <parameters> 1818 <param id="thread"> 1819 <jthread/> 1820 <description> 1821 The thread to stop. 1822 </description> 1823 </param> 1824 <param id="exception"> 1825 <jobject/> 1826 <description> 1827 The asynchronous exception object. 1828 </description> 1829 </param> 1830 </parameters> 1831 <errors> 1832 </errors> 1833 </function> 1834 1835 <function id="InterruptThread" num="8"> 1836 <synopsis>Interrupt Thread</synopsis> 1837 <description> 1838 Interrupt the specified thread 1839 (similar to <code>java.lang.Thread.interrupt</code>). 1840 </description> 1841 <origin>jvmdi</origin> 1842 <capabilities> 1843 <required id="can_signal_thread"></required> 1844 </capabilities> 1845 <parameters> 1846 <param id="thread"> 1847 <jthread impl="noconvert"/> 1848 <description> 1849 The thread to interrupt. 1850 </description> 1851 </param> 1852 </parameters> 1853 <errors> 1854 </errors> 1855 </function> 1856 1857 <function id="GetThreadInfo" num="9"> 1858 <synopsis>Get Thread Info</synopsis> 1859 <typedef id="jvmtiThreadInfo" label="Thread information structure"> 1860 <field id="name"> 1861 <allocfieldbuf><char/></allocfieldbuf> 1862 <description> 1863 The thread name, encoded as a 1864 <internallink id="mUTF">modified UTF-8</internallink> string. 1865 </description> 1866 </field> 1867 <field id="priority"> 1868 <jint/> 1869 <description> 1870 The thread priority. See the thread priority constants: 1871 <datalink id="jvmtiThreadPriority"></datalink>. 1872 </description> 1873 </field> 1874 <field id="is_daemon"> 1875 <jboolean/> 1876 <description> 1877 Is this a daemon thread? 1878 </description> 1879 </field> 1880 <field id="thread_group"> 1881 <jthreadGroup/> 1882 <description> 1883 The thread group to which this thread belongs. 1884 <code>NULL</code> if the thread has died. 1885 </description> 1886 </field> 1887 <field id="context_class_loader"> 1888 <jobject/> 1889 <description> 1890 The context class loader associated with this thread. 1891 </description> 1892 </field> 1893 </typedef> 1894 <description> 1895 Get thread information. The fields of the <datalink id="jvmtiThreadInfo"/> structure 1896 are filled in with details of the specified thread. 1897 </description> 1898 <origin>jvmdi</origin> 1899 <capabilities> 1900 </capabilities> 1901 <parameters> 1902 <param id="thread"> 1903 <jthread null="current" impl="noconvert" started="maybe"/> 1904 <description> 1905 The thread to query. 1906 </description> 1907 </param> 1908 <param id="info_ptr"> 1909 <outptr><struct>jvmtiThreadInfo</struct></outptr> 1910 <description> 1911 On return, filled with information describing the specified thread. 1912 </description> 1913 </param> 1914 </parameters> 1915 <errors> 1916 </errors> 1917 </function> 1918 1919 <function id="GetOwnedMonitorInfo" num="10"> 1920 <synopsis>Get Owned Monitor Info</synopsis> 1921 <description> 1922 Get information about the monitors owned by the 1923 specified thread. 1924 </description> 1925 <origin>jvmdiClone</origin> 1926 <capabilities> 1927 <required id="can_get_owned_monitor_info"></required> 1928 </capabilities> 1929 <parameters> 1930 <param id="thread"> 1931 <jthread null="current"/> 1932 <description> 1933 The thread to query. 1934 </description> 1935 </param> 1936 <param id="owned_monitor_count_ptr"> 1937 <outptr><jint/></outptr> 1938 <description> 1939 The number of monitors returned. 1940 </description> 1941 </param> 1942 <param id="owned_monitors_ptr"> 1943 <allocbuf outcount="owned_monitor_count_ptr"><jobject/></allocbuf> 1944 <description> 1945 The array of owned monitors. 1946 </description> 1947 </param> 1948 </parameters> 1949 <errors> 1950 </errors> 1951 </function> 1952 1953 <function id="GetOwnedMonitorStackDepthInfo" num="153" since="1.1"> 1954 <synopsis>Get Owned Monitor Stack Depth Info</synopsis> 1955 <typedef id="jvmtiMonitorStackDepthInfo" 1956 label="Monitor stack depth information structure"> 1957 <field id="monitor"> 1958 <jobject/> 1959 <description> 1960 The owned monitor. 1961 </description> 1962 </field> 1963 <field id="stack_depth"> 1964 <jint/> 1965 <description> 1966 The stack depth. Corresponds to the stack depth used in the 1967 <internallink id="stack">Stack Frame functions</internallink>. 1968 That is, zero is the current frame, one is the frame which 1969 called the current frame. And it is negative one if the 1970 implementation cannot determine the stack depth (e.g., for 1971 monitors acquired by JNI <code>MonitorEnter</code>). 1972 </description> 1973 </field> 1974 </typedef> 1975 <description> 1976 Get information about the monitors owned by the 1977 specified thread and the depth of the stack frame which locked them. 1978 </description> 1979 <origin>new</origin> 1980 <capabilities> 1981 <required id="can_get_owned_monitor_stack_depth_info"></required> 1982 </capabilities> 1983 <parameters> 1984 <param id="thread"> 1985 <jthread null="current"/> 1986 <description> 1987 The thread to query. 1988 </description> 1989 </param> 1990 <param id="monitor_info_count_ptr"> 1991 <outptr><jint/></outptr> 1992 <description> 1993 The number of monitors returned. 1994 </description> 1995 </param> 1996 <param id="monitor_info_ptr"> 1997 <allocbuf outcount="monitor_info_count_ptr"> 1998 <struct>jvmtiMonitorStackDepthInfo</struct> 1999 </allocbuf> 2000 <description> 2001 The array of owned monitor depth information. 2002 </description> 2003 </param> 2004 </parameters> 2005 <errors> 2006 </errors> 2007 </function> 2008 2009 <function id="GetCurrentContendedMonitor" num="11"> 2010 <synopsis>Get Current Contended Monitor</synopsis> 2011 <description> 2012 Get the object, if any, whose monitor the specified thread is waiting to 2013 enter or waiting to regain through <code>java.lang.Object.wait</code>. 2014 </description> 2015 <origin>jvmdi</origin> 2016 <capabilities> 2017 <required id="can_get_current_contended_monitor"></required> 2018 </capabilities> 2019 <parameters> 2020 <param id="thread"> 2021 <jthread null="current"/> 2022 <description> 2023 The thread to query. 2024 </description> 2025 </param> 2026 <param id="monitor_ptr"> 2027 <outptr><jobject/></outptr> 2028 <description> 2029 On return, filled with the current contended monitor, or 2030 NULL if there is none. 2031 </description> 2032 </param> 2033 </parameters> 2034 <errors> 2035 </errors> 2036 </function> 2037 2038 <callback id="jvmtiStartFunction"> 2039 <void/> 2040 <synopsis>Agent Start Function</synopsis> 2041 <description> 2042 Agent supplied callback function. 2043 This function is the entry point for an agent thread 2044 started with 2045 <functionlink id="RunAgentThread"></functionlink>. 2046 </description> 2047 <parameters> 2048 <param id="jvmti_env"> 2049 <outptr> 2050 <struct>jvmtiEnv</struct> 2051 </outptr> 2052 <description> 2053 The <jvmti/> environment. 2054 </description> 2055 </param> 2056 <param id="jni_env"> 2057 <outptr> 2058 <struct>JNIEnv</struct> 2059 </outptr> 2060 <description> 2061 The JNI environment. 2062 </description> 2063 </param> 2064 <param id="arg"> 2065 <outptr> 2066 <void/> 2067 </outptr> 2068 <description> 2069 The <code>arg</code> parameter passed to 2070 <functionlink id="RunAgentThread"></functionlink>. 2071 </description> 2072 </param> 2073 </parameters> 2074 </callback> 2075 2076 <function id="RunAgentThread" num="12"> 2077 <synopsis>Run Agent Thread</synopsis> 2078 <description> 2079 Starts the execution of an agent thread. with the specified native function. 2080 The parameter <paramlink id="arg"></paramlink> is forwarded on to the 2081 <functionlink id="jvmtiStartFunction">start function</functionlink> 2082 (specified with <paramlink id="proc"></paramlink>) as its single argument. 2083 This function allows the creation of agent threads 2084 for handling communication with another process or for handling events 2085 without the need to load a special subclass of <code>java.lang.Thread</code> or 2086 implementer of <code>java.lang.Runnable</code>. 2087 Instead, the created thread can run entirely in native code. 2088 However, the created thread does require a newly created instance 2089 of <code>java.lang.Thread</code> (referenced by the argument <code>thread</code>) to 2090 which it will be associated. 2091 The thread object can be created with JNI calls. 2092 <p/> 2093 The following common thread priorities are provided for your convenience: 2094 <constants id="jvmtiThreadPriority" label="Thread Priority Constants" kind="const"> 2095 <constant id="JVMTI_THREAD_MIN_PRIORITY" num="1"> 2096 Minimum possible thread priority 2097 </constant> 2098 <constant id="JVMTI_THREAD_NORM_PRIORITY" num="5"> 2099 Normal thread priority 2100 </constant> 2101 <constant id="JVMTI_THREAD_MAX_PRIORITY" num="10"> 2102 Maximum possible thread priority 2103 </constant> 2104 </constants> 2105 <p/> 2106 The new thread is started as a daemon thread with the specified 2107 <paramlink id="priority"></paramlink>. 2108 If enabled, a <eventlink id="ThreadStart"/> event will be sent. 2109 <p/> 2110 Since the thread has been started, the thread will be live when this function 2111 returns, unless the thread has died immediately. 2112 <p/> 2113 The thread group of the thread is ignored -- specifically, the thread is not 2114 added to the thread group and the thread is not seen on queries of the thread 2115 group at either the Java programming language or <jvmti/> levels. 2116 <p/> 2117 The thread is not visible to Java programming language queries but is 2118 included in <jvmti/> queries (for example, 2119 <functionlink id="GetAllThreads"/> and 2120 <functionlink id="GetAllStackTraces"/>). 2121 <p/> 2122 Upon execution of <code>proc</code>, the new thread will be attached to the 2123 VM -- see the JNI documentation on 2124 <externallink id="jni/invocation.html#attaching-to-the-vm" 2125 >Attaching to the VM</externallink>. 2126 </description> 2127 <origin>jvmdiClone</origin> 2128 <capabilities> 2129 </capabilities> 2130 <parameters> 2131 <param id="thread"> 2132 <jthread impl="noconvert" started="no"/> 2133 <description> 2134 The thread to run. 2135 </description> 2136 </param> 2137 <param id="proc"> 2138 <ptrtype> 2139 <struct>jvmtiStartFunction</struct> 2140 </ptrtype> 2141 <description> 2142 The start function. 2143 </description> 2144 </param> 2145 <param id="arg"> 2146 <inbuf> 2147 <void/> 2148 <nullok><code>NULL</code> is passed to the start function</nullok> 2149 </inbuf> 2150 <description> 2151 The argument to the start function. 2152 </description> 2153 </param> 2154 <param id="priority"> 2155 <jint/> 2156 <description> 2157 The priority of the started thread. Any thread 2158 priority allowed by <code>java.lang.Thread.setPriority</code> can be used including 2159 those in <datalink id="jvmtiThreadPriority"></datalink>. 2160 </description> 2161 </param> 2162 </parameters> 2163 <errors> 2164 <error id="JVMTI_ERROR_INVALID_PRIORITY"> 2165 <paramlink id="priority"/> is less than 2166 <datalink id="JVMTI_THREAD_MIN_PRIORITY"/> 2167 or greater than 2168 <datalink id="JVMTI_THREAD_MAX_PRIORITY"/> 2169 </error> 2170 </errors> 2171 </function> 2172 2173 <function id="SetThreadLocalStorage" jkernel="yes" impl="notrace" phase="start" num="103"> 2174 <synopsis>Set Thread Local Storage</synopsis> 2175 <description> 2176 The VM stores a pointer value associated with each environment-thread 2177 pair. This pointer value is called <i>thread-local storage</i>. 2178 This value is <code>NULL</code> unless set with this function. 2179 Agents can allocate memory in which they store thread specific 2180 information. By setting thread-local storage it can then be 2181 accessed with 2182 <functionlink id="GetThreadLocalStorage"></functionlink>. 2183 <p/> 2184 This function is called by the agent to set the value of the <jvmti/> 2185 thread-local storage. <jvmti/> supplies to the agent a pointer-size 2186 thread-local storage that can be used to record per-thread 2187 information. 2188 </description> 2189 <origin>jvmpi</origin> 2190 <capabilities> 2191 </capabilities> 2192 <parameters> 2193 <param id="thread"> 2194 <jthread null="current"/> 2195 <description> 2196 Store to this thread. 2197 </description> 2198 </param> 2199 <param id="data"> 2200 <inbuf> 2201 <void/> 2202 <nullok>value is set to <code>NULL</code></nullok> 2203 </inbuf> 2204 <description> 2205 The value to be entered into the thread-local storage. 2206 </description> 2207 </param> 2208 </parameters> 2209 <errors> 2210 </errors> 2211 </function> 2212 2213 <function id="GetThreadLocalStorage" jkernel="yes" impl="innative notrace" phase="start" num="102"> 2214 <synopsis>Get Thread Local Storage</synopsis> 2215 <description> 2216 Called by the agent to get the value of the <jvmti/> thread-local 2217 storage. 2218 </description> 2219 <origin>jvmpi</origin> 2220 <capabilities> 2221 </capabilities> 2222 <parameters> 2223 <param id="thread"> 2224 <jthread null="current" impl="noconvert"/> 2225 <description> 2226 Retrieve from this thread. 2227 </description> 2228 </param> 2229 <param id="data_ptr"> 2230 <agentbuf><void/></agentbuf> 2231 <description> 2232 Pointer through which the value of the thread local 2233 storage is returned. 2234 If thread-local storage has not been set with 2235 <functionlink id="SetThreadLocalStorage"></functionlink> the returned 2236 pointer is <code>NULL</code>. 2237 </description> 2238 </param> 2239 </parameters> 2240 <errors> 2241 </errors> 2242 </function> 2243 2244 </category> 2245 2246 <category id="thread_groups" label="Thread Group"> 2247 <intro> 2248 </intro> 2249 2250 <function id="GetTopThreadGroups" num="13"> 2251 <synopsis>Get Top Thread Groups</synopsis> 2252 <description> 2253 Return all top-level (parentless) thread groups in the VM. 2254 </description> 2255 <origin>jvmdi</origin> 2256 <capabilities> 2257 </capabilities> 2258 <parameters> 2259 <param id="group_count_ptr"> 2260 <outptr><jint/></outptr> 2261 <description> 2262 On return, points to the number of top-level thread groups. 2263 </description> 2264 </param> 2265 <param id="groups_ptr"> 2266 <allocbuf outcount="group_count_ptr"><jthreadGroup/></allocbuf> 2267 <description> 2268 On return, refers to a pointer to the top-level thread group array. 2269 </description> 2270 </param> 2271 </parameters> 2272 <errors> 2273 </errors> 2274 </function> 2275 2276 <function id="GetThreadGroupInfo" num="14"> 2277 <synopsis>Get Thread Group Info</synopsis> 2278 <typedef id="jvmtiThreadGroupInfo" label="Thread group information structure"> 2279 <field id="parent"> 2280 <jthreadGroup/> 2281 <description> 2282 The parent thread group. 2283 </description> 2284 </field> 2285 <field id="name"> 2286 <allocfieldbuf><char/></allocfieldbuf> 2287 <description> 2288 The thread group's name, encoded as a 2289 <internallink id="mUTF">modified UTF-8</internallink> string. 2290 </description> 2291 </field> 2292 <field id="max_priority"> 2293 <jint/> 2294 <description> 2295 The maximum priority for this thread group. 2296 </description> 2297 </field> 2298 <field id="is_daemon"> 2299 <jboolean/> 2300 <description> 2301 Is this a daemon thread group? 2302 </description> 2303 </field> 2304 </typedef> 2305 <description> 2306 Get information about the thread group. The fields of the 2307 <functionlink id="jvmtiThreadGroupInfo"></functionlink> structure 2308 are filled in with details of the specified thread group. 2309 </description> 2310 <origin>jvmdi</origin> 2311 <capabilities> 2312 </capabilities> 2313 <parameters> 2314 <param id="group"> 2315 <jthreadGroup/> 2316 <description> 2317 The thread group to query. 2318 </description> 2319 </param> 2320 <param id="info_ptr"> 2321 <outptr><struct>jvmtiThreadGroupInfo</struct></outptr> 2322 <description> 2323 On return, filled with information describing the specified 2324 thread group. 2325 </description> 2326 </param> 2327 </parameters> 2328 <errors> 2329 </errors> 2330 </function> 2331 2332 <function id="GetThreadGroupChildren" num="15"> 2333 <synopsis>Get Thread Group Children</synopsis> 2334 <description> 2335 Get the live threads and active subgroups in this thread group. 2336 </description> 2337 <origin>jvmdi</origin> 2338 <capabilities> 2339 </capabilities> 2340 <parameters> 2341 <param id="group"> 2342 <jthreadGroup/> 2343 <description> 2344 The group to query. 2345 </description> 2346 </param> 2347 <param id="thread_count_ptr"> 2348 <outptr><jint/></outptr> 2349 <description> 2350 On return, points to the number of live threads in this thread group. 2351 </description> 2352 </param> 2353 <param id="threads_ptr"> 2354 <allocbuf outcount="thread_count_ptr"><jthread/></allocbuf> 2355 <description> 2356 On return, points to an array of the live threads in this thread group. 2357 </description> 2358 </param> 2359 <param id="group_count_ptr"> 2360 <outptr><jint/></outptr> 2361 <description> 2362 On return, points to the number of active child thread groups 2363 </description> 2364 </param> 2365 <param id="groups_ptr"> 2366 <allocbuf outcount="group_count_ptr"><jthreadGroup/></allocbuf> 2367 <description> 2368 On return, points to an array of the active child thread groups. 2369 </description> 2370 </param> 2371 </parameters> 2372 <errors> 2373 </errors> 2374 </function> 2375 </category> 2376 2377 <category id="stack" label="Stack Frame"> 2378 <intro> 2379 These functions provide information about the stack of a thread. 2380 Stack frames are referenced by depth. 2381 The frame at depth zero is the current frame. 2382 <p/> 2383 Stack frames are as described in 2384 <vmspec chapter="3.6"/>, 2385 That is, they correspond to method 2386 invocations (including native methods) but do not correspond to platform native or 2387 VM internal frames. 2388 <p/> 2389 A <jvmti/> implementation may use method invocations to launch a thread and 2390 the corresponding frames may be included in the stack as presented by these functions -- 2391 that is, there may be frames shown 2392 deeper than <code>main()</code> and <code>run()</code>. 2393 However this presentation must be consistent across all <jvmti/> functionality which 2394 uses stack frames or stack depth. 2395 </intro> 2396 2397 <typedef id="jvmtiFrameInfo" label="Stack frame information structure"> 2398 <description> 2399 Information about a stack frame is returned in this structure. 2400 </description> 2401 <field id="method"> 2402 <jmethodID/> 2403 <description> 2404 The method executing in this frame. 2405 </description> 2406 </field> 2407 <field id="location"> 2408 <jlocation/> 2409 <description> 2410 The index of the instruction executing in this frame. 2411 <code>-1</code> if the frame is executing a native method. 2412 </description> 2413 </field> 2414 </typedef> 2415 2416 <typedef id="jvmtiStackInfo" label="Stack information structure"> 2417 <description> 2418 Information about a set of stack frames is returned in this structure. 2419 </description> 2420 <field id="thread"> 2421 <jthread/> 2422 <description> 2423 On return, the thread traced. 2424 </description> 2425 </field> 2426 <field id="state"> 2427 <jint/> 2428 <description> 2429 On return, the thread state. See <functionlink id="GetThreadState"></functionlink>. 2430 </description> 2431 </field> 2432 <field id="frame_buffer"> 2433 <outbuf incount="max_frame_count"> 2434 <struct>jvmtiFrameInfo</struct> 2435 </outbuf> 2436 <description> 2437 On return, this agent allocated buffer is filled 2438 with stack frame information. 2439 </description> 2440 </field> 2441 <field id="frame_count"> 2442 <jint/> 2443 <description> 2444 On return, the number of records filled into 2445 <code>frame_buffer</code>. 2446 This will be 2447 min(<code>max_frame_count</code>, <i>stackDepth</i>). 2448 </description> 2449 </field> 2450 </typedef> 2451 2452 <function id="GetStackTrace" num="104"> 2453 <synopsis>Get Stack Trace</synopsis> 2454 <description> 2455 Get information about the stack of a thread. 2456 If <paramlink id="max_frame_count"></paramlink> is less than the depth of the stack, 2457 the <paramlink id="max_frame_count"></paramlink> topmost frames are returned, 2458 otherwise the entire stack is returned. 2459 The topmost frames, those most recently invoked, are at the beginning of the returned buffer. 2460 <p/> 2461 The following example causes up to five of the topmost frames 2462 to be returned and (if there are any frames) the currently 2463 executing method name to be printed. 2464 <example> 2465 jvmtiFrameInfo frames[5]; 2466 jint count; 2467 jvmtiError err; 2468 2469 err = (*jvmti)->GetStackTrace(jvmti, aThread, 0, 5, 2470 frames, &count); 2471 if (err == JVMTI_ERROR_NONE && count >= 1) { 2472 char *methodName; 2473 err = (*jvmti)->GetMethodName(jvmti, frames[0].method, 2474 &methodName, NULL, NULL); 2475 if (err == JVMTI_ERROR_NONE) { 2476 printf("Executing method: %s", methodName); 2477 } 2478 } 2479 </example> 2480 <todo> 2481 check example code. 2482 </todo> 2483 <p/> 2484 The <paramlink id="thread"></paramlink> need not be suspended 2485 to call this function. 2486 <p/> 2487 The <functionlink id="GetLineNumberTable"></functionlink> 2488 function can be used to map locations to line numbers. Note that 2489 this mapping can be done lazily. 2490 </description> 2491 <origin>jvmpi</origin> 2492 <capabilities> 2493 </capabilities> 2494 <parameters> 2495 <param id="thread"> 2496 <jthread null="current"/> 2497 <description> 2498 Fetch the stack trace of this thread. 2499 </description> 2500 </param> 2501 <param id="start_depth"> 2502 <jint/> 2503 <description> 2504 Begin retrieving frames at this depth. 2505 If non-negative, count from the current frame, 2506 the first frame retrieved is at depth <code>start_depth</code>. 2507 For example, if zero, start from the current frame; if one, start from the 2508 caller of the current frame; if two, start from the caller of the 2509 caller of the current frame; and so on. 2510 If negative, count from below the oldest frame, 2511 the first frame retrieved is at depth <i>stackDepth</i><code> + start_depth</code>, 2512 where <i>stackDepth</i> is the count of frames on the stack. 2513 For example, if negative one, only the oldest frame is retrieved; 2514 if negative two, start from the frame called by the oldest frame. 2515 </description> 2516 </param> 2517 <param id="max_frame_count"> 2518 <jint min="0"/> 2519 <description> 2520 The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve. 2521 </description> 2522 </param> 2523 <param id="frame_buffer"> 2524 <outbuf incount="max_frame_count" outcount="count_ptr"> 2525 <struct>jvmtiFrameInfo</struct> 2526 </outbuf> 2527 <description> 2528 On return, this agent allocated buffer is filled 2529 with stack frame information. 2530 </description> 2531 </param> 2532 <param id="count_ptr"> 2533 <outptr><jint/></outptr> 2534 <description> 2535 On return, points to the number of records filled in. 2536 For non-negative <code>start_depth</code>, this will be 2537 min(<code>max_frame_count</code>, <i>stackDepth</i><code> - start_depth</code>). 2538 For negative <code>start_depth</code>, this will be 2539 min(<code>max_frame_count</code>, <code>-start_depth</code>). 2540 </description> 2541 </param> 2542 </parameters> 2543 <errors> 2544 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 2545 <paramlink id="start_depth"/> is positive and greater than or equal to <i>stackDepth</i>. 2546 Or <paramlink id="start_depth"/> is negative and less than <i>-stackDepth</i>. 2547 </error> 2548 </errors> 2549 </function> 2550 2551 2552 <function id="GetAllStackTraces" num="100"> 2553 <synopsis>Get All Stack Traces</synopsis> 2554 <description> 2555 Get information about the stacks of all live threads 2556 (including <internallink id="RunAgentThread">agent threads</internallink>). 2557 If <paramlink id="max_frame_count"/> is less than the depth of a stack, 2558 the <paramlink id="max_frame_count"/> topmost frames are returned for that thread, 2559 otherwise the entire stack is returned. 2560 The topmost frames, those most recently invoked, are at the beginning of the returned buffer. 2561 <p/> 2562 All stacks are collected simultaneously, that is, no changes will occur to the 2563 thread state or stacks between the sampling of one thread and the next. 2564 The threads need not be suspended. 2565 2566 <example> 2567 jvmtiStackInfo *stack_info; 2568 jint thread_count; 2569 int ti; 2570 jvmtiError err; 2571 2572 err = (*jvmti)->GetAllStackTraces(jvmti, MAX_FRAMES, &stack_info, &thread_count); 2573 if (err != JVMTI_ERROR_NONE) { 2574 ... 2575 } 2576 for (ti = 0; ti < thread_count; ++ti) { 2577 jvmtiStackInfo *infop = &stack_info[ti]; 2578 jthread thread = infop->thread; 2579 jint state = infop->state; 2580 jvmtiFrameInfo *frames = infop->frame_buffer; 2581 int fi; 2582 2583 myThreadAndStatePrinter(thread, state); 2584 for (fi = 0; fi < infop->frame_count; fi++) { 2585 myFramePrinter(frames[fi].method, frames[fi].location); 2586 } 2587 } 2588 /* this one Deallocate call frees all data allocated by GetAllStackTraces */ 2589 err = (*jvmti)->Deallocate(jvmti, stack_info); 2590 </example> 2591 <todo> 2592 check example code. 2593 </todo> 2594 2595 </description> 2596 <origin>new</origin> 2597 <capabilities> 2598 </capabilities> 2599 <parameters> 2600 <param id="max_frame_count"> 2601 <jint min="0"/> 2602 <description> 2603 The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve per thread. 2604 </description> 2605 </param> 2606 <param id="stack_info_ptr"> 2607 <allocbuf> 2608 <struct>jvmtiStackInfo</struct> 2609 </allocbuf> 2610 <description> 2611 On return, this buffer is filled 2612 with stack information for each thread. 2613 The number of <datalink id="jvmtiStackInfo"/> records is determined 2614 by <paramlink id="thread_count_ptr"/>. 2615 <p/> 2616 Note that this buffer is allocated to include the <datalink id="jvmtiFrameInfo"/> 2617 buffers pointed to by <datalink id="jvmtiStackInfo.frame_buffer"/>. 2618 These buffers must not be separately deallocated. 2619 </description> 2620 </param> 2621 <param id="thread_count_ptr"> 2622 <outptr><jint/></outptr> 2623 <description> 2624 The number of threads traced. 2625 </description> 2626 </param> 2627 </parameters> 2628 <errors> 2629 </errors> 2630 </function> 2631 2632 <function id="GetThreadListStackTraces" num="101"> 2633 <synopsis>Get Thread List Stack Traces</synopsis> 2634 <description> 2635 Get information about the stacks of the supplied threads. 2636 If <paramlink id="max_frame_count"/> is less than the depth of a stack, 2637 the <paramlink id="max_frame_count"/> topmost frames are returned for that thread, 2638 otherwise the entire stack is returned. 2639 The topmost frames, those most recently invoked, are at the beginning of the returned buffer. 2640 <p/> 2641 All stacks are collected simultaneously, that is, no changes will occur to the 2642 thread state or stacks between the sampling one thread and the next. 2643 The threads need not be suspended. 2644 <p/> 2645 If a thread has not yet started or terminates before the stack information is collected, 2646 a zero length stack (<datalink id="jvmtiStackInfo.frame_count"/> will be zero) 2647 will be returned and the thread <datalink id="jvmtiStackInfo.state"/> can be checked. 2648 <p/> 2649 See the example for the similar function 2650 <functionlink id="GetAllStackTraces"/>. 2651 </description> 2652 <origin>new</origin> 2653 <capabilities> 2654 </capabilities> 2655 <parameters> 2656 <param id="thread_count"> 2657 <jint min="0"/> 2658 <description> 2659 The number of threads to trace. 2660 </description> 2661 </param> 2662 <param id="thread_list"> 2663 <inbuf incount="thread_count"><jthread/></inbuf> 2664 <description> 2665 The list of threads to trace. 2666 </description> 2667 </param> 2668 <param id="max_frame_count"> 2669 <jint min="0"/> 2670 <description> 2671 The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve per thread. 2672 </description> 2673 </param> 2674 <param id="stack_info_ptr"> 2675 <allocbuf outcount="thread_count"> 2676 <struct>jvmtiStackInfo</struct> 2677 </allocbuf> 2678 <description> 2679 On return, this buffer is filled 2680 with stack information for each thread. 2681 The number of <datalink id="jvmtiStackInfo"/> records is determined 2682 by <paramlink id="thread_count"/>. 2683 <p/> 2684 Note that this buffer is allocated to include the <datalink id="jvmtiFrameInfo"/> 2685 buffers pointed to by <datalink id="jvmtiStackInfo.frame_buffer"/>. 2686 These buffers must not be separately deallocated. 2687 </description> 2688 </param> 2689 </parameters> 2690 <errors> 2691 <error id="JVMTI_ERROR_INVALID_THREAD"> 2692 An element in <paramlink id="thread_list"/> is not a thread object. 2693 </error> 2694 </errors> 2695 </function> 2696 2697 <elide> 2698 <function id="AsyncGetStackTrace" num="1000"> 2699 <synopsis>Get Stack Trace--Asynchronous</synopsis> 2700 <description> 2701 Get information about the entire stack of a thread (or a sub-section of it). 2702 This is the asynchronous version of <functionlink id="GetStackTrace"></functionlink> 2703 and is reentrant and safe to call 2704 from asynchronous signal handlers. 2705 The stack trace is returned only for the calling thread. 2706 <p/> 2707 The <functionlink id="GetLineNumberTable"></functionlink> 2708 function can be used to map locations to line numbers. Note that 2709 this mapping can be done lazily. 2710 </description> 2711 <origin>jvmpi</origin> 2712 <capabilities> 2713 <required id="can_get_async_stack_trace"></required> 2714 <capability id="can_show_JVM_spec_async_frames"> 2715 If <code>false</code>, 2716 <paramlink id="use_java_stack"></paramlink> 2717 must be <code>false</code>. 2718 </capability> 2719 </capabilities> 2720 <parameters> 2721 <param id="use_java_stack"> 2722 <jboolean/> 2723 <description> 2724 Return the stack showing <vmspec/> 2725 model of the stack; 2726 otherwise, show the internal representation of the stack with 2727 inlined and optimized methods missing. If the virtual machine 2728 is using the <i>Java Virtual Machine Specification</i> stack model 2729 internally, this flag is ignored. 2730 </description> 2731 </param> 2732 <param id="max_count"> 2733 <jint min="0"/> 2734 <description> 2735 The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve. 2736 Retrieve this many unless the stack depth is less than <code>max_count</code>. 2737 </description> 2738 </param> 2739 <param id="frame_buffer"> 2740 <outbuf incount="max_count" outcount="count_ptr"> 2741 <struct>jvmtiFrameInfo</struct> 2742 <nullok>this information is not returned</nullok> 2743 </outbuf> 2744 <description> 2745 The agent passes in a buffer 2746 large enough to hold <code>max_count</code> records of 2747 <datalink id="jvmtiFrameInfo"></datalink>. This buffer must be 2748 pre-allocated by the agent. 2749 </description> 2750 </param> 2751 <param id="count_ptr"> 2752 <outptr><jint/></outptr> 2753 <description> 2754 On return, points to the number of records filled in.. 2755 </description> 2756 </param> 2757 </parameters> 2758 <errors> 2759 <error id="JVMTI_ERROR_UNATTACHED_THREAD"> 2760 The thread being used to call this function is not attached 2761 to the virtual machine. Calls must be made from attached threads. 2762 </error> 2763 </errors> 2764 </function> 2765 </elide> 2766 2767 <function id="GetFrameCount" num="16"> 2768 <synopsis>Get Frame Count</synopsis> 2769 <description> 2770 Get the number of frames currently in the specified thread's call stack. 2771 <p/> 2772 If this function is called for a thread actively executing bytecodes (for example, 2773 not the current thread and not suspended), the information returned is transient. 2774 </description> 2775 <origin>jvmdi</origin> 2776 <capabilities> 2777 </capabilities> 2778 <parameters> 2779 <param id="thread"> 2780 <jthread null="current"/> 2781 <description> 2782 The thread to query. 2783 </description> 2784 </param> 2785 <param id="count_ptr"> 2786 <outptr><jint/></outptr> 2787 <description> 2788 On return, points to the number of frames in the call stack. 2789 </description> 2790 </param> 2791 </parameters> 2792 <errors> 2793 </errors> 2794 </function> 2795 2796 <function id="PopFrame" num="80"> 2797 <synopsis>Pop Frame</synopsis> 2798 <description> 2799 Pop the current frame of <code>thread</code>'s stack. 2800 Popping a frame takes you to the previous frame. 2801 When the thread is resumed, the execution 2802 state of the thread is reset to the state 2803 immediately before the called method was invoked. 2804 That is (using <vmspec/> terminology): 2805 <ul> 2806 <li>the current frame is discarded as the previous frame becomes the current one</li> 2807 <li>the operand stack is restored--the argument values are added back 2808 and if the invoke was not <code>invokestatic</code>, 2809 <code>objectref</code> is added back as well</li> 2810 <li>the Java virtual machine PC is restored to the opcode 2811 of the invoke instruction</li> 2812 </ul> 2813 Note however, that any changes to the arguments, which 2814 occurred in the called method, remain; 2815 when execution continues, the first instruction to 2816 execute will be the invoke. 2817 <p/> 2818 Between calling <code>PopFrame</code> and resuming the 2819 thread the state of the stack is undefined. 2820 To pop frames beyond the first, 2821 these three steps must be repeated: 2822 <ul> 2823 <li>suspend the thread via an event (step, breakpoint, ...)</li> 2824 <li>call <code>PopFrame</code></li> 2825 <li>resume the thread</li> 2826 </ul> 2827 <p/> 2828 A lock acquired by calling the called method 2829 (if it is a <code>synchronized</code> method) 2830 and locks acquired by entering <code>synchronized</code> 2831 blocks within the called method are released. 2832 Note: this does not apply to native locks or 2833 <code>java.util.concurrent.locks</code> locks. 2834 <p/> 2835 Finally blocks are not executed. 2836 <p/> 2837 Changes to global state are not addressed and thus remain changed. 2838 <p/> 2839 The specified thread must be suspended (which implies it cannot be the current thread). 2840 <p/> 2841 Both the called method and calling method must be non-native Java programming 2842 language methods. 2843 <p/> 2844 No <jvmti/> events are generated by this function. 2845 </description> 2846 <origin>jvmdi</origin> 2847 <capabilities> 2848 <required id="can_pop_frame"></required> 2849 </capabilities> 2850 <parameters> 2851 <param id="thread"> 2852 <jthread/> 2853 <description> 2854 The thread whose current frame is to be popped. 2855 </description> 2856 </param> 2857 </parameters> 2858 <errors> 2859 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 2860 Called or calling method is a native method. 2861 The implementation is unable to pop this frame. 2862 </error> 2863 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 2864 Thread was not suspended. 2865 </error> 2866 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 2867 There are less than two stack frames on the call stack. 2868 </error> 2869 </errors> 2870 </function> 2871 2872 <function id="GetFrameLocation" num="19"> 2873 <synopsis>Get Frame Location</synopsis> 2874 <description> 2875 <p/> 2876 For a Java programming language frame, return the location of the instruction 2877 currently executing. 2878 </description> 2879 <origin>jvmdiClone</origin> 2880 <capabilities> 2881 </capabilities> 2882 <parameters> 2883 <param id="thread"> 2884 <jthread null="current" frame="frame"/> 2885 <description> 2886 The thread of the frame to query. 2887 </description> 2888 </param> 2889 <param id="depth"> 2890 <jframeID thread="thread"/> 2891 <description> 2892 The depth of the frame to query. 2893 </description> 2894 </param> 2895 <param id="method_ptr"> 2896 <outptr><jmethodID/></outptr> 2897 <description> 2898 On return, points to the method for the current location. 2899 </description> 2900 </param> 2901 <param id="location_ptr"> 2902 <outptr><jlocation/></outptr> 2903 <description> 2904 On return, points to the index of the currently 2905 executing instruction. 2906 Is set to <code>-1</code> if the frame is executing 2907 a native method. 2908 </description> 2909 </param> 2910 </parameters> 2911 <errors> 2912 </errors> 2913 </function> 2914 2915 <function id="NotifyFramePop" num="20"> 2916 <synopsis>Notify Frame Pop</synopsis> 2917 <description> 2918 When the frame that is currently at <paramlink id="depth"></paramlink> 2919 is popped from the stack, generate a 2920 <eventlink id="FramePop"></eventlink> event. See the 2921 <eventlink id="FramePop"></eventlink> event for details. 2922 Only frames corresponding to non-native Java programming language 2923 methods can receive notification. 2924 <p/> 2925 The specified thread must either be the current thread 2926 or the thread must be suspended. 2927 </description> 2928 <origin>jvmdi</origin> 2929 <capabilities> 2930 <required id="can_generate_frame_pop_events"></required> 2931 </capabilities> 2932 <parameters> 2933 <param id="thread"> 2934 <jthread null="current" frame="depth"/> 2935 <description> 2936 The thread of the frame for which the frame pop event will be generated. 2937 </description> 2938 </param> 2939 <param id="depth"> 2940 <jframeID thread="thread"/> 2941 <description> 2942 The depth of the frame for which the frame pop event will be generated. 2943 </description> 2944 </param> 2945 </parameters> 2946 <errors> 2947 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 2948 The frame at <code>depth</code> is executing a 2949 native method. 2950 </error> 2951 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 2952 Thread was not suspended and was not the current thread. 2953 </error> 2954 </errors> 2955 </function> 2956 2957 </category> 2958 2959 <category id="ForceEarlyReturn" label="Force Early Return"> 2960 <intro> 2961 These functions allow an agent to force a method 2962 to return at any point during its execution. 2963 The method which will return early is referred to as the <i>called method</i>. 2964 The called method is the current method 2965 (as defined by 2966 <vmspec chapter="3.6"/>) 2967 for the specified thread at 2968 the time the function is called. 2969 <p/> 2970 The specified thread must be suspended or must be the current thread. 2971 The return occurs when execution of Java programming 2972 language code is resumed on this thread. 2973 Between calling one of these functions and resumption 2974 of thread execution, the state of the stack is undefined. 2975 <p/> 2976 No further instructions are executed in the called method. 2977 Specifically, finally blocks are not executed. 2978 Note: this can cause inconsistent states in the application. 2979 <p/> 2980 A lock acquired by calling the called method 2981 (if it is a <code>synchronized</code> method) 2982 and locks acquired by entering <code>synchronized</code> 2983 blocks within the called method are released. 2984 Note: this does not apply to native locks or 2985 <code>java.util.concurrent.locks</code> locks. 2986 <p/> 2987 Events, such as <eventlink id="MethodExit"></eventlink>, 2988 are generated as they would be in a normal return. 2989 <p/> 2990 The called method must be a non-native Java programming 2991 language method. 2992 Forcing return on a thread with only one frame on the 2993 stack causes the thread to exit when resumed. 2994 </intro> 2995 2996 <function id="ForceEarlyReturnObject" num="81" since="1.1"> 2997 <synopsis>Force Early Return - Object</synopsis> 2998 <description> 2999 This function can be used to return from a method whose 3000 result type is <code>Object</code> 3001 or a subclass of <code>Object</code>. 3002 </description> 3003 <origin>new</origin> 3004 <capabilities> 3005 <required id="can_force_early_return"></required> 3006 </capabilities> 3007 <parameters> 3008 <param id="thread"> 3009 <jthread null="current"/> 3010 <description> 3011 The thread whose current frame is to return early. 3012 </description> 3013 </param> 3014 <param id="value"> 3015 <jobject/> 3016 <description> 3017 The return value for the called frame. 3018 An object or <code>NULL</code>. 3019 </description> 3020 </param> 3021 </parameters> 3022 <errors> 3023 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3024 Attempted to return early from a frame 3025 corresponding to a native method. 3026 Or the implementation is unable to provide 3027 this functionality on this frame. 3028 </error> 3029 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3030 The result type of the called method is not 3031 <code>Object</code> or a subclass of <code>Object</code>. 3032 </error> 3033 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3034 The supplied <paramlink id="value"/> is not compatible with the 3035 result type of the called method. 3036 </error> 3037 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3038 Thread was not the current thread and was not suspended. 3039 </error> 3040 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3041 There are no more frames on the call stack. 3042 </error> 3043 </errors> 3044 </function> 3045 3046 <function id="ForceEarlyReturnInt" num="82" since="1.1"> 3047 <synopsis>Force Early Return - Int</synopsis> 3048 <description> 3049 This function can be used to return from a method whose 3050 result type is <code>int</code>, <code>short</code>, 3051 <code>char</code>, <code>byte</code>, or 3052 <code>boolean</code>. 3053 </description> 3054 <origin>new</origin> 3055 <capabilities> 3056 <required id="can_force_early_return"></required> 3057 </capabilities> 3058 <parameters> 3059 <param id="thread"> 3060 <jthread null="current"/> 3061 <description> 3062 The thread whose current frame is to return early. 3063 </description> 3064 </param> 3065 <param id="value"> 3066 <jint/> 3067 <description> 3068 The return value for the called frame. 3069 </description> 3070 </param> 3071 </parameters> 3072 <errors> 3073 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3074 Attempted to return early from a frame 3075 corresponding to a native method. 3076 Or the implementation is unable to provide 3077 this functionality on this frame. 3078 </error> 3079 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3080 The result type of the called method is not 3081 <code>int</code>, <code>short</code>, 3082 <code>char</code>, <code>byte</code>, or 3083 <code>boolean</code>. 3084 </error> 3085 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3086 Thread was not the current thread and was not suspended. 3087 </error> 3088 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3089 There are no frames on the call stack. 3090 </error> 3091 </errors> 3092 </function> 3093 3094 <function id="ForceEarlyReturnLong" num="83" since="1.1"> 3095 <synopsis>Force Early Return - Long</synopsis> 3096 <description> 3097 This function can be used to return from a method whose 3098 result type is <code>long</code>. 3099 </description> 3100 <origin>new</origin> 3101 <capabilities> 3102 <required id="can_force_early_return"></required> 3103 </capabilities> 3104 <parameters> 3105 <param id="thread"> 3106 <jthread null="current"/> 3107 <description> 3108 The thread whose current frame is to return early. 3109 </description> 3110 </param> 3111 <param id="value"> 3112 <jlong/> 3113 <description> 3114 The return value for the called frame. 3115 </description> 3116 </param> 3117 </parameters> 3118 <errors> 3119 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3120 Attempted to return early from a frame 3121 corresponding to a native method. 3122 Or the implementation is unable to provide 3123 this functionality on this frame. 3124 </error> 3125 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3126 The result type of the called method is not <code>long</code>. 3127 </error> 3128 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3129 Thread was not the current thread and was not suspended. 3130 </error> 3131 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3132 There are no frames on the call stack. 3133 </error> 3134 </errors> 3135 </function> 3136 3137 <function id="ForceEarlyReturnFloat" num="84" since="1.1"> 3138 <synopsis>Force Early Return - Float</synopsis> 3139 <description> 3140 This function can be used to return from a method whose 3141 result type is <code>float</code>. 3142 </description> 3143 <origin>new</origin> 3144 <capabilities> 3145 <required id="can_force_early_return"></required> 3146 </capabilities> 3147 <parameters> 3148 <param id="thread"> 3149 <jthread null="current"/> 3150 <description> 3151 The thread whose current frame is to return early. 3152 </description> 3153 </param> 3154 <param id="value"> 3155 <jfloat/> 3156 <description> 3157 The return value for the called frame. 3158 </description> 3159 </param> 3160 </parameters> 3161 <errors> 3162 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3163 Attempted to return early from a frame 3164 corresponding to a native method. 3165 Or the implementation is unable to provide 3166 this functionality on this frame. 3167 </error> 3168 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3169 The result type of the called method is not <code>float</code>. 3170 </error> 3171 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3172 Thread was not the current thread and was not suspended. 3173 </error> 3174 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3175 There are no frames on the call stack. 3176 </error> 3177 </errors> 3178 </function> 3179 3180 <function id="ForceEarlyReturnDouble" num="85" since="1.1"> 3181 <synopsis>Force Early Return - Double</synopsis> 3182 <description> 3183 This function can be used to return from a method whose 3184 result type is <code>double</code>. 3185 </description> 3186 <origin>new</origin> 3187 <capabilities> 3188 <required id="can_force_early_return"></required> 3189 </capabilities> 3190 <parameters> 3191 <param id="thread"> 3192 <jthread null="current"/> 3193 <description> 3194 The thread whose current frame is to return early. 3195 </description> 3196 </param> 3197 <param id="value"> 3198 <jdouble/> 3199 <description> 3200 The return value for the called frame. 3201 </description> 3202 </param> 3203 </parameters> 3204 <errors> 3205 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3206 Attempted to return early from a frame corresponding to a native method. 3207 Or the implementation is unable to provide this functionality on this frame. 3208 </error> 3209 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3210 The result type of the called method is not <code>double</code>. 3211 </error> 3212 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3213 Thread was not the current thread and was not suspended. 3214 </error> 3215 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3216 There are no frames on the call stack. 3217 </error> 3218 </errors> 3219 </function> 3220 3221 <function id="ForceEarlyReturnVoid" num="86" since="1.1"> 3222 <synopsis>Force Early Return - Void</synopsis> 3223 <description> 3224 This function can be used to return from a method with no result type. 3225 That is, the called method must be declared <code>void</code>. 3226 </description> 3227 <origin>new</origin> 3228 <capabilities> 3229 <required id="can_force_early_return"></required> 3230 </capabilities> 3231 <parameters> 3232 <param id="thread"> 3233 <jthread null="current"/> 3234 <description> 3235 The thread whose current frame is to return early. 3236 </description> 3237 </param> 3238 </parameters> 3239 <errors> 3240 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3241 Attempted to return early from a frame 3242 corresponding to a native method. 3243 Or the implementation is unable to provide 3244 this functionality on this frame. 3245 </error> 3246 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3247 The called method has a result type. 3248 </error> 3249 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3250 Thread was not the current thread and was not suspended. 3251 </error> 3252 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3253 There are no frames on the call stack. 3254 </error> 3255 </errors> 3256 </function> 3257 3258 </category> 3259 3260 <category id="Heap" label="Heap"> 3261 <intro> 3262 These functions are used to analyze the heap. 3263 Functionality includes the ability to view the objects in the 3264 heap and to tag these objects. 3265 </intro> 3266 3267 <intro id="objectTags" label="Object Tags"> 3268 A <i>tag</i> is a value associated with an object. 3269 Tags are explicitly set by the agent using the 3270 <functionlink id="SetTag"></functionlink> function or by 3271 callback functions such as <functionlink id="jvmtiHeapIterationCallback"/>. 3272 <p/> 3273 Tags are local to the environment; that is, the tags of one 3274 environment are not visible in another. 3275 <p/> 3276 Tags are <code>jlong</code> values which can be used 3277 simply to mark an object or to store a pointer to more detailed 3278 information. Objects which have not been tagged have a 3279 tag of zero. 3280 Setting a tag to zero makes the object untagged. 3281 </intro> 3282 3283 <intro id="heapCallbacks" label="Heap Callback Functions"> 3284 Heap functions which iterate through the heap and recursively 3285 follow object references use agent supplied callback functions 3286 to deliver the information. 3287 <p/> 3288 These heap callback functions must adhere to the following restrictions -- 3289 These callbacks must not use JNI functions. 3290 These callbacks must not use <jvmti/> functions except 3291 <i>callback safe</i> functions which 3292 specifically allow such use (see the raw monitor, memory management, 3293 and environment local storage functions). 3294 <p/> 3295 An implementation may invoke a callback on an internal thread or 3296 the thread which called the iteration function. 3297 Heap callbacks are single threaded -- no more than one callback will 3298 be invoked at a time. 3299 <p/> 3300 The Heap Filter Flags can be used to prevent reporting 3301 based on the tag status of an object or its class. 3302 If no flags are set (the <code>jint</code> is zero), objects 3303 will not be filtered out. 3304 3305 <constants id="jvmtiHeapFilter" label="Heap Filter Flags" kind="bits"> 3306 <constant id="JVMTI_HEAP_FILTER_TAGGED" num="0x4"> 3307 Filter out tagged objects. Objects which are tagged are not included. 3308 </constant> 3309 <constant id="JVMTI_HEAP_FILTER_UNTAGGED" num="0x8"> 3310 Filter out untagged objects. Objects which are not tagged are not included. 3311 </constant> 3312 <constant id="JVMTI_HEAP_FILTER_CLASS_TAGGED" num="0x10"> 3313 Filter out objects with tagged classes. Objects whose class is tagged are not included. 3314 </constant> 3315 <constant id="JVMTI_HEAP_FILTER_CLASS_UNTAGGED" num="0x20"> 3316 Filter out objects with untagged classes. Objects whose class is not tagged are not included. 3317 </constant> 3318 </constants> 3319 3320 <p/> 3321 The Heap Visit Control Flags are returned by the heap callbacks 3322 and can be used to abort the iteration. For the 3323 <functionlink id="jvmtiHeapReferenceCallback">Heap 3324 Reference Callback</functionlink>, it can also be used 3325 to prune the graph of traversed references 3326 (<code>JVMTI_VISIT_OBJECTS</code> is not set). 3327 3328 <constants id="jvmtiHeapVisitControl" 3329 label="Heap Visit Control Flags" 3330 kind="bits" 3331 since="1.1"> 3332 <constant id="JVMTI_VISIT_OBJECTS" num="0x100"> 3333 If we are visiting an object and if this callback 3334 was initiated by <functionlink id="FollowReferences"/>, 3335 traverse the references of this object. 3336 Otherwise ignored. 3337 </constant> 3338 <constant id="JVMTI_VISIT_ABORT" num="0x8000"> 3339 Abort the iteration. Ignore all other bits. 3340 </constant> 3341 </constants> 3342 3343 <p/> 3344 The Heap Reference Enumeration is provided by the 3345 <functionlink id="jvmtiHeapReferenceCallback">Heap 3346 Reference Callback</functionlink> and 3347 <functionlink id="jvmtiPrimitiveFieldCallback">Primitive Field 3348 Callback</functionlink> to 3349 describe the kind of reference 3350 being reported. 3351 3352 <constants id="jvmtiHeapReferenceKind" 3353 label="Heap Reference Enumeration" 3354 kind="enum" 3355 since="1.1"> 3356 <constant id="JVMTI_HEAP_REFERENCE_CLASS" num="1"> 3357 Reference from an object to its class. 3358 </constant> 3359 <constant id="JVMTI_HEAP_REFERENCE_FIELD" num="2"> 3360 Reference from an object to the value of one of its instance fields. 3361 </constant> 3362 <constant id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT" num="3"> 3363 Reference from an array to one of its elements. 3364 </constant> 3365 <constant id="JVMTI_HEAP_REFERENCE_CLASS_LOADER" num="4"> 3366 Reference from a class to its class loader. 3367 </constant> 3368 <constant id="JVMTI_HEAP_REFERENCE_SIGNERS" num="5"> 3369 Reference from a class to its signers array. 3370 </constant> 3371 <constant id="JVMTI_HEAP_REFERENCE_PROTECTION_DOMAIN" num="6"> 3372 Reference from a class to its protection domain. 3373 </constant> 3374 <constant id="JVMTI_HEAP_REFERENCE_INTERFACE" num="7"> 3375 Reference from a class to one of its interfaces. 3376 Note: interfaces are defined via a constant pool reference, 3377 so the referenced interfaces may also be reported with a 3378 <code>JVMTI_HEAP_REFERENCE_CONSTANT_POOL</code> reference kind. 3379 </constant> 3380 <constant id="JVMTI_HEAP_REFERENCE_STATIC_FIELD" num="8"> 3381 Reference from a class to the value of one of its static fields. 3382 </constant> 3383 <constant id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL" num="9"> 3384 Reference from a class to a resolved entry in the constant pool. 3385 </constant> 3386 <constant id="JVMTI_HEAP_REFERENCE_SUPERCLASS" num="10"> 3387 Reference from a class to its superclass. 3388 A callback is not sent if the superclass is <code>java.lang.Object</code>. 3389 Note: loaded classes define superclasses via a constant pool 3390 reference, so the referenced superclass may also be reported with 3391 a <code>JVMTI_HEAP_REFERENCE_CONSTANT_POOL</code> reference kind. 3392 </constant> 3393 <constant id="JVMTI_HEAP_REFERENCE_JNI_GLOBAL" num="21"> 3394 Heap root reference: JNI global reference. 3395 </constant> 3396 <constant id="JVMTI_HEAP_REFERENCE_SYSTEM_CLASS" num="22"> 3397 Heap root reference: System class. 3398 </constant> 3399 <constant id="JVMTI_HEAP_REFERENCE_MONITOR" num="23"> 3400 Heap root reference: monitor. 3401 </constant> 3402 <constant id="JVMTI_HEAP_REFERENCE_STACK_LOCAL" num="24"> 3403 Heap root reference: local variable on the stack. 3404 </constant> 3405 <constant id="JVMTI_HEAP_REFERENCE_JNI_LOCAL" num="25"> 3406 Heap root reference: JNI local reference. 3407 </constant> 3408 <constant id="JVMTI_HEAP_REFERENCE_THREAD" num="26"> 3409 Heap root reference: Thread. 3410 </constant> 3411 <constant id="JVMTI_HEAP_REFERENCE_OTHER" num="27"> 3412 Heap root reference: other heap root reference. 3413 </constant> 3414 </constants> 3415 3416 <p/> 3417 Definitions for the single character type descriptors of 3418 primitive types. 3419 3420 <constants id="jvmtiPrimitiveType" 3421 label="Primitive Type Enumeration" 3422 kind="enum" 3423 since="1.1"> 3424 <constant id="JVMTI_PRIMITIVE_TYPE_BOOLEAN" num="90"> 3425 'Z' - Java programming language <code>boolean</code> - JNI <code>jboolean</code> 3426 </constant> 3427 <constant id="JVMTI_PRIMITIVE_TYPE_BYTE" num="66"> 3428 'B' - Java programming language <code>byte</code> - JNI <code>jbyte</code> 3429 </constant> 3430 <constant id="JVMTI_PRIMITIVE_TYPE_CHAR" num="67"> 3431 'C' - Java programming language <code>char</code> - JNI <code>jchar</code> 3432 </constant> 3433 <constant id="JVMTI_PRIMITIVE_TYPE_SHORT" num="83"> 3434 'S' - Java programming language <code>short</code> - JNI <code>jshort</code> 3435 </constant> 3436 <constant id="JVMTI_PRIMITIVE_TYPE_INT" num="73"> 3437 'I' - Java programming language <code>int</code> - JNI <code>jint</code> 3438 </constant> 3439 <constant id="JVMTI_PRIMITIVE_TYPE_LONG" num="74"> 3440 'J' - Java programming language <code>long</code> - JNI <code>jlong</code> 3441 </constant> 3442 <constant id="JVMTI_PRIMITIVE_TYPE_FLOAT" num="70"> 3443 'F' - Java programming language <code>float</code> - JNI <code>jfloat</code> 3444 </constant> 3445 <constant id="JVMTI_PRIMITIVE_TYPE_DOUBLE" num="68"> 3446 'D' - Java programming language <code>double</code> - JNI <code>jdouble</code> 3447 </constant> 3448 </constants> 3449 </intro> 3450 3451 <typedef id="jvmtiHeapReferenceInfoField" 3452 label="Reference information structure for Field references" 3453 since="1.1"> 3454 <description> 3455 Reference information returned for 3456 <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/> and 3457 <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/> references. 3458 </description> 3459 <field id="index"> 3460 <jint/> 3461 <description> 3462 For <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/>, the 3463 referrer object is not a class or an interface. 3464 In this case, <code>index</code> is the index of the field 3465 in the class of the referrer object. 3466 This class is referred to below as <i>C</i>. 3467 <p/> 3468 For <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/>, 3469 the referrer object is a class (referred to below as <i>C</i>) 3470 or an interface (referred to below as <i>I</i>). 3471 In this case, <code>index</code> is the index of the field in 3472 that class or interface. 3473 <p/> 3474 If the referrer object is not an interface, then the field 3475 indices are determined as follows: 3476 <ul> 3477 <li>make a list of all the fields in <i>C</i> and its 3478 superclasses, starting with all the fields in 3479 <code>java.lang.Object</code> and ending with all the 3480 fields in <i>C</i>.</li> 3481 <li>Within this list, put 3482 the fields for a given class in the order returned by 3483 <functionlink id="GetClassFields"/>.</li> 3484 <li>Assign the fields in this list indices 3485 <i>n</i>, <i>n</i>+1, ..., in order, where <i>n</i> 3486 is the count of the fields in all the interfaces 3487 implemented by <i>C</i>. 3488 Note that <i>C</i> implements all interfaces 3489 directly implemented by its superclasses; as well 3490 as all superinterfaces of these interfaces.</li> 3491 </ul> 3492 If the referrer object is an interface, then the field 3493 indices are determined as follows: 3494 <ul> 3495 <li>make a list of the fields directly declared in 3496 <i>I</i>.</li> 3497 <li>Within this list, put 3498 the fields in the order returned by 3499 <functionlink id="GetClassFields"/>.</li> 3500 <li>Assign the fields in this list indices 3501 <i>n</i>, <i>n</i>+1, ..., in order, where <i>n</i> 3502 is the count of the fields in all the superinterfaces 3503 of <i>I</i>.</li> 3504 </ul> 3505 All fields are included in this computation, regardless of 3506 field modifier (static, public, private, etc). 3507 <p/> 3508 For example, given the following classes and interfaces: 3509 <example> 3510 interface I0 { 3511 int p = 0; 3512 } 3513 3514 interface I1 extends I0 { 3515 int x = 1; 3516 } 3517 3518 interface I2 extends I0 { 3519 int y = 2; 3520 } 3521 3522 class C1 implements I1 { 3523 public static int a = 3; 3524 private int b = 4; 3525 } 3526 3527 class C2 extends C1 implements I2 { 3528 static int q = 5; 3529 final int r = 6; 3530 } 3531 </example> 3532 Assume that <functionlink id="GetClassFields"/> called on 3533 <code>C1</code> returns the fields of <code>C1</code> in the 3534 order: a, b; and that the fields of <code>C2</code> are 3535 returned in the order: q, r. 3536 An instance of class <code>C1</code> will have the 3537 following field indices: 3538 <blockquote><table> 3539 <tr> 3540 <td class="centered"> 3541 a 3542 </td> 3543 <td class="centered"> 3544 2 3545 </td> 3546 <td> 3547 The count of the fields in the interfaces 3548 implemented by <code>C1</code> is two (<i>n</i>=2): 3549 <code>p</code> of <code>I0</code> 3550 and <code>x</code> of <code>I1</code>. 3551 </td> 3552 </tr> 3553 <tr> 3554 <td class="centered"> 3555 b 3556 </td> 3557 <td class="centered"> 3558 3 3559 </td> 3560 <td> 3561 the subsequent index. 3562 </td> 3563 </tr> 3564 </table></blockquote> 3565 The class <code>C1</code> will have the same field indices. 3566 <p/> 3567 An instance of class <code>C2</code> will have the 3568 following field indices: 3569 <blockquote><table> 3570 <tr> 3571 <td class="centered"> 3572 a 3573 </td> 3574 <td class="centered"> 3575 3 3576 </td> 3577 <td> 3578 The count of the fields in the interfaces 3579 implemented by <code>C2</code> is three (<i>n</i>=3): 3580 <code>p</code> of <code>I0</code>, 3581 <code>x</code> of <code>I1</code> and <code>y</code> of <code>I2</code> 3582 (an interface of <code>C2</code>). Note that the field <code>p</code> 3583 of <code>I0</code> is only included once. 3584 </td> 3585 </tr> 3586 <tr> 3587 <td class="centered"> 3588 b 3589 </td> 3590 <td class="centered"> 3591 4 3592 </td> 3593 <td> 3594 the subsequent index to "a". 3595 </td> 3596 </tr> 3597 <tr> 3598 <td class="centered"> 3599 q 3600 </td> 3601 <td class="centered"> 3602 5 3603 </td> 3604 <td> 3605 the subsequent index to "b". 3606 </td> 3607 </tr> 3608 <tr> 3609 <td class="centered"> 3610 r 3611 </td> 3612 <td class="centered"> 3613 6 3614 </td> 3615 <td> 3616 the subsequent index to "q". 3617 </td> 3618 </tr> 3619 </table></blockquote> 3620 The class <code>C2</code> will have the same field indices. 3621 Note that a field may have a different index depending on the 3622 object that is viewing it -- for example field "a" above. 3623 Note also: not all field indices may be visible from the 3624 callbacks, but all indices are shown for illustrative purposes. 3625 <p/> 3626 The interface <code>I1</code> will have the 3627 following field indices: 3628 <blockquote><table> 3629 <tr> 3630 <td class="centered"> 3631 x 3632 </td> 3633 <td class="centered"> 3634 1 3635 </td> 3636 <td> 3637 The count of the fields in the superinterfaces 3638 of <code>I1</code> is one (<i>n</i>=1): 3639 <code>p</code> of <code>I0</code>. 3640 </td> 3641 </tr> 3642 </table></blockquote> 3643 </description> 3644 </field> 3645 </typedef> 3646 3647 <typedef id="jvmtiHeapReferenceInfoArray" 3648 label="Reference information structure for Array references" 3649 since="1.1"> 3650 <description> 3651 Reference information returned for 3652 <datalink id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT"/> references. 3653 </description> 3654 <field id="index"> 3655 <jint/> 3656 <description> 3657 The array index. 3658 </description> 3659 </field> 3660 </typedef> 3661 3662 <typedef id="jvmtiHeapReferenceInfoConstantPool" 3663 label="Reference information structure for Constant Pool references" 3664 since="1.1"> 3665 <description> 3666 Reference information returned for 3667 <datalink id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL"/> references. 3668 </description> 3669 <field id="index"> 3670 <jint/> 3671 <description> 3672 The index into the constant pool of the class. See the description in 3673 <vmspec chapter="4.4"/>. 3674 </description> 3675 </field> 3676 </typedef> 3677 3678 <typedef id="jvmtiHeapReferenceInfoStackLocal" 3679 label="Reference information structure for Local Variable references" 3680 since="1.1"> 3681 <description> 3682 Reference information returned for 3683 <datalink id="JVMTI_HEAP_REFERENCE_STACK_LOCAL"/> references. 3684 </description> 3685 <field id="thread_tag"> 3686 <jlong/> 3687 <description> 3688 The tag of the thread corresponding to this stack, zero if not tagged. 3689 </description> 3690 </field> 3691 <field id="thread_id"> 3692 <jlong/> 3693 <description> 3694 The unique thread ID of the thread corresponding to this stack. 3695 </description> 3696 </field> 3697 <field id="depth"> 3698 <jint/> 3699 <description> 3700 The depth of the frame. 3701 </description> 3702 </field> 3703 <field id="method"> 3704 <jmethodID/> 3705 <description> 3706 The method executing in this frame. 3707 </description> 3708 </field> 3709 <field id="location"> 3710 <jlocation/> 3711 <description> 3712 The currently executing location in this frame. 3713 </description> 3714 </field> 3715 <field id="slot"> 3716 <jint/> 3717 <description> 3718 The slot number of the local variable. 3719 </description> 3720 </field> 3721 </typedef> 3722 3723 <typedef id="jvmtiHeapReferenceInfoJniLocal" 3724 label="Reference information structure for JNI local references" 3725 since="1.1"> 3726 <description> 3727 Reference information returned for 3728 <datalink id="JVMTI_HEAP_REFERENCE_JNI_LOCAL"/> references. 3729 </description> 3730 <field id="thread_tag"> 3731 <jlong/> 3732 <description> 3733 The tag of the thread corresponding to this stack, zero if not tagged. 3734 </description> 3735 </field> 3736 <field id="thread_id"> 3737 <jlong/> 3738 <description> 3739 The unique thread ID of the thread corresponding to this stack. 3740 </description> 3741 </field> 3742 <field id="depth"> 3743 <jint/> 3744 <description> 3745 The depth of the frame. 3746 </description> 3747 </field> 3748 <field id="method"> 3749 <jmethodID/> 3750 <description> 3751 The method executing in this frame. 3752 </description> 3753 </field> 3754 </typedef> 3755 3756 <typedef id="jvmtiHeapReferenceInfoReserved" 3757 label="Reference information structure for Other references" 3758 since="1.1"> 3759 <description> 3760 Reference information returned for other references. 3761 </description> 3762 <field id="reserved1"> 3763 <jlong/> 3764 <description> 3765 reserved for future use. 3766 </description> 3767 </field> 3768 <field id="reserved2"> 3769 <jlong/> 3770 <description> 3771 reserved for future use. 3772 </description> 3773 </field> 3774 <field id="reserved3"> 3775 <jlong/> 3776 <description> 3777 reserved for future use. 3778 </description> 3779 </field> 3780 <field id="reserved4"> 3781 <jlong/> 3782 <description> 3783 reserved for future use. 3784 </description> 3785 </field> 3786 <field id="reserved5"> 3787 <jlong/> 3788 <description> 3789 reserved for future use. 3790 </description> 3791 </field> 3792 <field id="reserved6"> 3793 <jlong/> 3794 <description> 3795 reserved for future use. 3796 </description> 3797 </field> 3798 <field id="reserved7"> 3799 <jlong/> 3800 <description> 3801 reserved for future use. 3802 </description> 3803 </field> 3804 <field id="reserved8"> 3805 <jlong/> 3806 <description> 3807 reserved for future use. 3808 </description> 3809 </field> 3810 </typedef> 3811 3812 <uniontypedef id="jvmtiHeapReferenceInfo" 3813 label="Reference information structure" 3814 since="1.1"> 3815 <description> 3816 The information returned about referrers. 3817 Represented as a union of the various kinds of reference information. 3818 </description> 3819 <field id="field"> 3820 <struct>jvmtiHeapReferenceInfoField</struct> 3821 <description> 3822 The referrer information for 3823 <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/> 3824 and <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/> references. 3825 </description> 3826 </field> 3827 <field id="array"> 3828 <struct>jvmtiHeapReferenceInfoArray</struct> 3829 <description> 3830 The referrer information for 3831 For <datalink id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT"/> references. 3832 </description> 3833 </field> 3834 <field id="constant_pool"> 3835 <struct>jvmtiHeapReferenceInfoConstantPool</struct> 3836 <description> 3837 The referrer information for 3838 For <datalink id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL"/> references. 3839 </description> 3840 </field> 3841 <field id="stack_local"> 3842 <struct>jvmtiHeapReferenceInfoStackLocal</struct> 3843 <description> 3844 The referrer information for 3845 For <datalink id="JVMTI_HEAP_REFERENCE_STACK_LOCAL"/> references. 3846 </description> 3847 </field> 3848 <field id="jni_local"> 3849 <struct>jvmtiHeapReferenceInfoJniLocal</struct> 3850 <description> 3851 The referrer information for 3852 For <datalink id="JVMTI_HEAP_REFERENCE_JNI_LOCAL"/> references. 3853 </description> 3854 </field> 3855 <field id="other"> 3856 <struct>jvmtiHeapReferenceInfoReserved</struct> 3857 <description> 3858 reserved for future use. 3859 </description> 3860 </field> 3861 </uniontypedef> 3862 3863 <typedef id="jvmtiHeapCallbacks" 3864 label="Heap callback function structure" 3865 since="1.1"> 3866 <field id="heap_iteration_callback"> 3867 <ptrtype> 3868 <struct>jvmtiHeapIterationCallback</struct> 3869 </ptrtype> 3870 <description> 3871 The callback to be called to describe an 3872 object in the heap. Used by the 3873 <functionlink id="IterateThroughHeap"/> function, ignored by the 3874 <functionlink id="FollowReferences"/> function. 3875 </description> 3876 </field> 3877 <field id="heap_reference_callback"> 3878 <ptrtype> 3879 <struct>jvmtiHeapReferenceCallback</struct> 3880 </ptrtype> 3881 <description> 3882 The callback to be called to describe an 3883 object reference. Used by the 3884 <functionlink id="FollowReferences"/> function, ignored by the 3885 <functionlink id="IterateThroughHeap"/> function. 3886 </description> 3887 </field> 3888 <field id="primitive_field_callback"> 3889 <ptrtype> 3890 <struct>jvmtiPrimitiveFieldCallback</struct> 3891 </ptrtype> 3892 <description> 3893 The callback to be called to describe a 3894 primitive field. 3895 </description> 3896 </field> 3897 <field id="array_primitive_value_callback"> 3898 <ptrtype> 3899 <struct>jvmtiArrayPrimitiveValueCallback</struct> 3900 </ptrtype> 3901 <description> 3902 The callback to be called to describe an 3903 array of primitive values. 3904 </description> 3905 </field> 3906 <field id="string_primitive_value_callback"> 3907 <ptrtype> 3908 <struct>jvmtiStringPrimitiveValueCallback</struct> 3909 </ptrtype> 3910 <description> 3911 The callback to be called to describe a String value. 3912 </description> 3913 </field> 3914 <field id="reserved5"> 3915 <ptrtype> 3916 <struct>jvmtiReservedCallback</struct> 3917 </ptrtype> 3918 <description> 3919 Reserved for future use.. 3920 </description> 3921 </field> 3922 <field id="reserved6"> 3923 <ptrtype> 3924 <struct>jvmtiReservedCallback</struct> 3925 </ptrtype> 3926 <description> 3927 Reserved for future use.. 3928 </description> 3929 </field> 3930 <field id="reserved7"> 3931 <ptrtype> 3932 <struct>jvmtiReservedCallback</struct> 3933 </ptrtype> 3934 <description> 3935 Reserved for future use.. 3936 </description> 3937 </field> 3938 <field id="reserved8"> 3939 <ptrtype> 3940 <struct>jvmtiReservedCallback</struct> 3941 </ptrtype> 3942 <description> 3943 Reserved for future use.. 3944 </description> 3945 </field> 3946 <field id="reserved9"> 3947 <ptrtype> 3948 <struct>jvmtiReservedCallback</struct> 3949 </ptrtype> 3950 <description> 3951 Reserved for future use.. 3952 </description> 3953 </field> 3954 <field id="reserved10"> 3955 <ptrtype> 3956 <struct>jvmtiReservedCallback</struct> 3957 </ptrtype> 3958 <description> 3959 Reserved for future use.. 3960 </description> 3961 </field> 3962 <field id="reserved11"> 3963 <ptrtype> 3964 <struct>jvmtiReservedCallback</struct> 3965 </ptrtype> 3966 <description> 3967 Reserved for future use.. 3968 </description> 3969 </field> 3970 <field id="reserved12"> 3971 <ptrtype> 3972 <struct>jvmtiReservedCallback</struct> 3973 </ptrtype> 3974 <description> 3975 Reserved for future use.. 3976 </description> 3977 </field> 3978 <field id="reserved13"> 3979 <ptrtype> 3980 <struct>jvmtiReservedCallback</struct> 3981 </ptrtype> 3982 <description> 3983 Reserved for future use.. 3984 </description> 3985 </field> 3986 <field id="reserved14"> 3987 <ptrtype> 3988 <struct>jvmtiReservedCallback</struct> 3989 </ptrtype> 3990 <description> 3991 Reserved for future use.. 3992 </description> 3993 </field> 3994 <field id="reserved15"> 3995 <ptrtype> 3996 <struct>jvmtiReservedCallback</struct> 3997 </ptrtype> 3998 <description> 3999 Reserved for future use.. 4000 </description> 4001 </field> 4002 </typedef> 4003 4004 4005 <intro> 4006 <rationale> 4007 The heap dumping functionality (below) uses a callback 4008 for each object. While it would seem that a buffered approach 4009 would provide better throughput, tests do 4010 not show this to be the case--possibly due to locality of 4011 memory reference or array access overhead. 4012 </rationale> 4013 4014 <issue> 4015 Still under investigation as to if java.lang.ref references 4016 are reported as a different type of reference. 4017 </issue> 4018 4019 <issue> 4020 Should or can an indication of the cost or relative cost of 4021 these operations be included? 4022 </issue> 4023 4024 </intro> 4025 4026 <callback id="jvmtiHeapIterationCallback" since="1.1"> 4027 <jint/> 4028 <synopsis>Heap Iteration Callback</synopsis> 4029 <description> 4030 Agent supplied callback function. 4031 Describes (but does not pass in) an object in the heap. 4032 <p/> 4033 This function should return a bit vector of the desired 4034 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>. 4035 This will determine if the entire iteration should be aborted 4036 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored). 4037 <p/> 4038 See the <internallink id="heapCallbacks">heap callback 4039 function restrictions</internallink>. 4040 </description> 4041 <parameters> 4042 <param id="class_tag"> 4043 <jlong/> 4044 <description> 4045 The tag of the class of object (zero if the class is not tagged). 4046 If the object represents a runtime class, 4047 the <code>class_tag</code> is the tag 4048 associated with <code>java.lang.Class</code> 4049 (zero if <code>java.lang.Class</code> is not tagged). 4050 </description> 4051 </param> 4052 <param id="size"> 4053 <jlong/> 4054 <description> 4055 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 4056 </description> 4057 </param> 4058 <param id="tag_ptr"> 4059 <outptr><jlong/></outptr> 4060 <description> 4061 The object tag value, or zero if the object is not tagged. 4062 To set the tag value to be associated with the object 4063 the agent sets the <code>jlong</code> pointed to by the parameter. 4064 </description> 4065 </param> 4066 <param id="length"> 4067 <jint/> 4068 <description> 4069 If this object is an array, the length of the array. Otherwise negative one (-1). 4070 </description> 4071 </param> 4072 <param id="user_data"> 4073 <outptr><void/></outptr> 4074 <description> 4075 The user supplied data that was passed into the iteration function. 4076 </description> 4077 </param> 4078 </parameters> 4079 </callback> 4080 4081 <callback id="jvmtiHeapReferenceCallback" since="1.1"> 4082 <jint/> 4083 <synopsis>Heap Reference Callback</synopsis> 4084 <description> 4085 Agent supplied callback function. 4086 Describes a reference from an object or the VM (the referrer) to another object 4087 (the referree) or a heap root to a referree. 4088 <p/> 4089 This function should return a bit vector of the desired 4090 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>. 4091 This will determine if the objects referenced by the referree 4092 should be visited or if the entire iteration should be aborted. 4093 <p/> 4094 See the <internallink id="heapCallbacks">heap callback 4095 function restrictions</internallink>. 4096 </description> 4097 <parameters> 4098 <param id="reference_kind"> 4099 <enum>jvmtiHeapReferenceKind</enum> 4100 <description> 4101 The kind of reference. 4102 </description> 4103 </param> 4104 <param id="reference_info"> 4105 <inptr> 4106 <struct>jvmtiHeapReferenceInfo</struct> 4107 </inptr> 4108 <description> 4109 Details about the reference. 4110 Set when the <datalink id="jvmtiHeapReferenceCallback.reference_kind">reference_kind</datalink> is 4111 <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/>, 4112 <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/>, 4113 <datalink id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT"/>, 4114 <datalink id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL"/>, 4115 <datalink id="JVMTI_HEAP_REFERENCE_STACK_LOCAL"/>, 4116 or <datalink id="JVMTI_HEAP_REFERENCE_JNI_LOCAL"/>. 4117 Otherwise <code>NULL</code>. 4118 </description> 4119 </param> 4120 <param id="class_tag"> 4121 <jlong/> 4122 <description> 4123 The tag of the class of referree object (zero if the class is not tagged). 4124 If the referree object represents a runtime class, 4125 the <code>class_tag</code> is the tag 4126 associated with <code>java.lang.Class</code> 4127 (zero if <code>java.lang.Class</code> is not tagged). 4128 </description> 4129 </param> 4130 <param id="referrer_class_tag"> 4131 <jlong/> 4132 <description> 4133 The tag of the class of the referrer object (zero if the class is not tagged 4134 or the referree is a heap root). If the referrer object represents a runtime 4135 class, the <code>referrer_class_tag</code> is the tag associated with 4136 the <code>java.lang.Class</code> 4137 (zero if <code>java.lang.Class</code> is not tagged). 4138 </description> 4139 </param> 4140 <param id="size"> 4141 <jlong/> 4142 <description> 4143 Size of the referree object (in bytes). 4144 See <functionlink id="GetObjectSize"/>. 4145 </description> 4146 </param> 4147 <param id="tag_ptr"> 4148 <outptr><jlong/></outptr> 4149 <description> 4150 Points to the referree object tag value, or zero if the object is not 4151 tagged. 4152 To set the tag value to be associated with the object 4153 the agent sets the <code>jlong</code> pointed to by the parameter. 4154 </description> 4155 </param> 4156 <param id="referrer_tag_ptr"> 4157 <outptr><jlong/></outptr> 4158 <description> 4159 Points to the tag of the referrer object, or 4160 points to the zero if the referrer 4161 object is not tagged. 4162 <code>NULL</code> if the referrer in not an object (that is, 4163 this callback is reporting a heap root). 4164 To set the tag value to be associated with the referrer object 4165 the agent sets the <code>jlong</code> pointed to by the parameter. 4166 If this callback is reporting a reference from an object to itself, 4167 <code>referrer_tag_ptr == tag_ptr</code>. 4168 </description> 4169 </param> 4170 <param id="length"> 4171 <jint/> 4172 <description> 4173 If this object is an array, the length of the array. Otherwise negative one (-1). 4174 </description> 4175 </param> 4176 <param id="user_data"> 4177 <outptr><void/></outptr> 4178 <description> 4179 The user supplied data that was passed into the iteration function. 4180 </description> 4181 </param> 4182 </parameters> 4183 </callback> 4184 4185 <callback id="jvmtiPrimitiveFieldCallback" since="1.1"> 4186 <jint/> 4187 <synopsis>Primitive Field Callback</synopsis> 4188 <description> 4189 Agent supplied callback function which 4190 describes a primitive field of an object (<i>the object</i>). 4191 A primitive field is a field whose type is a primitive type. 4192 This callback will describe a static field if the object is a class, 4193 and otherwise will describe an instance field. 4194 <p/> 4195 This function should return a bit vector of the desired 4196 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>. 4197 This will determine if the entire iteration should be aborted 4198 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored). 4199 <p/> 4200 See the <internallink id="heapCallbacks">heap callback 4201 function restrictions</internallink>. 4202 </description> 4203 <parameters> 4204 <param id="kind"> 4205 <enum>jvmtiHeapReferenceKind</enum> 4206 <description> 4207 The kind of field -- instance or static (<datalink id="JVMTI_HEAP_REFERENCE_FIELD"/> or 4208 <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/>). 4209 </description> 4210 </param> 4211 <param id="info"> 4212 <inptr> 4213 <struct>jvmtiHeapReferenceInfo</struct> 4214 </inptr> 4215 <description> 4216 Which field (the field index). 4217 </description> 4218 </param> 4219 <param id="object_class_tag"> 4220 <jlong/> 4221 <description> 4222 The tag of the class of the object (zero if the class is not tagged). 4223 If the object represents a runtime class, the 4224 <code>object_class_tag</code> is the tag 4225 associated with <code>java.lang.Class</code> 4226 (zero if <code>java.lang.Class</code> is not tagged). 4227 </description> 4228 </param> 4229 <param id="object_tag_ptr"> 4230 <outptr><jlong/></outptr> 4231 <description> 4232 Points to the tag of the object, or zero if the object is not 4233 tagged. 4234 To set the tag value to be associated with the object 4235 the agent sets the <code>jlong</code> pointed to by the parameter. 4236 </description> 4237 </param> 4238 <param id="value"> 4239 <jvalue/> 4240 <description> 4241 The value of the field. 4242 </description> 4243 </param> 4244 <param id="value_type"> 4245 <enum>jvmtiPrimitiveType</enum> 4246 <description> 4247 The type of the field. 4248 </description> 4249 </param> 4250 <param id="user_data"> 4251 <outptr><void/></outptr> 4252 <description> 4253 The user supplied data that was passed into the iteration function. 4254 </description> 4255 </param> 4256 </parameters> 4257 </callback> 4258 4259 <callback id="jvmtiArrayPrimitiveValueCallback" since="1.1"> 4260 <jint/> 4261 <synopsis>Array Primitive Value Callback</synopsis> 4262 <description> 4263 Agent supplied callback function. 4264 Describes the values in an array of a primitive type. 4265 <p/> 4266 This function should return a bit vector of the desired 4267 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>. 4268 This will determine if the entire iteration should be aborted 4269 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored). 4270 <p/> 4271 See the <internallink id="heapCallbacks">heap callback 4272 function restrictions</internallink>. 4273 </description> 4274 <parameters> 4275 <param id="class_tag"> 4276 <jlong/> 4277 <description> 4278 The tag of the class of the array object (zero if the class is not tagged). 4279 </description> 4280 </param> 4281 <param id="size"> 4282 <jlong/> 4283 <description> 4284 Size of the array (in bytes). 4285 See <functionlink id="GetObjectSize"/>. 4286 </description> 4287 </param> 4288 <param id="tag_ptr"> 4289 <outptr><jlong/></outptr> 4290 <description> 4291 Points to the tag of the array object, or zero if the object is not 4292 tagged. 4293 To set the tag value to be associated with the object 4294 the agent sets the <code>jlong</code> pointed to by the parameter. 4295 </description> 4296 </param> 4297 <param id="element_count"> 4298 <jint/> 4299 <description> 4300 The length of the primitive array. 4301 </description> 4302 </param> 4303 <param id="element_type"> 4304 <enum>jvmtiPrimitiveType</enum> 4305 <description> 4306 The type of the elements of the array. 4307 </description> 4308 </param> 4309 <param id="elements"> 4310 <vmbuf><void/></vmbuf> 4311 <description> 4312 The elements of the array in a packed array of <code>element_count</code> 4313 items of <code>element_type</code> size each. 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="jvmtiStringPrimitiveValueCallback" since="1.1"> 4326 <jint/> 4327 <synopsis>String Primitive Value Callback</synopsis> 4328 <description> 4329 Agent supplied callback function. 4330 Describes the value of a java.lang.String. 4331 <p/> 4332 This function should return a bit vector of the desired 4333 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>. 4334 This will determine if the entire iteration should be aborted 4335 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored). 4336 <p/> 4337 See the <internallink id="heapCallbacks">heap callback 4338 function restrictions</internallink>. 4339 </description> 4340 <parameters> 4341 <param id="class_tag"> 4342 <jlong/> 4343 <description> 4344 The tag of the class of the String class (zero if the class is not tagged). 4345 <issue>Is this needed?</issue> 4346 </description> 4347 </param> 4348 <param id="size"> 4349 <jlong/> 4350 <description> 4351 Size of the string (in bytes). 4352 See <functionlink id="GetObjectSize"/>. 4353 </description> 4354 </param> 4355 <param id="tag_ptr"> 4356 <outptr><jlong/></outptr> 4357 <description> 4358 Points to the tag of the String object, or zero if the object is not 4359 tagged. 4360 To set the tag value to be associated with the object 4361 the agent sets the <code>jlong</code> pointed to by the parameter. 4362 </description> 4363 </param> 4364 <param id="value"> 4365 <vmbuf><jchar/></vmbuf> 4366 <description> 4367 The value of the String, encoded as a Unicode string. 4368 </description> 4369 </param> 4370 <param id="value_length"> 4371 <jint/> 4372 <description> 4373 The length of the string. 4374 The length is equal to the number of 16-bit Unicode 4375 characters in the string. 4376 </description> 4377 </param> 4378 <param id="user_data"> 4379 <outptr><void/></outptr> 4380 <description> 4381 The user supplied data that was passed into the iteration function. 4382 </description> 4383 </param> 4384 </parameters> 4385 </callback> 4386 4387 4388 <callback id="jvmtiReservedCallback" since="1.1"> 4389 <jint/> 4390 <synopsis>reserved for future use Callback</synopsis> 4391 <description> 4392 Placeholder -- reserved for future use. 4393 </description> 4394 <parameters> 4395 </parameters> 4396 </callback> 4397 4398 <function id="FollowReferences" num="115" since="1.1"> 4399 <synopsis>Follow References</synopsis> 4400 <description> 4401 This function initiates a traversal over the objects that are 4402 directly and indirectly reachable from the specified object or, 4403 if <code>initial_object</code> is not specified, all objects 4404 reachable from the heap roots. 4405 The heap root are the set of system classes, 4406 JNI globals, references from thread stacks, and other objects used as roots 4407 for the purposes of garbage collection. 4408 <p/> 4409 This function operates by traversing the reference graph. 4410 Let <i>A</i>, <i>B</i>, ... represent objects. 4411 When a reference from <i>A</i> to <i>B</i> is traversed, 4412 when a reference from a heap root to <i>B</i> is traversed, 4413 or when <i>B</i> is specified as the <paramlink id="initial_object"/>, 4414 then <i>B</i> is said to be <i>visited</i>. 4415 A reference from <i>A</i> to <i>B</i> is not traversed until <i>A</i> 4416 is visited. 4417 References are reported in the same order that the references are traversed. 4418 Object references are reported by invoking the agent supplied 4419 callback function <functionlink id="jvmtiHeapReferenceCallback"/>. 4420 In a reference from <i>A</i> to <i>B</i>, <i>A</i> is known 4421 as the <i>referrer</i> and <i>B</i> as the <i>referree</i>. 4422 The callback is invoked exactly once for each reference from a referrer; 4423 this is true even if there are reference cycles or multiple paths to 4424 the referrer. 4425 There may be more than one reference between a referrer and a referree, 4426 each reference is reported. 4427 These references may be distinguished by examining the 4428 <datalink 4429 id="jvmtiHeapReferenceCallback.reference_kind"><code>reference_kind</code></datalink> 4430 and 4431 <datalink 4432 id="jvmtiHeapReferenceCallback.reference_info"><code>reference_info</code></datalink> 4433 parameters of the <functionlink id="jvmtiHeapReferenceCallback"/> callback. 4434 <p/> 4435 This function reports a Java programming language view of object references, 4436 not a virtual machine implementation view. The following object references 4437 are reported when they are non-null: 4438 <ul> 4439 <li>Instance objects report references to each non-primitive instance fields 4440 (including inherited fields).</li> 4441 <li>Instance objects report a reference to the object type (class).</li> 4442 <li>Classes report a reference to the superclass and directly 4443 implemented/extended interfaces.</li> 4444 <li>Classes report a reference to the class loader, protection domain, 4445 signers, and resolved entries in the constant pool.</li> 4446 <li>Classes report a reference to each directly declared non-primitive 4447 static field.</li> 4448 <li>Arrays report a reference to the array type (class) and each 4449 array element.</li> 4450 <li>Primitive arrays report a reference to the array type.</li> 4451 </ul> 4452 <p/> 4453 This function can also be used to examine primitive (non-object) values. 4454 The primitive value of an array or String 4455 is reported after the object has been visited; 4456 it is reported by invoking the agent supplied callback function 4457 <functionlink id="jvmtiArrayPrimitiveValueCallback"/> or 4458 <functionlink id="jvmtiStringPrimitiveValueCallback"/>. 4459 A primitive field 4460 is reported after the object with that field is visited; 4461 it is reported by invoking the agent supplied callback function 4462 <functionlink id="jvmtiPrimitiveFieldCallback"/>. 4463 <p/> 4464 Whether a callback is provided or is <code>NULL</code> only determines 4465 whether the callback will be invoked, it does not influence 4466 which objects are visited nor does it influence whether other callbacks 4467 will be invoked. 4468 However, the 4469 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink> 4470 returned by <functionlink id="jvmtiHeapReferenceCallback"/> 4471 do determine if the objects referenced by the 4472 current object as visited. 4473 The <datalink id="jvmtiHeapFilter">heap filter flags</datalink> 4474 and <paramlink id="klass"/> provided as parameters to this function 4475 do not control which objects are visited but they do control which 4476 objects and primitive values are reported by the callbacks. 4477 For example, if the only callback that was set is 4478 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> and <code>klass</code> 4479 is set to the array of bytes class, then only arrays of byte will be 4480 reported. 4481 The table below summarizes this: 4482 <p/> 4483 <table> 4484 <tr> 4485 <th/> 4486 <th> 4487 Controls objects visited 4488 </th> 4489 <th> 4490 Controls objects reported 4491 </th> 4492 <th> 4493 Controls primitives reported 4494 </th> 4495 </tr> 4496 <tr> 4497 <th class="leftAligned"> 4498 the 4499 <datalink id="jvmtiHeapVisitControl">Heap Visit Control Flags</datalink> 4500 returned by <functionlink id="jvmtiHeapReferenceCallback"/> 4501 </th> 4502 <td class="centered"> 4503 <b>Yes</b> 4504 </td> 4505 <td class="centered"> 4506 <b>Yes</b>, since visits are controlled 4507 </td> 4508 <td class="centered"> 4509 <b>Yes</b>, since visits are controlled 4510 </td> 4511 </tr> 4512 <tr> 4513 <th class="leftAligned"> 4514 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> 4515 in <paramlink id="callbacks"/> set 4516 </th> 4517 <td class="centered"> 4518 No 4519 </td> 4520 <td class="centered"> 4521 <b>Yes</b> 4522 </td> 4523 <td class="centered"> 4524 No 4525 </td> 4526 </tr> 4527 <tr> 4528 <th class="leftAligned"> 4529 <paramlink id="heap_filter"/> 4530 </th> 4531 <td class="centered"> 4532 No 4533 </td> 4534 <td class="centered"> 4535 <b>Yes</b> 4536 </td> 4537 <td class="centered"> 4538 <b>Yes</b> 4539 </td> 4540 </tr> 4541 <tr> 4542 <th class="leftAligned"> 4543 <paramlink id="klass"/> 4544 </th> 4545 <td class="centered"> 4546 No 4547 </td> 4548 <td class="centered"> 4549 <b>Yes</b> 4550 </td> 4551 <td class="centered"> 4552 <b>Yes</b> 4553 </td> 4554 </tr> 4555 </table> 4556 <p/> 4557 During the execution of this function the state of the heap 4558 does not change: no objects are allocated, no objects are 4559 garbage collected, and the state of objects (including 4560 held values) does not change. 4561 As a result, threads executing Java 4562 programming language code, threads attempting to resume the 4563 execution of Java programming language code, and threads 4564 attempting to execute JNI functions are typically stalled. 4565 </description> 4566 <origin>new</origin> 4567 <capabilities> 4568 <required id="can_tag_objects"></required> 4569 </capabilities> 4570 <parameters> 4571 <param id="heap_filter"> 4572 <jint/> 4573 <description> 4574 This bit vector of 4575 <datalink id="jvmtiHeapFilter">heap filter flags</datalink>. 4576 restricts the objects for which the callback function is called. 4577 This applies to both the object and primitive callbacks. 4578 </description> 4579 </param> 4580 <param id="klass"> 4581 <ptrtype> 4582 <jclass/> 4583 <nullok>callbacks are not limited to instances of a particular 4584 class</nullok> 4585 </ptrtype> 4586 <description> 4587 Callbacks are only reported when the object is an instance of 4588 this class. 4589 Objects which are instances of a subclass of <code>klass</code> 4590 are not reported. 4591 If <code>klass</code> is an interface, no objects are reported. 4592 This applies to both the object and primitive callbacks. 4593 </description> 4594 </param> 4595 <param id="initial_object"> 4596 <ptrtype> 4597 <jobject/> 4598 <nullok>references are followed from the heap roots</nullok> 4599 </ptrtype> 4600 <description> 4601 The object to follow 4602 </description> 4603 </param> 4604 <param id="callbacks"> 4605 <inptr> 4606 <struct>jvmtiHeapCallbacks</struct> 4607 </inptr> 4608 <description> 4609 Structure defining the set of callback functions. 4610 </description> 4611 </param> 4612 <param id="user_data"> 4613 <inbuf> 4614 <void/> 4615 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 4616 </inbuf> 4617 <description> 4618 User supplied data to be passed to the callback. 4619 </description> 4620 </param> 4621 </parameters> 4622 <errors> 4623 <error id="JVMTI_ERROR_INVALID_CLASS"> 4624 <paramlink id="klass"/> is not a valid class. 4625 </error> 4626 <error id="JVMTI_ERROR_INVALID_OBJECT"> 4627 <paramlink id="initial_object"/> is not a valid object. 4628 </error> 4629 </errors> 4630 </function> 4631 4632 4633 <function id="IterateThroughHeap" num="116" since="1.1"> 4634 <synopsis>Iterate Through Heap</synopsis> 4635 <description> 4636 Initiate an iteration over all objects in the heap. 4637 This includes both reachable and 4638 unreachable objects. Objects are visited in no particular order. 4639 <p/> 4640 Heap objects are reported by invoking the agent supplied 4641 callback function <functionlink id="jvmtiHeapIterationCallback"/>. 4642 References between objects are not reported. 4643 If only reachable objects are desired, or if object reference information 4644 is needed, use <functionlink id="FollowReferences"/>. 4645 <p/> 4646 This function can also be used to examine primitive (non-object) values. 4647 The primitive value of an array or String 4648 is reported after the object has been visited; 4649 it is reported by invoking the agent supplied callback function 4650 <functionlink id="jvmtiArrayPrimitiveValueCallback"/> or 4651 <functionlink id="jvmtiStringPrimitiveValueCallback"/>. 4652 A primitive field 4653 is reported after the object with that field is visited; 4654 it is reported by invoking the agent supplied 4655 callback function 4656 <functionlink id="jvmtiPrimitiveFieldCallback"/>. 4657 <p/> 4658 Unless the iteration is aborted by the 4659 <datalink id="jvmtiHeapVisitControl">Heap Visit Control Flags</datalink> 4660 returned by a callback, all objects in the heap are visited. 4661 Whether a callback is provided or is <code>NULL</code> only determines 4662 whether the callback will be invoked, it does not influence 4663 which objects are visited nor does it influence whether other callbacks 4664 will be invoked. 4665 The <datalink id="jvmtiHeapFilter">heap filter flags</datalink> 4666 and <paramlink id="klass"/> provided as parameters to this function 4667 do not control which objects are visited but they do control which 4668 objects and primitive values are reported by the callbacks. 4669 For example, if the only callback that was set is 4670 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> and <code>klass</code> 4671 is set to the array of bytes class, then only arrays of byte will be 4672 reported. The table below summarizes this (contrast this with 4673 <functionlink id="FollowReferences"/>): 4674 <p/> 4675 <table> 4676 <tr> 4677 <th/> 4678 <th> 4679 Controls objects visited 4680 </th> 4681 <th> 4682 Controls objects reported 4683 </th> 4684 <th> 4685 Controls primitives reported 4686 </th> 4687 </tr> 4688 <tr> 4689 <th class="leftAligned"> 4690 the 4691 <datalink id="jvmtiHeapVisitControl">Heap Visit Control Flags</datalink> 4692 returned by <functionlink id="jvmtiHeapIterationCallback"/> 4693 </th> 4694 <td class="centered"> 4695 No<br/>(unless they abort the iteration) 4696 </td> 4697 <td class="centered"> 4698 No<br/>(unless they abort the iteration) 4699 </td> 4700 <td class="centered"> 4701 No<br/>(unless they abort the iteration) 4702 </td> 4703 </tr> 4704 <tr> 4705 <th class="leftAligned"> 4706 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> 4707 in <paramlink id="callbacks"/> set 4708 </th> 4709 <td class="centered"> 4710 No 4711 </td> 4712 <td class="centered"> 4713 <b>Yes</b> 4714 </td> 4715 <td class="centered"> 4716 No 4717 </td> 4718 </tr> 4719 <tr> 4720 <th class="leftAligned"> 4721 <paramlink id="heap_filter"/> 4722 </th> 4723 <td class="centered"> 4724 No 4725 </td> 4726 <td class="centered"> 4727 <b>Yes</b> 4728 </td> 4729 <td class="centered"> 4730 <b>Yes</b> 4731 </td> 4732 </tr> 4733 <tr> 4734 <th class="leftAligned"> 4735 <paramlink id="klass"/> 4736 </th> 4737 <td class="centered"> 4738 No 4739 </td> 4740 <td class="centered"> 4741 <b>Yes</b> 4742 </td> 4743 <td class="centered"> 4744 <b>Yes</b> 4745 </td> 4746 </tr> 4747 </table> 4748 <p/> 4749 During the execution of this function the state of the heap 4750 does not change: no objects are allocated, no objects are 4751 garbage collected, and the state of objects (including 4752 held values) does not change. 4753 As a result, threads executing Java 4754 programming language code, threads attempting to resume the 4755 execution of Java programming language code, and threads 4756 attempting to execute JNI functions are typically stalled. 4757 </description> 4758 <origin>new</origin> 4759 <capabilities> 4760 <required id="can_tag_objects"></required> 4761 </capabilities> 4762 <parameters> 4763 <param id="heap_filter"> 4764 <jint/> 4765 <description> 4766 This bit vector of 4767 <datalink id="jvmtiHeapFilter">heap filter flags</datalink>. 4768 restricts the objects for which the callback function is called. 4769 This applies to both the object and primitive callbacks. 4770 </description> 4771 </param> 4772 <param id="klass"> 4773 <ptrtype> 4774 <jclass/> 4775 <nullok>callbacks are not limited to instances of a particular class</nullok> 4776 </ptrtype> 4777 <description> 4778 Callbacks are only reported when the object is an instance of 4779 this class. 4780 Objects which are instances of a subclass of <code>klass</code> 4781 are not reported. 4782 If <code>klass</code> is an interface, no objects are reported. 4783 This applies to both the object and primitive callbacks. 4784 </description> 4785 </param> 4786 <param id="callbacks"> 4787 <inptr> 4788 <struct>jvmtiHeapCallbacks</struct> 4789 </inptr> 4790 <description> 4791 Structure defining the set callback functions. 4792 </description> 4793 </param> 4794 <param id="user_data"> 4795 <inbuf> 4796 <void/> 4797 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 4798 </inbuf> 4799 <description> 4800 User supplied data to be passed to the callback. 4801 </description> 4802 </param> 4803 </parameters> 4804 <errors> 4805 <error id="JVMTI_ERROR_INVALID_CLASS"> 4806 <paramlink id="klass"/> is not a valid class. 4807 </error> 4808 </errors> 4809 </function> 4810 4811 <function id="GetTag" phase="start" num="106"> 4812 <synopsis>Get Tag</synopsis> 4813 <description> 4814 Retrieve the tag associated with an object. 4815 The tag is a long value typically used to store a 4816 unique identifier or pointer to object information. 4817 The tag is set with 4818 <functionlink id="SetTag"></functionlink>. 4819 Objects for which no tags have been set return a 4820 tag value of zero. 4821 </description> 4822 <origin>new</origin> 4823 <capabilities> 4824 <required id="can_tag_objects"></required> 4825 </capabilities> 4826 <parameters> 4827 <param id="object"> 4828 <jobject/> 4829 <description> 4830 The object whose tag is to be retrieved. 4831 </description> 4832 </param> 4833 <param id="tag_ptr"> 4834 <outptr><jlong/></outptr> 4835 <description> 4836 On return, the referenced long is set to the value 4837 of the tag. 4838 </description> 4839 </param> 4840 </parameters> 4841 <errors> 4842 </errors> 4843 </function> 4844 4845 <function id="SetTag" phase="start" num="107"> 4846 <synopsis>Set Tag</synopsis> 4847 <description> 4848 Set the tag associated with an object. 4849 The tag is a long value typically used to store a 4850 unique identifier or pointer to object information. 4851 The tag is visible with 4852 <functionlink id="GetTag"></functionlink>. 4853 </description> 4854 <origin>new</origin> 4855 <capabilities> 4856 <required id="can_tag_objects"></required> 4857 </capabilities> 4858 <parameters> 4859 <param id="object"> 4860 <jobject/> 4861 <description> 4862 The object whose tag is to be set. 4863 </description> 4864 </param> 4865 <param id="tag"> 4866 <jlong/> 4867 <description> 4868 The new value of the tag. 4869 </description> 4870 </param> 4871 </parameters> 4872 <errors> 4873 </errors> 4874 </function> 4875 4876 <function id="GetObjectsWithTags" num="114"> 4877 <synopsis>Get Objects With Tags</synopsis> 4878 <description> 4879 Return objects in the heap with the specified tags. 4880 The format is parallel arrays of objects and tags. 4881 </description> 4882 <origin>new</origin> 4883 <capabilities> 4884 <required id="can_tag_objects"></required> 4885 </capabilities> 4886 <parameters> 4887 <param id="tag_count"> 4888 <jint min="0"/> 4889 <description> 4890 Number of tags to scan for. 4891 </description> 4892 </param> 4893 <param id="tags"> 4894 <inbuf incount="tag_count"> 4895 <jlong/> 4896 </inbuf> 4897 <description> 4898 Scan for objects with these tags. 4899 Zero is not permitted in this array. 4900 </description> 4901 </param> 4902 <param id="count_ptr"> 4903 <outptr> 4904 <jint/> 4905 </outptr> 4906 <description> 4907 Return the number of objects with any of the tags 4908 in <paramlink id="tags"/>. 4909 </description> 4910 </param> 4911 <param id="object_result_ptr"> 4912 <allocbuf outcount="count_ptr"> 4913 <jobject/> 4914 <nullok>this information is not returned</nullok> 4915 </allocbuf> 4916 <description> 4917 Returns the array of objects with any of the tags 4918 in <paramlink id="tags"/>. 4919 </description> 4920 </param> 4921 <param id="tag_result_ptr"> 4922 <allocbuf outcount="count_ptr"> 4923 <jlong/> 4924 <nullok>this information is not returned</nullok> 4925 </allocbuf> 4926 <description> 4927 For each object in <paramlink id="object_result_ptr"/>, 4928 return the tag at the corresponding index. 4929 </description> 4930 </param> 4931 </parameters> 4932 <errors> 4933 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 4934 Zero is present in <paramlink id="tags"></paramlink>. 4935 </error> 4936 </errors> 4937 </function> 4938 4939 <function id="ForceGarbageCollection" num="108"> 4940 <synopsis>Force Garbage Collection</synopsis> 4941 <description> 4942 Force the VM to perform a garbage collection. 4943 The garbage collection is as complete as possible. 4944 This function does not cause finalizers to be run. 4945 This function does not return until the garbage collection 4946 is finished. 4947 <p/> 4948 Although garbage collection is as complete 4949 as possible there is no guarantee that all 4950 <eventlink id="ObjectFree"/> 4951 events will have been 4952 sent by the time that this function 4953 returns. In particular, an object may be 4954 prevented from being freed because it 4955 is awaiting finalization. 4956 </description> 4957 <origin>new</origin> 4958 <capabilities> 4959 </capabilities> 4960 <parameters> 4961 </parameters> 4962 <errors> 4963 </errors> 4964 </function> 4965 4966 4967 </category> 4968 4969 <category id="Heap_1_0" label="Heap (1.0)"> 4970 <intro> 4971 <b> 4972 These functions and data types were introduced in the original 4973 <jvmti/> version 1.0 and have been superseded by more 4974 </b> 4975 <internallink id="Heap"><b>powerful and flexible versions</b></internallink> 4976 <b> 4977 which: 4978 </b> 4979 <ul> 4980 <li> 4981 <b> 4982 Allow access to primitive values (the value of Strings, arrays, 4983 and primitive fields) 4984 </b> 4985 </li> 4986 <li> 4987 <b> 4988 Allow the tag of the referrer to be set, thus enabling more 4989 efficient localized reference graph building 4990 </b> 4991 </li> 4992 <li> 4993 <b> 4994 Provide more extensive filtering abilities 4995 </b> 4996 </li> 4997 <li> 4998 <b> 4999 Are extensible, allowing their abilities to grow in future versions of <jvmti/> 5000 </b> 5001 </li> 5002 </ul> 5003 <p/> 5004 <b>Please use the </b> 5005 <internallink id="Heap"><b>current Heap functions</b></internallink>. 5006 <p/> 5007 <constants id="jvmtiHeapObjectFilter" label="Heap Object Filter Enumeration" kind="enum"> 5008 <constant id="JVMTI_HEAP_OBJECT_TAGGED" num="1"> 5009 Tagged objects only. 5010 </constant> 5011 <constant id="JVMTI_HEAP_OBJECT_UNTAGGED" num="2"> 5012 Untagged objects only. 5013 </constant> 5014 <constant id="JVMTI_HEAP_OBJECT_EITHER" num="3"> 5015 Either tagged or untagged objects. 5016 </constant> 5017 </constants> 5018 5019 <constants id="jvmtiHeapRootKind" label="Heap Root Kind Enumeration" kind="enum"> 5020 <constant id="JVMTI_HEAP_ROOT_JNI_GLOBAL" num="1"> 5021 JNI global reference. 5022 </constant> 5023 <constant id="JVMTI_HEAP_ROOT_SYSTEM_CLASS" num="2"> 5024 System class. 5025 </constant> 5026 <constant id="JVMTI_HEAP_ROOT_MONITOR" num="3"> 5027 Monitor. 5028 </constant> 5029 <constant id="JVMTI_HEAP_ROOT_STACK_LOCAL" num="4"> 5030 Stack local. 5031 </constant> 5032 <constant id="JVMTI_HEAP_ROOT_JNI_LOCAL" num="5"> 5033 JNI local reference. 5034 </constant> 5035 <constant id="JVMTI_HEAP_ROOT_THREAD" num="6"> 5036 Thread. 5037 </constant> 5038 <constant id="JVMTI_HEAP_ROOT_OTHER" num="7"> 5039 Other. 5040 </constant> 5041 </constants> 5042 5043 <constants id="jvmtiObjectReferenceKind" label="Object Reference Enumeration" kind="enum"> 5044 <constant id="JVMTI_REFERENCE_CLASS" num="1"> 5045 Reference from an object to its class. 5046 </constant> 5047 <constant id="JVMTI_REFERENCE_FIELD" num="2"> 5048 Reference from an object to the value of one of its instance fields. 5049 For references of this kind the <code>referrer_index</code> 5050 parameter to the <internallink id="jvmtiObjectReferenceCallback"> 5051 jvmtiObjectReferenceCallback</internallink> is the index of the 5052 the instance field. The index is based on the order of all the 5053 object's fields. This includes all fields of the directly declared 5054 static and instance fields in the class, and includes all fields (both 5055 public and private) fields declared in superclasses and superinterfaces. 5056 The index is thus calculated by summing the index of the field in the directly 5057 declared class (see <functionlink id="GetClassFields"/>), with the total 5058 number of fields (both public and private) declared in all superclasses 5059 and superinterfaces. The index starts at zero. 5060 </constant> 5061 <constant id="JVMTI_REFERENCE_ARRAY_ELEMENT" num="3"> 5062 Reference from an array to one of its elements. 5063 For references of this kind the <code>referrer_index</code> 5064 parameter to the <internallink id="jvmtiObjectReferenceCallback"> 5065 jvmtiObjectReferenceCallback</internallink> is the array index. 5066 </constant> 5067 <constant id="JVMTI_REFERENCE_CLASS_LOADER" num="4"> 5068 Reference from a class to its class loader. 5069 </constant> 5070 <constant id="JVMTI_REFERENCE_SIGNERS" num="5"> 5071 Reference from a class to its signers array. 5072 </constant> 5073 <constant id="JVMTI_REFERENCE_PROTECTION_DOMAIN" num="6"> 5074 Reference from a class to its protection domain. 5075 </constant> 5076 <constant id="JVMTI_REFERENCE_INTERFACE" num="7"> 5077 Reference from a class to one of its interfaces. 5078 </constant> 5079 <constant id="JVMTI_REFERENCE_STATIC_FIELD" num="8"> 5080 Reference from a class to the value of one of its static fields. 5081 For references of this kind the <code>referrer_index</code> 5082 parameter to the <internallink id="jvmtiObjectReferenceCallback"> 5083 jvmtiObjectReferenceCallback</internallink> is the index of the 5084 the static field. The index is based on the order of all the 5085 object's fields. This includes all fields of the directly declared 5086 static and instance fields in the class, and includes all fields (both 5087 public and private) fields declared in superclasses and superinterfaces. 5088 The index is thus calculated by summing the index of the field in the directly 5089 declared class (see <functionlink id="GetClassFields"/>), with the total 5090 number of fields (both public and private) declared in all superclasses 5091 and superinterfaces. The index starts at zero. 5092 Note: this definition differs from that in the <jvmti/> 1.0 Specification. 5093 <rationale>No known implementations used the 1.0 definition.</rationale> 5094 </constant> 5095 <constant id="JVMTI_REFERENCE_CONSTANT_POOL" num="9"> 5096 Reference from a class to a resolved entry in the constant pool. 5097 For references of this kind the <code>referrer_index</code> 5098 parameter to the <internallink id="jvmtiObjectReferenceCallback"> 5099 jvmtiObjectReferenceCallback</internallink> is the index into 5100 constant pool table of the class, starting at 1. See 5101 <vmspec chapter="4.4"/>. 5102 </constant> 5103 </constants> 5104 5105 <constants id="jvmtiIterationControl" label="Iteration Control Enumeration" kind="enum"> 5106 <constant id="JVMTI_ITERATION_CONTINUE" num="1"> 5107 Continue the iteration. 5108 If this is a reference iteration, follow the references of this object. 5109 </constant> 5110 <constant id="JVMTI_ITERATION_IGNORE" num="2"> 5111 Continue the iteration. 5112 If this is a reference iteration, ignore the references of this object. 5113 </constant> 5114 <constant id="JVMTI_ITERATION_ABORT" num="0"> 5115 Abort the iteration. 5116 </constant> 5117 </constants> 5118 </intro> 5119 5120 <callback id="jvmtiHeapObjectCallback"> 5121 <enum>jvmtiIterationControl</enum> 5122 <synopsis>Heap Object Callback</synopsis> 5123 <description> 5124 Agent supplied callback function. 5125 Describes (but does not pass in) an object in the heap. 5126 <p/> 5127 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration, 5128 or <code>JVMTI_ITERATION_ABORT</code> to stop iteration. 5129 <p/> 5130 See the <internallink id="heapCallbacks">heap callback 5131 function restrictions</internallink>. 5132 </description> 5133 <parameters> 5134 <param id="class_tag"> 5135 <jlong/> 5136 <description> 5137 The tag of the class of object (zero if the class is not tagged). 5138 If the object represents a runtime class, 5139 the <code>class_tag</code> is the tag 5140 associated with <code>java.lang.Class</code> 5141 (zero if <code>java.lang.Class</code> is not tagged). 5142 </description> 5143 </param> 5144 <param id="size"> 5145 <jlong/> 5146 <description> 5147 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 5148 </description> 5149 </param> 5150 <param id="tag_ptr"> 5151 <outptr><jlong/></outptr> 5152 <description> 5153 The object tag value, or zero if the object is not tagged. 5154 To set the tag value to be associated with the object 5155 the agent sets the <code>jlong</code> pointed to by the parameter. 5156 </description> 5157 </param> 5158 <param id="user_data"> 5159 <outptr><void/></outptr> 5160 <description> 5161 The user supplied data that was passed into the iteration function. 5162 </description> 5163 </param> 5164 </parameters> 5165 </callback> 5166 5167 <callback id="jvmtiHeapRootCallback"> 5168 <enum>jvmtiIterationControl</enum> 5169 <synopsis>Heap Root Object Callback</synopsis> 5170 <description> 5171 Agent supplied callback function. 5172 Describes (but does not pass in) an object that is a root for the purposes 5173 of garbage collection. 5174 <p/> 5175 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration, 5176 <code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing 5177 references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration. 5178 <p/> 5179 See the <internallink id="heapCallbacks">heap callback 5180 function restrictions</internallink>. 5181 </description> 5182 <parameters> 5183 <param id="root_kind"> 5184 <enum>jvmtiHeapRootKind</enum> 5185 <description> 5186 The kind of heap root. 5187 </description> 5188 </param> 5189 <param id="class_tag"> 5190 <jlong/> 5191 <description> 5192 The tag of the class of object (zero if the class is not tagged). 5193 If the object represents a runtime class, the <code>class_tag</code> is the tag 5194 associated with <code>java.lang.Class</code> 5195 (zero if <code>java.lang.Class</code> is not tagged). 5196 </description> 5197 </param> 5198 <param id="size"> 5199 <jlong/> 5200 <description> 5201 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 5202 </description> 5203 </param> 5204 <param id="tag_ptr"> 5205 <outptr><jlong/></outptr> 5206 <description> 5207 The object tag value, or zero if the object is not tagged. 5208 To set the tag value to be associated with the object 5209 the agent sets the <code>jlong</code> pointed to by the parameter. 5210 </description> 5211 </param> 5212 <param id="user_data"> 5213 <outptr><void/></outptr> 5214 <description> 5215 The user supplied data that was passed into the iteration function. 5216 </description> 5217 </param> 5218 </parameters> 5219 </callback> 5220 5221 <callback id="jvmtiStackReferenceCallback"> 5222 <enum>jvmtiIterationControl</enum> 5223 <synopsis>Stack Reference Object Callback</synopsis> 5224 <description> 5225 Agent supplied callback function. 5226 Describes (but does not pass in) an object on the stack that is a root for 5227 the purposes of garbage collection. 5228 <p/> 5229 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration, 5230 <code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing 5231 references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration. 5232 <p/> 5233 See the <internallink id="heapCallbacks">heap callback 5234 function restrictions</internallink>. 5235 </description> 5236 <parameters> 5237 <param id="root_kind"> 5238 <enum>jvmtiHeapRootKind</enum> 5239 <description> 5240 The kind of root (either <code>JVMTI_HEAP_ROOT_STACK_LOCAL</code> or 5241 <code>JVMTI_HEAP_ROOT_JNI_LOCAL</code>). 5242 </description> 5243 </param> 5244 <param id="class_tag"> 5245 <jlong/> 5246 <description> 5247 The tag of the class of object (zero if the class is not tagged). 5248 If the object represents a runtime class, the <code>class_tag</code> is the tag 5249 associated with <code>java.lang.Class</code> 5250 (zero if <code>java.lang.Class</code> is not tagged). 5251 </description> 5252 </param> 5253 <param id="size"> 5254 <jlong/> 5255 <description> 5256 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 5257 </description> 5258 </param> 5259 <param id="tag_ptr"> 5260 <outptr><jlong/></outptr> 5261 <description> 5262 The object tag value, or zero if the object is not tagged. 5263 To set the tag value to be associated with the object 5264 the agent sets the <code>jlong</code> pointed to by the parameter. 5265 </description> 5266 </param> 5267 <param id="thread_tag"> 5268 <jlong/> 5269 <description> 5270 The tag of the thread corresponding to this stack, zero if not tagged. 5271 </description> 5272 </param> 5273 <param id="depth"> 5274 <jint/> 5275 <description> 5276 The depth of the frame. 5277 </description> 5278 </param> 5279 <param id="method"> 5280 <jmethodID/> 5281 <description> 5282 The method executing in this frame. 5283 </description> 5284 </param> 5285 <param id="slot"> 5286 <jint/> 5287 <description> 5288 The slot number. 5289 </description> 5290 </param> 5291 <param id="user_data"> 5292 <outptr><void/></outptr> 5293 <description> 5294 The user supplied data that was passed into the iteration function. 5295 </description> 5296 </param> 5297 </parameters> 5298 </callback> 5299 5300 <callback id="jvmtiObjectReferenceCallback"> 5301 <enum>jvmtiIterationControl</enum> 5302 <synopsis>Object Reference Callback</synopsis> 5303 <description> 5304 Agent supplied callback function. 5305 Describes a reference from an object (the referrer) to another object 5306 (the referree). 5307 <p/> 5308 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration, 5309 <code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing 5310 references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration. 5311 <p/> 5312 See the <internallink id="heapCallbacks">heap callback 5313 function restrictions</internallink>. 5314 </description> 5315 <parameters> 5316 <param id="reference_kind"> 5317 <enum>jvmtiObjectReferenceKind</enum> 5318 <description> 5319 The type of reference. 5320 </description> 5321 </param> 5322 <param id="class_tag"> 5323 <jlong/> 5324 <description> 5325 The tag of the class of referree object (zero if the class is not tagged). 5326 If the referree object represents a runtime class, 5327 the <code>class_tag</code> is the tag 5328 associated with <code>java.lang.Class</code> 5329 (zero if <code>java.lang.Class</code> is not tagged). 5330 </description> 5331 </param> 5332 <param id="size"> 5333 <jlong/> 5334 <description> 5335 Size of the referree object (in bytes). 5336 See <functionlink id="GetObjectSize"/>. 5337 </description> 5338 </param> 5339 <param id="tag_ptr"> 5340 <outptr><jlong/></outptr> 5341 <description> 5342 The referree object tag value, or zero if the object is not 5343 tagged. 5344 To set the tag value to be associated with the object 5345 the agent sets the <code>jlong</code> pointed to by the parameter. 5346 </description> 5347 </param> 5348 <param id="referrer_tag"> 5349 <jlong/> 5350 <description> 5351 The tag of the referrer object, or zero if the referrer 5352 object is not tagged. 5353 </description> 5354 </param> 5355 <param id="referrer_index"> 5356 <jint/> 5357 <description> 5358 For references of type <code>JVMTI_REFERENCE_FIELD</code> or 5359 <code>JVMTI_REFERENCE_STATIC_FIELD</code> the index 5360 of the field in the referrer object. The index is based on the 5361 order of all the object's fields - see <internallink 5362 id="JVMTI_REFERENCE_FIELD">JVMTI_REFERENCE_FIELD</internallink> 5363 or <internallink 5364 id="JVMTI_REFERENCE_STATIC_FIELD">JVMTI_REFERENCE_STATIC_FIELD 5365 </internallink> for further description. 5366 <p/> 5367 For references of type <code>JVMTI_REFERENCE_ARRAY_ELEMENT</code> 5368 the array index - see <internallink id="JVMTI_REFERENCE_ARRAY_ELEMENT"> 5369 JVMTI_REFERENCE_ARRAY_ELEMENT</internallink> for further description. 5370 <p/> 5371 For references of type <code>JVMTI_REFERENCE_CONSTANT_POOL</code> 5372 the index into the constant pool of the class - see 5373 <internallink id="JVMTI_REFERENCE_CONSTANT_POOL"> 5374 JVMTI_REFERENCE_CONSTANT_POOL</internallink> for further 5375 description. 5376 <p/> 5377 For references of other kinds the <code>referrer_index</code> is 5378 <code>-1</code>. 5379 </description> 5380 </param> 5381 <param id="user_data"> 5382 <outptr><void/></outptr> 5383 <description> 5384 The user supplied data that was passed into the iteration function. 5385 </description> 5386 </param> 5387 </parameters> 5388 </callback> 5389 5390 <function id="IterateOverObjectsReachableFromObject" num="109"> 5391 <synopsis>Iterate Over Objects Reachable From Object</synopsis> 5392 <description> 5393 This function iterates over all objects that are directly 5394 and indirectly reachable from the specified object. 5395 For each object <i>A</i> (known 5396 as the referrer) with a reference to object <i>B</i> the specified 5397 callback function is called to describe the object reference. 5398 The callback is called exactly once for each reference from a referrer; 5399 this is true even if there are reference cycles or multiple paths to 5400 the referrer. 5401 There may be more than one reference between a referrer and a referree, 5402 These may be distinguished by the 5403 <datalink id="jvmtiObjectReferenceCallback.reference_kind"></datalink> and 5404 <datalink id="jvmtiObjectReferenceCallback.referrer_index"></datalink>. 5405 The callback for an object will always occur after the callback for 5406 its referrer. 5407 <p/> 5408 See <functionlink id="FollowReferences"/> for the object 5409 references which are reported. 5410 <p/> 5411 During the execution of this function the state of the heap 5412 does not change: no objects are allocated, no objects are 5413 garbage collected, and the state of objects (including 5414 held values) does not change. 5415 As a result, threads executing Java 5416 programming language code, threads attempting to resume the 5417 execution of Java programming language code, and threads 5418 attempting to execute JNI functions are typically stalled. 5419 </description> 5420 <origin>new</origin> 5421 <capabilities> 5422 <required id="can_tag_objects"></required> 5423 </capabilities> 5424 <parameters> 5425 <param id="object"> 5426 <jobject/> 5427 <description> 5428 The object 5429 </description> 5430 </param> 5431 <param id="object_reference_callback"> 5432 <ptrtype> 5433 <struct>jvmtiObjectReferenceCallback</struct> 5434 </ptrtype> 5435 <description> 5436 The callback to be called to describe each 5437 object reference. 5438 </description> 5439 </param> 5440 <param id="user_data"> 5441 <inbuf> 5442 <void/> 5443 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 5444 </inbuf> 5445 <description> 5446 User supplied data to be passed to the callback. 5447 </description> 5448 </param> 5449 </parameters> 5450 <errors> 5451 </errors> 5452 </function> 5453 5454 <function id="IterateOverReachableObjects" num="110"> 5455 <synopsis>Iterate Over Reachable Objects</synopsis> 5456 <description> 5457 This function iterates over the root objects and all objects that 5458 are directly and indirectly reachable from the root objects. 5459 The root objects comprise the set of system classes, 5460 JNI globals, references from thread stacks, and other objects used as roots 5461 for the purposes of garbage collection. 5462 <p/> 5463 For each root the <paramlink id="heap_root_callback"></paramlink> 5464 or <paramlink id="stack_ref_callback"></paramlink> callback is called. 5465 An object can be a root object for more than one reason and in that case 5466 the appropriate callback is called for each reason. 5467 <p/> 5468 For each object reference the <paramlink id="object_ref_callback"></paramlink> 5469 callback function is called to describe the object reference. 5470 The callback is called exactly once for each reference from a referrer; 5471 this is true even if there are reference cycles or multiple paths to 5472 the referrer. 5473 There may be more than one reference between a referrer and a referree, 5474 These may be distinguished by the 5475 <datalink id="jvmtiObjectReferenceCallback.reference_kind"></datalink> and 5476 <datalink id="jvmtiObjectReferenceCallback.referrer_index"></datalink>. 5477 The callback for an object will always occur after the callback for 5478 its referrer. 5479 <p/> 5480 See <functionlink id="FollowReferences"/> for the object 5481 references which are reported. 5482 <p/> 5483 Roots are always reported to the profiler before any object references 5484 are reported. In other words, the <paramlink id="object_ref_callback"></paramlink> 5485 callback will not be called until the appropriate callback has been called 5486 for all roots. If the <paramlink id="object_ref_callback"></paramlink> callback is 5487 specified as <code>NULL</code> then this function returns after 5488 reporting the root objects to the profiler. 5489 <p/> 5490 During the execution of this function the state of the heap 5491 does not change: no objects are allocated, no objects are 5492 garbage collected, and the state of objects (including 5493 held values) does not change. 5494 As a result, threads executing Java 5495 programming language code, threads attempting to resume the 5496 execution of Java programming language code, and threads 5497 attempting to execute JNI functions are typically stalled. 5498 </description> 5499 <origin>new</origin> 5500 <capabilities> 5501 <required id="can_tag_objects"></required> 5502 </capabilities> 5503 <parameters> 5504 <param id="heap_root_callback"> 5505 <ptrtype> 5506 <struct>jvmtiHeapRootCallback</struct> 5507 <nullok>do not report heap roots</nullok> 5508 </ptrtype> 5509 <description> 5510 The callback function to be called for each heap root of type 5511 <code>JVMTI_HEAP_ROOT_JNI_GLOBAL</code>, 5512 <code>JVMTI_HEAP_ROOT_SYSTEM_CLASS</code>, 5513 <code>JVMTI_HEAP_ROOT_MONITOR</code>, 5514 <code>JVMTI_HEAP_ROOT_THREAD</code>, or 5515 <code>JVMTI_HEAP_ROOT_OTHER</code>. 5516 </description> 5517 </param> 5518 <param id="stack_ref_callback"> 5519 <ptrtype> 5520 <struct>jvmtiStackReferenceCallback</struct> 5521 <nullok>do not report stack references</nullok> 5522 </ptrtype> 5523 <description> 5524 The callback function to be called for each heap root of 5525 <code>JVMTI_HEAP_ROOT_STACK_LOCAL</code> or 5526 <code>JVMTI_HEAP_ROOT_JNI_LOCAL</code>. 5527 </description> 5528 </param> 5529 <param id="object_ref_callback"> 5530 <ptrtype> 5531 <struct>jvmtiObjectReferenceCallback</struct> 5532 <nullok>do not follow references from the root objects</nullok> 5533 </ptrtype> 5534 <description> 5535 The callback function to be called for each object reference. 5536 </description> 5537 </param> 5538 <param id="user_data"> 5539 <inbuf> 5540 <void/> 5541 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 5542 </inbuf> 5543 <description> 5544 User supplied data to be passed to the callback. 5545 </description> 5546 </param> 5547 </parameters> 5548 <errors> 5549 </errors> 5550 </function> 5551 5552 <function id="IterateOverHeap" num="111"> 5553 <synopsis>Iterate Over Heap</synopsis> 5554 <description> 5555 Iterate over all objects in the heap. This includes both reachable and 5556 unreachable objects. 5557 <p/> 5558 The <paramlink id="object_filter"></paramlink> parameter indicates the 5559 objects for which the callback function is called. If this parameter 5560 is <code>JVMTI_HEAP_OBJECT_TAGGED</code> then the callback will only be 5561 called for every object that is tagged. If the parameter is 5562 <code>JVMTI_HEAP_OBJECT_UNTAGGED</code> then the callback will only be 5563 for objects that are not tagged. If the parameter 5564 is <code>JVMTI_HEAP_OBJECT_EITHER</code> then the callback will be 5565 called for every object in the heap, irrespective of whether it is 5566 tagged or not. 5567 <p/> 5568 During the execution of this function the state of the heap 5569 does not change: no objects are allocated, no objects are 5570 garbage collected, and the state of objects (including 5571 held values) does not change. 5572 As a result, threads executing Java 5573 programming language code, threads attempting to resume the 5574 execution of Java programming language code, and threads 5575 attempting to execute JNI functions are typically stalled. 5576 </description> 5577 <origin>new</origin> 5578 <capabilities> 5579 <required id="can_tag_objects"></required> 5580 </capabilities> 5581 <parameters> 5582 <param id="object_filter"> 5583 <enum>jvmtiHeapObjectFilter</enum> 5584 <description> 5585 Indicates the objects for which the callback function is called. 5586 </description> 5587 </param> 5588 <param id="heap_object_callback"> 5589 <ptrtype> 5590 <struct>jvmtiHeapObjectCallback</struct> 5591 </ptrtype> 5592 <description> 5593 The iterator function to be called for each 5594 object matching the <paramlink id="object_filter"/>. 5595 </description> 5596 </param> 5597 <param id="user_data"> 5598 <inbuf> 5599 <void/> 5600 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 5601 </inbuf> 5602 <description> 5603 User supplied data to be passed to the callback. 5604 </description> 5605 </param> 5606 </parameters> 5607 <errors> 5608 </errors> 5609 </function> 5610 5611 <function id="IterateOverInstancesOfClass" num="112"> 5612 <synopsis>Iterate Over Instances Of Class</synopsis> 5613 <description> 5614 Iterate over all objects in the heap that are instances of the specified class. 5615 This includes direct instances of the specified class and 5616 instances of all subclasses of the specified class. 5617 This includes both reachable and unreachable objects. 5618 <p/> 5619 The <paramlink id="object_filter"></paramlink> parameter indicates the 5620 objects for which the callback function is called. If this parameter 5621 is <code>JVMTI_HEAP_OBJECT_TAGGED</code> then the callback will only be 5622 called for every object that is tagged. If the parameter is 5623 <code>JVMTI_HEAP_OBJECT_UNTAGGED</code> then the callback will only be 5624 called for objects that are not tagged. If the parameter 5625 is <code>JVMTI_HEAP_OBJECT_EITHER</code> then the callback will be 5626 called for every object in the heap, irrespective of whether it is 5627 tagged or not. 5628 <p/> 5629 During the execution of this function the state of the heap 5630 does not change: no objects are allocated, no objects are 5631 garbage collected, and the state of objects (including 5632 held values) does not change. 5633 As a result, threads executing Java 5634 programming language code, threads attempting to resume the 5635 execution of Java programming language code, and threads 5636 attempting to execute JNI functions are typically stalled. 5637 </description> 5638 <origin>new</origin> 5639 <capabilities> 5640 <required id="can_tag_objects"></required> 5641 </capabilities> 5642 <parameters> 5643 <param id="klass"> 5644 <jclass/> 5645 <description> 5646 Iterate over objects of this class only. 5647 </description> 5648 </param> 5649 <param id="object_filter"> 5650 <enum>jvmtiHeapObjectFilter</enum> 5651 <description> 5652 Indicates the objects for which the callback function is called. 5653 </description> 5654 </param> 5655 <param id="heap_object_callback"> 5656 <ptrtype> 5657 <struct>jvmtiHeapObjectCallback</struct> 5658 </ptrtype> 5659 <description> 5660 The iterator function to be called for each 5661 <paramlink id="klass"/> instance matching 5662 the <paramlink id="object_filter"/>. 5663 </description> 5664 </param> 5665 <param id="user_data"> 5666 <inbuf> 5667 <void/> 5668 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 5669 </inbuf> 5670 <description> 5671 User supplied data to be passed to the callback. 5672 </description> 5673 </param> 5674 </parameters> 5675 <errors> 5676 </errors> 5677 </function> 5678 5679 </category> 5680 5681 <category id="local" label="Local Variable"> 5682 5683 <intro> 5684 These functions are used to retrieve or set the value of a local variable. 5685 The variable is identified by the depth of the frame containing its 5686 value and the variable's slot number within that frame. 5687 The mapping of variables to 5688 slot numbers can be obtained with the function 5689 <functionlink id="GetLocalVariableTable"></functionlink>. 5690 </intro> 5691 5692 <function id="GetLocalObject" num="21"> 5693 <synopsis>Get Local Variable - Object</synopsis> 5694 <description> 5695 This function can be used to retrieve the value of a local 5696 variable whose type is <code>Object</code> or a subclass of <code>Object</code>. 5697 </description> 5698 <origin>jvmdi</origin> 5699 <capabilities> 5700 <required id="can_access_local_variables"></required> 5701 </capabilities> 5702 <parameters> 5703 <param id="thread"> 5704 <jthread null="current" frame="frame"/> 5705 <description> 5706 The thread of the frame containing the variable's value. 5707 </description> 5708 </param> 5709 <param id="depth"> 5710 <jframeID thread="thread"/> 5711 <description> 5712 The depth of the frame containing the variable's value. 5713 </description> 5714 </param> 5715 <param id="slot"> 5716 <jint/> 5717 <description> 5718 The variable's slot number. 5719 </description> 5720 </param> 5721 <param id="value_ptr"> 5722 <outptr><jobject/></outptr> 5723 <description> 5724 On return, points to the variable's value. 5725 </description> 5726 </param> 5727 </parameters> 5728 <errors> 5729 <error id="JVMTI_ERROR_INVALID_SLOT"> 5730 Invalid <code>slot</code>. 5731 </error> 5732 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 5733 The variable type is not 5734 <code>Object</code> or a subclass of <code>Object</code>. 5735 </error> 5736 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 5737 Not a visible frame 5738 </error> 5739 </errors> 5740 </function> 5741 5742 <function id="GetLocalInstance" num="155" since="1.2"> 5743 <synopsis>Get Local Instance</synopsis> 5744 <description> 5745 This function can be used to retrieve the value of the local object 5746 variable at slot 0 (the "<code>this</code>" object) from non-static 5747 frames. This function can retrieve the "<code>this</code>" object from 5748 native method frames, whereas <code>GetLocalObject()</code> would 5749 return <code>JVMTI_ERROR_OPAQUE_FRAME</code> in those cases. 5750 </description> 5751 <origin>new</origin> 5752 <capabilities> 5753 <required id="can_access_local_variables"></required> 5754 </capabilities> 5755 <parameters> 5756 <param id="thread"> 5757 <jthread null="current" frame="frame"/> 5758 <description> 5759 The thread of the frame containing the variable's value. 5760 </description> 5761 </param> 5762 <param id="depth"> 5763 <jframeID thread="thread"/> 5764 <description> 5765 The depth of the frame containing the variable's value. 5766 </description> 5767 </param> 5768 <param id="value_ptr"> 5769 <outptr><jobject/></outptr> 5770 <description> 5771 On return, points to the variable's value. 5772 </description> 5773 </param> 5774 </parameters> 5775 <errors> 5776 <error id="JVMTI_ERROR_INVALID_SLOT"> 5777 If the specified frame is a static method frame. 5778 </error> 5779 </errors> 5780 </function> 5781 <function id="GetLocalInt" num="22"> 5782 <synopsis>Get Local Variable - Int</synopsis> 5783 <description> 5784 This function can be used to retrieve the value of a local 5785 variable whose type is <code>int</code>, 5786 <code>short</code>, <code>char</code>, <code>byte</code>, or 5787 <code>boolean</code>. 5788 </description> 5789 <origin>jvmdi</origin> 5790 <capabilities> 5791 <required id="can_access_local_variables"></required> 5792 </capabilities> 5793 <parameters> 5794 <param id="thread"> 5795 <jthread null="current" frame="frame"/> 5796 <description> 5797 The thread of the frame containing the variable's value. 5798 </description> 5799 </param> 5800 <param id="depth"> 5801 <jframeID thread="thread"/> 5802 <description> 5803 The depth of the frame containing the variable's value. 5804 </description> 5805 </param> 5806 <param id="slot"> 5807 <jint/> 5808 <description> 5809 The variable's slot number. 5810 </description> 5811 </param> 5812 <param id="value_ptr"> 5813 <outptr><jint/></outptr> 5814 <description> 5815 On return, points to the variable's value. 5816 </description> 5817 </param> 5818 </parameters> 5819 <errors> 5820 <error id="JVMTI_ERROR_INVALID_SLOT"> 5821 Invalid <code>slot</code>. 5822 </error> 5823 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 5824 The variable type is not 5825 <code>int</code>, <code>short</code>, 5826 <code>char</code>, <code>byte</code>, or 5827 <code>boolean</code>. 5828 </error> 5829 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 5830 Not a visible frame 5831 </error> 5832 </errors> 5833 </function> 5834 5835 <function id="GetLocalLong" num="23"> 5836 <synopsis>Get Local Variable - Long</synopsis> 5837 <description> 5838 This function can be used to retrieve the value of a local 5839 variable whose type is <code>long</code>. 5840 </description> 5841 <origin>jvmdi</origin> 5842 <capabilities> 5843 <required id="can_access_local_variables"></required> 5844 </capabilities> 5845 <parameters> 5846 <param id="thread"> 5847 <jthread null="current" frame="frame"/> 5848 <description> 5849 The thread of the frame containing the variable's value. 5850 </description> 5851 </param> 5852 <param id="depth"> 5853 <jframeID thread="thread"/> 5854 <description> 5855 The depth of the frame containing the variable's value. 5856 </description> 5857 </param> 5858 <param id="slot"> 5859 <jint/> 5860 <description> 5861 The variable's slot number. 5862 </description> 5863 </param> 5864 <param id="value_ptr"> 5865 <outptr><jlong/></outptr> 5866 <description> 5867 On return, points to the variable's value. 5868 </description> 5869 </param> 5870 </parameters> 5871 <errors> 5872 <error id="JVMTI_ERROR_INVALID_SLOT"> 5873 Invalid <code>slot</code>. 5874 </error> 5875 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 5876 The variable type is not <code>long</code>. 5877 </error> 5878 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 5879 Not a visible frame 5880 </error> 5881 </errors> 5882 </function> 5883 5884 <function id="GetLocalFloat" num="24"> 5885 <synopsis>Get Local Variable - Float</synopsis> 5886 <description> 5887 This function can be used to retrieve the value of a local 5888 variable whose type is <code>float</code>. 5889 </description> 5890 <origin>jvmdi</origin> 5891 <capabilities> 5892 <required id="can_access_local_variables"></required> 5893 </capabilities> 5894 <parameters> 5895 <param id="thread"> 5896 <jthread null="current" frame="frame"/> 5897 <description> 5898 The thread of the frame containing the variable's value. 5899 </description> 5900 </param> 5901 <param id="depth"> 5902 <jframeID thread="thread"/> 5903 <description> 5904 The depth of the frame containing the variable's value. 5905 </description> 5906 </param> 5907 <param id="slot"> 5908 <jint/> 5909 <description> 5910 The variable's slot number. 5911 </description> 5912 </param> 5913 <param id="value_ptr"> 5914 <outptr><jfloat/></outptr> 5915 <description> 5916 On return, points to the variable's value. 5917 </description> 5918 </param> 5919 </parameters> 5920 <errors> 5921 <error id="JVMTI_ERROR_INVALID_SLOT"> 5922 Invalid <code>slot</code>. 5923 </error> 5924 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 5925 The variable type is not <code>float</code>. 5926 </error> 5927 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 5928 Not a visible frame 5929 </error> 5930 </errors> 5931 </function> 5932 5933 <function id="GetLocalDouble" num="25"> 5934 <synopsis>Get Local Variable - Double</synopsis> 5935 <description> 5936 This function can be used to retrieve the value of a local 5937 variable whose type is <code>long</code>. 5938 </description> 5939 <origin>jvmdi</origin> 5940 <capabilities> 5941 <required id="can_access_local_variables"></required> 5942 </capabilities> 5943 <parameters> 5944 <param id="thread"> 5945 <jthread null="current" frame="frame"/> 5946 <description> 5947 The thread of the frame containing the variable's value. 5948 </description> 5949 </param> 5950 <param id="depth"> 5951 <jframeID thread="thread"/> 5952 <description> 5953 The depth of the frame containing the variable's value. 5954 </description> 5955 </param> 5956 <param id="slot"> 5957 <jint/> 5958 <description> 5959 The variable's slot number. 5960 </description> 5961 </param> 5962 <param id="value_ptr"> 5963 <outptr><jdouble/></outptr> 5964 <description> 5965 On return, points to the variable's value. 5966 </description> 5967 </param> 5968 </parameters> 5969 <errors> 5970 <error id="JVMTI_ERROR_INVALID_SLOT"> 5971 Invalid <code>slot</code>. 5972 </error> 5973 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 5974 The variable type is not <code>double</code>. 5975 </error> 5976 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 5977 Not a visible frame 5978 </error> 5979 </errors> 5980 </function> 5981 5982 <function id="SetLocalObject" num="26"> 5983 <synopsis>Set Local Variable - Object</synopsis> 5984 <description> 5985 This function can be used to set the value of a local 5986 variable whose type is <code>Object</code> or a subclass of <code>Object</code>. 5987 </description> 5988 <origin>jvmdi</origin> 5989 <capabilities> 5990 <required id="can_access_local_variables"></required> 5991 </capabilities> 5992 <parameters> 5993 <param id="thread"> 5994 <jthread null="current" frame="frame"/> 5995 <description> 5996 The thread of the frame containing the variable's value. 5997 </description> 5998 </param> 5999 <param id="depth"> 6000 <jframeID thread="thread"/> 6001 <description> 6002 The depth of the frame containing the variable's value. 6003 </description> 6004 </param> 6005 <param id="slot"> 6006 <jint/> 6007 <description> 6008 The variable's slot number. 6009 </description> 6010 </param> 6011 <param id="value"> 6012 <jobject/> 6013 <description> 6014 The new value for the variable. 6015 </description> 6016 </param> 6017 </parameters> 6018 <errors> 6019 <error id="JVMTI_ERROR_INVALID_SLOT"> 6020 Invalid <code>slot</code>. 6021 </error> 6022 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6023 The variable type is not 6024 <code>Object</code> or a subclass of <code>Object</code>. 6025 </error> 6026 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6027 The supplied <paramlink id="value"/> is not compatible 6028 with the variable type. 6029 </error> 6030 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6031 Not a visible frame 6032 </error> 6033 </errors> 6034 </function> 6035 6036 <function id="SetLocalInt" num="27"> 6037 <synopsis>Set Local Variable - Int</synopsis> 6038 <description> 6039 This function can be used to set the value of a local 6040 variable whose type is <code>int</code>, 6041 <code>short</code>, <code>char</code>, <code>byte</code>, or 6042 <code>boolean</code>. 6043 </description> 6044 <origin>jvmdi</origin> 6045 <capabilities> 6046 <required id="can_access_local_variables"></required> 6047 </capabilities> 6048 <parameters> 6049 <param id="thread"> 6050 <jthread null="current" frame="frame"/> 6051 <description> 6052 The thread of the frame containing the variable's value. 6053 </description> 6054 </param> 6055 <param id="depth"> 6056 <jframeID thread="thread"/> 6057 <description> 6058 The depth of the frame containing the variable's value. 6059 </description> 6060 </param> 6061 <param id="slot"> 6062 <jint/> 6063 <description> 6064 The variable's slot number. 6065 </description> 6066 </param> 6067 <param id="value"> 6068 <jint/> 6069 <description> 6070 The new value for the variable. 6071 </description> 6072 </param> 6073 </parameters> 6074 <errors> 6075 <error id="JVMTI_ERROR_INVALID_SLOT"> 6076 Invalid <code>slot</code>. 6077 </error> 6078 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6079 The variable type is not 6080 <code>int</code>, <code>short</code>, 6081 <code>char</code>, <code>byte</code>, or 6082 <code>boolean</code>. 6083 </error> 6084 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6085 Not a visible frame 6086 </error> 6087 </errors> 6088 </function> 6089 6090 <function id="SetLocalLong" num="28"> 6091 <synopsis>Set Local Variable - Long</synopsis> 6092 <description> 6093 This function can be used to set the value of a local 6094 variable whose type is <code>long</code>. 6095 </description> 6096 <origin>jvmdi</origin> 6097 <capabilities> 6098 <required id="can_access_local_variables"></required> 6099 </capabilities> 6100 <parameters> 6101 <param id="thread"> 6102 <jthread null="current" frame="frame"/> 6103 <description> 6104 The thread of the frame containing the variable's value. 6105 </description> 6106 </param> 6107 <param id="depth"> 6108 <jframeID thread="thread"/> 6109 <description> 6110 The depth of the frame containing the variable's value. 6111 </description> 6112 </param> 6113 <param id="slot"> 6114 <jint/> 6115 <description> 6116 The variable's slot number. 6117 </description> 6118 </param> 6119 <param id="value"> 6120 <jlong/> 6121 <description> 6122 The new value for the variable. 6123 </description> 6124 </param> 6125 </parameters> 6126 <errors> 6127 <error id="JVMTI_ERROR_INVALID_SLOT"> 6128 Invalid <code>slot</code>. 6129 </error> 6130 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6131 The variable type is not <code>long</code>. 6132 </error> 6133 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6134 Not a visible frame 6135 </error> 6136 </errors> 6137 </function> 6138 6139 <function id="SetLocalFloat" num="29"> 6140 <synopsis>Set Local Variable - Float</synopsis> 6141 <description> 6142 This function can be used to set the value of a local 6143 variable whose type is <code>float</code>. 6144 </description> 6145 <origin>jvmdi</origin> 6146 <capabilities> 6147 <required id="can_access_local_variables"></required> 6148 </capabilities> 6149 <parameters> 6150 <param id="thread"> 6151 <jthread null="current" frame="frame"/> 6152 <description> 6153 The thread of the frame containing the variable's value. 6154 </description> 6155 </param> 6156 <param id="depth"> 6157 <jframeID thread="thread"/> 6158 <description> 6159 The depth of the frame containing the variable's value. 6160 </description> 6161 </param> 6162 <param id="slot"> 6163 <jint/> 6164 <description> 6165 The variable's slot number. 6166 </description> 6167 </param> 6168 <param id="value"> 6169 <jfloat/> 6170 <description> 6171 The new value for the variable. 6172 </description> 6173 </param> 6174 </parameters> 6175 <errors> 6176 <error id="JVMTI_ERROR_INVALID_SLOT"> 6177 Invalid <code>slot</code>. 6178 </error> 6179 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6180 The variable type is not <code>float</code>. 6181 </error> 6182 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6183 Not a visible frame 6184 </error> 6185 </errors> 6186 </function> 6187 6188 <function id="SetLocalDouble" num="30"> 6189 <synopsis>Set Local Variable - Double</synopsis> 6190 <description> 6191 This function can be used to set the value of a local 6192 variable whose type is <code>double</code>. 6193 </description> 6194 <origin>jvmdi</origin> 6195 <capabilities> 6196 <required id="can_access_local_variables"></required> 6197 </capabilities> 6198 <parameters> 6199 <param id="thread"> 6200 <jthread null="current" frame="frame"/> 6201 <description> 6202 The thread of the frame containing the variable's value. 6203 </description> 6204 </param> 6205 <param id="depth"> 6206 <jframeID thread="thread"/> 6207 <description> 6208 The depth of the frame containing the variable's value. 6209 </description> 6210 </param> 6211 <param id="slot"> 6212 <jint/> 6213 <description> 6214 The variable's slot number. 6215 </description> 6216 </param> 6217 <param id="value"> 6218 <jdouble/> 6219 <description> 6220 The new value for the variable. 6221 </description> 6222 </param> 6223 </parameters> 6224 <errors> 6225 <error id="JVMTI_ERROR_INVALID_SLOT"> 6226 Invalid <code>slot</code>. 6227 </error> 6228 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6229 The variable type is not <code>double</code>. 6230 </error> 6231 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6232 Not a visible frame 6233 </error> 6234 </errors> 6235 </function> 6236 </category> 6237 6238 <category id="breakpointCategory" label="Breakpoint"> 6239 6240 <intro> 6241 </intro> 6242 6243 <function id="SetBreakpoint" num="38"> 6244 <synopsis>Set Breakpoint</synopsis> 6245 <description> 6246 Set a breakpoint at the instruction indicated by 6247 <code>method</code> and <code>location</code>. 6248 An instruction can only have one breakpoint. 6249 <p/> 6250 Whenever the designated instruction is about to be executed, a 6251 <eventlink id="Breakpoint"></eventlink> event is generated. 6252 </description> 6253 <origin>jvmdi</origin> 6254 <capabilities> 6255 <required id="can_generate_breakpoint_events"></required> 6256 </capabilities> 6257 <parameters> 6258 <param id="klass"> 6259 <jclass method="method"/> 6260 <description> 6261 The class in which to set the breakpoint 6262 </description> 6263 </param> 6264 <param id="method"> 6265 <jmethodID class="klass"/> 6266 <description> 6267 The method in which to set the breakpoint 6268 </description> 6269 </param> 6270 <param id="location"> 6271 <jlocation/> 6272 <description> 6273 the index of the instruction at which to set the breakpoint 6274 6275 </description> 6276 </param> 6277 </parameters> 6278 <errors> 6279 <error id="JVMTI_ERROR_DUPLICATE"> 6280 The designated bytecode already has a breakpoint. 6281 </error> 6282 </errors> 6283 </function> 6284 6285 <function id="ClearBreakpoint" num="39"> 6286 <synopsis>Clear Breakpoint</synopsis> 6287 <description> 6288 Clear the breakpoint at the bytecode indicated by 6289 <code>method</code> and <code>location</code>. 6290 </description> 6291 <origin>jvmdi</origin> 6292 <capabilities> 6293 <required id="can_generate_breakpoint_events"></required> 6294 </capabilities> 6295 <parameters> 6296 <param id="klass"> 6297 <jclass method="method"/> 6298 <description> 6299 The class in which to clear the breakpoint 6300 </description> 6301 </param> 6302 <param id="method"> 6303 <jmethodID class="klass"/> 6304 <description> 6305 The method in which to clear the breakpoint 6306 </description> 6307 </param> 6308 <param id="location"> 6309 <jlocation/> 6310 <description> 6311 the index of the instruction at which to clear the breakpoint 6312 </description> 6313 </param> 6314 </parameters> 6315 <errors> 6316 <error id="JVMTI_ERROR_NOT_FOUND"> 6317 There's no breakpoint at the designated bytecode. 6318 </error> 6319 </errors> 6320 </function> 6321 6322 </category> 6323 6324 <category id="fieldWatch" label="Watched Field"> 6325 6326 <intro> 6327 </intro> 6328 6329 <function id="SetFieldAccessWatch" num="41"> 6330 <synopsis>Set Field Access Watch</synopsis> 6331 <description> 6332 Generate a <eventlink id="FieldAccess"></eventlink> event 6333 when the field specified 6334 by <code>klass</code> and 6335 <code>field</code> is about to be accessed. 6336 An event will be generated for each access of the field 6337 until it is canceled with 6338 <functionlink id="ClearFieldAccessWatch"></functionlink>. 6339 Field accesses from Java programming language code or from JNI code are watched, 6340 fields modified by other means are not watched. 6341 Note that <jvmti/> users should be aware that their own field accesses 6342 will trigger the watch. 6343 A field can only have one field access watch set. 6344 Modification of a field is not considered an access--use 6345 <functionlink id="SetFieldModificationWatch"></functionlink> 6346 to monitor modifications. 6347 </description> 6348 <origin>jvmdi</origin> 6349 <capabilities> 6350 <required id="can_generate_field_access_events"></required> 6351 </capabilities> 6352 <parameters> 6353 <param id="klass"> 6354 <jclass field="field"/> 6355 <description> 6356 The class containing the field to watch 6357 </description> 6358 </param> 6359 <param id="field"> 6360 <jfieldID class="klass"/> 6361 <description> 6362 The field to watch 6363 6364 </description> 6365 </param> 6366 </parameters> 6367 <errors> 6368 <error id="JVMTI_ERROR_DUPLICATE"> 6369 The designated field is already being watched for accesses. 6370 </error> 6371 </errors> 6372 </function> 6373 6374 <function id="ClearFieldAccessWatch" num="42"> 6375 <synopsis>Clear Field Access Watch</synopsis> 6376 <description> 6377 Cancel a field access watch previously set by 6378 <functionlink id="SetFieldAccessWatch"></functionlink>, on the 6379 field specified 6380 by <code>klass</code> and 6381 <code>field</code>. 6382 </description> 6383 <origin>jvmdi</origin> 6384 <capabilities> 6385 <required id="can_generate_field_access_events"></required> 6386 </capabilities> 6387 <parameters> 6388 <param id="klass"> 6389 <jclass field="field"/> 6390 <description> 6391 The class containing the field to watch 6392 </description> 6393 </param> 6394 <param id="field"> 6395 <jfieldID class="klass"/> 6396 <description> 6397 The field to watch 6398 6399 </description> 6400 </param> 6401 </parameters> 6402 <errors> 6403 <error id="JVMTI_ERROR_NOT_FOUND"> 6404 The designated field is not being watched for accesses. 6405 </error> 6406 </errors> 6407 </function> 6408 6409 <function id="SetFieldModificationWatch" num="43"> 6410 <synopsis>Set Field Modification Watch</synopsis> 6411 <description> 6412 Generate a <eventlink id="FieldModification"></eventlink> event 6413 when the field specified 6414 by <code>klass</code> and 6415 <code>field</code> is about to be modified. 6416 An event will be generated for each modification of the field 6417 until it is canceled with 6418 <functionlink id="ClearFieldModificationWatch"></functionlink>. 6419 Field modifications from Java programming language code or from JNI code are watched, 6420 fields modified by other means are not watched. 6421 Note that <jvmti/> users should be aware that their own field modifications 6422 will trigger the watch. 6423 A field can only have one field modification watch set. 6424 </description> 6425 <origin>jvmdi</origin> 6426 <capabilities> 6427 <required id="can_generate_field_modification_events"></required> 6428 </capabilities> 6429 <parameters> 6430 <param id="klass"> 6431 <jclass field="field"/> 6432 <description> 6433 The class containing the field to watch 6434 </description> 6435 </param> 6436 <param id="field"> 6437 <jfieldID class="klass"/> 6438 <description> 6439 The field to watch 6440 6441 </description> 6442 </param> 6443 </parameters> 6444 <errors> 6445 <error id="JVMTI_ERROR_DUPLICATE"> 6446 The designated field is already being watched for modifications. 6447 </error> 6448 </errors> 6449 </function> 6450 6451 <function id="ClearFieldModificationWatch" num="44"> 6452 <synopsis>Clear Field Modification Watch</synopsis> 6453 <description> 6454 6455 Cancel a field modification watch previously set by 6456 <functionlink id="SetFieldModificationWatch"></functionlink>, on the 6457 field specified 6458 by <code>klass</code> and 6459 <code>field</code>. 6460 </description> 6461 <origin>jvmdi</origin> 6462 <capabilities> 6463 <required id="can_generate_field_modification_events"></required> 6464 </capabilities> 6465 <parameters> 6466 <param id="klass"> 6467 <jclass field="field"/> 6468 <description> 6469 The class containing the field to watch 6470 </description> 6471 </param> 6472 <param id="field"> 6473 <jfieldID class="klass"/> 6474 <description> 6475 The field to watch 6476 6477 </description> 6478 </param> 6479 </parameters> 6480 <errors> 6481 <error id="JVMTI_ERROR_NOT_FOUND"> 6482 The designated field is not being watched for modifications. 6483 </error> 6484 </errors> 6485 </function> 6486 </category> 6487 6488 <category id="module" label="Module"> 6489 6490 <intro> 6491 </intro> 6492 6493 <function id="GetAllModules" num="3" since="9"> 6494 <synopsis>Get All Modules</synopsis> 6495 <description> 6496 Return an array of all modules loaded in the virtual machine. 6497 The array includes the unnamed module for each class loader. 6498 The number of modules in the array is returned via 6499 <code>module_count_ptr</code>, and the array itself via 6500 <code>modules_ptr</code>. 6501 <p/> 6502 </description> 6503 <origin>new</origin> 6504 <capabilities> 6505 </capabilities> 6506 <parameters> 6507 <param id="module_count_ptr"> 6508 <outptr><jint/></outptr> 6509 <description> 6510 On return, points to the number of returned modules. 6511 </description> 6512 </param> 6513 <param id="modules_ptr"> 6514 <allocbuf outcount="module_count_ptr"><jobject/></allocbuf> 6515 <description> 6516 On return, points to an array of references, one 6517 for each module. 6518 </description> 6519 </param> 6520 </parameters> 6521 <errors> 6522 </errors> 6523 </function> 6524 6525 <function id="GetNamedModule" num="40" since="9"> 6526 <synopsis>Get Named Module</synopsis> 6527 <description> 6528 Return the <code>java.lang.Module</code> object for a named 6529 module defined to a class loader that contains a given package. 6530 The module is returned via <code>module_ptr</code>. 6531 <p/> 6532 If a named module is defined to the class loader and it 6533 contains the package then that named module is returned, 6534 otherwise <code>NULL</code> is returned. 6535 <p/> 6536 </description> 6537 <origin>new</origin> 6538 <capabilities> 6539 </capabilities> 6540 <parameters> 6541 <param id="class_loader"> 6542 <ptrtype> 6543 <jobject/> 6544 <nullok>the bootstrap loader is assumed</nullok> 6545 </ptrtype> 6546 <description> 6547 A class loader. 6548 If the <code>class_loader</code> is not <code>NULL</code> 6549 or a subclass of <code>java.lang.ClassLoader</code> 6550 this function returns 6551 <errorlink id="JVMTI_ERROR_ILLEGAL_ARGUMENT"></errorlink>. 6552 </description> 6553 </param> 6554 <param id="package_name"> 6555 <inbuf><char/></inbuf> 6556 <description> 6557 The name of the package, encoded as a 6558 <internallink id="mUTF">modified UTF-8</internallink> string. 6559 The package name is in internal form (JVMS 4.2.1); 6560 identifiers are separated by forward slashes rather than periods. 6561 </description> 6562 </param> 6563 <param id="module_ptr"> 6564 <outptr><jobject/></outptr> 6565 <description> 6566 On return, points to a <code>java.lang.Module</code> object 6567 or points to <code>NULL</code>. 6568 </description> 6569 </param> 6570 </parameters> 6571 <errors> 6572 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 6573 If class loader is not <code>NULL</code> and is not a class loader object. 6574 </error> 6575 </errors> 6576 </function> 6577 6578 <function id="AddModuleReads" num="94" since="9"> 6579 <synopsis>Add Module Reads</synopsis> 6580 <description> 6581 Update a module to read another module. This function is a no-op 6582 when <paramlink id="module"></paramlink> is an unnamed module. 6583 This function facilitates the instrumentation of code 6584 in named modules where that instrumentation requires 6585 expanding the set of modules that a module reads. 6586 </description> 6587 <origin>new</origin> 6588 <capabilities> 6589 </capabilities> 6590 <parameters> 6591 <param id="module"> 6592 <ptrtype><jobject/></ptrtype> 6593 <description> 6594 The module to update. 6595 </description> 6596 </param> 6597 <param id="to_module"> 6598 <ptrtype><jobject/></ptrtype> 6599 <description> 6600 The additional module to read. 6601 </description> 6602 </param> 6603 </parameters> 6604 <errors> 6605 <error id="JVMTI_ERROR_INVALID_MODULE"> 6606 If <paramlink id="module"></paramlink> is not a module object. 6607 </error> 6608 <error id="JVMTI_ERROR_INVALID_MODULE"> 6609 If <paramlink id="to_module"></paramlink> is not a module object. 6610 </error> 6611 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE"> 6612 if the module cannot be modified. 6613 See <functionlink id="IsModifiableModule"/>. 6614 </error> 6615 </errors> 6616 </function> 6617 6618 <function id="AddModuleExports" num="95" since="9"> 6619 <synopsis>Add Module Exports</synopsis> 6620 <description> 6621 Update a module to export a package to another module. 6622 This function is a no-op when <paramlink id="module"></paramlink> 6623 is an unnamed module or an open module. 6624 This function facilitates the instrumentation of code 6625 in named modules where that instrumentation requires 6626 expanding the set of packages that a module exports. 6627 </description> 6628 <origin>new</origin> 6629 <capabilities> 6630 </capabilities> 6631 <parameters> 6632 <param id="module"> 6633 <ptrtype><jobject/></ptrtype> 6634 <description> 6635 The module to update. 6636 </description> 6637 </param> 6638 <param id="pkg_name"> 6639 <inbuf><char/></inbuf> 6640 <description> 6641 The exported package name. 6642 </description> 6643 </param> 6644 <param id="to_module"> 6645 <ptrtype><jobject/></ptrtype> 6646 <description> 6647 The module the package is exported to. 6648 If the <code>to_module</code> is not a subclass of 6649 <code>java.lang.Module</code> this function returns 6650 <errorlink id="JVMTI_ERROR_INVALID_MODULE"></errorlink>. 6651 </description> 6652 </param> 6653 </parameters> 6654 <errors> 6655 <error id="JVMTI_ERROR_INVALID_MODULE"> 6656 If <paramlink id="module"></paramlink> is not a module object. 6657 </error> 6658 <error id="JVMTI_ERROR_INVALID_MODULE"> 6659 If <paramlink id="to_module"></paramlink> is not a module object. 6660 </error> 6661 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 6662 If the package <paramlink id="pkg_name"></paramlink> 6663 does not belong to the module. 6664 </error> 6665 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE"> 6666 if the module cannot be modified. 6667 See <functionlink id="IsModifiableModule"/>. 6668 </error> 6669 </errors> 6670 </function> 6671 6672 <function id="AddModuleOpens" num="96" since="9"> 6673 <synopsis>Add Module Opens</synopsis> 6674 <description> 6675 Update a module to open a package to another module. 6676 This function is a no-op when <paramlink id="module"></paramlink> 6677 is an unnamed module or an open module. 6678 This function facilitates the instrumentation of code 6679 in modules where that instrumentation requires 6680 expanding the set of packages that a module opens to 6681 other modules. 6682 </description> 6683 <origin>new</origin> 6684 <capabilities> 6685 </capabilities> 6686 <parameters> 6687 <param id="module"> 6688 <ptrtype><jobject/></ptrtype> 6689 <description> 6690 The module to update. 6691 </description> 6692 </param> 6693 <param id="pkg_name"> 6694 <inbuf><char/></inbuf> 6695 <description> 6696 The package name of the package to open. 6697 </description> 6698 </param> 6699 <param id="to_module"> 6700 <ptrtype><jobject/></ptrtype> 6701 <description> 6702 The module with the package to open. 6703 If the <code>to_module</code> is not a subclass of 6704 <code>java.lang.Module</code> this function returns 6705 <errorlink id="JVMTI_ERROR_INVALID_MODULE"></errorlink>. 6706 </description> 6707 </param> 6708 </parameters> 6709 <errors> 6710 <error id="JVMTI_ERROR_INVALID_MODULE"> 6711 If <paramlink id="module"></paramlink> is not a module object. 6712 </error> 6713 <error id="JVMTI_ERROR_INVALID_MODULE"> 6714 If <paramlink id="to_module"></paramlink> is not a module object. 6715 </error> 6716 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 6717 If the package <paramlink id="pkg_name"></paramlink> 6718 does not belong to the module. 6719 </error> 6720 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE"> 6721 if the module cannot be modified. 6722 See <functionlink id="IsModifiableModule"/>. 6723 </error> 6724 </errors> 6725 </function> 6726 6727 <function id="AddModuleUses" num="97" since="9"> 6728 <synopsis>Add Module Uses</synopsis> 6729 <description> 6730 Updates a module to add a service to the set of services that 6731 a module uses. This function is a no-op when the module 6732 is an unnamed module. 6733 This function facilitates the instrumentation of code 6734 in named modules where that instrumentation requires 6735 expanding the set of services that a module is using. 6736 </description> 6737 <origin>new</origin> 6738 <capabilities> 6739 </capabilities> 6740 <parameters> 6741 <param id="module"> 6742 <ptrtype><jobject/></ptrtype> 6743 <description> 6744 The module to update. 6745 </description> 6746 </param> 6747 <param id="service"> 6748 <ptrtype><jclass/></ptrtype> 6749 <description> 6750 The service to use. 6751 </description> 6752 </param> 6753 </parameters> 6754 <errors> 6755 <error id="JVMTI_ERROR_INVALID_MODULE"> 6756 If <paramlink id="module"></paramlink> is not a module object. 6757 </error> 6758 <error id="JVMTI_ERROR_INVALID_CLASS"> 6759 If <paramlink id="service"></paramlink> is not a class object. 6760 </error> 6761 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE"> 6762 if the module cannot be modified. 6763 See <functionlink id="IsModifiableModule"/>. 6764 </error> 6765 </errors> 6766 </function> 6767 6768 <function id="AddModuleProvides" num="98" since="9"> 6769 <synopsis>Add Module Provides</synopsis> 6770 <description> 6771 Updates a module to add a service to the set of services that 6772 a module provides. This function is a no-op when the module 6773 is an unnamed module. 6774 This function facilitates the instrumentation of code 6775 in named modules where that instrumentation requires 6776 changes to the services that are provided. 6777 </description> 6778 <origin>new</origin> 6779 <capabilities> 6780 </capabilities> 6781 <parameters> 6782 <param id="module"> 6783 <ptrtype><jobject/></ptrtype> 6784 <description> 6785 The module to update. 6786 </description> 6787 </param> 6788 <param id="service"> 6789 <ptrtype><jclass/></ptrtype> 6790 <description> 6791 The service to provide. 6792 </description> 6793 </param> 6794 <param id="impl_class"> 6795 <ptrtype><jclass/></ptrtype> 6796 <description> 6797 The implementation class for the provided service. 6798 </description> 6799 </param> 6800 </parameters> 6801 <errors> 6802 <error id="JVMTI_ERROR_INVALID_MODULE"> 6803 If <paramlink id="module"></paramlink> is not a module object. 6804 </error> 6805 <error id="JVMTI_ERROR_INVALID_CLASS"> 6806 If <paramlink id="service"></paramlink> is not a class object. 6807 </error> 6808 <error id="JVMTI_ERROR_INVALID_CLASS"> 6809 If <paramlink id="impl_class"></paramlink> is not a class object. 6810 </error> 6811 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE"> 6812 if the module cannot be modified. 6813 See <functionlink id="IsModifiableModule"/>. 6814 </error> 6815 </errors> 6816 </function> 6817 6818 <function id="IsModifiableModule" num="99" since="9"> 6819 <synopsis>Is Modifiable Module</synopsis> 6820 <description> 6821 Determines whether a module is modifiable. 6822 If a module is modifiable then this module can be updated with 6823 <functionlink id="AddModuleReads"/>, <functionlink id="AddModuleExports"/>, 6824 <functionlink id="AddModuleOpens"/>, <functionlink id="AddModuleUses"/>, 6825 and <functionlink id="AddModuleProvides"/>. If a module is not modifiable 6826 then the module can not be updated with these functions. The result of 6827 this function is always <code>JNI_TRUE</code> when called to determine 6828 if an unnamed module is modifiable. 6829 </description> 6830 <origin>new</origin> 6831 <capabilities> 6832 </capabilities> 6833 <parameters> 6834 <param id="module"> 6835 <ptrtype><jobject/></ptrtype> 6836 <description> 6837 The module to query. 6838 </description> 6839 </param> 6840 <param id="is_modifiable_module_ptr"> 6841 <outptr><jboolean/></outptr> 6842 <description> 6843 On return, points to the boolean result of this function. 6844 </description> 6845 </param> 6846 </parameters> 6847 <errors> 6848 <error id="JVMTI_ERROR_INVALID_MODULE"> 6849 If <paramlink id="module"></paramlink> is not a module object. 6850 </error> 6851 </errors> 6852 </function> 6853 6854 </category> 6855 6856 <category id="class" label="Class"> 6857 6858 <intro> 6859 </intro> 6860 6861 <function id="GetLoadedClasses" jkernel="yes" num="78"> 6862 <synopsis>Get Loaded Classes</synopsis> 6863 <description> 6864 Return an array of all classes loaded in the virtual machine. 6865 The number of classes in the array is returned via 6866 <code>class_count_ptr</code>, and the array itself via 6867 <code>classes_ptr</code>. 6868 <p/> 6869 Array classes of all types (including arrays of primitive types) are 6870 included in the returned list. Primitive classes (for example, 6871 <code>java.lang.Integer.TYPE</code>) are <i>not</i> included in this list. 6872 </description> 6873 <origin>jvmdi</origin> 6874 <capabilities> 6875 </capabilities> 6876 <parameters> 6877 <param id="class_count_ptr"> 6878 <outptr><jint/></outptr> 6879 <description> 6880 On return, points to the number of classes. 6881 </description> 6882 </param> 6883 <param id="classes_ptr"> 6884 <allocbuf outcount="class_count_ptr"><jclass/></allocbuf> 6885 <description> 6886 On return, points to an array of references, one 6887 for each class. 6888 </description> 6889 </param> 6890 </parameters> 6891 <errors> 6892 </errors> 6893 </function> 6894 6895 <function id="GetClassLoaderClasses" jkernel="yes" num="79"> 6896 <synopsis>Get Classloader Classes</synopsis> 6897 <description> 6898 Returns an array of those classes for which this class loader has 6899 been recorded as an initiating loader. Each 6900 class in the returned array was created by this class loader, 6901 either by defining it directly or by delegation to another class loader. 6902 See <vmspec chapter="5.3"/>. 6903 <p/> 6904 The number of classes in the array is returned via 6905 <code>class_count_ptr</code>, and the array itself via 6906 <code>classes_ptr</code>. 6907 </description> 6908 <origin>jvmdi</origin> 6909 <capabilities> 6910 </capabilities> 6911 <parameters> 6912 <param id="initiating_loader"> 6913 <ptrtype> 6914 <jobject/> 6915 <nullok>the classes initiated by the bootstrap loader will be returned</nullok> 6916 </ptrtype> 6917 <description> 6918 An initiating class loader. 6919 </description> 6920 </param> 6921 <param id="class_count_ptr"> 6922 <outptr><jint/></outptr> 6923 <description> 6924 On return, points to the number of classes. 6925 </description> 6926 </param> 6927 <param id="classes_ptr"> 6928 <allocbuf outcount="class_count_ptr"><jclass/></allocbuf> 6929 <description> 6930 On return, points to an array of references, one 6931 for each class. 6932 </description> 6933 </param> 6934 </parameters> 6935 <errors> 6936 </errors> 6937 </function> 6938 6939 <function id="GetClassSignature" phase="start" num="48"> 6940 <synopsis>Get Class Signature</synopsis> 6941 <description> 6942 For the class indicated by <code>klass</code>, return the 6943 <externallink id="jni/types.html#type-signatures">JNI 6944 type signature</externallink> 6945 and the generic signature of the class. 6946 For example, <code>java.util.List</code> is <code>"Ljava/util/List;"</code> 6947 and <code>int[]</code> is <code>"[I"</code> 6948 The returned name for primitive classes 6949 is the type signature character of the corresponding primitive type. 6950 For example, <code>java.lang.Integer.TYPE</code> is <code>"I"</code>. 6951 </description> 6952 <origin>jvmdiClone</origin> 6953 <capabilities> 6954 </capabilities> 6955 <parameters> 6956 <param id="klass"> 6957 <jclass/> 6958 <description> 6959 The class to query. 6960 </description> 6961 </param> 6962 <param id="signature_ptr"> 6963 <allocbuf> 6964 <char/> 6965 <nullok>the signature is not returned</nullok> 6966 </allocbuf> 6967 <description> 6968 On return, points to the JNI type signature of the class, encoded as a 6969 <internallink id="mUTF">modified UTF-8</internallink> string. 6970 </description> 6971 </param> 6972 <param id="generic_ptr"> 6973 <allocbuf> 6974 <char/> 6975 <nullok>the generic signature is not returned</nullok> 6976 </allocbuf> 6977 <description> 6978 On return, points to the generic signature of the class, encoded as a 6979 <internallink id="mUTF">modified UTF-8</internallink> string. 6980 If there is no generic signature attribute for the class, then, 6981 on return, points to <code>NULL</code>. 6982 </description> 6983 </param> 6984 </parameters> 6985 <errors> 6986 </errors> 6987 </function> 6988 6989 <function id="GetClassStatus" phase="start" num="49"> 6990 <synopsis>Get Class Status</synopsis> 6991 <description> 6992 Get the status of the class. Zero or more of the following bits can be 6993 set. 6994 <constants id="jvmtiClassStatus" label="Class Status Flags" kind="bits"> 6995 <constant id="JVMTI_CLASS_STATUS_VERIFIED" num="1"> 6996 Class bytecodes have been verified 6997 </constant> 6998 <constant id="JVMTI_CLASS_STATUS_PREPARED" num="2"> 6999 Class preparation is complete 7000 </constant> 7001 <constant id="JVMTI_CLASS_STATUS_INITIALIZED" num="4"> 7002 Class initialization is complete. Static initializer has been run. 7003 </constant> 7004 <constant id="JVMTI_CLASS_STATUS_ERROR" num="8"> 7005 Error during initialization makes class unusable 7006 </constant> 7007 <constant id="JVMTI_CLASS_STATUS_ARRAY" num="16"> 7008 Class is an array. If set, all other bits are zero. 7009 </constant> 7010 <constant id="JVMTI_CLASS_STATUS_PRIMITIVE" num="32"> 7011 Class is a primitive class (for example, <code>java.lang.Integer.TYPE</code>). 7012 If set, all other bits are zero. 7013 </constant> 7014 </constants> 7015 </description> 7016 <origin>jvmdi</origin> 7017 <capabilities> 7018 </capabilities> 7019 <parameters> 7020 <param id="klass"> 7021 <jclass/> 7022 <description> 7023 The class to query. 7024 </description> 7025 </param> 7026 <param id="status_ptr"> 7027 <outptr><jint/></outptr> 7028 <description> 7029 On return, points to the current state of this class as one or 7030 more of the <internallink id="jvmtiClassStatus">class status flags</internallink>. 7031 </description> 7032 </param> 7033 </parameters> 7034 <errors> 7035 </errors> 7036 </function> 7037 7038 <function id="GetSourceFileName" phase="start" num="50"> 7039 <synopsis>Get Source File Name</synopsis> 7040 <description> 7041 For the class indicated by <code>klass</code>, return the source file 7042 name via <code>source_name_ptr</code>. The returned string 7043 is a file name only and never contains a directory name. 7044 <p/> 7045 For primitive classes (for example, <code>java.lang.Integer.TYPE</code>) 7046 and for arrays this function returns 7047 <errorlink id="JVMTI_ERROR_ABSENT_INFORMATION"></errorlink>. 7048 </description> 7049 <origin>jvmdi</origin> 7050 <capabilities> 7051 <required id="can_get_source_file_name"></required> 7052 </capabilities> 7053 <parameters> 7054 <param id="klass"> 7055 <jclass/> 7056 <description> 7057 The class to query. 7058 </description> 7059 </param> 7060 <param id="source_name_ptr"> 7061 <allocbuf><char/></allocbuf> 7062 <description> 7063 On return, points to the class's source file name, encoded as a 7064 <internallink id="mUTF">modified UTF-8</internallink> string. 7065 </description> 7066 </param> 7067 </parameters> 7068 <errors> 7069 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 7070 Class information does not include a source file name. This includes 7071 cases where the class is an array class or primitive class. 7072 </error> 7073 </errors> 7074 </function> 7075 7076 <function id="GetClassModifiers" phase="start" num="51"> 7077 <synopsis>Get Class Modifiers</synopsis> 7078 <description> 7079 For the class indicated by <code>klass</code>, return the access 7080 flags 7081 via <code>modifiers_ptr</code>. 7082 Access flags are defined in <vmspec chapter="4"/>. 7083 <p/> 7084 If the class is an array class, then its public, private, and protected 7085 modifiers are the same as those of its component type. For arrays of 7086 primitives, this component type is represented by one of the primitive 7087 classes (for example, <code>java.lang.Integer.TYPE</code>). 7088 <p/> 7089 If the class is a primitive class, its public modifier is always true, 7090 and its protected and private modifiers are always false. 7091 <p/> 7092 If the class is an array class or a primitive class then its final 7093 modifier is always true and its interface modifier is always false. 7094 The values of its other modifiers are not determined by this specification. 7095 7096 </description> 7097 <origin>jvmdi</origin> 7098 <capabilities> 7099 </capabilities> 7100 <parameters> 7101 <param id="klass"> 7102 <jclass/> 7103 <description> 7104 The class to query. 7105 </description> 7106 </param> 7107 <param id="modifiers_ptr"> 7108 <outptr><jint/></outptr> 7109 <description> 7110 On return, points to the current access flags of this class. 7111 7112 </description> 7113 </param> 7114 </parameters> 7115 <errors> 7116 </errors> 7117 </function> 7118 7119 <function id="GetClassMethods" phase="start" num="52"> 7120 <synopsis>Get Class Methods</synopsis> 7121 <description> 7122 For the class indicated by <code>klass</code>, return a count of 7123 methods via <code>method_count_ptr</code> and a list of 7124 method IDs via <code>methods_ptr</code>. The method list contains 7125 constructors and static initializers as well as true methods. 7126 Only directly declared methods are returned (not inherited methods). 7127 An empty method list is returned for array classes and primitive classes 7128 (for example, <code>java.lang.Integer.TYPE</code>). 7129 </description> 7130 <origin>jvmdi</origin> 7131 <capabilities> 7132 <capability id="can_maintain_original_method_order"/> 7133 </capabilities> 7134 <parameters> 7135 <param id="klass"> 7136 <jclass/> 7137 <description> 7138 The class to query. 7139 </description> 7140 </param> 7141 <param id="method_count_ptr"> 7142 <outptr><jint/></outptr> 7143 <description> 7144 On return, points to the number of methods declared in this class. 7145 </description> 7146 </param> 7147 <param id="methods_ptr"> 7148 <allocbuf outcount="method_count_ptr"><jmethodID class="klass"/></allocbuf> 7149 <description> 7150 On return, points to the method ID array. 7151 </description> 7152 </param> 7153 </parameters> 7154 <errors> 7155 <error id="JVMTI_ERROR_CLASS_NOT_PREPARED"> 7156 <paramlink id="klass"></paramlink> is not prepared. 7157 </error> 7158 </errors> 7159 </function> 7160 7161 <function id="GetClassFields" phase="start" num="53"> 7162 <synopsis>Get Class Fields</synopsis> 7163 <description> 7164 For the class indicated by <code>klass</code>, return a count of fields 7165 via <code>field_count_ptr</code> and a list of field IDs via 7166 <code>fields_ptr</code>. 7167 Only directly declared fields are returned (not inherited fields). 7168 Fields are returned in the order they occur in the class file. 7169 An empty field list is returned for array classes and primitive classes 7170 (for example, <code>java.lang.Integer.TYPE</code>). 7171 Use JNI to determine the length of an array. 7172 </description> 7173 <origin>jvmdi</origin> 7174 <capabilities> 7175 </capabilities> 7176 <parameters> 7177 <param id="klass"> 7178 <jclass/> 7179 <description> 7180 The class to query. 7181 </description> 7182 </param> 7183 <param id="field_count_ptr"> 7184 <outptr><jint/></outptr> 7185 <description> 7186 On return, points to the number of fields declared in this class. 7187 </description> 7188 </param> 7189 <param id="fields_ptr"> 7190 <allocbuf outcount="field_count_ptr"><jfieldID/></allocbuf> 7191 <description> 7192 On return, points to the field ID array. 7193 </description> 7194 </param> 7195 </parameters> 7196 <errors> 7197 <error id="JVMTI_ERROR_CLASS_NOT_PREPARED"> 7198 <paramlink id="klass"></paramlink> is not prepared. 7199 </error> 7200 </errors> 7201 </function> 7202 7203 <function id="GetImplementedInterfaces" phase="start" num="54"> 7204 <synopsis>Get Implemented Interfaces</synopsis> 7205 <description> 7206 Return the direct super-interfaces of this class. For a class, this 7207 function returns the interfaces declared in its <code>implements</code> 7208 clause. For an interface, this function returns the interfaces declared in 7209 its <code>extends</code> clause. 7210 An empty interface list is returned for array classes and primitive classes 7211 (for example, <code>java.lang.Integer.TYPE</code>). 7212 </description> 7213 <origin>jvmdi</origin> 7214 <capabilities> 7215 </capabilities> 7216 <parameters> 7217 <param id="klass"> 7218 <jclass/> 7219 <description> 7220 The class to query. 7221 </description> 7222 </param> 7223 <param id="interface_count_ptr"> 7224 <outptr><jint/></outptr> 7225 <description> 7226 On return, points to the number of interfaces. 7227 </description> 7228 </param> 7229 <param id="interfaces_ptr"> 7230 <allocbuf outcount="interface_count_ptr"><jclass/></allocbuf> 7231 <description> 7232 On return, points to the interface array. 7233 </description> 7234 </param> 7235 </parameters> 7236 <errors> 7237 <error id="JVMTI_ERROR_CLASS_NOT_PREPARED"> 7238 <paramlink id="klass"></paramlink> is not prepared. 7239 </error> 7240 </errors> 7241 </function> 7242 7243 <function id="GetClassVersionNumbers" phase="start" num="145" since="1.1"> 7244 <synopsis>Get Class Version Numbers</synopsis> 7245 <description> 7246 For the class indicated by <code>klass</code>, 7247 return the minor and major version numbers, 7248 as defined in 7249 <vmspec chapter="4"/>. 7250 </description> 7251 <origin>new</origin> 7252 <capabilities> 7253 </capabilities> 7254 <parameters> 7255 <param id="klass"> 7256 <jclass/> 7257 <description> 7258 The class to query. 7259 </description> 7260 </param> 7261 <param id="minor_version_ptr"> 7262 <outptr><jint/></outptr> 7263 <description> 7264 On return, points to the value of the 7265 <code>minor_version</code> item of the 7266 Class File Format. 7267 Note: to be consistent with the Class File Format, 7268 the minor version number is the first parameter. 7269 </description> 7270 </param> 7271 <param id="major_version_ptr"> 7272 <outptr><jint/></outptr> 7273 <description> 7274 On return, points to the value of the 7275 <code>major_version</code> item of the 7276 Class File Format. 7277 </description> 7278 </param> 7279 </parameters> 7280 <errors> 7281 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 7282 The class is a primitive or array class. 7283 </error> 7284 </errors> 7285 </function> 7286 7287 <function id="GetConstantPool" phase="start" num="146" since="1.1"> 7288 <synopsis>Get Constant Pool</synopsis> 7289 <description> 7290 For the class indicated by <code>klass</code>, 7291 return the raw bytes of the constant pool in the format of the 7292 <code>constant_pool</code> item of 7293 <vmspec chapter="4"/>. 7294 The format of the constant pool may differ between versions 7295 of the Class File Format, so, the 7296 <functionlink id="GetClassVersionNumbers">minor and major 7297 class version numbers</functionlink> should be checked for 7298 compatibility. 7299 <p/> 7300 The returned constant pool might not have the same layout or 7301 contents as the constant pool in the defining class file. 7302 The constant pool returned by GetConstantPool() may have 7303 more or fewer entries than the defining constant pool. 7304 Entries may be in a different order. 7305 The constant pool returned by GetConstantPool() will match the 7306 constant pool used by 7307 <functionlink id="GetBytecodes">GetBytecodes()</functionlink>. 7308 That is, the bytecodes returned by GetBytecodes() will have 7309 constant pool indices which refer to constant pool entries returned 7310 by GetConstantPool(). 7311 Note that since <functionlink id="RetransformClasses"/> 7312 and <functionlink id="RedefineClasses"/> can change 7313 the constant pool, the constant pool returned by this function 7314 can change accordingly. Thus, the correspondence between 7315 GetConstantPool() and GetBytecodes() does not hold if there 7316 is an intervening class retransformation or redefinition. 7317 The value of a constant pool entry used by a given bytecode will 7318 match that of the defining class file (even if the indices don't match). 7319 Constant pool entries which are not used directly or indirectly by 7320 bytecodes (for example, UTF-8 strings associated with annotations) are 7321 not required to exist in the returned constant pool. 7322 </description> 7323 <origin>new</origin> 7324 <capabilities> 7325 <required id="can_get_constant_pool"></required> 7326 </capabilities> 7327 <parameters> 7328 <param id="klass"> 7329 <jclass/> 7330 <description> 7331 The class to query. 7332 </description> 7333 </param> 7334 <param id="constant_pool_count_ptr"> 7335 <outptr><jint/></outptr> 7336 <description> 7337 On return, points to the number of entries 7338 in the constant pool table plus one. 7339 This corresponds to the <code>constant_pool_count</code> 7340 item of the Class File Format. 7341 </description> 7342 </param> 7343 <param id="constant_pool_byte_count_ptr"> 7344 <outptr><jint/></outptr> 7345 <description> 7346 On return, points to the number of bytes 7347 in the returned raw constant pool. 7348 </description> 7349 </param> 7350 <param id="constant_pool_bytes_ptr"> 7351 <allocbuf outcount="constant_pool_byte_count_ptr"><uchar/></allocbuf> 7352 <description> 7353 On return, points to the raw constant pool, that is the bytes 7354 defined by the <code>constant_pool</code> item of the 7355 Class File Format 7356 </description> 7357 </param> 7358 </parameters> 7359 <errors> 7360 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 7361 The class is a primitive or array class. 7362 </error> 7363 </errors> 7364 </function> 7365 7366 <function id="IsInterface" phase="start" num="55"> 7367 <synopsis>Is Interface</synopsis> 7368 <description> 7369 Determines whether a class object reference represents an interface. 7370 The <code>jboolean</code> result is 7371 <code>JNI_TRUE</code> if the "class" is actually an interface, 7372 <code>JNI_FALSE</code> otherwise. 7373 </description> 7374 <origin>jvmdi</origin> 7375 <capabilities> 7376 </capabilities> 7377 <parameters> 7378 <param id="klass"> 7379 <jclass/> 7380 <description> 7381 The class to query. 7382 </description> 7383 </param> 7384 <param id="is_interface_ptr"> 7385 <outptr><jboolean/></outptr> 7386 <description> 7387 On return, points to the boolean result of this function. 7388 7389 </description> 7390 </param> 7391 </parameters> 7392 <errors> 7393 </errors> 7394 </function> 7395 7396 <function id="IsArrayClass" phase="start" num="56"> 7397 <synopsis>Is Array Class</synopsis> 7398 <description> 7399 Determines whether a class object reference represents an array. 7400 The <code>jboolean</code> result is 7401 <code>JNI_TRUE</code> if the class is an array, 7402 <code>JNI_FALSE</code> otherwise. 7403 </description> 7404 <origin>jvmdi</origin> 7405 <capabilities> 7406 </capabilities> 7407 <parameters> 7408 <param id="klass"> 7409 <jclass/> 7410 <description> 7411 The class to query. 7412 </description> 7413 </param> 7414 <param id="is_array_class_ptr"> 7415 <outptr><jboolean/></outptr> 7416 <description> 7417 On return, points to the boolean result of this function. 7418 7419 </description> 7420 </param> 7421 </parameters> 7422 <errors> 7423 </errors> 7424 </function> 7425 7426 <function id="IsModifiableClass" jkernel="yes" phase="start" num="45" since="1.1"> 7427 <synopsis>Is Modifiable Class</synopsis> 7428 <description> 7429 Determines whether a class is modifiable. 7430 If a class is modifiable (<paramlink id="is_modifiable_class_ptr"/> 7431 returns <code>JNI_TRUE</code>) the class can be 7432 redefined with <functionlink id="RedefineClasses"/> (assuming 7433 the agent possesses the 7434 <fieldlink id="can_redefine_classes" struct="jvmtiCapabilities"/> 7435 capability) or 7436 retransformed with <functionlink id="RetransformClasses"/> (assuming 7437 the agent possesses the 7438 <fieldlink id="can_retransform_classes" struct="jvmtiCapabilities"/> 7439 capability). 7440 If a class is not modifiable (<paramlink id="is_modifiable_class_ptr"/> 7441 returns <code>JNI_FALSE</code>) the class can be neither 7442 redefined nor retransformed. 7443 <p/> 7444 Primitive classes (for example, <code>java.lang.Integer.TYPE</code>), 7445 array classes, and some implementation defined classes are never modifiable. 7446 <p/> 7447 </description> 7448 <origin>new</origin> 7449 <capabilities> 7450 <capability id="can_redefine_any_class"> 7451 If possessed then all classes (except primitive, array, and some implementation defined 7452 classes) are modifiable (redefine or retransform). 7453 </capability> 7454 <capability id="can_retransform_any_class"> 7455 If possessed then all classes (except primitive, array, and some implementation defined 7456 classes) are modifiable with <functionlink id="RetransformClasses"/>. 7457 </capability> 7458 <capability id="can_redefine_classes"> 7459 No effect on the result of the function. 7460 But must additionally be possessed to modify the class with 7461 <functionlink id="RedefineClasses"/>. 7462 </capability> 7463 <capability id="can_retransform_classes"> 7464 No effect on the result of the function. 7465 But must additionally be possessed to modify the class with 7466 <functionlink id="RetransformClasses"/>. 7467 </capability> 7468 </capabilities> 7469 <parameters> 7470 <param id="klass"> 7471 <jclass/> 7472 <description> 7473 The class to query. 7474 </description> 7475 </param> 7476 <param id="is_modifiable_class_ptr"> 7477 <outptr><jboolean/></outptr> 7478 <description> 7479 On return, points to the boolean result of this function. 7480 </description> 7481 </param> 7482 </parameters> 7483 <errors> 7484 </errors> 7485 </function> 7486 7487 <function id="GetClassLoader" phase="start" num="57"> 7488 <synopsis>Get Class Loader</synopsis> 7489 <description> 7490 For the class indicated by <code>klass</code>, return via 7491 <code>classloader_ptr</code> a reference to the class loader for the 7492 class. 7493 </description> 7494 <origin>jvmdi</origin> 7495 <capabilities> 7496 </capabilities> 7497 <parameters> 7498 <param id="klass"> 7499 <jclass/> 7500 <description> 7501 The class to query. 7502 </description> 7503 </param> 7504 <param id="classloader_ptr"> 7505 <outptr><jobject/></outptr> 7506 <description> 7507 On return, points to the class loader that loaded 7508 this class. 7509 If the class was not created by a class loader 7510 or if the class loader is the bootstrap class loader, 7511 points to <code>NULL</code>. 7512 </description> 7513 </param> 7514 </parameters> 7515 <errors> 7516 </errors> 7517 7518 </function> 7519 7520 <function id="GetSourceDebugExtension" phase="start" num="90"> 7521 <synopsis>Get Source Debug Extension</synopsis> 7522 <description> 7523 For the class indicated by <code>klass</code>, return the debug 7524 extension via <code>source_debug_extension_ptr</code>. 7525 The returned string 7526 contains exactly the debug extension information present in the 7527 class file of <code>klass</code>. 7528 </description> 7529 <origin>jvmdi</origin> 7530 <capabilities> 7531 <required id="can_get_source_debug_extension"></required> 7532 </capabilities> 7533 <parameters> 7534 <param id="klass"> 7535 <jclass/> 7536 <description> 7537 The class to query. 7538 </description> 7539 </param> 7540 <param id="source_debug_extension_ptr"> 7541 <allocbuf><char/></allocbuf> 7542 <description> 7543 On return, points to the class's debug extension, encoded as a 7544 <internallink id="mUTF">modified UTF-8</internallink> string. 7545 </description> 7546 </param> 7547 </parameters> 7548 <errors> 7549 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 7550 Class information does not include a debug extension. 7551 </error> 7552 </errors> 7553 </function> 7554 7555 <function id="RetransformClasses" jkernel="yes" num="152" since="1.1"> 7556 <synopsis>Retransform Classes</synopsis> 7557 <description> 7558 This function facilitates the 7559 <internallink id="bci">bytecode instrumentation</internallink> 7560 of already loaded classes. 7561 To replace the class definition without reference to the existing 7562 bytecodes, as one might do when recompiling from source for 7563 fix-and-continue debugging, <functionlink id="RedefineClasses"/> 7564 function should be used instead. 7565 <p/> 7566 When classes are initially loaded or when they are 7567 <functionlink id="RedefineClasses">redefined</functionlink>, 7568 the initial class file bytes can be transformed with the 7569 <eventlink id="ClassFileLoadHook"/> event. 7570 This function reruns the transformation process 7571 (whether or not a transformation has previously occurred). 7572 This retransformation follows these steps: 7573 <ul> 7574 <li>starting from the initial class file bytes 7575 </li> 7576 <li>for each <fieldlink id="can_retransform_classes" 7577 struct="jvmtiCapabilities">retransformation 7578 incapable</fieldlink> 7579 agent which received a 7580 <code>ClassFileLoadHook</code> event during the previous 7581 load or redefine, the bytes it returned 7582 (via the <code>new_class_data</code> parameter) 7583 are reused as the output of the transformation; 7584 note that this is equivalent to reapplying 7585 the previous transformation, unaltered. except that 7586 the <code>ClassFileLoadHook</code> event 7587 is <b>not</b> sent to these agents 7588 </li> 7589 <li>for each <fieldlink id="can_retransform_classes" 7590 struct="jvmtiCapabilities">retransformation 7591 capable</fieldlink> 7592 agent, the <code>ClassFileLoadHook</code> event is sent, 7593 allowing a new transformation to be applied 7594 </li> 7595 <li>the transformed class file bytes are installed as the new 7596 definition of the class 7597 </li> 7598 </ul> 7599 See the <eventlink id="ClassFileLoadHook"/> event for more details. 7600 <p/> 7601 The initial class file bytes represent the bytes passed to 7602 <code>ClassLoader.defineClass</code> 7603 or <code>RedefineClasses</code> (before any transformations 7604 were applied), however they may not exactly match them. 7605 The constant pool may differ in ways described in 7606 <functionlink id="GetConstantPool"/>. 7607 Constant pool indices in the bytecodes of methods will correspond. 7608 Some attributes may not be present. 7609 Where order is not meaningful, for example the order of methods, 7610 order may not be preserved. 7611 <p/> 7612 Retransformation can cause new versions of methods to be installed. 7613 Old method versions may become 7614 <internallink id="obsoleteMethods">obsolete</internallink> 7615 The new method version will be used on new invokes. 7616 If a method has active stack frames, those active frames continue to 7617 run the bytecodes of the original method version. 7618 <p/> 7619 This function does not cause any initialization except that which 7620 would occur under the customary JVM semantics. 7621 In other words, retransforming a class does not cause its initializers to be 7622 run. The values of static fields will remain as they were 7623 prior to the call. 7624 <p/> 7625 Threads need not be suspended. 7626 <p/> 7627 All breakpoints in the class are cleared. 7628 <p/> 7629 All attributes are updated. 7630 <p/> 7631 Instances of the retransformed class are not affected -- fields retain their 7632 previous values. 7633 <functionlink id="GetTag">Tags</functionlink> on the instances are 7634 also unaffected. 7635 <p/> 7636 In response to this call, no events other than the 7637 <eventlink id="ClassFileLoadHook"/> event 7638 will be sent. 7639 <p/> 7640 The retransformation may change method bodies, the constant pool and attributes 7641 (unless explicitly prohibited). 7642 The retransformation must not add, remove or rename fields or methods, change the 7643 signatures of methods, change modifiers, or change inheritance. 7644 The retransformation must not change the <code>NestHost</code> or 7645 <code>NestMembers</code> attributes. 7646 These restrictions may be lifted in future versions. 7647 See the error return description below for information on error codes 7648 returned if an unsupported retransformation is attempted. 7649 The class file bytes are not verified or installed until they have passed 7650 through the chain of <eventlink id="ClassFileLoadHook"/> events, thus the 7651 returned error code reflects the result of the transformations. 7652 If any error code is returned other than <code>JVMTI_ERROR_NONE</code>, 7653 none of the classes to be retransformed will have a new definition installed. 7654 When this function returns (with the error code of <code>JVMTI_ERROR_NONE</code>) 7655 all of the classes to be retransformed will have their new definitions installed. 7656 </description> 7657 <origin>new</origin> 7658 <capabilities> 7659 <required id="can_retransform_classes"></required> 7660 <capability id="can_retransform_any_class"></capability> 7661 </capabilities> 7662 <parameters> 7663 <param id="class_count"> 7664 <jint min="0"/> 7665 <description> 7666 The number of classes to be retransformed. 7667 </description> 7668 </param> 7669 <param id="classes"> 7670 <inbuf incount="class_count"><jclass/></inbuf> 7671 <description> 7672 The array of classes to be retransformed. 7673 </description> 7674 </param> 7675 </parameters> 7676 <errors> 7677 <error id="JVMTI_ERROR_UNMODIFIABLE_CLASS"> 7678 One of the <paramlink id="classes"/> cannot be modified. 7679 See <functionlink id="IsModifiableClass"/>. 7680 </error> 7681 <error id="JVMTI_ERROR_INVALID_CLASS"> 7682 One of the <paramlink id="classes"/> is not a valid class. 7683 </error> 7684 <error id="JVMTI_ERROR_UNSUPPORTED_VERSION"> 7685 A retransformed class file has a version number not supported by this VM. 7686 </error> 7687 <error id="JVMTI_ERROR_INVALID_CLASS_FORMAT"> 7688 A retransformed class file is malformed (The VM would return a <code>ClassFormatError</code>). 7689 </error> 7690 <error id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION"> 7691 The retransformed class file definitions would lead to a circular definition 7692 (the VM would return a <code>ClassCircularityError</code>). 7693 </error> 7694 <error id="JVMTI_ERROR_FAILS_VERIFICATION"> 7695 The retransformed class file bytes fail verification. 7696 </error> 7697 <error id="JVMTI_ERROR_NAMES_DONT_MATCH"> 7698 The class name defined in a retransformed class file is 7699 different from the name in the old class object. 7700 </error> 7701 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED"> 7702 A retransformed class file would require adding a method. 7703 </error> 7704 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED"> 7705 A retransformed class file changes a field. 7706 </error> 7707 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED"> 7708 A direct superclass is different for a retransformed class file, 7709 or the set of directly implemented 7710 interfaces is different. 7711 </error> 7712 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED"> 7713 A retransformed class file does not declare a method 7714 declared in the old class version. 7715 </error> 7716 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED"> 7717 A retransformed class file has unsupported differences in class attributes. 7718 </error> 7719 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED"> 7720 A retransformed class file has different class modifiers. 7721 </error> 7722 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED"> 7723 A method in the retransformed class file has different modifiers 7724 than its counterpart in the old class version. 7725 </error> 7726 </errors> 7727 </function> 7728 7729 <function id="RedefineClasses" jkernel="yes" num="87"> 7730 <synopsis>Redefine Classes</synopsis> 7731 <typedef id="jvmtiClassDefinition" label="Class redefinition description"> 7732 <field id="klass"> 7733 <jclass/> 7734 <description> 7735 Class object for this class 7736 </description> 7737 </field> 7738 <field id="class_byte_count"> 7739 <jint/> 7740 <description> 7741 Number of bytes defining class (below) 7742 </description> 7743 </field> 7744 <field id="class_bytes"> 7745 <inbuf incount="class_byte_count"><uchar/></inbuf> 7746 <description> 7747 Bytes defining class (in <vmspec chapter="4"/>) 7748 </description> 7749 </field> 7750 </typedef> 7751 <description> 7752 All classes given are redefined according to the definitions 7753 supplied. 7754 This function is used to replace the definition of a class 7755 with a new definition, as might be needed in fix-and-continue 7756 debugging. 7757 Where the existing class file bytes are to be transformed, for 7758 example in 7759 <internallink id="bci">bytecode instrumentation</internallink>, 7760 <functionlink id="RetransformClasses"/> should be used. 7761 <p/> 7762 Redefinition can cause new versions of methods to be installed. 7763 Old method versions may become 7764 <internallink id="obsoleteMethods">obsolete</internallink> 7765 The new method version will be used on new invokes. 7766 If a method has active stack frames, those active frames continue to 7767 run the bytecodes of the original method version. 7768 If resetting of stack frames is desired, use 7769 <functionlink id="PopFrame"></functionlink> 7770 to pop frames with obsolete method versions. 7771 <p/> 7772 This function does not cause any initialization except that which 7773 would occur under the customary JVM semantics. 7774 In other words, redefining a class does not cause its initializers to be 7775 run. The values of static fields will remain as they were 7776 prior to the call. 7777 <p/> 7778 Threads need not be suspended. 7779 <p/> 7780 All breakpoints in the class are cleared. 7781 <p/> 7782 All attributes are updated. 7783 <p/> 7784 Instances of the redefined class are not affected -- fields retain their 7785 previous values. 7786 <functionlink id="GetTag">Tags</functionlink> on the instances are 7787 also unaffected. 7788 <p/> 7789 In response to this call, the <jvmti/> event 7790 <eventlink id="ClassFileLoadHook">Class File Load Hook</eventlink> 7791 will be sent (if enabled), but no other <jvmti/> events will be sent. 7792 <p/> 7793 The redefinition may change method bodies, the constant pool and attributes 7794 (unless explicitly prohibited). 7795 The redefinition must not add, remove or rename fields or methods, change the 7796 signatures of methods, change modifiers, or change inheritance. 7797 The retransformation must not change the <code>NestHost</code> or 7798 <code>NestMembers</code> attributes. 7799 These restrictions may be lifted in future versions. 7800 See the error return description below for information on error codes 7801 returned if an unsupported redefinition is attempted. 7802 The class file bytes are not verified or installed until they have passed 7803 through the chain of <eventlink id="ClassFileLoadHook"/> events, thus the 7804 returned error code reflects the result of the transformations applied 7805 to the bytes passed into <paramlink id="class_definitions"/>. 7806 If any error code is returned other than <code>JVMTI_ERROR_NONE</code>, 7807 none of the classes to be redefined will have a new definition installed. 7808 When this function returns (with the error code of <code>JVMTI_ERROR_NONE</code>) 7809 all of the classes to be redefined will have their new definitions installed. 7810 </description> 7811 <origin>jvmdi</origin> 7812 <capabilities> 7813 <required id="can_redefine_classes"></required> 7814 <capability id="can_redefine_any_class"></capability> 7815 </capabilities> 7816 <parameters> 7817 <param id="class_count"> 7818 <jint min="0"/> 7819 <description> 7820 The number of classes specified in <code>class_definitions</code> 7821 </description> 7822 </param> 7823 <param id="class_definitions"> 7824 <inbuf incount="class_count"><struct>jvmtiClassDefinition</struct></inbuf> 7825 <description> 7826 The array of new class definitions 7827 </description> 7828 </param> 7829 </parameters> 7830 <errors> 7831 <error id="JVMTI_ERROR_NULL_POINTER"> 7832 One of <code>class_bytes</code> is <code>NULL</code>. 7833 </error> 7834 <error id="JVMTI_ERROR_UNMODIFIABLE_CLASS"> 7835 An element of <code>class_definitions</code> cannot be modified. 7836 See <functionlink id="IsModifiableClass"/>. 7837 </error> 7838 <error id="JVMTI_ERROR_INVALID_CLASS"> 7839 An element of <code>class_definitions</code> is not a valid class. 7840 </error> 7841 <error id="JVMTI_ERROR_UNSUPPORTED_VERSION"> 7842 A new class file has a version number not supported by this VM. 7843 </error> 7844 <error id="JVMTI_ERROR_INVALID_CLASS_FORMAT"> 7845 A new class file is malformed (The VM would return a <code>ClassFormatError</code>). 7846 </error> 7847 <error id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION"> 7848 The new class file definitions would lead to a circular definition 7849 (the VM would return a <code>ClassCircularityError</code>). 7850 </error> 7851 <error id="JVMTI_ERROR_FAILS_VERIFICATION"> 7852 The class bytes fail verification. 7853 </error> 7854 <error id="JVMTI_ERROR_NAMES_DONT_MATCH"> 7855 The class name defined in a new class file is 7856 different from the name in the old class object. 7857 </error> 7858 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED"> 7859 A new class file would require adding a method. 7860 </error> 7861 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED"> 7862 A new class version changes a field. 7863 </error> 7864 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED"> 7865 A direct superclass is different for a new class 7866 version, or the set of directly implemented 7867 interfaces is different. 7868 </error> 7869 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED"> 7870 A new class version does not declare a method 7871 declared in the old class version. 7872 </error> 7873 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED"> 7874 A new class version has unsupported differences in class attributes. 7875 </error> 7876 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED"> 7877 A new class version has different modifiers. 7878 </error> 7879 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED"> 7880 A method in the new class version has different modifiers 7881 than its counterpart in the old class version. 7882 </error> 7883 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE"> 7884 A module cannot be modified. 7885 See <functionlink id="IsModifiableModule"/>. 7886 </error> 7887 </errors> 7888 </function> 7889 7890 </category> 7891 7892 <category id="object" label="Object"> 7893 7894 <function id="GetObjectSize" jkernel="yes" phase="start" num="154"> 7895 <synopsis>Get Object Size</synopsis> 7896 <description> 7897 For the object indicated by <code>object</code>, 7898 return via <code>size_ptr</code> the size of the object. 7899 This size is an implementation-specific approximation of 7900 the amount of storage consumed by this object. 7901 It may include some or all of the object's overhead, and thus 7902 is useful for comparison within an implementation but not 7903 between implementations. 7904 The estimate may change during a single invocation of the JVM. 7905 </description> 7906 <origin>new</origin> 7907 <capabilities> 7908 </capabilities> 7909 <parameters> 7910 <param id="object"> 7911 <jobject/> 7912 <description> 7913 The object to query. 7914 </description> 7915 </param> 7916 <param id="size_ptr"> 7917 <outptr><jlong/></outptr> 7918 <description> 7919 On return, points to the object's size in bytes. 7920 </description> 7921 </param> 7922 </parameters> 7923 <errors> 7924 </errors> 7925 </function> 7926 7927 <function id="GetObjectHashCode" phase="start" num="58"> 7928 <synopsis>Get Object Hash Code</synopsis> 7929 <description> 7930 For the object indicated by <code>object</code>, 7931 return via <code>hash_code_ptr</code> a hash code. 7932 This hash code could be used to maintain a hash table of object references, 7933 however, on some implementations this can cause significant performance 7934 impacts--in most cases 7935 <internallink id="Heap">tags</internallink> 7936 will be a more efficient means of associating information with objects. 7937 This function guarantees 7938 the same hash code value for a particular object throughout its life 7939 </description> 7940 <origin>jvmdi</origin> 7941 <capabilities> 7942 </capabilities> 7943 <parameters> 7944 <param id="object"> 7945 <jobject/> 7946 <description> 7947 The object to query. 7948 </description> 7949 </param> 7950 <param id="hash_code_ptr"> 7951 <outptr><jint/></outptr> 7952 <description> 7953 On return, points to the object's hash code. 7954 </description> 7955 </param> 7956 </parameters> 7957 <errors> 7958 </errors> 7959 </function> 7960 7961 <function id="GetObjectMonitorUsage" num="59"> 7962 <synopsis>Get Object Monitor Usage</synopsis> 7963 <typedef id="jvmtiMonitorUsage" label="Object monitor usage information"> 7964 <field id="owner"> 7965 <jthread/> 7966 <description> 7967 The thread owning this monitor, or <code>NULL</code> if unused 7968 </description> 7969 </field> 7970 <field id="entry_count"> 7971 <jint/> 7972 <description> 7973 The number of times the owning thread has entered the monitor 7974 </description> 7975 </field> 7976 <field id="waiter_count"> 7977 <jint/> 7978 <description> 7979 The number of threads waiting to own this monitor 7980 </description> 7981 </field> 7982 <field id="waiters"> 7983 <allocfieldbuf><jthread/></allocfieldbuf> 7984 <description> 7985 The <code>waiter_count</code> waiting threads 7986 </description> 7987 </field> 7988 <field id="notify_waiter_count"> 7989 <jint/> 7990 <description> 7991 The number of threads waiting to be notified by this monitor 7992 </description> 7993 </field> 7994 <field id="notify_waiters"> 7995 <allocfieldbuf><jthread/></allocfieldbuf> 7996 <description> 7997 The <code>notify_waiter_count</code> threads waiting to be notified 7998 </description> 7999 </field> 8000 </typedef> 8001 <description> 8002 Get information about the object's monitor. 8003 The fields of the <functionlink id="jvmtiMonitorUsage"></functionlink> structure 8004 are filled in with information about usage of the monitor. 8005 <todo> 8006 Decide and then clarify suspend requirements. 8007 </todo> 8008 </description> 8009 <origin>jvmdi</origin> 8010 <capabilities> 8011 <required id="can_get_monitor_info"></required> 8012 </capabilities> 8013 <parameters> 8014 <param id="object"> 8015 <jobject/> 8016 <description> 8017 The object to query. 8018 </description> 8019 </param> 8020 <param id="info_ptr"> 8021 <outptr><struct>jvmtiMonitorUsage</struct></outptr> 8022 <description> 8023 On return, filled with monitor information for the 8024 specified object. 8025 </description> 8026 </param> 8027 </parameters> 8028 <errors> 8029 </errors> 8030 </function> 8031 8032 <elide> 8033 <function id="GetObjectMonitors" num="116"> 8034 <synopsis>Get Object Monitors</synopsis> 8035 <description> 8036 Return the list of object monitors. 8037 <p/> 8038 Note: details about each monitor can be examined with 8039 <functionlink id="GetObjectMonitorUsage"></functionlink>. 8040 </description> 8041 <origin>new</origin> 8042 <capabilities> 8043 <required id="can_get_monitor_info"></required> 8044 </capabilities> 8045 <parameters> 8046 <param id="monitorCnt"> 8047 <outptr><jint/></outptr> 8048 <description> 8049 On return, pointer to the number 8050 of monitors returned in <code>monitors_ptr</code>. 8051 </description> 8052 </param> 8053 <param id="monitors_ptr"> 8054 <allocbuf outcount="monitorCnt"><jobject/></allocbuf> 8055 <description> 8056 On return, pointer to the monitor list. 8057 </description> 8058 </param> 8059 </parameters> 8060 <errors> 8061 </errors> 8062 </function> 8063 </elide> 8064 8065 </category> 8066 8067 <category id="fieldCategory" label="Field"> 8068 8069 <intro> 8070 </intro> 8071 8072 <function id="GetFieldName" phase="start" num="60"> 8073 <synopsis>Get Field Name (and Signature)</synopsis> 8074 <description> 8075 For the field indicated by <paramlink id="klass"/> and <paramlink id="field"/>, 8076 return the field name via <paramlink id="name_ptr"/> and field signature via 8077 <paramlink id="signature_ptr"/>. 8078 <p/> 8079 Field signatures are defined in the 8080 <externallink id="jni/index.html">JNI Specification</externallink> 8081 and are referred to as <code>field descriptors</code> in 8082 <vmspec chapter="4.3.2"/>. 8083 </description> 8084 <origin>jvmdiClone</origin> 8085 <capabilities> 8086 </capabilities> 8087 <parameters> 8088 <param id="klass"> 8089 <jclass field="field"/> 8090 <description> 8091 The class of the field to query. 8092 </description> 8093 </param> 8094 <param id="field"> 8095 <jfieldID class="klass"/> 8096 <description> 8097 The field to query. 8098 </description> 8099 </param> 8100 <param id="name_ptr"> 8101 <allocbuf> 8102 <char/> 8103 <nullok>the name is not returned</nullok> 8104 </allocbuf> 8105 <description> 8106 On return, points to the field name, encoded as a 8107 <internallink id="mUTF">modified UTF-8</internallink> string. 8108 </description> 8109 </param> 8110 <param id="signature_ptr"> 8111 <allocbuf> 8112 <char/> 8113 <nullok>the signature is not returned</nullok> 8114 </allocbuf> 8115 <description> 8116 On return, points to the field signature, encoded as a 8117 <internallink id="mUTF">modified UTF-8</internallink> string. 8118 </description> 8119 </param> 8120 <param id="generic_ptr"> 8121 <allocbuf> 8122 <char/> 8123 <nullok>the generic signature is not returned</nullok> 8124 </allocbuf> 8125 <description> 8126 On return, points to the generic signature of the field, encoded as a 8127 <internallink id="mUTF">modified UTF-8</internallink> string. 8128 If there is no generic signature attribute for the field, then, 8129 on return, points to <code>NULL</code>. 8130 </description> 8131 </param> 8132 </parameters> 8133 <errors> 8134 </errors> 8135 </function> 8136 8137 <function id="GetFieldDeclaringClass" phase="start" num="61"> 8138 <synopsis>Get Field Declaring Class</synopsis> 8139 <description> 8140 For the field indicated by <code>klass</code> and <code>field</code> 8141 return the class that defined it via <code>declaring_class_ptr</code>. 8142 The declaring class will either be <code>klass</code>, a superclass, or 8143 an implemented interface. 8144 </description> 8145 <origin>jvmdi</origin> 8146 <capabilities> 8147 </capabilities> 8148 <parameters> 8149 <param id="klass"> 8150 <jclass field="field"/> 8151 <description> 8152 The class to query. 8153 </description> 8154 </param> 8155 <param id="field"> 8156 <jfieldID class="klass"/> 8157 <description> 8158 The field to query. 8159 </description> 8160 </param> 8161 <param id="declaring_class_ptr"> 8162 <outptr><jclass/></outptr> 8163 <description> 8164 On return, points to the declaring class 8165 </description> 8166 </param> 8167 </parameters> 8168 <errors> 8169 </errors> 8170 </function> 8171 8172 <function id="GetFieldModifiers" phase="start" num="62"> 8173 <synopsis>Get Field Modifiers</synopsis> 8174 <description> 8175 For the field indicated by <code>klass</code> and <code>field</code> 8176 return the access flags via <code>modifiers_ptr</code>. 8177 Access flags are defined in <vmspec chapter="4"/>. 8178 </description> 8179 <origin>jvmdi</origin> 8180 <capabilities> 8181 </capabilities> 8182 <parameters> 8183 <param id="klass"> 8184 <jclass field="field"/> 8185 <description> 8186 The class to query. 8187 </description> 8188 </param> 8189 <param id="field"> 8190 <jfieldID class="klass"/> 8191 <description> 8192 The field to query. 8193 </description> 8194 </param> 8195 <param id="modifiers_ptr"> 8196 <outptr><jint/></outptr> 8197 <description> 8198 On return, points to the access flags. 8199 </description> 8200 </param> 8201 </parameters> 8202 <errors> 8203 </errors> 8204 </function> 8205 8206 <function id="IsFieldSynthetic" phase="start" num="63"> 8207 <synopsis>Is Field Synthetic</synopsis> 8208 <description> 8209 For the field indicated by <code>klass</code> and <code>field</code>, return a 8210 value indicating whether the field is synthetic via <code>is_synthetic_ptr</code>. 8211 Synthetic fields are generated by the compiler but not present in the 8212 original source code. 8213 </description> 8214 <origin>jvmdi</origin> 8215 <capabilities> 8216 <required id="can_get_synthetic_attribute"></required> 8217 </capabilities> 8218 <parameters> 8219 <param id="klass"> 8220 <jclass field="field"/> 8221 <description> 8222 The class of the field to query. 8223 </description> 8224 </param> 8225 <param id="field"> 8226 <jfieldID class="klass"/> 8227 <description> 8228 The field to query. 8229 </description> 8230 </param> 8231 <param id="is_synthetic_ptr"> 8232 <outptr><jboolean/></outptr> 8233 <description> 8234 On return, points to the boolean result of this function. 8235 </description> 8236 </param> 8237 </parameters> 8238 <errors> 8239 </errors> 8240 </function> 8241 8242 </category> 8243 8244 <category id="method" label="Method"> 8245 8246 <intro> 8247 These functions provide information about a method (represented as a 8248 <typelink id="jmethodID"/>) and set how methods are processed. 8249 </intro> 8250 8251 <intro id="obsoleteMethods" label="Obsolete Methods"> 8252 The functions <functionlink id="RetransformClasses"/> and 8253 <functionlink id="RedefineClasses"/> can cause new versions 8254 of methods to be installed. 8255 An original version of a method is considered equivalent 8256 to the new version if: 8257 <ul> 8258 <li>their bytecodes are the same except for indices into the 8259 constant pool and </li> 8260 <li>the referenced constants are equal.</li> 8261 </ul> 8262 An original method version which is not equivalent to the 8263 new method version is called obsolete and is assigned a new method ID; 8264 the original method ID now refers to the new method version. 8265 A method ID can be tested for obsolescence with 8266 <functionlink id="IsMethodObsolete"/>. 8267 </intro> 8268 8269 <function id="GetMethodName" phase="start" num="64"> 8270 <synopsis>Get Method Name (and Signature)</synopsis> 8271 <description> 8272 For the method indicated by <code>method</code>, 8273 return the method name via <code>name_ptr</code> and method signature via 8274 <code>signature_ptr</code>. 8275 <p/> 8276 Method signatures are defined in the 8277 <externallink id="jni/index.html">JNI Specification</externallink> 8278 and are referred to as <code>method descriptors</code> in 8279 <vmspec chapter="4.3.3"/>. 8280 Note this is different 8281 than method signatures as defined in the <i>Java Language Specification</i>. 8282 </description> 8283 <origin>jvmdiClone</origin> 8284 <capabilities> 8285 </capabilities> 8286 <parameters> 8287 <param id="method"> 8288 <jmethodID/> 8289 <description> 8290 The method to query. 8291 </description> 8292 </param> 8293 <param id="name_ptr"> 8294 <allocbuf> 8295 <char/> 8296 <nullok>the name is not returned</nullok> 8297 </allocbuf> 8298 <description> 8299 On return, points to the method name, encoded as a 8300 <internallink id="mUTF">modified UTF-8</internallink> string. 8301 </description> 8302 </param> 8303 <param id="signature_ptr"> 8304 <allocbuf> 8305 <char/> 8306 <nullok>the signature is not returned</nullok> 8307 </allocbuf> 8308 <description> 8309 On return, points to the method signature, encoded as a 8310 <internallink id="mUTF">modified UTF-8</internallink> string. 8311 </description> 8312 </param> 8313 <param id="generic_ptr"> 8314 <allocbuf> 8315 <char/> 8316 <nullok>the generic signature is not returned</nullok> 8317 </allocbuf> 8318 <description> 8319 On return, points to the generic signature of the method, encoded as a 8320 <internallink id="mUTF">modified UTF-8</internallink> string. 8321 If there is no generic signature attribute for the method, then, 8322 on return, points to <code>NULL</code>. 8323 </description> 8324 </param> 8325 </parameters> 8326 <errors> 8327 </errors> 8328 </function> 8329 8330 <function id="GetMethodDeclaringClass" phase="start" num="65"> 8331 <synopsis>Get Method Declaring Class</synopsis> 8332 <description> 8333 For the method indicated by <code>method</code>, 8334 return the class that defined it via <code>declaring_class_ptr</code>. 8335 </description> 8336 <origin>jvmdi</origin> 8337 <capabilities> 8338 </capabilities> 8339 <parameters> 8340 <param id="klass"> 8341 <jclass method="method"/> 8342 <description> 8343 The class to query. 8344 </description> 8345 </param> 8346 <param id="method"> 8347 <jmethodID class="klass"/> 8348 <description> 8349 The method to query. 8350 </description> 8351 </param> 8352 <param id="declaring_class_ptr"> 8353 <outptr><jclass/></outptr> 8354 <description> 8355 On return, points to the declaring class 8356 </description> 8357 </param> 8358 </parameters> 8359 <errors> 8360 </errors> 8361 </function> 8362 8363 <function id="GetMethodModifiers" phase="start" num="66"> 8364 <synopsis>Get Method Modifiers</synopsis> 8365 <description> 8366 For the method indicated by <code>method</code>, 8367 return the access flags via <code>modifiers_ptr</code>. 8368 Access flags are defined in <vmspec chapter="4"/>. 8369 </description> 8370 <origin>jvmdi</origin> 8371 <capabilities> 8372 </capabilities> 8373 <parameters> 8374 <param id="klass"> 8375 <jclass method="method"/> 8376 <description> 8377 The class to query. 8378 </description> 8379 </param> 8380 <param id="method"> 8381 <jmethodID class="klass"/> 8382 <description> 8383 The method to query. 8384 </description> 8385 </param> 8386 <param id="modifiers_ptr"> 8387 <outptr><jint/></outptr> 8388 <description> 8389 On return, points to the access flags. 8390 </description> 8391 </param> 8392 </parameters> 8393 <errors> 8394 </errors> 8395 </function> 8396 8397 <function id="GetMaxLocals" phase="start" num="68"> 8398 <synopsis>Get Max Locals</synopsis> 8399 <description> 8400 For the method indicated by <code>method</code>, 8401 return the number of local variable slots used by the method, 8402 including the local variables used to pass parameters to the 8403 method on its invocation. 8404 <p/> 8405 See <code>max_locals</code> in <vmspec chapter="4.7.3"/>. 8406 </description> 8407 <origin>jvmdi</origin> 8408 <capabilities> 8409 </capabilities> 8410 <parameters> 8411 <param id="klass"> 8412 <jclass method="method"/> 8413 <description> 8414 The class to query. 8415 </description> 8416 </param> 8417 <param id="method"> 8418 <jmethodID class="klass" native="error"/> 8419 <description> 8420 The method to query. 8421 </description> 8422 </param> 8423 <param id="max_ptr"> 8424 <outptr><jint/></outptr> 8425 <description> 8426 On return, points to the maximum number of local slots 8427 </description> 8428 </param> 8429 </parameters> 8430 <errors> 8431 </errors> 8432 </function> 8433 8434 <function id="GetArgumentsSize" phase="start" num="69"> 8435 <synopsis>Get Arguments Size</synopsis> 8436 <description> 8437 For the method indicated by <code>method</code>, 8438 return via <code>max_ptr</code> the number of local variable slots used 8439 by the method's arguments. 8440 Note that two-word arguments use two slots. 8441 </description> 8442 <origin>jvmdi</origin> 8443 <capabilities> 8444 </capabilities> 8445 <parameters> 8446 <param id="klass"> 8447 <jclass method="method"/> 8448 <description> 8449 The class to query. 8450 </description> 8451 </param> 8452 <param id="method"> 8453 <jmethodID class="klass" native="error"/> 8454 <description> 8455 The method to query. 8456 </description> 8457 </param> 8458 <param id="size_ptr"> 8459 <outptr><jint/></outptr> 8460 <description> 8461 On return, points to the number of argument slots 8462 </description> 8463 </param> 8464 </parameters> 8465 <errors> 8466 </errors> 8467 </function> 8468 8469 <function id="GetLineNumberTable" phase="start" num="70"> 8470 <synopsis>Get Line Number Table</synopsis> 8471 <typedef id="jvmtiLineNumberEntry" label="Line number table entry"> 8472 <field id="start_location"> 8473 <jlocation/> 8474 <description> 8475 the <datalink id="jlocation"></datalink> where the line begins 8476 </description> 8477 </field> 8478 <field id="line_number"> 8479 <jint/> 8480 <description> 8481 the line number 8482 </description> 8483 </field> 8484 </typedef> 8485 <description> 8486 For the method indicated by <code>method</code>, 8487 return a table of source line number entries. The size of the table is 8488 returned via <code>entry_count_ptr</code> and the table itself is 8489 returned via <code>table_ptr</code>. 8490 </description> 8491 <origin>jvmdi</origin> 8492 <capabilities> 8493 <required id="can_get_line_numbers"></required> 8494 </capabilities> 8495 <parameters> 8496 <param id="klass"> 8497 <jclass method="method"/> 8498 <description> 8499 The class to query. 8500 </description> 8501 </param> 8502 <param id="method"> 8503 <jmethodID class="klass" native="error"/> 8504 <description> 8505 The method to query. 8506 </description> 8507 </param> 8508 <param id="entry_count_ptr"> 8509 <outptr><jint/></outptr> 8510 <description> 8511 On return, points to the number of entries in the table 8512 </description> 8513 </param> 8514 <param id="table_ptr"> 8515 <allocbuf outcount="entry_count_ptr"><struct>jvmtiLineNumberEntry</struct></allocbuf> 8516 <description> 8517 On return, points to the line number table pointer. 8518 </description> 8519 </param> 8520 </parameters> 8521 <errors> 8522 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 8523 Class information does not include line numbers. 8524 </error> 8525 </errors> 8526 </function> 8527 8528 <function id="GetMethodLocation" phase="start" num="71"> 8529 <synopsis>Get Method Location</synopsis> 8530 <description> 8531 For the method indicated by <code>method</code>, 8532 return the beginning and ending addresses through 8533 <code>start_location_ptr</code> and <code>end_location_ptr</code>. In a 8534 conventional bytecode indexing scheme, 8535 <code>start_location_ptr</code> will always point to zero 8536 and <code>end_location_ptr</code> 8537 will always point to the bytecode count minus one. 8538 </description> 8539 <origin>jvmdi</origin> 8540 <capabilities> 8541 </capabilities> 8542 <parameters> 8543 <param id="klass"> 8544 <jclass method="method"/> 8545 <description> 8546 The class to query. 8547 </description> 8548 </param> 8549 <param id="method"> 8550 <jmethodID class="klass" native="error"/> 8551 <description> 8552 The method to query. 8553 </description> 8554 </param> 8555 <param id="start_location_ptr"> 8556 <outptr><jlocation/></outptr> 8557 <description> 8558 On return, points to the first location, or 8559 <code>-1</code> if location information is not available. 8560 If the information is available and 8561 <functionlink id="GetJLocationFormat"></functionlink> 8562 returns <datalink id="JVMTI_JLOCATION_JVMBCI"></datalink> 8563 then this will always be zero. 8564 </description> 8565 </param> 8566 <param id="end_location_ptr"> 8567 <outptr><jlocation/></outptr> 8568 <description> 8569 On return, points to the last location, 8570 or <code>-1</code> if location information is not available. 8571 </description> 8572 </param> 8573 </parameters> 8574 <errors> 8575 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 8576 Class information does not include method sizes. 8577 </error> 8578 </errors> 8579 </function> 8580 8581 <function id="GetLocalVariableTable" num="72"> 8582 <synopsis>Get Local Variable Table</synopsis> 8583 <typedef id="jvmtiLocalVariableEntry" label="Local variable table entry"> 8584 <field id="start_location"> 8585 <jlocation/> 8586 <description> 8587 The code array index where the local variable is first valid 8588 (that is, where it must have a value). 8589 </description> 8590 </field> 8591 <field id="length"> 8592 <jint/> 8593 <description> 8594 The length of the valid section for this local variable. 8595 The last code array index where the local variable is valid 8596 is <code>start_location + length</code>. 8597 </description> 8598 </field> 8599 <field id="name"> 8600 <allocfieldbuf><char/></allocfieldbuf> 8601 <description> 8602 The local variable name, encoded as a 8603 <internallink id="mUTF">modified UTF-8</internallink> string. 8604 </description> 8605 </field> 8606 <field id="signature"> 8607 <allocfieldbuf><char/></allocfieldbuf> 8608 <description> 8609 The local variable's type signature, encoded as a 8610 <internallink id="mUTF">modified UTF-8</internallink> string. 8611 The signature format is the same as that defined in 8612 <vmspec chapter="4.3.2"/>. 8613 </description> 8614 </field> 8615 <field id="generic_signature"> 8616 <allocfieldbuf><char/></allocfieldbuf> 8617 <description> 8618 The local variable's generic signature, encoded as a 8619 <internallink id="mUTF">modified UTF-8</internallink> string. 8620 The value of this field will be <code>NULL</code> for any local 8621 variable which does not have a generic type. 8622 </description> 8623 </field> 8624 <field id="slot"> 8625 <jint/> 8626 <description> 8627 The local variable's slot. See <internallink id="local">Local Variables</internallink>. 8628 </description> 8629 </field> 8630 </typedef> 8631 <description> 8632 Return local variable information. 8633 </description> 8634 <origin>jvmdiClone</origin> 8635 <capabilities> 8636 <required id="can_access_local_variables"></required> 8637 </capabilities> 8638 <parameters> 8639 <param id="method"> 8640 <jmethodID native="error"/> 8641 <description> 8642 The method to query. 8643 </description> 8644 </param> 8645 <param id="entry_count_ptr"> 8646 <outptr><jint/></outptr> 8647 <description> 8648 On return, points to the number of entries in the table 8649 </description> 8650 </param> 8651 <param id="table_ptr"> 8652 <allocbuf outcount="entry_count_ptr"><struct>jvmtiLocalVariableEntry</struct></allocbuf> 8653 <description> 8654 On return, points to an array of local variable table entries. 8655 </description> 8656 </param> 8657 </parameters> 8658 <errors> 8659 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 8660 Class information does not include local variable 8661 information. 8662 </error> 8663 </errors> 8664 </function> 8665 8666 <function id="GetBytecodes" phase="start" num="75"> 8667 <synopsis>Get Bytecodes</synopsis> 8668 <description> 8669 For the method indicated by <code>method</code>, 8670 return the bytecodes that implement the method. The number of 8671 bytecodes is returned via <code>bytecode_count_ptr</code>. The bytecodes 8672 themselves are returned via <code>bytecodes_ptr</code>. 8673 </description> 8674 <origin>jvmdi</origin> 8675 <capabilities> 8676 <required id="can_get_bytecodes"></required> 8677 </capabilities> 8678 <parameters> 8679 <param id="klass"> 8680 <jclass method="method"/> 8681 <description> 8682 The class to query. 8683 </description> 8684 </param> 8685 <param id="method"> 8686 <jmethodID class="klass" native="error"/> 8687 <description> 8688 The method to query. 8689 </description> 8690 </param> 8691 <param id="bytecode_count_ptr"> 8692 <outptr><jint/></outptr> 8693 <description> 8694 On return, points to the length of the bytecode array 8695 </description> 8696 </param> 8697 <param id="bytecodes_ptr"> 8698 <allocbuf outcount="bytecode_count_ptr"><uchar/></allocbuf> 8699 <description> 8700 On return, points to the pointer to the bytecode array 8701 </description> 8702 </param> 8703 </parameters> 8704 <errors> 8705 </errors> 8706 </function> 8707 8708 <function id="IsMethodNative" phase="start" num="76"> 8709 <synopsis>Is Method Native</synopsis> 8710 <description> 8711 For the method indicated by <code>method</code>, return a 8712 value indicating whether the method is native via <code>is_native_ptr</code> 8713 </description> 8714 <origin>jvmdi</origin> 8715 <capabilities> 8716 </capabilities> 8717 <parameters> 8718 <param id="klass"> 8719 <jclass method="method"/> 8720 <description> 8721 The class to query. 8722 </description> 8723 </param> 8724 <param id="method"> 8725 <jmethodID class="klass"/> 8726 <description> 8727 The method to query. 8728 </description> 8729 </param> 8730 <param id="is_native_ptr"> 8731 <outptr><jboolean/></outptr> 8732 <description> 8733 On return, points to the boolean result of this function. 8734 </description> 8735 </param> 8736 </parameters> 8737 <errors> 8738 </errors> 8739 </function> 8740 8741 <function id="IsMethodSynthetic" phase="start" num="77"> 8742 <synopsis>Is Method Synthetic</synopsis> 8743 <description> 8744 For the method indicated by <code>method</code>, return a 8745 value indicating whether the method is synthetic via <code>is_synthetic_ptr</code>. 8746 Synthetic methods are generated by the compiler but not present in the 8747 original source code. 8748 </description> 8749 <origin>jvmdi</origin> 8750 <capabilities> 8751 <required id="can_get_synthetic_attribute"></required> 8752 </capabilities> 8753 <parameters> 8754 <param id="klass"> 8755 <jclass method="method"/> 8756 <description> 8757 The class to query. 8758 </description> 8759 </param> 8760 <param id="method"> 8761 <jmethodID class="klass"/> 8762 <description> 8763 The method to query. 8764 </description> 8765 </param> 8766 <param id="is_synthetic_ptr"> 8767 <outptr><jboolean/></outptr> 8768 <description> 8769 On return, points to the boolean result of this function. 8770 </description> 8771 </param> 8772 </parameters> 8773 <errors> 8774 </errors> 8775 </function> 8776 8777 <function id="IsMethodObsolete" phase="start" num="91"> 8778 <synopsis>Is Method Obsolete</synopsis> 8779 <description> 8780 Determine if a method ID refers to an 8781 <internallink id="obsoleteMethods">obsolete</internallink> 8782 method version. 8783 </description> 8784 <origin>jvmdi</origin> 8785 <capabilities> 8786 </capabilities> 8787 <parameters> 8788 <param id="klass"> 8789 <jclass method="method"/> 8790 <description> 8791 The class to query. 8792 </description> 8793 </param> 8794 <param id="method"> 8795 <jmethodID class="klass"/> 8796 <description> 8797 The method ID to query. 8798 </description> 8799 </param> 8800 <param id="is_obsolete_ptr"> 8801 <outptr><jboolean/></outptr> 8802 <description> 8803 On return, points to the boolean result of this function. 8804 </description> 8805 </param> 8806 </parameters> 8807 <errors> 8808 </errors> 8809 </function> 8810 8811 <function id="SetNativeMethodPrefix" jkernel="yes" phase="any" num="73" since="1.1"> 8812 <synopsis>Set Native Method Prefix</synopsis> 8813 <description> 8814 This function modifies the failure handling of 8815 native method resolution by allowing retry 8816 with a prefix applied to the name. 8817 When used with the 8818 <eventlink id="ClassFileLoadHook">ClassFileLoadHook 8819 event</eventlink>, it enables native methods to be 8820 <internallink id="bci">instrumented</internallink>. 8821 <p/> 8822 Since native methods cannot be directly instrumented 8823 (they have no bytecodes), they must be wrapped with 8824 a non-native method which can be instrumented. 8825 For example, if we had: 8826 <example> 8827 native boolean foo(int x);</example> 8828 <p/> 8829 We could transform the class file (with the 8830 ClassFileLoadHook event) so that this becomes: 8831 <example> 8832 boolean foo(int x) { 8833 <i>... record entry to foo ...</i> 8834 return wrapped_foo(x); 8835 } 8836 8837 native boolean wrapped_foo(int x);</example> 8838 <p/> 8839 Where foo becomes a wrapper for the actual native method 8840 with the appended prefix "wrapped_". Note that 8841 "wrapped_" would be a poor choice of prefix since it 8842 might conceivably form the name of an existing method 8843 thus something like "$$$MyAgentWrapped$$$_" would be 8844 better but would make these examples less readable. 8845 <p/> 8846 The wrapper will allow data to be collected on the native 8847 method call, but now the problem becomes linking up the 8848 wrapped method with the native implementation. 8849 That is, the method <code>wrapped_foo</code> needs to be 8850 resolved to the native implementation of <code>foo</code>, 8851 which might be: 8852 <example> 8853 Java_somePackage_someClass_foo(JNIEnv* env, jint x)</example> 8854 <p/> 8855 This function allows the prefix to be specified and the 8856 proper resolution to occur. 8857 Specifically, when the standard resolution fails, the 8858 resolution is retried taking the prefix into consideration. 8859 There are two ways that resolution occurs, explicit 8860 resolution with the JNI function <code>RegisterNatives</code> 8861 and the normal automatic resolution. For 8862 <code>RegisterNatives</code>, the VM will attempt this 8863 association: 8864 <example> 8865 method(foo) -> nativeImplementation(foo)</example> 8866 <p/> 8867 When this fails, the resolution will be retried with 8868 the specified prefix prepended to the method name, 8869 yielding the correct resolution: 8870 <example> 8871 method(wrapped_foo) -> nativeImplementation(foo)</example> 8872 <p/> 8873 For automatic resolution, the VM will attempt: 8874 <example> 8875 method(wrapped_foo) -> nativeImplementation(wrapped_foo)</example> 8876 <p/> 8877 When this fails, the resolution will be retried with 8878 the specified prefix deleted from the implementation name, 8879 yielding the correct resolution: 8880 <example> 8881 method(wrapped_foo) -> nativeImplementation(foo)</example> 8882 <p/> 8883 Note that since the prefix is only used when standard 8884 resolution fails, native methods can be wrapped selectively. 8885 <p/> 8886 Since each <jvmti/> environment is independent and 8887 can do its own transformation of the bytecodes, more 8888 than one layer of wrappers may be applied. Thus each 8889 environment needs its own prefix. Since transformations 8890 are applied in order, the prefixes, if applied, will 8891 be applied in the same order. 8892 The order of transformation application is described in 8893 the <eventlink id="ClassFileLoadHook"/> event. 8894 Thus if three environments applied 8895 wrappers, <code>foo</code> might become 8896 <code>$env3_$env2_$env1_foo</code>. But if, say, 8897 the second environment did not apply a wrapper to 8898 <code>foo</code> it would be just 8899 <code>$env3_$env1_foo</code>. To be able to 8900 efficiently determine the sequence of prefixes, 8901 an intermediate prefix is only applied if its non-native 8902 wrapper exists. Thus, in the last example, even though 8903 <code>$env1_foo</code> is not a native method, the 8904 <code>$env1_</code> prefix is applied since 8905 <code>$env1_foo</code> exists. 8906 <p/> 8907 Since the prefixes are used at resolution time 8908 and since resolution may be arbitrarily delayed, a 8909 native method prefix must remain set as long as there 8910 are corresponding prefixed native methods. 8911 </description> 8912 <origin>new</origin> 8913 <capabilities> 8914 <required id="can_set_native_method_prefix"></required> 8915 </capabilities> 8916 <parameters> 8917 <param id="prefix"> 8918 <inbuf> 8919 <char/> 8920 <nullok> 8921 any existing prefix in this environment is cancelled 8922 </nullok> 8923 </inbuf> 8924 <description> 8925 The prefix to apply, encoded as a 8926 <internallink id="mUTF">modified UTF-8</internallink> string. 8927 </description> 8928 </param> 8929 </parameters> 8930 <errors> 8931 </errors> 8932 </function> 8933 8934 <function id="SetNativeMethodPrefixes" jkernel="yes" phase="any" num="74" since="1.1"> 8935 <synopsis>Set Native Method Prefixes</synopsis> 8936 <description> 8937 For a normal agent, <functionlink id="SetNativeMethodPrefix"/> 8938 will provide all needed native method prefixing. 8939 For a meta-agent that performs multiple independent class 8940 file transformations (for example as a proxy for another 8941 layer of agents) this function allows each transformation 8942 to have its own prefix. 8943 The prefixes are applied in the order supplied and are 8944 processed in the same manner as described for the 8945 application of prefixes from multiple <jvmti/> environments 8946 in <functionlink id="SetNativeMethodPrefix"/>. 8947 <p/> 8948 Any previous prefixes are replaced. Thus, calling this 8949 function with a <paramlink id="prefix_count"/> of <code>0</code> 8950 disables prefixing in this environment. 8951 <p/> 8952 <functionlink id="SetNativeMethodPrefix"/> and this function 8953 are the two ways to set the prefixes. 8954 Calling <code>SetNativeMethodPrefix</code> with 8955 a prefix is the same as calling this function with 8956 <paramlink id="prefix_count"/> of <code>1</code>. 8957 Calling <code>SetNativeMethodPrefix</code> with 8958 <code>NULL</code> is the same as calling this function with 8959 <paramlink id="prefix_count"/> of <code>0</code>. 8960 </description> 8961 <origin>new</origin> 8962 <capabilities> 8963 <required id="can_set_native_method_prefix"></required> 8964 </capabilities> 8965 <parameters> 8966 <param id="prefix_count"> 8967 <jint min="0"/> 8968 <description> 8969 The number of prefixes to apply. 8970 </description> 8971 </param> 8972 <param id="prefixes"> 8973 <agentbuf> 8974 <char/> 8975 </agentbuf> 8976 <description> 8977 The prefixes to apply for this environment, each encoded as a 8978 <internallink id="mUTF">modified UTF-8</internallink> string. 8979 </description> 8980 </param> 8981 </parameters> 8982 <errors> 8983 </errors> 8984 </function> 8985 8986 </category> 8987 8988 <category id="RawMonitors" label="Raw Monitor"> 8989 8990 <function id="CreateRawMonitor" phase="onload" callbacksafe="safe" num="31"> 8991 <synopsis>Create Raw Monitor</synopsis> 8992 <description> 8993 Create a raw monitor. 8994 </description> 8995 <origin>jvmdi</origin> 8996 <capabilities> 8997 </capabilities> 8998 <parameters> 8999 <param id="name"> 9000 <inbuf><char/></inbuf> 9001 <description> 9002 A name to identify the monitor, encoded as a 9003 <internallink id="mUTF">modified UTF-8</internallink> string. 9004 </description> 9005 </param> 9006 <param id="monitor_ptr"> 9007 <outptr><jrawMonitorID/></outptr> 9008 <description> 9009 On return, points to the created monitor. 9010 </description> 9011 </param> 9012 </parameters> 9013 <errors> 9014 </errors> 9015 </function> 9016 9017 <function id="DestroyRawMonitor" phase="onload" callbacksafe="safe" num="32"> 9018 <synopsis>Destroy Raw Monitor</synopsis> 9019 <description> 9020 Destroy the raw monitor. 9021 If the monitor being destroyed has been entered by this thread, it will be 9022 exited before it is destroyed. 9023 If the monitor being destroyed has been entered by another thread, 9024 an error will be returned and the monitor will not be destroyed. 9025 </description> 9026 <origin>jvmdi</origin> 9027 <capabilities> 9028 </capabilities> 9029 <parameters> 9030 <param id="monitor"> 9031 <jrawMonitorID/> 9032 <description> 9033 The monitor 9034 </description> 9035 </param> 9036 </parameters> 9037 <errors> 9038 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 9039 Not monitor owner 9040 </error> 9041 </errors> 9042 </function> 9043 9044 <function id="RawMonitorEnter" phase="any" callbacksafe="safe" impl="innative notrace" num="33"> 9045 <synopsis>Raw Monitor Enter</synopsis> 9046 <description> 9047 Gain exclusive ownership of a raw monitor. 9048 The same thread may enter a monitor more then once. 9049 The thread must 9050 <functionlink id="RawMonitorExit">exit</functionlink> 9051 the monitor the same number of times as it is entered. 9052 If a monitor is entered during <code>OnLoad</code> (before attached threads exist) 9053 and has not exited when attached threads come into existence, the enter 9054 is considered to have occurred on the main thread. 9055 </description> 9056 <origin>jvmdi</origin> 9057 <capabilities> 9058 </capabilities> 9059 <parameters> 9060 <param id="monitor"> 9061 <jrawMonitorID/> 9062 <description> 9063 The monitor 9064 </description> 9065 </param> 9066 </parameters> 9067 <errors> 9068 </errors> 9069 </function> 9070 9071 <function id="RawMonitorExit" phase="any" callbacksafe="safe" impl="innative notrace" num="34"> 9072 <synopsis>Raw Monitor Exit</synopsis> 9073 <description> 9074 Release exclusive ownership of a raw monitor. 9075 </description> 9076 <origin>jvmdi</origin> 9077 <capabilities> 9078 </capabilities> 9079 <parameters> 9080 <param id="monitor"> 9081 <jrawMonitorID/> 9082 <description> 9083 The monitor 9084 </description> 9085 </param> 9086 </parameters> 9087 <errors> 9088 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 9089 Not monitor owner 9090 </error> 9091 </errors> 9092 </function> 9093 9094 <function id="RawMonitorWait" phase="any" callbacksafe="safe" impl="innative notrace" num="35"> 9095 <synopsis>Raw Monitor Wait</synopsis> 9096 <description> 9097 Wait for notification of the raw monitor. 9098 <p/> 9099 Causes the current thread to wait until either another thread calls 9100 <functionlink id="RawMonitorNotify"/> or 9101 <functionlink id="RawMonitorNotifyAll"/> 9102 for the specified raw monitor, or the specified 9103 <paramlink id="millis">timeout</paramlink> 9104 has elapsed. 9105 </description> 9106 <origin>jvmdi</origin> 9107 <capabilities> 9108 </capabilities> 9109 <parameters> 9110 <param id="monitor"> 9111 <jrawMonitorID/> 9112 <description> 9113 The monitor 9114 </description> 9115 </param> 9116 <param id="millis"> 9117 <jlong/> 9118 <description> 9119 The timeout, in milliseconds. If the timeout is 9120 zero, then real time is not taken into consideration 9121 and the thread simply waits until notified. 9122 </description> 9123 </param> 9124 </parameters> 9125 <errors> 9126 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 9127 Not monitor owner 9128 </error> 9129 <error id="JVMTI_ERROR_INTERRUPT"> 9130 Wait was interrupted, try again 9131 </error> 9132 </errors> 9133 </function> 9134 9135 <function id="RawMonitorNotify" phase="any" callbacksafe="safe" impl="notrace" num="36"> 9136 <synopsis>Raw Monitor Notify</synopsis> 9137 <description> 9138 Notify a single thread waiting on the raw monitor. 9139 </description> 9140 <origin>jvmdi</origin> 9141 <capabilities> 9142 </capabilities> 9143 <parameters> 9144 <param id="monitor"> 9145 <jrawMonitorID/> 9146 <description> 9147 The monitor 9148 </description> 9149 </param> 9150 </parameters> 9151 <errors> 9152 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 9153 Not monitor owner 9154 </error> 9155 </errors> 9156 </function> 9157 9158 <function id="RawMonitorNotifyAll" phase="any" callbacksafe="safe" impl="notrace" num="37"> 9159 <synopsis>Raw Monitor Notify All</synopsis> 9160 <description> 9161 Notify all threads waiting on the raw monitor. 9162 </description> 9163 <origin>jvmdi</origin> 9164 <capabilities> 9165 </capabilities> 9166 <parameters> 9167 <param id="monitor"> 9168 <jrawMonitorID/> 9169 <description> 9170 The monitor 9171 </description> 9172 </param> 9173 </parameters> 9174 <errors> 9175 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 9176 Not monitor owner 9177 </error> 9178 </errors> 9179 </function> 9180 9181 <elide> 9182 <function id="GetRawMonitorUse" num="118"> 9183 <synopsis>Get Raw Monitor Use</synopsis> 9184 <description> 9185 The fields of the <functionlink id="jvmtiMonitorUsage"></functionlink> structure 9186 are filled in with information about usage of the raw monitor. 9187 </description> 9188 <origin>new</origin> 9189 <capabilities> 9190 <required id="can_get_raw_monitor_usage"></required> 9191 </capabilities> 9192 <parameters> 9193 <param id="monitor"> 9194 <jrawMonitorID/> 9195 <description> 9196 the raw monitor to query. 9197 </description> 9198 </param> 9199 <param id="info_ptr"> 9200 <outptr><struct>jvmtiMonitorUsage</struct></outptr> 9201 <description> 9202 On return, filled with monitor information for the 9203 specified raw monitor. 9204 </description> 9205 </param> 9206 </parameters> 9207 <errors> 9208 </errors> 9209 </function> 9210 9211 <function id="GetRawMonitors" num="119"> 9212 <synopsis>Get Raw Monitors</synopsis> 9213 <description> 9214 Return the list of raw monitors. 9215 <p/> 9216 Note: details about each monitor can be examined with 9217 <functionlink id="GetRawMonitorUse"></functionlink>. 9218 </description> 9219 <origin>new</origin> 9220 <capabilities> 9221 <required id="can_get_raw_monitor_usage"></required> 9222 </capabilities> 9223 <parameters> 9224 <param id="monitorCnt"> 9225 <outptr><jint/></outptr> 9226 <description> 9227 On return, pointer to the number 9228 of monitors returned in <code>monitors_ptr</code>. 9229 </description> 9230 </param> 9231 <param id="monitors_ptr"> 9232 <allocbuf outcount="monitorCnt"><jrawMonitorID/></allocbuf> 9233 <description> 9234 On return, pointer to the monitor list. 9235 </description> 9236 </param> 9237 </parameters> 9238 <errors> 9239 </errors> 9240 </function> 9241 </elide> 9242 </category> 9243 9244 <category id="jniIntercept" label="JNI Function Interception"> 9245 9246 <intro> 9247 Provides the ability to intercept and resend 9248 Java Native Interface (JNI) function calls 9249 by manipulating the JNI function table. 9250 See <externallink id="jni/functions.html">JNI 9251 Functions</externallink> in the <i>Java Native Interface Specification</i>. 9252 <p/> 9253 The following example illustrates intercepting the 9254 <code>NewGlobalRef</code> JNI call in order to count reference 9255 creation. 9256 <example> 9257 JNIEnv original_jni_Functions; 9258 JNIEnv redirected_jni_Functions; 9259 int my_global_ref_count = 0; 9260 9261 jobject 9262 MyNewGlobalRef(JNIEnv *jni_env, jobject lobj) { 9263 ++my_global_ref_count; 9264 return originalJNIFunctions->NewGlobalRef(env, lobj); 9265 } 9266 9267 void 9268 myInit() { 9269 jvmtiError err; 9270 9271 err = (*jvmti_env)->GetJNIFunctionTable(jvmti_env, &original_jni_Functions); 9272 if (err != JVMTI_ERROR_NONE) { 9273 die(); 9274 } 9275 err = (*jvmti_env)->GetJNIFunctionTable(jvmti_env, &redirected_jni_Functions); 9276 if (err != JVMTI_ERROR_NONE) { 9277 die(); 9278 } 9279 redirectedJNIFunctions->NewGlobalRef = MyNewGlobalRef; 9280 err = (*jvmti_env)->SetJNIFunctionTable(jvmti_env, redirected_jni_Functions); 9281 if (err != JVMTI_ERROR_NONE) { 9282 die(); 9283 } 9284 } 9285 </example> 9286 Sometime after <code>myInit</code> is called the user's JNI 9287 code is executed which makes the call to create a new global 9288 reference. Instead of going to the normal JNI implementation 9289 the call goes to <code>myNewGlobalRef</code>. Note that a 9290 copy of the original function table is kept so that the normal 9291 JNI function can be called after the data is collected. 9292 Note also that any JNI functions which are not overwritten 9293 will behave normally. 9294 <todo> 9295 check that the example compiles and executes. 9296 </todo> 9297 </intro> 9298 9299 <function id="SetJNIFunctionTable" phase="start" num="120"> 9300 <synopsis>Set JNI Function Table</synopsis> 9301 <description> 9302 Set the JNI function table 9303 in all current and future JNI environments. 9304 As a result, all future JNI calls are directed to the specified functions. 9305 Use <functionlink id="GetJNIFunctionTable"></functionlink> to get the 9306 function table to pass to this function. 9307 For this function to take effect the the updated table entries must be 9308 used by the JNI clients. 9309 Since the table is defined <code>const</code> some compilers may optimize 9310 away the access to the table, thus preventing this function from taking 9311 effect. 9312 The table is copied--changes to the local copy of the 9313 table have no effect. 9314 This function affects only the function table, all other aspects of the environment are 9315 unaffected. 9316 See the examples <internallink id="jniIntercept">above</internallink>. 9317 </description> 9318 <origin>new</origin> 9319 <capabilities> 9320 </capabilities> 9321 <parameters> 9322 <param id="function_table"> 9323 <inptr> 9324 <struct>jniNativeInterface</struct> 9325 </inptr> 9326 <description> 9327 Points to the new JNI function table. 9328 </description> 9329 </param> 9330 </parameters> 9331 <errors> 9332 </errors> 9333 </function> 9334 9335 <function id="GetJNIFunctionTable" phase="start" num="121"> 9336 <synopsis>Get JNI Function Table</synopsis> 9337 <description> 9338 Get the JNI function table. 9339 The JNI function table is copied into allocated memory. 9340 If <functionlink id="SetJNIFunctionTable"></functionlink> 9341 has been called, the modified (not the original) function 9342 table is returned. 9343 Only the function table is copied, no other aspects of the environment 9344 are copied. 9345 See the examples <internallink id="jniIntercept">above</internallink>. 9346 </description> 9347 <origin>new</origin> 9348 <capabilities> 9349 </capabilities> 9350 <parameters> 9351 <param id="function_table"> 9352 <allocbuf> 9353 <struct>jniNativeInterface</struct> 9354 </allocbuf> 9355 <description> 9356 On return, <code>*function_table</code> 9357 points a newly allocated copy of the JNI function table. 9358 </description> 9359 </param> 9360 </parameters> 9361 <errors> 9362 </errors> 9363 </function> 9364 9365 </category> 9366 9367 <category id="eventManagement" label="Event Management"> 9368 9369 <function id="SetEventCallbacks" jkernel="yes" phase="onload" num="122"> 9370 <synopsis>Set Event Callbacks</synopsis> 9371 <description> 9372 Set the functions to be called for each event. 9373 The callbacks are specified by supplying a replacement function table. 9374 The function table is copied--changes to the local copy of the 9375 table have no effect. 9376 This is an atomic action, all callbacks are set at once. 9377 No events are sent before this function is called. 9378 When an entry is <code>NULL</code> or when the event is beyond 9379 <paramlink id="size_of_callbacks"></paramlink> no event is sent. 9380 Details on events are 9381 described <internallink id="EventSection">later</internallink> in this document. 9382 An event must be enabled and have a callback in order to be 9383 sent--the order in which this function and 9384 <functionlink id="SetEventNotificationMode"></functionlink> 9385 are called does not affect the result. 9386 </description> 9387 <origin>new</origin> 9388 <capabilities> 9389 </capabilities> 9390 <parameters> 9391 <param id="callbacks"> 9392 <inptr> 9393 <struct>jvmtiEventCallbacks</struct> 9394 <nullok>remove the existing callbacks</nullok> 9395 </inptr> 9396 <description> 9397 The new event callbacks. 9398 </description> 9399 </param> 9400 <param id="size_of_callbacks"> 9401 <jint min="0"/> 9402 <description> 9403 <code>sizeof(jvmtiEventCallbacks)</code>--for version 9404 compatibility. 9405 </description> 9406 </param> 9407 </parameters> 9408 <errors> 9409 </errors> 9410 </function> 9411 9412 <function id="SetEventNotificationMode" jkernel="yes" phase="onload" num="2"> 9413 <synopsis>Set Event Notification Mode</synopsis> 9414 <description> 9415 Control the generation of events. 9416 <constants id="jvmtiEventMode" label="Event Enable/Disable" kind="enum"> 9417 <constant id="JVMTI_ENABLE" num="1"> 9418 If <paramlink id="mode"></paramlink> is <code>JVMTI_ENABLE</code>, 9419 the event <paramlink id="event_type"></paramlink> will be enabled 9420 </constant> 9421 <constant id="JVMTI_DISABLE" num="0"> 9422 If <paramlink id="mode"></paramlink> is <code>JVMTI_DISABLE</code>, 9423 the event <paramlink id="event_type"></paramlink> will be disabled 9424 </constant> 9425 </constants> 9426 If <code>event_thread</code> is <code>NULL</code>, 9427 the event is enabled or disabled globally; otherwise, it is 9428 enabled or disabled for a particular thread. 9429 An event is generated for 9430 a particular thread if it is enabled either at the thread or global 9431 levels. 9432 <p/> 9433 See <internallink id="EventIndex">below</internallink> for information on specific events. 9434 <p/> 9435 The following events cannot be controlled at the thread 9436 level through this function. 9437 <ul> 9438 <li><eventlink id="VMInit"></eventlink></li> 9439 <li><eventlink id="VMStart"></eventlink></li> 9440 <li><eventlink id="VMDeath"></eventlink></li> 9441 <li><eventlink id="ThreadStart"></eventlink></li> 9442 <li><eventlink id="CompiledMethodLoad"></eventlink></li> 9443 <li><eventlink id="CompiledMethodUnload"></eventlink></li> 9444 <li><eventlink id="DynamicCodeGenerated"></eventlink></li> 9445 <li><eventlink id="DataDumpRequest"></eventlink></li> 9446 </ul> 9447 <p/> 9448 Initially, no events are enabled at either the thread level 9449 or the global level. 9450 <p/> 9451 Any needed capabilities (see Event Enabling Capabilities below) must be possessed 9452 before calling this function. 9453 <p/> 9454 Details on events are 9455 described <internallink id="EventSection">below</internallink>. 9456 </description> 9457 <origin>jvmdiClone</origin> 9458 <eventcapabilities></eventcapabilities> 9459 <parameters> 9460 <param id="mode"> 9461 <enum>jvmtiEventMode</enum> 9462 <description> 9463 <code>JVMTI_ENABLE</code> or <code>JVMTI_DISABLE</code> 9464 </description> 9465 </param> 9466 <param id="event_type"> 9467 <enum>jvmtiEvent</enum> 9468 <description> 9469 the event to control 9470 </description> 9471 </param> 9472 <param id="event_thread"> 9473 <ptrtype> 9474 <jthread impl="noconvert"/> 9475 <nullok>event is controlled at the global level</nullok> 9476 </ptrtype> 9477 <description> 9478 The thread to control 9479 </description> 9480 </param> 9481 <param id="..."> 9482 <varargs/> 9483 <description> 9484 for future expansion 9485 </description> 9486 </param> 9487 </parameters> 9488 <errors> 9489 <error id="JVMTI_ERROR_INVALID_THREAD"> 9490 <paramlink id="event_thread"/> is non-<code>NULL</code> and is not a valid thread. 9491 </error> 9492 <error id="JVMTI_ERROR_THREAD_NOT_ALIVE"> 9493 <paramlink id="event_thread"/> is non-<code>NULL</code> and is not live (has not been started or is now dead). 9494 </error> 9495 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 9496 thread level control was attempted on events which do not 9497 permit thread level control. 9498 </error> 9499 <error id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY"> 9500 The Required Event Enabling Capability is not possessed. 9501 </error> 9502 </errors> 9503 </function> 9504 9505 <function id="GenerateEvents" num="123"> 9506 <synopsis>Generate Events</synopsis> 9507 <description> 9508 Generate events to represent the current state of the VM. 9509 For example, if <paramlink id="event_type"/> is 9510 <code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code>, 9511 a <eventlink id="CompiledMethodLoad"></eventlink> event will be 9512 sent for each currently compiled method. 9513 Methods that were loaded and now have been unloaded are not sent. 9514 The history of what events have previously been sent does not 9515 effect what events are sent by this function--for example, 9516 all currently compiled methods 9517 will be sent each time this function is called. 9518 <p/> 9519 This function is useful when 9520 events may have been missed due to the agent attaching after program 9521 execution begins; this function generates the missed events. 9522 <p/> 9523 Attempts to execute Java programming language code or 9524 JNI functions may be paused until this function returns - 9525 so neither should be called from the thread sending the event. 9526 This function returns only after the missed events have been 9527 sent, processed and have returned. 9528 The event may be sent on a different thread than the thread 9529 on which the event occurred. 9530 The callback for the event must be set with 9531 <functionlink id="SetEventCallbacks"></functionlink> 9532 and the event must be enabled with 9533 <functionlink id="SetEventNotificationMode"></functionlink> 9534 or the events will not occur. 9535 If the VM no longer has the information to generate some or 9536 all of the requested events, the events are simply not sent - 9537 no error is returned. 9538 <p/> 9539 Only the following events are supported: 9540 <ul> 9541 <li><eventlink id="CompiledMethodLoad"></eventlink></li> 9542 <li><eventlink id="DynamicCodeGenerated"></eventlink></li> 9543 </ul> 9544 </description> 9545 <origin>new</origin> 9546 <capabilities> 9547 <capability id="can_generate_compiled_method_load_events"></capability> 9548 </capabilities> 9549 <parameters> 9550 <param id="event_type"> 9551 <enum>jvmtiEvent</enum> 9552 <description> 9553 The type of event to generate. Must be one of these: 9554 <ul> 9555 <li><eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink></li> 9556 <li><eventlink id="DynamicCodeGenerated"><code>JVMTI_EVENT_DYNAMIC_CODE_GENERATED</code></eventlink></li> 9557 </ul> 9558 </description> 9559 </param> 9560 </parameters> 9561 <errors> 9562 <error id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY"> 9563 <paramlink id="event_type"/> is 9564 <eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink> 9565 and <fieldlink id="can_generate_compiled_method_load_events" struct="jvmtiCapabilities"></fieldlink> 9566 is <code>false</code>. 9567 </error> 9568 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 9569 <paramlink id="event_type"/> is other than 9570 <eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink> 9571 or <eventlink id="DynamicCodeGenerated"><code>JVMTI_EVENT_DYNAMIC_CODE_GENERATED</code></eventlink>. 9572 </error> 9573 </errors> 9574 </function> 9575 9576 </category> 9577 9578 <category id="extension" label="Extension Mechanism"> 9579 9580 <intro> 9581 These functions 9582 allow a <jvmti/> implementation to provide functions and events 9583 beyond those defined in this specification. 9584 <p/> 9585 Both extension functions and extension events have parameters 9586 each of which has a 'type' and 'kind' chosen from the following tables: 9587 9588 <constants id="jvmtiParamTypes" label="Extension Function/Event Parameter Types" kind="enum"> 9589 <constant id="JVMTI_TYPE_JBYTE" num="101"> 9590 Java programming language primitive type - <code>byte</code>. 9591 JNI type <code>jbyte</code>. 9592 </constant> 9593 <constant id="JVMTI_TYPE_JCHAR" num="102"> 9594 Java programming language primitive type - <code>char</code>. 9595 JNI type <code>jchar</code>. 9596 </constant> 9597 <constant id="JVMTI_TYPE_JSHORT" num="103"> 9598 Java programming language primitive type - <code>short</code>. 9599 JNI type <code>jshort</code>. 9600 </constant> 9601 <constant id="JVMTI_TYPE_JINT" num="104"> 9602 Java programming language primitive type - <code>int</code>. 9603 JNI type <datalink id="jint"></datalink>. 9604 </constant> 9605 <constant id="JVMTI_TYPE_JLONG" num="105"> 9606 Java programming language primitive type - <code>long</code>. 9607 JNI type <datalink id="jlong"></datalink>. 9608 </constant> 9609 <constant id="JVMTI_TYPE_JFLOAT" num="106"> 9610 Java programming language primitive type - <code>float</code>. 9611 JNI type <datalink id="jfloat"></datalink>. 9612 </constant> 9613 <constant id="JVMTI_TYPE_JDOUBLE" num="107"> 9614 Java programming language primitive type - <code>double</code>. 9615 JNI type <datalink id="jdouble"></datalink>. 9616 </constant> 9617 <constant id="JVMTI_TYPE_JBOOLEAN" num="108"> 9618 Java programming language primitive type - <code>boolean</code>. 9619 JNI type <datalink id="jboolean"></datalink>. 9620 </constant> 9621 <constant id="JVMTI_TYPE_JOBJECT" num="109"> 9622 Java programming language object type - <code>java.lang.Object</code>. 9623 JNI type <datalink id="jobject"></datalink>. 9624 Returned values are JNI local references and must be managed. 9625 </constant> 9626 <constant id="JVMTI_TYPE_JTHREAD" num="110"> 9627 Java programming language object type - <code>java.lang.Thread</code>. 9628 <jvmti/> type <datalink id="jthread"></datalink>. 9629 Returned values are JNI local references and must be managed. 9630 </constant> 9631 <constant id="JVMTI_TYPE_JCLASS" num="111"> 9632 Java programming language object type - <code>java.lang.Class</code>. 9633 JNI type <datalink id="jclass"></datalink>. 9634 Returned values are JNI local references and must be managed. 9635 </constant> 9636 <constant id="JVMTI_TYPE_JVALUE" num="112"> 9637 Union of all Java programming language primitive and object types - 9638 JNI type <datalink id="jvalue"></datalink>. 9639 Returned values which represent object types are JNI local references and must be managed. 9640 </constant> 9641 <constant id="JVMTI_TYPE_JFIELDID" num="113"> 9642 Java programming language field identifier - 9643 JNI type <datalink id="jfieldID"></datalink>. 9644 </constant> 9645 <constant id="JVMTI_TYPE_JMETHODID" num="114"> 9646 Java programming language method identifier - 9647 JNI type <datalink id="jmethodID"></datalink>. 9648 </constant> 9649 <constant id="JVMTI_TYPE_CCHAR" num="115"> 9650 C programming language type - <code>char</code>. 9651 </constant> 9652 <constant id="JVMTI_TYPE_CVOID" num="116"> 9653 C programming language type - <code>void</code>. 9654 </constant> 9655 <constant id="JVMTI_TYPE_JNIENV" num="117"> 9656 JNI environment - <code>JNIEnv</code>. 9657 Should be used with the correct <datalink id="jvmtiParamKind"/> to make it a pointer type. 9658 </constant> 9659 </constants> 9660 9661 <constants id="jvmtiParamKind" label="Extension Function/Event Parameter Kinds" kind="enum"> 9662 <constant id="JVMTI_KIND_IN" num="91"> 9663 Ingoing argument - <code>foo</code>. 9664 </constant> 9665 <constant id="JVMTI_KIND_IN_PTR" num="92"> 9666 Ingoing pointer argument - <code>const foo*</code>. 9667 </constant> 9668 <constant id="JVMTI_KIND_IN_BUF" num="93"> 9669 Ingoing array argument - <code>const foo*</code>. 9670 </constant> 9671 <constant id="JVMTI_KIND_ALLOC_BUF" num="94"> 9672 Outgoing allocated array argument - <code>foo**</code>. 9673 Free with <code>Deallocate</code>. 9674 </constant> 9675 <constant id="JVMTI_KIND_ALLOC_ALLOC_BUF" num="95"> 9676 Outgoing allocated array of allocated arrays argument - <code>foo***</code>. 9677 Free with <code>Deallocate</code>. 9678 </constant> 9679 <constant id="JVMTI_KIND_OUT" num="96"> 9680 Outgoing argument - <code>foo*</code>. 9681 </constant> 9682 <constant id="JVMTI_KIND_OUT_BUF" num="97"> 9683 Outgoing array argument (pre-allocated by agent) - <code>foo*</code>. 9684 Do not <code>Deallocate</code>. 9685 </constant> 9686 </constants> 9687 9688 </intro> 9689 9690 <typedef id="jvmtiParamInfo" label="Extension Function/Event Parameter Info"> 9691 <field id="name"> 9692 <allocfieldbuf><char/></allocfieldbuf> 9693 <description> 9694 The parameter name, encoded as a 9695 <internallink id="mUTF">modified UTF-8</internallink> string 9696 </description> 9697 </field> 9698 <field id="kind"> 9699 <enum>jvmtiParamKind</enum> 9700 <description> 9701 The kind of the parameter - type modifiers 9702 </description> 9703 </field> 9704 <field id="base_type"> 9705 <enum>jvmtiParamTypes</enum> 9706 <description> 9707 The base type of the parameter - modified by <code>kind</code> 9708 </description> 9709 </field> 9710 <field id="null_ok"> 9711 <jboolean/> 9712 <description> 9713 Is a <code>NULL</code> argument permitted? Applies only to pointer and object types. 9714 </description> 9715 </field> 9716 </typedef> 9717 9718 <callback id="jvmtiExtensionFunction"> 9719 <enum>jvmtiError</enum> 9720 <synopsis>Extension Function</synopsis> 9721 <description> 9722 This is the implementation-specific extension function. 9723 </description> 9724 <parameters> 9725 <param id="jvmti_env"> 9726 <outptr> 9727 <struct>jvmtiEnv</struct> 9728 </outptr> 9729 <description> 9730 The <jvmti/> environment is the only fixed parameter for extension functions. 9731 </description> 9732 </param> 9733 <param id="..."> 9734 <varargs/> 9735 <description> 9736 The extension function-specific parameters 9737 </description> 9738 </param> 9739 </parameters> 9740 </callback> 9741 9742 <function id="GetExtensionFunctions" phase="onload" num="124"> 9743 <synopsis>Get Extension Functions</synopsis> 9744 9745 <typedef id="jvmtiExtensionFunctionInfo" label="Extension Function Info"> 9746 <field id="func"> 9747 <ptrtype> 9748 <struct>jvmtiExtensionFunction</struct> 9749 </ptrtype> 9750 <description> 9751 The actual function to call 9752 </description> 9753 </field> 9754 <field id="id"> 9755 <allocfieldbuf><char/></allocfieldbuf> 9756 <description> 9757 The identifier for the extension function, encoded as a 9758 <internallink id="mUTF">modified UTF-8</internallink> string. 9759 Uses package name conventions. 9760 For example, <code>com.sun.hotspot.bar</code> 9761 </description> 9762 </field> 9763 <field id="short_description"> 9764 <allocfieldbuf><char/></allocfieldbuf> 9765 <description> 9766 A one sentence description of the function, encoded as a 9767 <internallink id="mUTF">modified UTF-8</internallink> string. 9768 </description> 9769 </field> 9770 <field id="param_count"> 9771 <jint/> 9772 <description> 9773 The number of parameters excluding <code>jvmtiEnv *jvmti_env</code> 9774 </description> 9775 </field> 9776 <field id="params"> 9777 <allocfieldbuf outcount="param_count"> 9778 <struct>jvmtiParamInfo</struct> 9779 </allocfieldbuf> 9780 <description> 9781 Array of 9782 <fieldlink id="param_count" struct="jvmtiExtensionFunctionInfo"></fieldlink> 9783 parameters (<code>jvmtiEnv *jvmti_env</code> excluded) 9784 </description> 9785 </field> 9786 <field id="error_count"> 9787 <jint/> 9788 <description> 9789 The number of possible error returns (excluding universal errors) 9790 </description> 9791 </field> 9792 <field id="errors"> 9793 <allocfieldbuf outcount="error_count"> 9794 <enum>jvmtiError</enum> 9795 </allocfieldbuf> 9796 <description> 9797 Array of <fieldlink id="error_count" struct="jvmtiExtensionFunctionInfo"></fieldlink> 9798 possible errors 9799 </description> 9800 </field> 9801 </typedef> 9802 9803 <description> 9804 Returns the set of extension functions. 9805 </description> 9806 <origin>new</origin> 9807 <capabilities> 9808 </capabilities> 9809 <parameters> 9810 <param id="extension_count_ptr"> 9811 <outptr><jint/></outptr> 9812 <description> 9813 On return, points to the number of extension functions 9814 </description> 9815 </param> 9816 <param id="extensions"> 9817 <allocbuf outcount="extension_count_ptr"><struct>jvmtiExtensionFunctionInfo</struct></allocbuf> 9818 <description> 9819 Returns an array of extension function info, one per function 9820 </description> 9821 </param> 9822 </parameters> 9823 <errors> 9824 </errors> 9825 </function> 9826 9827 <function id="GetExtensionEvents" phase="onload" num="125"> 9828 <synopsis>Get Extension Events</synopsis> 9829 9830 <typedef id="jvmtiExtensionEventInfo" label="Extension Event Info"> 9831 <field id="extension_event_index"> 9832 <jint/> 9833 <description> 9834 The identifying index of the event 9835 </description> 9836 </field> 9837 <field id="id"> 9838 <allocfieldbuf><char/></allocfieldbuf> 9839 <description> 9840 The identifier for the extension event, encoded as a 9841 <internallink id="mUTF">modified UTF-8</internallink> string. 9842 Uses package name conventions. 9843 For example, <code>com.sun.hotspot.bar</code> 9844 </description> 9845 </field> 9846 <field id="short_description"> 9847 <allocfieldbuf><char/></allocfieldbuf> 9848 <description> 9849 A one sentence description of the event, encoded as a 9850 <internallink id="mUTF">modified UTF-8</internallink> string. 9851 </description> 9852 </field> 9853 <field id="param_count"> 9854 <jint/> 9855 <description> 9856 The number of parameters excluding <code>jvmtiEnv *jvmti_env</code> 9857 </description> 9858 </field> 9859 <field id="params"> 9860 <allocfieldbuf outcount="param_count"> 9861 <struct>jvmtiParamInfo</struct> 9862 </allocfieldbuf> 9863 <description> 9864 Array of 9865 <fieldlink id="param_count" struct="jvmtiExtensionEventInfo"></fieldlink> 9866 parameters (<code>jvmtiEnv *jvmti_env</code> excluded) 9867 </description> 9868 </field> 9869 </typedef> 9870 9871 <description> 9872 Returns the set of extension events. 9873 </description> 9874 <origin>new</origin> 9875 <capabilities> 9876 </capabilities> 9877 <parameters> 9878 <param id="extension_count_ptr"> 9879 <outptr><jint/></outptr> 9880 <description> 9881 On return, points to the number of extension events 9882 </description> 9883 </param> 9884 <param id="extensions"> 9885 <allocbuf outcount="extension_count_ptr"><struct>jvmtiExtensionEventInfo</struct></allocbuf> 9886 <description> 9887 Returns an array of extension event info, one per event 9888 </description> 9889 </param> 9890 </parameters> 9891 <errors> 9892 </errors> 9893 </function> 9894 9895 <callback id="jvmtiExtensionEvent"> 9896 <void/> 9897 <synopsis>Extension Event</synopsis> 9898 <description> 9899 This is the implementation-specific event. 9900 The event handler is set with 9901 <functionlink id="SetExtensionEventCallback"/>. 9902 <p/> 9903 Event handlers for extension events must be declared varargs to match this definition. 9904 Failure to do so could result in calling convention mismatch and undefined behavior 9905 on some platforms. 9906 <p/> 9907 For example, if the <code>jvmtiParamInfo</code> 9908 returned by <functionlink id="GetExtensionEvents"/> indicates that 9909 there is a <code>jint</code> parameter, the event handler should be 9910 declared: 9911 <example> 9912 void JNICALL myHandler(jvmtiEnv* jvmti_env, jint myInt, ...) 9913 </example> 9914 Note the terminal "<code>...</code>" which indicates varargs. 9915 </description> 9916 <parameters> 9917 <param id="jvmti_env"> 9918 <outptr> 9919 <struct>jvmtiEnv</struct> 9920 </outptr> 9921 <description> 9922 The <jvmti/> environment is the only fixed parameter for extension events. 9923 </description> 9924 </param> 9925 <param id="..."> 9926 <varargs/> 9927 <description> 9928 The extension event-specific parameters 9929 </description> 9930 </param> 9931 </parameters> 9932 </callback> 9933 9934 <function id="SetExtensionEventCallback" phase="onload" num="126"> 9935 <synopsis>Set Extension Event Callback</synopsis> 9936 9937 <description> 9938 Sets the callback function for an extension event and 9939 enables the event. Or, if the callback is <code>NULL</code>, disables 9940 the event. Note that unlike standard events, setting 9941 the callback and enabling the event are a single operation. 9942 </description> 9943 <origin>new</origin> 9944 <capabilities> 9945 </capabilities> 9946 <parameters> 9947 <param id="extension_event_index"> 9948 <jint/> 9949 <description> 9950 Identifies which callback to set. 9951 This index is the 9952 <fieldlink id="extension_event_index" struct="jvmtiExtensionEventInfo"></fieldlink> 9953 field of 9954 <datalink id="jvmtiExtensionEventInfo"/>. 9955 </description> 9956 </param> 9957 <param id="callback"> 9958 <ptrtype> 9959 <struct>jvmtiExtensionEvent</struct> 9960 <nullok>disable the event</nullok> 9961 </ptrtype> 9962 <description> 9963 If <code>callback</code> is non-<code>NULL</code>, 9964 set <code>callback</code> to be the event callback function 9965 and enable the event. 9966 </description> 9967 </param> 9968 </parameters> 9969 <errors> 9970 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 9971 <paramlink id="extension_event_index"/> is not an 9972 <fieldlink id="extension_event_index" 9973 struct="jvmtiExtensionEventInfo"/> 9974 returned by 9975 <functionlink id="GetExtensionEvents"/> 9976 </error> 9977 </errors> 9978 </function> 9979 9980 </category> 9981 9982 <category id="capability" label="Capability"> 9983 9984 <intro> 9985 The capabilities functions allow you to change the 9986 functionality available to <jvmti/>--that is, 9987 which <jvmti/> 9988 functions can be called, what events can be generated, 9989 and what functionality these events and functions can 9990 provide. 9991 <p/> 9992 The "Capabilities" section of each function and event describe which 9993 capabilities, if any, they are associated with. "Required Functionality" 9994 means it is available for use and no capabilities must be added to use it. 9995 "Optional Functionality" means the agent must possess the capability 9996 before it can be used. 9997 To possess a capability, the agent must 9998 <functionlink id="AddCapabilities">add the capability</functionlink>. 9999 "Optional Features" describe capabilities which, 10000 if added, extend the feature set. 10001 <p/> 10002 The potentially available capabilities of each <jvmti/> implementation are different. 10003 Depending on the implementation, a capability: 10004 <ul> 10005 <li>may never be added</li> 10006 <li>may be added in either the <code>OnLoad</code> or live phase in any environment</li> 10007 <li>may be added only during the <code>OnLoad</code> phase</li> 10008 <li>may be possessed by only one environment at a time</li> 10009 <li>may be possessed by only one environment at a time, 10010 and only during the <code>OnLoad</code> phase</li> 10011 <li>and so on ...</li> 10012 </ul> 10013 Frequently, the addition of a capability may incur a cost in execution speed, start up 10014 time, and/or memory footprint. Note that the overhead of using a capability 10015 is completely different than the overhead of possessing a capability. 10016 Take single stepping as an example. When single stepping is on (that 10017 is, when the event is enabled and thus actively sending events) 10018 the overhead of sending and processing an event 10019 on each instruction is huge in any implementation. 10020 However, the overhead of possessing the capability may be small or large, 10021 depending on the implementation. Also, when and if a capability is potentially 10022 available depends on the implementation. Some examples: 10023 <ul> 10024 <li>One VM might perform all execution by compiling bytecodes into 10025 native code and be unable to generate single step instructions. 10026 In this implementation the capability can not be added.</li> 10027 <li>Another VM may be able to switch execution to a single stepping 10028 interpreter at any time. In this implementation, having the capability has no 10029 overhead and could be added at any time.</li> 10030 <li>Yet another VM might be able to choose a bytecode compiling or single stepping capable interpreted 10031 execution engine at start up, but be unable to switch between them. 10032 In this implementation the capability would need to be added 10033 during the <code>OnLoad</code> phase (before bytecode 10034 execution begins) and would have a large impact on execution speed 10035 even if single stepping was never used.</li> 10036 <li>Still another VM might be able to add an "is single stepping on" check 10037 into compiled bytecodes or a generated interpreter. Again in this implementation 10038 the capability would need to be added during the <code>OnLoad</code> phase but the overhead (a test 10039 and branch on each instruction) would be considerably less.</li> 10040 </ul> 10041 <p/> 10042 Each <jvmti/> <internallink id="environments">environment</internallink> 10043 has its own set of capabilities. 10044 Initially, that set is empty. 10045 Any desired capability must be added. 10046 If possible, capabilities should be added during the <code>OnLoad</code> phase. For most 10047 virtual machines certain capabilities require special set up for 10048 the virtual machine and this set up must happen 10049 during the <code>OnLoad</code> phase, before the virtual machine begins execution. 10050 Once a capability is added, it can 10051 only be removed if explicitly relinquished by the environment. 10052 <p/> 10053 The agent can, 10054 <functionlink id="GetPotentialCapabilities">determine what 10055 capabilities this VM can potentially provide</functionlink>, 10056 <functionlink id="AddCapabilities">add the capabilities 10057 to be used</functionlink>, 10058 <functionlink id="RelinquishCapabilities">release capabilities 10059 which are no longer needed</functionlink>, and 10060 <functionlink id="GetCapabilities">examine the currently available 10061 capabilities</functionlink>. 10062 </intro> 10063 10064 <intro id="capabilityExamples" label="Capability Examples"> 10065 For example, a freshly started agent (in the <code>OnLoad</code> function) 10066 wants to enable all possible capabilities. 10067 Note that, in general, this is not advisable as the agent may suffer 10068 a performance penalty for functionality it is not using. 10069 The code might look like this in C: 10070 <example> 10071 jvmtiCapabilities capa; 10072 jvmtiError err; 10073 10074 err = (*jvmti)->GetPotentialCapabilities(jvmti, &capa); 10075 if (err == JVMTI_ERROR_NONE) { 10076 err = (*jvmti)->AddCapabilities(jvmti, &capa); 10077 </example> 10078 For example, if an agent wants to check if it can get 10079 the bytecodes of a method (that is, it wants to check 10080 if it previously added this capability and has not 10081 relinquished it), the code might 10082 look like this in C: 10083 <example> 10084 jvmtiCapabilities capa; 10085 jvmtiError err; 10086 10087 err = (*jvmti)->GetCapabilities(jvmti, &capa); 10088 if (err == JVMTI_ERROR_NONE) { 10089 if (capa.can_get_bytecodes) { ... } } 10090 </example> 10091 </intro> 10092 10093 <capabilitiestypedef id="jvmtiCapabilities" label="The Capabilities Structure"> 10094 <description> 10095 The functions in this category use this capabilities structure 10096 which contains boolean flags corresponding to each capability: 10097 </description> 10098 <capabilityfield id="can_tag_objects"> 10099 <description> 10100 Can set and get tags, as described in the 10101 <internallink id="Heap">Heap category</internallink>. 10102 </description> 10103 </capabilityfield> 10104 <capabilityfield id="can_generate_field_modification_events"> 10105 <description> 10106 Can set watchpoints on field modification - 10107 <functionlink id="SetFieldModificationWatch"></functionlink> 10108 </description> 10109 </capabilityfield> 10110 <capabilityfield id="can_generate_field_access_events"> 10111 <description> 10112 Can set watchpoints on field access - 10113 <functionlink id="SetFieldAccessWatch"></functionlink> 10114 </description> 10115 </capabilityfield> 10116 <capabilityfield id="can_get_bytecodes"> 10117 <description> 10118 Can get bytecodes of a method <functionlink id="GetBytecodes"></functionlink> 10119 </description> 10120 </capabilityfield> 10121 <capabilityfield id="can_get_synthetic_attribute"> 10122 <description> 10123 Can test if a field or method is synthetic - 10124 <functionlink id="IsFieldSynthetic"></functionlink> and 10125 <functionlink id="IsMethodSynthetic"></functionlink> 10126 </description> 10127 </capabilityfield> 10128 <capabilityfield id="can_get_owned_monitor_info"> 10129 <description> 10130 Can get information about ownership of monitors - 10131 <functionlink id="GetOwnedMonitorInfo"></functionlink> 10132 </description> 10133 </capabilityfield> 10134 <capabilityfield id="can_get_current_contended_monitor"> 10135 <description> 10136 Can <functionlink id="GetCurrentContendedMonitor"></functionlink> 10137 </description> 10138 </capabilityfield> 10139 <capabilityfield id="can_get_monitor_info"> 10140 <description> 10141 Can <functionlink id="GetObjectMonitorUsage"></functionlink> 10142 </description> 10143 </capabilityfield> 10144 <capabilityfield id="can_pop_frame"> 10145 <description> 10146 Can pop frames off the stack - <functionlink id="PopFrame"></functionlink> 10147 </description> 10148 </capabilityfield> 10149 <capabilityfield id="can_redefine_classes"> 10150 <description> 10151 Can redefine classes with <functionlink id="RedefineClasses"/>. 10152 </description> 10153 </capabilityfield> 10154 <capabilityfield id="can_signal_thread"> 10155 <description> 10156 Can send stop or interrupt to threads 10157 </description> 10158 </capabilityfield> 10159 <capabilityfield id="can_get_source_file_name"> 10160 <description> 10161 Can get the source file name of a class 10162 </description> 10163 </capabilityfield> 10164 <capabilityfield id="can_get_line_numbers"> 10165 <description> 10166 Can get the line number table of a method 10167 </description> 10168 </capabilityfield> 10169 <capabilityfield id="can_get_source_debug_extension"> 10170 <description> 10171 Can get the source debug extension of a class 10172 </description> 10173 </capabilityfield> 10174 <capabilityfield id="can_access_local_variables"> 10175 <description> 10176 Can set and get local variables 10177 </description> 10178 </capabilityfield> 10179 <capabilityfield id="can_maintain_original_method_order"> 10180 <description> 10181 Can return methods in the order they occur in the class file 10182 </description> 10183 </capabilityfield> 10184 <capabilityfield id="can_generate_single_step_events"> 10185 <description> 10186 Can get <eventlink id="SingleStep">single step</eventlink> events 10187 </description> 10188 </capabilityfield> 10189 <capabilityfield id="can_generate_exception_events"> 10190 <description> 10191 Can get <eventlink id="Exception">exception thrown</eventlink> and 10192 <eventlink id="ExceptionCatch">exception catch</eventlink> events 10193 </description> 10194 </capabilityfield> 10195 <capabilityfield id="can_generate_frame_pop_events"> 10196 <description> 10197 Can <functionlink id="NotifyFramePop">set</functionlink> and thus get 10198 <eventlink id="FramePop"></eventlink> events 10199 </description> 10200 </capabilityfield> 10201 <capabilityfield id="can_generate_breakpoint_events"> 10202 <description> 10203 Can <functionlink id="SetBreakpoint">set</functionlink> and thus get 10204 <eventlink id="Breakpoint"></eventlink> events 10205 </description> 10206 </capabilityfield> 10207 <capabilityfield id="can_suspend"> 10208 <description> 10209 Can suspend and resume threads 10210 </description> 10211 </capabilityfield> 10212 <capabilityfield id="can_redefine_any_class"> 10213 <description> 10214 Can modify (retransform or redefine) any modifiable class. 10215 See <functionlink id="IsModifiableClass"/>. 10216 </description> 10217 </capabilityfield> 10218 <capabilityfield id="can_get_current_thread_cpu_time"> 10219 <description> 10220 Can <functionlink id="GetCurrentThreadCpuTime">get</functionlink> 10221 current thread CPU time 10222 </description> 10223 </capabilityfield> 10224 <capabilityfield id="can_get_thread_cpu_time"> 10225 <description> 10226 Can <functionlink id="GetThreadCpuTime">get</functionlink> 10227 thread CPU time 10228 </description> 10229 </capabilityfield> 10230 <capabilityfield id="can_generate_method_entry_events" 10231 disp1="can_generate" disp2="_method_entry_events" 10232 > 10233 <description> 10234 Can generate method entry events on entering a method 10235 </description> 10236 </capabilityfield> 10237 <capabilityfield id="can_generate_method_exit_events" 10238 disp1="can_generate" disp2="_method_exit_events" 10239 > 10240 <description> 10241 Can generate method exit events on leaving a method 10242 </description> 10243 </capabilityfield> 10244 <capabilityfield id="can_generate_all_class_hook_events" 10245 disp1="can_generate" disp2="_all_class_hook_events" 10246 > 10247 <description> 10248 Can generate ClassFileLoadHook events for every loaded class. 10249 </description> 10250 </capabilityfield> 10251 <capabilityfield id="can_generate_compiled_method_load_events" 10252 disp1="can_generate" disp2="_compiled_method_load_events" 10253 > 10254 <description> 10255 Can generate events when a method is compiled or unloaded 10256 </description> 10257 </capabilityfield> 10258 <capabilityfield id="can_generate_monitor_events" 10259 disp1="can_generate" disp2="_monitor_events" 10260 > 10261 <description> 10262 Can generate events on monitor activity 10263 </description> 10264 </capabilityfield> 10265 <capabilityfield id="can_generate_vm_object_alloc_events" 10266 disp1="can_generate" disp2="_vm_object_alloc_events" 10267 > 10268 <description> 10269 Can generate events on VM allocation of an object 10270 </description> 10271 </capabilityfield> 10272 <capabilityfield id="can_generate_native_method_bind_events" 10273 disp1="can_generate" disp2="_native_method_bind_events" 10274 > 10275 <description> 10276 Can generate events when a native method is bound to its 10277 implementation 10278 </description> 10279 </capabilityfield> 10280 <capabilityfield id="can_generate_garbage_collection_events" 10281 disp1="can_generate" disp2="_garbage_collection_events" 10282 > 10283 <description> 10284 Can generate events when garbage collection begins or ends 10285 </description> 10286 </capabilityfield> 10287 <capabilityfield id="can_generate_object_free_events" 10288 disp1="can_generate" disp2="_object_free_events" 10289 > 10290 <description> 10291 Can generate events when the garbage collector frees an object 10292 </description> 10293 </capabilityfield> 10294 <capabilityfield id="can_force_early_return" since="1.1"> 10295 <description> 10296 Can return early from a method, as described in the 10297 <internallink id="ForceEarlyReturn">Force Early Return category</internallink>. 10298 </description> 10299 </capabilityfield> 10300 <capabilityfield id="can_get_owned_monitor_stack_depth_info" since="1.1"> 10301 <description> 10302 Can get information about owned monitors with stack depth - 10303 <functionlink id="GetOwnedMonitorStackDepthInfo"></functionlink> 10304 </description> 10305 </capabilityfield> 10306 <capabilityfield id="can_get_constant_pool" since="1.1"> 10307 <description> 10308 Can get the constant pool of a class - 10309 <functionlink id="GetConstantPool"></functionlink> 10310 </description> 10311 </capabilityfield> 10312 <capabilityfield id="can_set_native_method_prefix" since="1.1"> 10313 <description> 10314 Can set prefix to be applied when native method cannot be resolved - 10315 <functionlink id="SetNativeMethodPrefix"/> and 10316 <functionlink id="SetNativeMethodPrefixes"/> 10317 </description> 10318 </capabilityfield> 10319 <capabilityfield id="can_retransform_classes" since="1.1"> 10320 <description> 10321 Can retransform classes with <functionlink id="RetransformClasses"/>. 10322 In addition to the restrictions imposed by the specific 10323 implementation on this capability (see the 10324 <internallink id="capability">Capability</internallink> section), 10325 this capability must be set before the 10326 <eventlink id="ClassFileLoadHook"/> event is enabled for the 10327 first time in this environment. 10328 An environment that possesses this capability at the time that 10329 <code>ClassFileLoadHook</code> is enabled for the first time is 10330 said to be <i>retransformation capable</i>. 10331 An environment that does not possess this capability at the time that 10332 <code>ClassFileLoadHook</code> is enabled for the first time is 10333 said to be <i>retransformation incapable</i>. 10334 </description> 10335 </capabilityfield> 10336 <capabilityfield id="can_retransform_any_class" since="1.1"> 10337 <description> 10338 <functionlink id="RetransformClasses"/> can be called on any modifiable class. 10339 See <functionlink id="IsModifiableClass"/>. 10340 (<fieldlink id="can_retransform_classes" struct="jvmtiCapabilities"/> 10341 must also be set) 10342 </description> 10343 </capabilityfield> 10344 <capabilityfield id="can_generate_resource_exhaustion_heap_events" since="1.1"> 10345 <description> 10346 Can generate events when the VM is unable to allocate memory from 10347 the <tm>Java</tm> platform heap. 10348 See <eventlink id="ResourceExhausted"/>. 10349 </description> 10350 </capabilityfield> 10351 <capabilityfield id="can_generate_resource_exhaustion_threads_events" since="1.1"> 10352 <description> 10353 Can generate events when the VM is unable to create a thread. 10354 See <eventlink id="ResourceExhausted"/>. 10355 </description> 10356 </capabilityfield> 10357 <capabilityfield id="can_generate_early_vmstart" since="9"> 10358 <description> 10359 Can generate the <code>VMStart</code> event early. 10360 See <eventlink id="VMStart"/>. 10361 </description> 10362 </capabilityfield> 10363 <capabilityfield id="can_generate_early_class_hook_events" since="9"> 10364 <description> 10365 Can generate the <eventlink id="ClassFileLoadHook"/> events 10366 in the primordial phase. If this capability and 10367 <internallink id="jvmtiCapabilities.can_generate_all_class_hook_events"> 10368 <code>can_generate_all_class_hook_events</code></internallink> 10369 are enabled then the <eventlink id="ClassFileLoadHook"/> events 10370 can be posted for classes loaded in the primordial phase. 10371 See <eventlink id="ClassFileLoadHook"/>. 10372 </description> 10373 </capabilityfield> 10374 <capabilityfield id="can_generate_sampled_object_alloc_events" since="11"> 10375 <description> 10376 Can generate sampled allocation events. 10377 If this capability is enabled then the heap sampling method 10378 <functionlink id="SetHeapSamplingInterval"></functionlink> can be 10379 called and <eventlink id="SampledObjectAlloc"></eventlink> events can be generated. 10380 </description> 10381 </capabilityfield> 10382 </capabilitiestypedef> 10383 10384 <function id="GetPotentialCapabilities" jkernel="yes" phase="onload" num="140"> 10385 <synopsis>Get Potential Capabilities</synopsis> 10386 <description> 10387 Returns via <paramlink id="capabilities_ptr"></paramlink> the <jvmti/> 10388 features that can potentially be possessed by this environment 10389 at this time. 10390 The returned capabilities differ from the complete set of capabilities 10391 implemented by the VM in two cases: another environment possesses 10392 capabilities that can only be possessed by one environment, or the 10393 current <functionlink id="GetPhase">phase</functionlink> is live, 10394 and certain capabilities can only be added during the <code>OnLoad</code> phase. 10395 The <functionlink id="AddCapabilities"></functionlink> function 10396 may be used to set any or all or these capabilities. 10397 Currently possessed capabilities are included. 10398 <p/> 10399 Typically this function is used in the <code>OnLoad</code> function. 10400 Some virtual machines may allow a limited set of capabilities to be 10401 added in the live phase. 10402 In this case, the set of potentially available capabilities 10403 will likely differ from the <code>OnLoad</code> phase set. 10404 <p/> 10405 See the 10406 <internallink id="capabilityExamples">Capability Examples</internallink>. 10407 </description> 10408 <origin>new</origin> 10409 <capabilities> 10410 </capabilities> 10411 <parameters> 10412 <param id="capabilities_ptr"> 10413 <outptr><struct>jvmtiCapabilities</struct></outptr> 10414 <description> 10415 On return, points to the <jvmti/> capabilities that may be added. 10416 </description> 10417 </param> 10418 </parameters> 10419 <errors> 10420 </errors> 10421 </function> 10422 10423 <elide> 10424 <function id="EstimateCostOfCapabilities" phase="onload" num="141"> 10425 <synopsis>Estimate Cost Of Capabilities</synopsis> 10426 <description> 10427 <issue>There is strong opposition to this function. The concern is 10428 that it would be difficult or impossible to provide meaningful 10429 numbers, as the amount of impact is conditional on many factors 10430 that a single number could not represent. There is doubt that 10431 conditional implementations would be used or are even a good idea. 10432 The thought is that release documentation for the implementation 10433 would be the best means of exposing this information. 10434 Unless new arguments are presented, I intend to remove this 10435 function in the next revision. 10436 </issue> 10437 <p/> 10438 Return via the <paramlink id="time_impact_ptr"></paramlink> and 10439 <paramlink id="space_impact_ptr"></paramlink> an estimate of the impact 10440 of adding the capabilities pointed to by 10441 <paramlink id="capabilities_ptr"></paramlink>. 10442 The returned estimates are in percentage of additional overhead, thus 10443 a time impact of 100 mean the application might run 10444 at half the speed. 10445 The estimates are very rough approximations and are not guaranteed. 10446 Note also, that the estimates are of the impact of having the 10447 capability available--when and if it is used the impact may be 10448 much greater. 10449 Estimates can be for a single capability or for a set of 10450 capabilities. Note that the costs are not necessarily additive, 10451 adding support for one capability might make another available 10452 for free or conversely having two capabilities at once may 10453 have multiplicative impact. 10454 Estimates are relative to the current set of capabilities - 10455 that is, how much more impact given the currently possessed capabilities. 10456 <p/> 10457 Typically this function is used in the OnLoad function, 10458 some virtual machines may allow a limited set of capabilities to be 10459 added in the live phase. 10460 In this case, the set of potentially available capabilities 10461 will likely differ from the OnLoad phase set. 10462 <p/> 10463 See the 10464 <internallink id="capabilityExamples">Capability Examples</internallink>. 10465 </description> 10466 <origin>new</origin> 10467 <capabilities> 10468 </capabilities> 10469 <parameters> 10470 <param id="capabilities_ptr"> 10471 <inptr><struct>jvmtiCapabilities</struct></inptr> 10472 <description> 10473 points to the <jvmti/> capabilities to evaluate. 10474 </description> 10475 </param> 10476 <param id="time_impact_ptr"> 10477 <outptr><jint/></outptr> 10478 <description> 10479 On return, points to the estimated percentage increase in 10480 run time if this capability was added. 10481 </description> 10482 </param> 10483 <param id="space_impact_ptr"> 10484 <outptr><jint/></outptr> 10485 <description> 10486 On return, points to the estimated percentage increase in 10487 memory space used if this capability was added. 10488 </description> 10489 </param> 10490 </parameters> 10491 <errors> 10492 <error id="JVMTI_ERROR_NOT_AVAILABLE"> 10493 The desired capabilities are not even potentially available. 10494 </error> 10495 </errors> 10496 </function> 10497 </elide> 10498 10499 <function id="AddCapabilities" jkernel="yes" phase="onload" num="142"> 10500 <synopsis>Add Capabilities</synopsis> 10501 <description> 10502 Set new capabilities by adding the capabilities 10503 whose values are set to one (<code>1</code>) in 10504 <code>*</code><paramlink id="capabilities_ptr"></paramlink>. 10505 All previous capabilities are retained. 10506 Typically this function is used in the <code>OnLoad</code> function. 10507 Some virtual machines may allow a limited set of capabilities to be 10508 added in the live phase. 10509 <p/> 10510 See the 10511 <internallink id="capabilityExamples">Capability Examples</internallink>. 10512 </description> 10513 <origin>new</origin> 10514 <capabilities> 10515 </capabilities> 10516 <parameters> 10517 <param id="capabilities_ptr"> 10518 <inptr><struct>jvmtiCapabilities</struct></inptr> 10519 <description> 10520 Points to the <jvmti/> capabilities to add. 10521 </description> 10522 </param> 10523 </parameters> 10524 <errors> 10525 <error id="JVMTI_ERROR_NOT_AVAILABLE"> 10526 The desired capabilities are not even potentially available. 10527 </error> 10528 </errors> 10529 </function> 10530 10531 10532 <function id="RelinquishCapabilities" phase="onload" num="143"> 10533 <synopsis>Relinquish Capabilities</synopsis> 10534 <description> 10535 Relinquish the capabilities 10536 whose values are set to one (<code>1</code>) in 10537 <code>*</code><paramlink id="capabilities_ptr"></paramlink>. 10538 Some implementations may allow only one environment to have a capability 10539 (see the <internallink id="capability">capability introduction</internallink>). 10540 This function releases capabilities 10541 so that they may be used by other agents. 10542 All other capabilities are retained. 10543 The capability will no longer be present in <functionlink id="GetCapabilities"></functionlink>. 10544 Attempting to relinquish a capability that the agent does not possess is not an error. 10545 <issue> 10546 It is possible for the agent to be actively using capabilities 10547 which are being relinquished. For example, a thread is currently 10548 suspended and can_suspend is being relinquished or an event is currently 10549 enabled and can_generate_whatever is being relinquished. 10550 There are three possible ways we could spec this: 10551 <ul> 10552 <li>relinquish automatically releases them</li> 10553 <li>relinquish checks and returns some error code if held</li> 10554 <li>it is the agent's responsibility and it is not checked</li> 10555 </ul> 10556 One of these should be chosen. 10557 </issue> 10558 </description> 10559 <origin>new</origin> 10560 <capabilities> 10561 </capabilities> 10562 <parameters> 10563 <param id="capabilities_ptr"> 10564 <inptr><struct>jvmtiCapabilities</struct></inptr> 10565 <description> 10566 Points to the <jvmti/> capabilities to relinquish. 10567 </description> 10568 </param> 10569 </parameters> 10570 <errors> 10571 </errors> 10572 </function> 10573 10574 10575 10576 <function id="GetCapabilities" jkernel="yes" phase="any" num="89"> 10577 <synopsis>Get Capabilities</synopsis> 10578 <description> 10579 Returns via <paramlink id="capabilities_ptr"></paramlink> the optional <jvmti/> 10580 features which this environment currently possesses. 10581 Each possessed capability is indicated by a one (<code>1</code>) in the 10582 corresponding field of the <internallink id="jvmtiCapabilities">capabilities 10583 structure</internallink>. 10584 An environment does not possess a capability unless it has been successfully added with 10585 <functionlink id="AddCapabilities"/>. 10586 An environment only loses possession of a capability if it has been relinquished with 10587 <functionlink id="RelinquishCapabilities"/>. Thus, this function returns the net result 10588 of the <code>AddCapabilities</code> and <code>RelinquishCapabilities</code> calls which 10589 have been made. 10590 <p/> 10591 See the 10592 <internallink id="capabilityExamples">Capability Examples</internallink>. 10593 </description> 10594 <origin>jvmdiClone</origin> 10595 <capabilities> 10596 </capabilities> 10597 <parameters> 10598 <param id="capabilities_ptr"> 10599 <outptr><struct>jvmtiCapabilities</struct></outptr> 10600 <description> 10601 On return, points to the <jvmti/> capabilities. 10602 </description> 10603 </param> 10604 </parameters> 10605 <errors> 10606 </errors> 10607 </function> 10608 10609 </category> 10610 10611 10612 <category id="timers" label="Timers"> 10613 10614 <intro> 10615 These functions provide timing information. 10616 The resolution at which the time is updated is not specified. 10617 They provides nanosecond precision, but not necessarily nanosecond accuracy. 10618 Details about the timers, such as their maximum values, can be accessed with 10619 the timer information functions. 10620 </intro> 10621 10622 <typedef id="jvmtiTimerInfo" label="Timer Info"> 10623 <description> 10624 The information function for each timer returns this data structure. 10625 </description> 10626 <field id="max_value"> 10627 <jlong/> 10628 <description> 10629 The maximum value the timer can reach. 10630 After this value is reached the timer wraps back to zero. 10631 This is an unsigned value. If tested or printed as a jlong (signed value) 10632 it may appear to be a negative number. 10633 </description> 10634 </field> 10635 <field id="may_skip_forward"> 10636 <jboolean/> 10637 <description> 10638 If true, the timer can be externally adjusted and as a result skip forward. 10639 If false, the timer value will never increase faster than real time. 10640 </description> 10641 </field> 10642 <field id="may_skip_backward"> 10643 <jboolean/> 10644 <description> 10645 If true, the timer can be externally adjusted and as a result skip backward. 10646 If false, the timer value will be monotonically increasing. 10647 </description> 10648 </field> 10649 <field id="kind"> 10650 <enum>jvmtiTimerKind</enum> 10651 <description> 10652 The kind of timer. 10653 On a platform that does not distinguish between user and system time, <datalink 10654 id="JVMTI_TIMER_TOTAL_CPU"><code>JVMTI_TIMER_TOTAL_CPU</code></datalink> 10655 is returned. 10656 </description> 10657 </field> 10658 <field id="reserved1"> 10659 <jlong/> 10660 <description> 10661 Reserved for future use. 10662 </description> 10663 </field> 10664 <field id="reserved2"> 10665 <jlong/> 10666 <description> 10667 Reserved for future use. 10668 </description> 10669 </field> 10670 </typedef> 10671 10672 <intro> 10673 Where the timer kind is -- 10674 10675 <constants id="jvmtiTimerKind" label="Timer Kinds" kind="enum"> 10676 <constant id="JVMTI_TIMER_USER_CPU" num="30"> 10677 CPU time that a thread is in user mode. 10678 </constant> 10679 <constant id="JVMTI_TIMER_TOTAL_CPU" num="31"> 10680 CPU time that a thread is in user or system mode. 10681 </constant> 10682 <constant id="JVMTI_TIMER_ELAPSED" num="32"> 10683 Elapsed time. 10684 </constant> 10685 </constants> 10686 </intro> 10687 10688 <function id="GetCurrentThreadCpuTimerInfo" callbacksafe="safe" impl="innative notrace" phase="start" num="134"> 10689 <synopsis>Get Current Thread CPU Timer Information</synopsis> 10690 <description> 10691 Get information about the 10692 <functionlink id="GetCurrentThreadCpuTime"/> timer. 10693 The fields of the <datalink id="jvmtiTimerInfo"/> structure 10694 are filled in with details about the timer. 10695 This information is specific to the platform and the implementation of 10696 <functionlink id="GetCurrentThreadCpuTime"/> and thus 10697 does not vary by thread nor does it vary 10698 during a particular invocation of the VM. 10699 <p/> 10700 Note that the implementations of <functionlink id="GetCurrentThreadCpuTime"/> 10701 and <functionlink id="GetThreadCpuTime"/> may differ, and thus the values 10702 returned by <code>GetCurrentThreadCpuTimerInfo</code> 10703 and <functionlink id="GetThreadCpuTimerInfo"/> 10704 may differ -- see <functionlink id="GetCurrentThreadCpuTime"/> for more information. 10705 </description> 10706 <origin>new</origin> 10707 <capabilities> 10708 <required id="can_get_current_thread_cpu_time"> 10709 Can get current thread CPU time. 10710 </required> 10711 </capabilities> 10712 <parameters> 10713 <param id="info_ptr"> 10714 <outptr><struct>jvmtiTimerInfo</struct></outptr> 10715 <description> 10716 On return, filled with information describing the time 10717 returned by <functionlink id="GetCurrentThreadCpuTime"/>. 10718 </description> 10719 </param> 10720 </parameters> 10721 <errors> 10722 </errors> 10723 </function> 10724 10725 <function id="GetCurrentThreadCpuTime" callbacksafe="safe" impl="innative notrace" phase="start" num="135"> 10726 <synopsis>Get Current Thread CPU Time</synopsis> 10727 <description> 10728 Return the CPU time utilized by the current thread. 10729 <p/> 10730 Note that the <functionlink id="GetThreadCpuTime"/> 10731 function provides CPU time for any thread, including 10732 the current thread. <code>GetCurrentThreadCpuTime</code> 10733 exists to support platforms which cannot 10734 supply CPU time for threads other than the current 10735 thread or which have more accurate information for 10736 the current thread (see 10737 <functionlink id="GetCurrentThreadCpuTimerInfo"/> vs 10738 <functionlink id="GetThreadCpuTimerInfo"/>). 10739 On many platforms this call will be equivalent to: 10740 <example> 10741 GetThreadCpuTime(env, NULL, nanos_ptr) 10742 </example> 10743 </description> 10744 <origin>new</origin> 10745 <capabilities> 10746 <required id="can_get_current_thread_cpu_time"> 10747 Can get current thread CPU time. 10748 <p/> 10749 If this capability is enabled after threads have started, 10750 the implementation may choose any time up 10751 to and including the time that the capability is enabled 10752 as the point where CPU time collection starts. 10753 <p/> 10754 This capability must be potentially available on any 10755 platform where 10756 <internallink id="jvmtiCapabilities.can_get_thread_cpu_time"><code>can_get_thread_cpu_time</code></internallink> 10757 is potentially available. 10758 </required> 10759 </capabilities> 10760 <parameters> 10761 <param id="nanos_ptr"> 10762 <outptr><jlong/></outptr> 10763 <description> 10764 On return, points to the CPU time used by this thread 10765 in nanoseconds. 10766 This is an unsigned value. If tested or printed as a jlong (signed value) 10767 it may appear to be a negative number. 10768 </description> 10769 </param> 10770 </parameters> 10771 <errors> 10772 </errors> 10773 </function> 10774 10775 <function id="GetThreadCpuTimerInfo" num="136"> 10776 <synopsis>Get Thread CPU Timer Information</synopsis> 10777 <description> 10778 Get information about the 10779 <functionlink id="GetThreadCpuTime"/> timer. 10780 The fields of the <datalink id="jvmtiTimerInfo"/> structure 10781 are filled in with details about the timer. 10782 This information is specific to the platform and the implementation of 10783 <functionlink id="GetThreadCpuTime"/> and thus 10784 does not vary by thread nor does it vary 10785 during a particular invocation of the VM. 10786 <p/> 10787 Note that the implementations of <functionlink id="GetCurrentThreadCpuTime"/> 10788 and <functionlink id="GetThreadCpuTime"/> may differ, and thus the values 10789 returned by <functionlink id="GetCurrentThreadCpuTimerInfo"/> 10790 and <code>GetThreadCpuTimerInfo</code> 10791 may differ -- see <functionlink id="GetCurrentThreadCpuTime"/> for more information. 10792 </description> 10793 <origin>new</origin> 10794 <capabilities> 10795 <required id="can_get_thread_cpu_time"> 10796 Can get thread CPU time. 10797 </required> 10798 </capabilities> 10799 <parameters> 10800 <param id="info_ptr"> 10801 <outptr><struct>jvmtiTimerInfo</struct></outptr> 10802 <description> 10803 On return, filled with information describing the time 10804 returned by <functionlink id="GetThreadCpuTime"/>. 10805 </description> 10806 </param> 10807 </parameters> 10808 <errors> 10809 </errors> 10810 </function> 10811 10812 <function id="GetThreadCpuTime" num="137"> 10813 <synopsis>Get Thread CPU Time</synopsis> 10814 <description> 10815 Return the CPU time utilized by the specified thread. 10816 <p/> 10817 Get information about this timer with 10818 <functionlink id="GetThreadCpuTimerInfo"/>. 10819 </description> 10820 <origin>new</origin> 10821 <capabilities> 10822 <required id="can_get_thread_cpu_time"> 10823 Can get thread CPU time. 10824 <p/> 10825 If this capability is enabled after threads have started, 10826 the implementation may choose any time up 10827 to and including the time that the capability is enabled 10828 as the point where CPU time collection starts. 10829 </required> 10830 </capabilities> 10831 <parameters> 10832 <param id="thread"> 10833 <jthread null="current"/> 10834 <description> 10835 The thread to query. 10836 </description> 10837 </param> 10838 <param id="nanos_ptr"> 10839 <outptr><jlong/></outptr> 10840 <description> 10841 On return, points to the CPU time used by the specified thread 10842 in nanoseconds. 10843 This is an unsigned value. If tested or printed as a jlong (signed value) 10844 it may appear to be a negative number. 10845 </description> 10846 </param> 10847 </parameters> 10848 <errors> 10849 </errors> 10850 </function> 10851 10852 <function id="GetTimerInfo" phase="any" callbacksafe="safe" num="138"> 10853 <synopsis>Get Timer Information</synopsis> 10854 <description> 10855 Get information about the 10856 <functionlink id="GetTime"/> timer. 10857 The fields of the <datalink id="jvmtiTimerInfo"/> structure 10858 are filled in with details about the timer. 10859 This information will not change during a particular invocation of the VM. 10860 </description> 10861 <origin>new</origin> 10862 <capabilities> 10863 </capabilities> 10864 <parameters> 10865 <param id="info_ptr"> 10866 <outptr><struct>jvmtiTimerInfo</struct></outptr> 10867 <description> 10868 On return, filled with information describing the time 10869 returned by <functionlink id="GetTime"/>. 10870 </description> 10871 </param> 10872 </parameters> 10873 <errors> 10874 </errors> 10875 </function> 10876 10877 <function id="GetTime" phase="any" callbacksafe="safe" num="139"> 10878 <synopsis>Get Time</synopsis> 10879 <description> 10880 Return the current value of the system timer, in nanoseconds. 10881 <p/> 10882 The value returned represents nanoseconds since some fixed but 10883 arbitrary time (perhaps in the future, so values may be 10884 negative). This function provides nanosecond precision, but not 10885 necessarily nanosecond accuracy. No guarantees are made about 10886 how frequently values change. 10887 <p/> 10888 Get information about this timer with 10889 <functionlink id="GetTimerInfo"/>. 10890 </description> 10891 <origin>new</origin> 10892 <capabilities> 10893 </capabilities> 10894 <parameters> 10895 <param id="nanos_ptr"> 10896 <outptr><jlong/></outptr> 10897 <description> 10898 On return, points to the time in nanoseconds. 10899 This is an unsigned value. If tested or printed as a jlong (signed value) 10900 it may appear to be a negative number. 10901 </description> 10902 </param> 10903 </parameters> 10904 <errors> 10905 </errors> 10906 </function> 10907 10908 <function id="GetAvailableProcessors" phase="any" num="144"> 10909 <synopsis>Get Available Processors</synopsis> 10910 <description> 10911 Returns the number of processors available to the Java virtual machine. 10912 <p/> 10913 This value may change during a particular invocation of the virtual machine. 10914 Applications that are sensitive to the number of available processors should 10915 therefore occasionally poll this property. 10916 </description> 10917 <origin>new</origin> 10918 <capabilities> 10919 </capabilities> 10920 <parameters> 10921 <param id="processor_count_ptr"> 10922 <outptr><jint/></outptr> 10923 <description> 10924 On return, points to the maximum number of processors available to the 10925 virtual machine; never smaller than one. 10926 </description> 10927 </param> 10928 </parameters> 10929 <errors> 10930 </errors> 10931 </function> 10932 10933 </category> 10934 10935 10936 <category id="classLoaderSearch" label="Class Loader Search"> 10937 10938 <intro> 10939 These functions allow the agent to add to the locations that a class loader searches for a class. 10940 This is useful for installing instrumentation under the correct class loader. 10941 </intro> 10942 10943 <function id="AddToBootstrapClassLoaderSearch" jkernel="yes" phase="onload" num="149"> 10944 <synopsis>Add To Bootstrap Class Loader Search</synopsis> 10945 <description> 10946 This function can be used to cause instrumentation classes to be defined by the 10947 bootstrap class loader. See <vmspec chapter="5.3.1"/>. 10948 After the bootstrap 10949 class loader unsuccessfully searches for a class, the specified platform-dependent 10950 search path <paramlink id="segment"/> will be searched as well. Only one segment may be specified in 10951 the <paramlink id="segment"/>. This function may be called multiple times to add multiple segments, 10952 the segments will be searched in the order that this function was called. 10953 <p/> 10954 In the <code>OnLoad</code> phase the function may be used to specify any platform-dependent 10955 search path segment to be searched after the bootstrap class loader unsuccessfully searches 10956 for a class. The segment is typically a directory or JAR file. 10957 <p/> 10958 In the live phase the <paramlink id="segment"/> may be used to specify any platform-dependent 10959 path to a <externallink id="jar/jar.html"> 10960 JAR file</externallink>. The agent should take care that the JAR file does not 10961 contain any classes or resources other than those to be defined by the bootstrap 10962 class loader for the purposes of instrumentation. 10963 <p/> 10964 <vmspec/> specifies that a subsequent attempt to resolve a symbolic 10965 reference that the Java virtual machine has previously unsuccessfully attempted 10966 to resolve always fails with the same error that was thrown as a result of the 10967 initial resolution attempt. Consequently, if the JAR file contains an entry 10968 that corresponds to a class for which the Java virtual machine has 10969 unsuccessfully attempted to resolve a reference, then subsequent attempts to 10970 resolve that reference will fail with the same error as the initial attempt. 10971 </description> 10972 <origin>new</origin> 10973 <capabilities> 10974 </capabilities> 10975 <parameters> 10976 <param id="segment"> 10977 <inbuf><char/></inbuf> 10978 <description> 10979 The platform-dependent search path segment, encoded as a 10980 <internallink id="mUTF">modified UTF-8</internallink> string. 10981 </description> 10982 </param> 10983 </parameters> 10984 <errors> 10985 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 10986 <paramlink id="segment"/> is an invalid path. In the live phase, anything other than an 10987 existing JAR file is an invalid path. 10988 </error> 10989 </errors> 10990 </function> 10991 10992 <function id="AddToSystemClassLoaderSearch" jkernel="yes" phase="onload" num="151" since="1.1"> 10993 <synopsis>Add To System Class Loader Search</synopsis> 10994 <description> 10995 This function can be used to cause instrumentation classes to be 10996 defined by the system class loader. See <vmspec chapter="5.3.2"/>. 10997 After the class loader unsuccessfully searches for a class, the specified platform-dependent search 10998 path <paramlink id="segment"/> will be searched as well. Only one segment may be specified in the 10999 <paramlink id="segment"/>. This function may be called multiple times to add multiple segments, the 11000 segments will be searched in the order that this function was called. 11001 <p/> 11002 In the <code>OnLoad</code> phase the function may be used to specify any platform-dependent 11003 search path segment to be searched after the system class loader unsuccessfully searches 11004 for a class. The segment is typically a directory or JAR file. 11005 <p/> 11006 In the live phase the <paramlink id="segment"/> is a platform-dependent path to a 11007 <externallink id="jar/jar.html">JAR file</externallink> to be 11008 searched after the system class loader unsuccessfully searches for a class. The agent should 11009 take care that the JAR file does not contain any classes or resources other than those to be 11010 defined by the system class loader for the purposes of instrumentation. 11011 <p/> 11012 In the live phase the system class loader supports adding a JAR file to be searched if 11013 the system class loader implements a method name <code>appendToClassPathForInstrumentation</code> 11014 which takes a single parameter of type <code>java.lang.String</code>. The method is not required 11015 to have <code>public</code> access. 11016 <p/> 11017 <vmspec/> specifies that a subsequent attempt to resolve a symbolic 11018 reference that the Java virtual machine has previously unsuccessfully attempted 11019 to resolve always fails with the same error that was thrown as a result of the 11020 initial resolution attempt. Consequently, if the JAR file contains an entry 11021 that corresponds to a class for which the Java virtual machine has 11022 unsuccessfully attempted to resolve a reference, then subsequent attempts to 11023 resolve that reference will fail with the same error as the initial attempt. 11024 </description> 11025 <origin>new</origin> 11026 <capabilities> 11027 </capabilities> 11028 <parameters> 11029 <param id="segment"> 11030 <inbuf><char/></inbuf> 11031 <description> 11032 The platform-dependent search path segment, encoded as a 11033 <internallink id="mUTF">modified UTF-8</internallink> string. 11034 </description> 11035 </param> 11036 </parameters> 11037 <errors> 11038 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 11039 <paramlink id="segment"/> is an invalid path. In the live phase, anything other than an 11040 existing JAR file is an invalid path. 11041 </error> 11042 <error id="JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED"> 11043 Operation not supported by the system class loader. 11044 </error> 11045 </errors> 11046 </function> 11047 11048 </category> 11049 11050 11051 <category id="props" label="System Properties"> 11052 11053 <intro> 11054 These functions get and set system properties. 11055 </intro> 11056 11057 <function id="GetSystemProperties" phase="onload" num="130"> 11058 <synopsis>Get System Properties</synopsis> 11059 <description> 11060 The list of VM system property keys which may be used with 11061 <functionlink id="GetSystemProperty"/> is returned. 11062 It is strongly recommended that virtual machines provide the 11063 following property keys: 11064 <ul> 11065 <li><code>java.vm.vendor</code></li> 11066 <li><code>java.vm.version</code></li> 11067 <li><code>java.vm.name</code></li> 11068 <li><code>java.vm.info</code></li> 11069 <li><code>java.library.path</code></li> 11070 <li><code>java.class.path</code></li> 11071 </ul> 11072 Provides access to system properties defined by and used 11073 by the VM. 11074 Properties set on the command-line are included. 11075 This allows getting and setting of these properties 11076 before the VM even begins executing bytecodes. 11077 Since this is a VM view of system properties, the set of available 11078 properties will usually be different than that 11079 in <code>java.lang.System.getProperties</code>. 11080 JNI method invocation may be used to access 11081 <code>java.lang.System.getProperties</code>. 11082 <p/> 11083 The set of properties may grow during execution. 11084 </description> 11085 <origin>new</origin> 11086 <capabilities> 11087 </capabilities> 11088 <parameters> 11089 <param id="count_ptr"> 11090 <outptr><jint/></outptr> 11091 <description> 11092 On return, points to the number of property keys returned. 11093 </description> 11094 </param> 11095 <param id="property_ptr"> 11096 <allocallocbuf outcount="count_ptr"><char/></allocallocbuf> 11097 <description> 11098 On return, points to an array of property keys, encoded as 11099 <internallink id="mUTF">modified UTF-8</internallink> strings. 11100 </description> 11101 </param> 11102 </parameters> 11103 <errors> 11104 </errors> 11105 </function> 11106 11107 <function id="GetSystemProperty" phase="onload" num="131"> 11108 <synopsis>Get System Property</synopsis> 11109 <description> 11110 Return a VM system property value given the property key. 11111 <p/> 11112 The function <functionlink id="GetSystemProperties"/> 11113 returns the set of property keys which may be used. 11114 The properties which can be retrieved may grow during 11115 execution. 11116 <p/> 11117 Since this is a VM view of system properties, the values 11118 of properties may differ from that returned by 11119 <code>java.lang.System.getProperty(String)</code>. 11120 A typical VM might copy the values of the VM system 11121 properties into the <code>Properties</code> held by 11122 <code>java.lang.System</code> during the initialization 11123 of that class. Thereafter any changes to the VM system 11124 properties (with <functionlink id="SetSystemProperty"/>) 11125 or the <code>java.lang.System</code> system properties 11126 (with <code>java.lang.System.setProperty(String,String)</code>) 11127 would cause the values to diverge. 11128 JNI method invocation may be used to access 11129 <code>java.lang.System.getProperty(String)</code>. 11130 </description> 11131 <origin>new</origin> 11132 <capabilities> 11133 </capabilities> 11134 <parameters> 11135 <param id="property"> 11136 <inbuf><char/></inbuf> 11137 <description> 11138 The key of the property to retrieve, encoded as a 11139 <internallink id="mUTF">modified UTF-8</internallink> string. 11140 </description> 11141 </param> 11142 <param id="value_ptr"> 11143 <allocbuf><char/></allocbuf> 11144 <description> 11145 On return, points to the property value, encoded as a 11146 <internallink id="mUTF">modified UTF-8</internallink> string. 11147 </description> 11148 </param> 11149 </parameters> 11150 <errors> 11151 <error id="JVMTI_ERROR_NOT_AVAILABLE"> 11152 This property is not available. 11153 Use <functionlink id="GetSystemProperties"/> to find available properties. 11154 </error> 11155 </errors> 11156 </function> 11157 11158 <function id="SetSystemProperty" phase="onloadOnly" num="132"> 11159 <synopsis>Set System Property</synopsis> 11160 <description> 11161 Set a VM system property value. 11162 <p/> 11163 The function <functionlink id="GetSystemProperties"/> 11164 returns the set of property keys, some of these may be settable. 11165 See <functionlink id="GetSystemProperty"/>. 11166 </description> 11167 <origin>new</origin> 11168 <capabilities> 11169 </capabilities> 11170 <parameters> 11171 <param id="property"> 11172 <inbuf><char/></inbuf> 11173 <description> 11174 The key of the property, encoded as a 11175 <internallink id="mUTF">modified UTF-8</internallink> string. 11176 </description> 11177 </param> 11178 <param id="value_ptr"> 11179 <inbuf> 11180 <char/> 11181 <nullok> 11182 do not set the value, but return <errorlink id="JVMTI_ERROR_NOT_AVAILABLE"/> 11183 if the property is not writeable 11184 </nullok> 11185 </inbuf> 11186 <description> 11187 The property value to set, encoded as a 11188 <internallink id="mUTF">modified UTF-8</internallink> string. 11189 </description> 11190 </param> 11191 </parameters> 11192 <errors> 11193 <error id="JVMTI_ERROR_NOT_AVAILABLE"> 11194 This property is not available or is not writeable. 11195 </error> 11196 </errors> 11197 </function> 11198 11199 </category> 11200 11201 <category id="general" label="General"> 11202 11203 <intro> 11204 </intro> 11205 11206 <function id="GetPhase" jkernel="yes" phase="any" num="133"> 11207 <synopsis>Get Phase</synopsis> 11208 <description> 11209 Return the current phase of VM execution. 11210 The phases proceed in sequence: 11211 <constants id="jvmtiPhase" label="Phases of execution" kind="enum"> 11212 <constant id="JVMTI_PHASE_ONLOAD" num="1"> 11213 <code>OnLoad</code> phase: while in the 11214 <internallink id="onload"><code>Agent_OnLoad</code></internallink> 11215 or, for statically linked agents, the <internallink id="onload"> 11216 <code>Agent_OnLoad_<agent-lib-name> 11217 </code></internallink> function. 11218 </constant> 11219 <constant id="JVMTI_PHASE_PRIMORDIAL" num="2"> 11220 Primordial phase: between return from <code>Agent_OnLoad</code> 11221 or <code>Agent_OnLoad_<agent-lib-name></code> and the 11222 <code>VMStart</code> event. 11223 </constant> 11224 <constant id="JVMTI_PHASE_START" num="6"> 11225 Start phase: when the <eventlink id="VMStart"><code>VMStart</code></eventlink> event 11226 is sent and until the <code>VMInit</code> event is sent. 11227 </constant> 11228 <constant id="JVMTI_PHASE_LIVE" num="4"> 11229 Live phase: when the <eventlink id="VMInit"><code>VMInit</code></eventlink> event is sent 11230 and until the <eventlink id="VMDeath"></eventlink> event returns. 11231 </constant> 11232 <constant id="JVMTI_PHASE_DEAD" num="8"> 11233 Dead phase: after the <eventlink id="VMDeath"></eventlink> event returns or after 11234 start-up failure. 11235 </constant> 11236 </constants> 11237 In the case of start-up failure the VM will proceed directly to the dead 11238 phase skipping intermediate phases and neither a <code>VMInit</code> nor 11239 <code>VMDeath</code> event will be sent. 11240 <p/> 11241 Most <jvmti/> functions operate only in the live phase. 11242 The following functions operate in either the <code>OnLoad</code> or live phases: 11243 <functionphaselist phase="onload"/> 11244 The following functions operate in only the <code>OnLoad</code> phase: 11245 <functionphaselist phase="onloadOnly"/> 11246 The following functions operate in the start or live phases: 11247 <functionphaselist phase="start"/> 11248 The following functions operate in any phase: 11249 <functionphaselist phase="any"/> 11250 JNI functions (except the Invocation API) must only be used in the start or live phases. 11251 <p/> 11252 Most <jvmti/> events are sent only in the live phase. 11253 The following events operate in others phases: 11254 <eventphaselist phase="start"/> 11255 <eventphaselist phase="any"/> 11256 </description> 11257 <origin>new</origin> 11258 <capabilities> 11259 </capabilities> 11260 <parameters> 11261 <param id="phase_ptr"> 11262 <outptr><enum>jvmtiPhase</enum></outptr> 11263 <description> 11264 On return, points to the phase. 11265 </description> 11266 </param> 11267 </parameters> 11268 <errors> 11269 </errors> 11270 </function> 11271 11272 <function id="DisposeEnvironment" jkernel="yes" phase="any" num="127"> 11273 <synopsis>Dispose Environment</synopsis> 11274 <description> 11275 Shutdown a <jvmti/> connection created with JNI <code>GetEnv</code> 11276 (see <internallink id="environments"><jvmti/> Environments</internallink>). 11277 Dispose of any resources held by the environment. 11278 <issue> 11279 What resources are reclaimed? What is undone? 11280 Breakpoints,watchpoints removed? 11281 </issue> 11282 Threads suspended by this environment are not resumed by this call, 11283 this must be done explicitly by the agent. 11284 Memory allocated by this environment via calls to <jvmti/> functions 11285 is not released, this can be done explicitly by the agent 11286 by calling <functionlink id="Deallocate"/>. 11287 Raw monitors created by this environment are not destroyed, 11288 this can be done explicitly by the agent 11289 by calling <functionlink id="DestroyRawMonitor"/>. 11290 The state of threads waiting on raw monitors created by this environment 11291 are not affected. 11292 <p/> 11293 Any <functionlink id="SetNativeMethodPrefix">native method 11294 prefixes</functionlink> for this environment will be unset; 11295 the agent must remove any prefixed native methods before 11296 dispose is called. 11297 <p/> 11298 Any <internallink id="capability">capabilities</internallink> 11299 held by this environment are relinquished. 11300 <p/> 11301 Events enabled by this environment will no longer be sent, however 11302 event handlers currently running will continue to run. Caution must 11303 be exercised in the design of event handlers whose environment may 11304 be disposed and thus become invalid during their execution. 11305 <p/> 11306 This environment may not be used after this call. 11307 This call returns to the caller. 11308 </description> 11309 <origin>new</origin> 11310 <capabilities> 11311 </capabilities> 11312 <parameters> 11313 </parameters> 11314 <errors> 11315 </errors> 11316 </function> 11317 11318 <function id="SetEnvironmentLocalStorage" jkernel="yes" phase="any" callbacksafe="safe" impl="innative notrace" num="148"> 11319 <synopsis>Set Environment Local Storage</synopsis> 11320 <description> 11321 The VM stores a pointer value associated with each environment. 11322 This pointer value is called <i>environment-local storage</i>. 11323 This value is <code>NULL</code> unless set with this function. 11324 Agents can allocate memory in which they store environment specific 11325 information. By setting environment-local storage it can then be 11326 accessed with 11327 <functionlink id="GetEnvironmentLocalStorage"></functionlink>. 11328 <p/> 11329 Called by the agent to set the value of the <jvmti/> 11330 environment-local storage. <jvmti/> supplies to the agent a pointer-size 11331 environment-local storage that can be used to record per-environment 11332 information. 11333 </description> 11334 <origin>new</origin> 11335 <capabilities> 11336 </capabilities> 11337 <parameters> 11338 <param id="data"> 11339 <inbuf> 11340 <void/> 11341 <nullok>value is set to <code>NULL</code></nullok> 11342 </inbuf> 11343 <description> 11344 The value to be entered into the environment-local storage. 11345 </description> 11346 </param> 11347 </parameters> 11348 <errors> 11349 </errors> 11350 </function> 11351 11352 <function id="GetEnvironmentLocalStorage" jkernel="yes" phase="any" callbacksafe="safe" impl="innative notrace" num="147"> 11353 <synopsis>Get Environment Local Storage</synopsis> 11354 <description> 11355 Called by the agent to get the value of the <jvmti/> environment-local 11356 storage. 11357 </description> 11358 <origin>new</origin> 11359 <capabilities> 11360 </capabilities> 11361 <parameters> 11362 <param id="data_ptr"> 11363 <agentbuf><void/></agentbuf> 11364 <description> 11365 Pointer through which the value of the environment local 11366 storage is returned. 11367 If environment-local storage has not been set with 11368 <functionlink id="SetEnvironmentLocalStorage"></functionlink> returned 11369 pointer is <code>NULL</code>. 11370 </description> 11371 </param> 11372 </parameters> 11373 <errors> 11374 </errors> 11375 </function> 11376 11377 <function id="GetVersionNumber" jkernel="yes" phase="any" num="88"> 11378 <synopsis>Get Version Number</synopsis> 11379 <description> 11380 Return the <jvmti/> version via <code>version_ptr</code>. 11381 The return value is the version identifier. 11382 The version identifier includes major, minor and micro 11383 version as well as the interface type. 11384 <constants id="jvmtiVersionInterfaceTypes" label="Version Interface Types" kind="bits"> 11385 <constant id="JVMTI_VERSION_INTERFACE_JNI" num="0x00000000"> 11386 Value of <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> for JNI. 11387 </constant> 11388 <constant id="JVMTI_VERSION_INTERFACE_JVMTI" num="0x30000000"> 11389 Value of <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> for <jvmti/>. 11390 </constant> 11391 </constants> 11392 <constants id="jvmtiVersionMasks" label="Version Masks" kind="bits"> 11393 <constant id="JVMTI_VERSION_MASK_INTERFACE_TYPE" num="0x70000000"> 11394 Mask to extract interface type. 11395 The value of the version returned by this function masked with 11396 <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> is always 11397 <code>JVMTI_VERSION_INTERFACE_JVMTI</code> 11398 since this is a <jvmti/> function. 11399 </constant> 11400 <constant id="JVMTI_VERSION_MASK_MAJOR" num="0x0FFF0000"> 11401 Mask to extract major version number. 11402 </constant> 11403 <constant id="JVMTI_VERSION_MASK_MINOR" num="0x0000FF00"> 11404 Mask to extract minor version number. 11405 </constant> 11406 <constant id="JVMTI_VERSION_MASK_MICRO" num="0x000000FF"> 11407 Mask to extract micro version number. 11408 </constant> 11409 </constants> 11410 <constants id="jvmtiVersionShifts" label="Version Shifts" kind="bits"> 11411 <constant id="JVMTI_VERSION_SHIFT_MAJOR" num="16"> 11412 Shift to extract major version number. 11413 </constant> 11414 <constant id="JVMTI_VERSION_SHIFT_MINOR" num="8"> 11415 Shift to extract minor version number. 11416 </constant> 11417 <constant id="JVMTI_VERSION_SHIFT_MICRO" num="0"> 11418 Shift to extract micro version number. 11419 </constant> 11420 </constants> 11421 </description> 11422 <origin>jvmdi</origin> 11423 <capabilities> 11424 </capabilities> 11425 <parameters> 11426 <param id="version_ptr"> 11427 <outptr><jint/></outptr> 11428 <description> 11429 On return, points to the <jvmti/> version. 11430 </description> 11431 </param> 11432 </parameters> 11433 <errors> 11434 </errors> 11435 </function> 11436 11437 11438 <function id="GetErrorName" phase="any" num="128"> 11439 <synopsis>Get Error Name</synopsis> 11440 <description> 11441 Return the symbolic name for an 11442 <internallink id="ErrorSection">error code</internallink>. 11443 <p/> 11444 For example 11445 <code>GetErrorName(env, JVMTI_ERROR_NONE, &err_name)</code> 11446 would return in <code>err_name</code> the string 11447 <code>"JVMTI_ERROR_NONE"</code>. 11448 </description> 11449 <origin>new</origin> 11450 <capabilities> 11451 </capabilities> 11452 <parameters> 11453 <param id="error"> 11454 <enum>jvmtiError</enum> 11455 <description> 11456 The error code. 11457 </description> 11458 </param> 11459 <param id="name_ptr"> 11460 <allocbuf><char/></allocbuf> 11461 <description> 11462 On return, points to the error name. 11463 The name is encoded as a 11464 <internallink id="mUTF">modified UTF-8</internallink> string, 11465 but is restricted to the ASCII subset. 11466 </description> 11467 </param> 11468 </parameters> 11469 <errors> 11470 </errors> 11471 </function> 11472 11473 <function id="SetVerboseFlag" phase="any" num="150"> 11474 <synopsis>Set Verbose Flag</synopsis> 11475 <description> 11476 <constants id="jvmtiVerboseFlag" label="Verbose Flag Enumeration" kind="enum"> 11477 <constant id="JVMTI_VERBOSE_OTHER" num="0"> 11478 Verbose output other than the below. 11479 </constant> 11480 <constant id="JVMTI_VERBOSE_GC" num="1"> 11481 Verbose garbage collector output, like that specified with <code>-verbose:gc</code>. 11482 </constant> 11483 <constant id="JVMTI_VERBOSE_CLASS" num="2"> 11484 Verbose class loading output, like that specified with <code>-verbose:class</code>. 11485 </constant> 11486 <constant id="JVMTI_VERBOSE_JNI" num="4"> 11487 Verbose JNI output, like that specified with <code>-verbose:jni</code>. 11488 </constant> 11489 </constants> 11490 Control verbose output. 11491 This is the output which typically is sent to <code>stderr</code>. 11492 </description> 11493 <origin>new</origin> 11494 <capabilities> 11495 </capabilities> 11496 <parameters> 11497 <param id="flag"> 11498 <enum>jvmtiVerboseFlag</enum> 11499 <description> 11500 Which verbose flag to set. 11501 </description> 11502 </param> 11503 <param id="value"> 11504 <jboolean/> 11505 <description> 11506 New value of the flag. 11507 </description> 11508 </param> 11509 </parameters> 11510 <errors> 11511 </errors> 11512 </function> 11513 11514 11515 <function id="GetJLocationFormat" phase="any" num="129"> 11516 <synopsis>Get JLocation Format</synopsis> 11517 <description> 11518 Although the greatest functionality is achieved with location information 11519 referencing the virtual machine bytecode index, the definition of 11520 <code>jlocation</code> has intentionally been left unconstrained to allow VM 11521 implementations that do not have this information. 11522 <p/> 11523 This function describes the representation of <code>jlocation</code> used in this VM. 11524 If the returned format is <datalink id="JVMTI_JLOCATION_JVMBCI"></datalink>, 11525 <code>jlocation</code>s can 11526 be used as in indices into the array returned by 11527 <functionlink id="GetBytecodes"></functionlink>. 11528 <constants id="jvmtiJlocationFormat" label="JLocation Format Enumeration" kind="enum"> 11529 <constant id="JVMTI_JLOCATION_JVMBCI" num="1"> 11530 <code>jlocation</code> values represent virtual machine 11531 bytecode indices--that is, offsets into the 11532 virtual machine code for a method. 11533 </constant> 11534 <constant id="JVMTI_JLOCATION_MACHINEPC" num="2"> 11535 <code>jlocation</code> values represent native machine 11536 program counter values. 11537 </constant> 11538 <constant id="JVMTI_JLOCATION_OTHER" num="0"> 11539 <code>jlocation</code> values have some other representation. 11540 </constant> 11541 </constants> 11542 </description> 11543 <origin>new</origin> 11544 <capabilities> 11545 </capabilities> 11546 <parameters> 11547 <param id="format_ptr"> 11548 <outptr><enum>jvmtiJlocationFormat</enum></outptr> 11549 <description> 11550 On return, points to the format identifier for <code>jlocation</code> values. 11551 </description> 11552 </param> 11553 </parameters> 11554 <errors> 11555 </errors> 11556 </function> 11557 11558 </category> 11559 11560 <category id="heap_monitoring" label="Heap Monitoring"> 11561 <function id="SetHeapSamplingInterval" phase="onload" num="156" since="11"> 11562 <synopsis>Set Heap Sampling Interval</synopsis> 11563 <description> 11564 Generate a <eventlink id="SampledObjectAlloc"/> event when objects are allocated. 11565 Each thread keeps a counter of bytes allocated. The event will only be generated 11566 when that counter exceeds an average of <paramlink id="sampling_interval"></paramlink> 11567 since the last sample. 11568 <p/> 11569 Setting <paramlink id="sampling_interval"></paramlink> to 0 will cause an event to be 11570 generated by each allocation supported by the system once the new interval is taken into account. 11571 <p/> 11572 Note that updating the new sampling interval might take various number of allocations 11573 to provoke internal data structure updates. Therefore it is important to 11574 consider the sampling interval as an average. This includes the interval 0, where events 11575 might not be generated straight away for each allocation. 11576 </description> 11577 <origin>new</origin> 11578 <capabilities> 11579 <required id="can_generate_sampled_object_alloc_events"></required> 11580 </capabilities> 11581 <parameters> 11582 <param id="sampling_interval"> 11583 <jint/> 11584 <description> 11585 The sampling interval in bytes. The sampler uses a statistical approach to 11586 generate an event, on average, once for every <paramlink id="sampling_interval"/> bytes of 11587 memory allocated by a given thread. 11588 <p/> 11589 Once the new sampling interval is taken into account, 0 as a sampling interval will generate 11590 a sample for every allocation. 11591 <p/> 11592 Note: The overhead of this feature is directly correlated with the sampling interval. 11593 A high sampling interval, such as 1024 bytes, will incur a high overhead. 11594 A lower interval, such as 1024KB, will have a much lower overhead. Sampling should only 11595 be used with an understanding that it may impact performance. 11596 </description> 11597 </param> 11598 </parameters> 11599 <errors> 11600 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 11601 <paramlink id="sampling_interval"></paramlink> is less than zero. 11602 </error> 11603 </errors> 11604 </function> 11605 </category> 11606 11607 </functionsection> 11608 11609 <errorsection label="Error Reference"> 11610 <intro> 11611 Every <jvmti/> function returns a <b><code>jvmtiError</code></b> error code. 11612 <p/> 11613 It is the responsibility of the agent to call <jvmti/> functions with 11614 valid parameters and in the proper context (calling thread is attached, 11615 phase is correct, etc.). 11616 Detecting some error conditions may be difficult, inefficient, or 11617 impossible for an implementation. 11618 The errors listed in 11619 <internallink id="reqerrors">Function Specific Required Errors</internallink> 11620 must be detected by the implementation. 11621 All other errors represent the recommended response to the error 11622 condition. 11623 </intro> 11624 11625 <errorcategory id="universal-error" label="Universal Errors"> 11626 <intro> 11627 The following errors may be returned by any function 11628 </intro> 11629 11630 <errorid id="JVMTI_ERROR_NONE" num="0"> 11631 No error has occurred. This is the error code that is returned 11632 on successful completion of the function. 11633 </errorid> 11634 <errorid id="JVMTI_ERROR_NULL_POINTER" num="100"> 11635 Pointer is unexpectedly <code>NULL</code>. 11636 </errorid> 11637 <errorid id="JVMTI_ERROR_OUT_OF_MEMORY" num="110"> 11638 The function attempted to allocate memory and no more memory was 11639 available for allocation. 11640 </errorid> 11641 <errorid id="JVMTI_ERROR_ACCESS_DENIED" num="111"> 11642 The desired functionality has not been enabled in this virtual machine. 11643 </errorid> 11644 <errorid id="JVMTI_ERROR_UNATTACHED_THREAD" num="115"> 11645 The thread being used to call this function is not attached 11646 to the virtual machine. Calls must be made from attached threads. 11647 See <code>AttachCurrentThread</code> in the JNI invocation API. 11648 </errorid> 11649 <errorid id="JVMTI_ERROR_INVALID_ENVIRONMENT" num="116"> 11650 The <jvmti/> environment provided is no longer connected or is 11651 not an environment. 11652 </errorid> 11653 <errorid id="JVMTI_ERROR_WRONG_PHASE" num="112"> 11654 The desired functionality is not available in the current 11655 <functionlink id="GetPhase">phase</functionlink>. 11656 Always returned if the virtual machine has completed running. 11657 </errorid> 11658 <errorid id="JVMTI_ERROR_INTERNAL" num="113"> 11659 An unexpected internal error has occurred. 11660 </errorid> 11661 </errorcategory> 11662 11663 <errorcategory id="reqerrors" label="Function Specific Required Errors"> 11664 <intro> 11665 The following errors are returned by some <jvmti/> functions and must 11666 be returned by the implementation when the condition occurs. 11667 </intro> 11668 11669 <errorid id="JVMTI_ERROR_INVALID_PRIORITY" num="12"> 11670 Invalid priority. 11671 </errorid> 11672 <errorid id="JVMTI_ERROR_THREAD_NOT_SUSPENDED" num="13"> 11673 Thread was not suspended. 11674 </errorid> 11675 <errorid id="JVMTI_ERROR_THREAD_SUSPENDED" num="14"> 11676 Thread already suspended. 11677 </errorid> 11678 <errorid id="JVMTI_ERROR_THREAD_NOT_ALIVE" num="15"> 11679 This operation requires the thread to be alive--that is, 11680 it must be started and not yet have died. 11681 </errorid> 11682 <errorid id="JVMTI_ERROR_CLASS_NOT_PREPARED" num="22"> 11683 The class has been loaded but not yet prepared. 11684 </errorid> 11685 <errorid id="JVMTI_ERROR_NO_MORE_FRAMES" num="31"> 11686 There are no Java programming language or JNI stack frames at the specified depth. 11687 </errorid> 11688 <errorid id="JVMTI_ERROR_OPAQUE_FRAME" num="32"> 11689 Information about the frame is not available (e.g. for native frames). 11690 </errorid> 11691 <errorid id="JVMTI_ERROR_DUPLICATE" num="40"> 11692 Item already set. 11693 </errorid> 11694 <errorid id="JVMTI_ERROR_NOT_FOUND" num="41"> 11695 Desired element (e.g. field or breakpoint) not found 11696 </errorid> 11697 <errorid id="JVMTI_ERROR_NOT_MONITOR_OWNER" num="51"> 11698 This thread doesn't own the raw monitor. 11699 </errorid> 11700 <errorid id="JVMTI_ERROR_INTERRUPT" num="52"> 11701 The call has been interrupted before completion. 11702 </errorid> 11703 <errorid id="JVMTI_ERROR_UNMODIFIABLE_CLASS" num="79"> 11704 The class cannot be modified. 11705 </errorid> 11706 <errorid id="JVMTI_ERROR_UNMODIFIABLE_MODULE" num="80"> 11707 The module cannot be modified. 11708 </errorid> 11709 <errorid id="JVMTI_ERROR_NOT_AVAILABLE" num="98"> 11710 The functionality is not available in this virtual machine. 11711 </errorid> 11712 <errorid id="JVMTI_ERROR_ABSENT_INFORMATION" num="101"> 11713 The requested information is not available. 11714 </errorid> 11715 <errorid id="JVMTI_ERROR_INVALID_EVENT_TYPE" num="102"> 11716 The specified event type ID is not recognized. 11717 </errorid> 11718 <errorid id="JVMTI_ERROR_NATIVE_METHOD" num="104"> 11719 The requested information is not available for native method. 11720 </errorid> 11721 <errorid id="JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED" num="106"> 11722 The class loader does not support this operation. 11723 </errorid> 11724 </errorcategory> 11725 11726 <errorcategory id="function-specific-errors" label="Function Specific Agent Errors"> 11727 <intro> 11728 The following errors are returned by some <jvmti/> functions. 11729 They are returned in the event of invalid parameters passed by the 11730 agent or usage in an invalid context. 11731 An implementation is not required to detect these errors. 11732 </intro> 11733 11734 <errorid id="JVMTI_ERROR_INVALID_THREAD" num="10"> 11735 The passed thread is not a valid thread. 11736 </errorid> 11737 <errorid id="JVMTI_ERROR_INVALID_FIELDID" num="25"> 11738 Invalid field. 11739 </errorid> 11740 <errorid id="JVMTI_ERROR_INVALID_MODULE" num="26"> 11741 Invalid module. 11742 </errorid> 11743 <errorid id="JVMTI_ERROR_INVALID_METHODID" num="23"> 11744 Invalid method. 11745 </errorid> 11746 <errorid id="JVMTI_ERROR_INVALID_LOCATION" num="24"> 11747 Invalid location. 11748 </errorid> 11749 <errorid id="JVMTI_ERROR_INVALID_OBJECT" num="20"> 11750 Invalid object. 11751 </errorid> 11752 <errorid id="JVMTI_ERROR_INVALID_CLASS" num="21"> 11753 Invalid class. 11754 </errorid> 11755 <errorid id="JVMTI_ERROR_TYPE_MISMATCH" num="34"> 11756 The variable is not an appropriate type for the function used. 11757 </errorid> 11758 <errorid id="JVMTI_ERROR_INVALID_SLOT" num="35"> 11759 Invalid slot. 11760 </errorid> 11761 <errorid id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY" num="99"> 11762 The capability being used is false in this environment. 11763 </errorid> 11764 <errorid id="JVMTI_ERROR_INVALID_THREAD_GROUP" num="11"> 11765 Thread group invalid. 11766 </errorid> 11767 <errorid id="JVMTI_ERROR_INVALID_MONITOR" num="50"> 11768 Invalid raw monitor. 11769 </errorid> 11770 <errorid id="JVMTI_ERROR_ILLEGAL_ARGUMENT" num="103"> 11771 Illegal argument. 11772 </errorid> 11773 <errorid id="JVMTI_ERROR_INVALID_TYPESTATE" num="65"> 11774 The state of the thread has been modified, and is now inconsistent. 11775 </errorid> 11776 <errorid id="JVMTI_ERROR_UNSUPPORTED_VERSION" num="68"> 11777 A new class file has a version number not supported by this VM. 11778 </errorid> 11779 <errorid id="JVMTI_ERROR_INVALID_CLASS_FORMAT" num="60"> 11780 A new class file is malformed (the VM would return a <code>ClassFormatError</code>). 11781 </errorid> 11782 <errorid id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION" num="61"> 11783 The new class file definitions would lead to a circular 11784 definition (the VM would return a <code>ClassCircularityError</code>). 11785 </errorid> 11786 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED" num="63"> 11787 A new class file would require adding a method. 11788 </errorid> 11789 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED" num="64"> 11790 A new class version changes a field. 11791 </errorid> 11792 <errorid id="JVMTI_ERROR_FAILS_VERIFICATION" num="62"> 11793 The class bytes fail verification. 11794 </errorid> 11795 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED" num="66"> 11796 A direct superclass is different for the new class 11797 version, or the set of directly implemented 11798 interfaces is different. 11799 </errorid> 11800 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED" num="67"> 11801 A new class version does not declare a method 11802 declared in the old class version. 11803 </errorid> 11804 <errorid id="JVMTI_ERROR_NAMES_DONT_MATCH" num="69"> 11805 The class name defined in the new class file is 11806 different from the name in the old class object. 11807 </errorid> 11808 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED" num="70"> 11809 A new class version has different modifiers. 11810 </errorid> 11811 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED" num="71"> 11812 A method in the new class version has different modifiers 11813 than its counterpart in the old class version. 11814 </errorid> 11815 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED" num="72"> 11816 A new class version has unsupported differences in class attributes. 11817 </errorid> 11818 </errorcategory> 11819 </errorsection> 11820 11821 <eventsection label="Events"> 11822 <intro label="Handling Events" id="eventIntro"> 11823 Agents can be informed of many events that occur in application 11824 programs. 11825 <p/> 11826 To handle events, designate a set of callback functions with 11827 <functionlink id="SetEventCallbacks"></functionlink>. 11828 For each event the corresponding callback function will be 11829 called. 11830 Arguments to the callback function provide additional 11831 information about the event. 11832 <p/> 11833 The callback function is usually called from within an application 11834 thread. The <jvmti/> implementation does not 11835 queue events in any way. This means 11836 that event callback functions must be written 11837 carefully. Here are some general guidelines. See 11838 the individual event descriptions for further 11839 suggestions. 11840 <p/> 11841 <ul> 11842 <li>Any exception thrown during the execution of an event callback can 11843 overwrite any current pending exception in the current application thread. 11844 Care must be taken to preserve a pending exception 11845 when an event callback makes a JNI call that might generate an exception. 11846 </li> 11847 <li>Event callback functions must be re-entrant. The <jvmti/> implementation does 11848 not queue events. If an agent needs to process events one at a time, it 11849 can use a raw monitor inside the 11850 event callback functions to serialize event processing. 11851 </li> 11852 <li>Event callback functions that execute JNI's FindClass function to load 11853 classes need to note that FindClass locates the class loader associated 11854 with the current native method. For the purposes of class loading, an 11855 event callback that includes a JNI environment as a parameter to the 11856 callback will treated as if it is a native call, where the native method 11857 is in the class of the event thread's current frame. 11858 </li> 11859 </ul> 11860 <p/> 11861 Some <jvmti/> events identify objects with JNI references. 11862 All references 11863 in <jvmti/> events are JNI local references and will become invalid 11864 after the event callback returns. 11865 Unless stated otherwise, memory referenced by pointers sent in event 11866 callbacks may not be referenced after the event callback returns. 11867 <p/> 11868 Except where stated otherwise, events are delivered on the thread 11869 that caused the event. 11870 Events are sent at the time they occur. 11871 The specification for each event includes the set of 11872 <functionlink id="GetPhase">phases</functionlink> in which it can be sent; 11873 if an event triggering activity occurs during another phase, no event 11874 is sent. 11875 <p/> 11876 A thread that generates an event does not change its execution status 11877 (for example, the event does not cause the thread to be suspended). 11878 If an agent wishes the event to result in suspension, then the agent 11879 is responsible for explicitly suspending the thread with 11880 <functionlink id="SuspendThread"></functionlink>. 11881 <p/> 11882 If an event is enabled in multiple environments, the event will be sent 11883 to each agent in the order that the environments were created. 11884 </intro> 11885 11886 <intro label="Enabling Events" id="enablingevents"> 11887 All events are initially disabled. In order to receive any 11888 event: 11889 <ul> 11890 <li> 11891 If the event requires a capability, that capability must 11892 be added with 11893 <functionlink id="AddCapabilities"></functionlink>. 11894 </li> 11895 <li> 11896 A callback for the event must be set with 11897 <functionlink id="SetEventCallbacks"></functionlink>. 11898 </li> 11899 <li> 11900 The event must be enabled with 11901 <functionlink id="SetEventNotificationMode"></functionlink>. 11902 </li> 11903 </ul> 11904 </intro> 11905 11906 <intro label="Multiple Co-located Events" id="eventorder"> 11907 In many situations it is possible for multiple events to occur 11908 at the same location in one thread. When this happens, all the events 11909 are reported through the event callbacks in the order specified in this section. 11910 <p/> 11911 If the current location is at the entry point of a method, the 11912 <eventlink id="MethodEntry"></eventlink> event is reported before 11913 any other event at the current location in the same thread. 11914 <p/> 11915 If an exception catch has been detected at the current location, 11916 either because it is the beginning of a catch clause or a native method 11917 that cleared a pending exception has returned, the 11918 <code>exceptionCatch</code> event is reported before 11919 any other event at the current location in the same thread. 11920 <p/> 11921 If a <code>singleStep</code> event or 11922 <code>breakpoint</code> event is triggered at the 11923 current location, the event is defined to occur 11924 immediately before the code at the current location is executed. 11925 These events are reported before any events which are triggered 11926 by the execution of code at the current location in the same 11927 thread (specifically: 11928 <code>exception</code>, 11929 <code>fieldAccess</code>, and 11930 <code>fieldModification</code>). 11931 If both a step and breakpoint event are triggered for the same thread and 11932 location, the step event is reported before the breakpoint event. 11933 <p/> 11934 If the current location is the exit point of a method (that is, the last 11935 location before returning to the caller), the 11936 <eventlink id="MethodExit"></eventlink> event and 11937 the <eventlink id="FramePop"></eventlink> event (if requested) 11938 are reported after all other events at the current location in the same 11939 thread. There is no specified ordering of these two events 11940 with respect to each other. 11941 <p/> 11942 Co-located events can be triggered during the processing of some other 11943 event by the agent at the same location in the same thread. 11944 If such an event, of type <i>y</i>, is triggered during the processing of 11945 an event of type <i>x</i>, and if <i>x</i> 11946 precedes <i>y</i> in the ordering specified above, the co-located event 11947 <i>y</i> is reported for the current thread and location. If <i>x</i> does not precede 11948 <i>y</i>, <i>y</i> is not reported for the current thread and location. 11949 For example, if a breakpoint is set at the current location 11950 during the processing of <eventlink id="SingleStep"></eventlink>, 11951 that breakpoint will be reported before the thread moves off the current 11952 location. 11953 <p/>The following events are never considered to be co-located with 11954 other events. 11955 <ul> 11956 <li><eventlink id="VMStart"></eventlink></li> 11957 <li><eventlink id="VMInit"></eventlink></li> 11958 <li><eventlink id="VMDeath"></eventlink></li> 11959 <li><eventlink id="ThreadStart"></eventlink></li> 11960 <li><eventlink id="ThreadEnd"></eventlink></li> 11961 <li><eventlink id="ClassLoad"></eventlink></li> 11962 <li><eventlink id="ClassPrepare"></eventlink></li> 11963 </ul> 11964 </intro> 11965 11966 <intro label="Event Callbacks" id="jvmtiEventCallbacks"> 11967 The event callback structure below is used to specify the handler function 11968 for events. It is set with the 11969 <functionlink id="SetEventCallbacks"></functionlink> function. 11970 </intro> 11971 11972 <event label="Single Step" 11973 id="SingleStep" const="JVMTI_EVENT_SINGLE_STEP" filtered="thread" num="60"> 11974 <description> 11975 Single step events allow the agent to trace thread execution 11976 at the finest granularity allowed by the VM. A single step event is 11977 generated whenever a thread reaches a new location. 11978 Typically, single step events represent the completion of one VM 11979 instruction as defined in <vmspec/>. However, some implementations 11980 may define locations differently. In any case the 11981 <code>method</code> and <code>location</code> 11982 parameters uniquely identify the current location and allow 11983 the mapping to source file and line number when that information is 11984 available. 11985 <p/> 11986 No single step events are generated from within native methods. 11987 </description> 11988 <origin>jvmdi</origin> 11989 <capabilities> 11990 <required id="can_generate_single_step_events"></required> 11991 </capabilities> 11992 <parameters> 11993 <param id="jni_env"> 11994 <outptr> 11995 <struct>JNIEnv</struct> 11996 </outptr> 11997 <description> 11998 The JNI environment of the event (current) thread 11999 </description> 12000 </param> 12001 <param id="thread"> 12002 <jthread/> 12003 <description> 12004 Thread about to execution a new instruction 12005 </description> 12006 </param> 12007 <param id="klass"> 12008 <jclass method="method"/> 12009 <description> 12010 Class of the method about to execute a new instruction 12011 </description> 12012 </param> 12013 <param id="method"> 12014 <jmethodID class="klass"/> 12015 <description> 12016 Method about to execute a new instruction 12017 </description> 12018 </param> 12019 <param id="location"> 12020 <jlocation/> 12021 <description> 12022 Location of the new instruction 12023 </description> 12024 </param> 12025 </parameters> 12026 </event> 12027 12028 <event label="Breakpoint" 12029 id="Breakpoint" const="JVMTI_EVENT_BREAKPOINT" filtered="thread" num="62"> 12030 <description> 12031 Breakpoint events are generated whenever a thread reaches a location 12032 designated as a breakpoint with <functionlink id="SetBreakpoint"></functionlink>. 12033 The <code>method</code> and <code>location</code> 12034 parameters uniquely identify the current location and allow 12035 the mapping to source file and line number when that information is 12036 available. 12037 </description> 12038 <origin>jvmdi</origin> 12039 <capabilities> 12040 <required id="can_generate_breakpoint_events"></required> 12041 </capabilities> 12042 <parameters> 12043 <param id="jni_env"> 12044 <outptr> 12045 <struct>JNIEnv</struct> 12046 </outptr> 12047 <description> 12048 The JNI environment of the event (current) thread. 12049 </description> 12050 </param> 12051 <param id="thread"> 12052 <jthread/> 12053 <description> 12054 Thread that hit the breakpoint 12055 </description> 12056 </param> 12057 <param id="klass"> 12058 <jclass method="method"/> 12059 <description> 12060 Class of the method that hit the breakpoint 12061 </description> 12062 </param> 12063 <param id="method"> 12064 <jmethodID class="klass"/> 12065 <description> 12066 Method that hit the breakpoint 12067 </description> 12068 </param> 12069 <param id="location"> 12070 <jlocation/> 12071 <description> 12072 location of the breakpoint 12073 </description> 12074 </param> 12075 </parameters> 12076 </event> 12077 12078 <event label="Field Access" 12079 id="FieldAccess" const="JVMTI_EVENT_FIELD_ACCESS" filtered="thread" num="63"> 12080 <description> 12081 Field access events are generated whenever a thread accesses 12082 a field that was designated as a watchpoint 12083 with <functionlink id="SetFieldAccessWatch"></functionlink>. 12084 The <code>method</code> and <code>location</code> 12085 parameters uniquely identify the current location and allow 12086 the mapping to source file and line number when that information is 12087 available. 12088 </description> 12089 <origin>jvmdi</origin> 12090 <capabilities> 12091 <required id="can_generate_field_access_events"></required> 12092 </capabilities> 12093 <parameters> 12094 <param id="jni_env"> 12095 <outptr> 12096 <struct>JNIEnv</struct> 12097 </outptr> 12098 <description> 12099 The JNI environment of the event (current) thread 12100 </description> 12101 </param> 12102 <param id="thread"> 12103 <jthread/> 12104 <description> 12105 Thread accessing the field 12106 </description> 12107 </param> 12108 <param id="klass"> 12109 <jclass method="method"/> 12110 <description> 12111 Class of the method where the access is occurring 12112 </description> 12113 </param> 12114 <param id="method"> 12115 <jmethodID class="klass"/> 12116 <description> 12117 Method where the access is occurring 12118 </description> 12119 </param> 12120 <param id="location"> 12121 <jlocation/> 12122 <description> 12123 Location where the access is occurring 12124 </description> 12125 </param> 12126 <param id="field_klass"> 12127 <jclass field="field"/> 12128 <description> 12129 Class of the field being accessed 12130 </description> 12131 </param> 12132 <param id="object"> 12133 <jobject/> 12134 <description> 12135 Object with the field being accessed if the field is an 12136 instance field; <code>NULL</code> otherwise 12137 </description> 12138 </param> 12139 <param id="field"> 12140 <jfieldID class="field_klass"/> 12141 <description> 12142 Field being accessed 12143 </description> 12144 </param> 12145 </parameters> 12146 </event> 12147 12148 <event label="Field Modification" 12149 id="FieldModification" const="JVMTI_EVENT_FIELD_MODIFICATION" filtered="thread" num="64"> 12150 <description> 12151 Field modification events are generated whenever a thread modifies 12152 a field that was designated as a watchpoint 12153 with <functionlink id="SetFieldModificationWatch"></functionlink>. 12154 The <code>method</code> and <code>location</code> 12155 parameters uniquely identify the current location and allow 12156 the mapping to source file and line number when that information is 12157 available. 12158 </description> 12159 <origin>jvmdi</origin> 12160 <capabilities> 12161 <required id="can_generate_field_modification_events"></required> 12162 </capabilities> 12163 <parameters> 12164 <param id="jni_env"> 12165 <outptr> 12166 <struct>JNIEnv</struct> 12167 </outptr> 12168 <description> 12169 The JNI environment of the event (current) thread 12170 </description> 12171 </param> 12172 <param id="thread"> 12173 <jthread/> 12174 <description> 12175 Thread modifying the field 12176 </description> 12177 </param> 12178 <param id="klass"> 12179 <jclass method="method"/> 12180 <description> 12181 Class of the method where the modification is occurring 12182 </description> 12183 </param> 12184 <param id="method"> 12185 <jmethodID class="klass"/> 12186 <description> 12187 Method where the modification is occurring 12188 </description> 12189 </param> 12190 <param id="location"> 12191 <jlocation/> 12192 <description> 12193 Location where the modification is occurring 12194 </description> 12195 </param> 12196 <param id="field_klass"> 12197 <jclass field="field"/> 12198 <description> 12199 Class of the field being modified 12200 </description> 12201 </param> 12202 <param id="object"> 12203 <jobject/> 12204 <description> 12205 Object with the field being modified if the field is an 12206 instance field; <code>NULL</code> otherwise 12207 </description> 12208 </param> 12209 <param id="field"> 12210 <jfieldID class="field_klass"/> 12211 <description> 12212 Field being modified 12213 </description> 12214 </param> 12215 <param id="signature_type"> 12216 <char/> 12217 <description> 12218 Signature type of the new value 12219 </description> 12220 </param> 12221 <param id="new_value"> 12222 <jvalue/> 12223 <description> 12224 The new value 12225 </description> 12226 </param> 12227 </parameters> 12228 </event> 12229 12230 <event label="Frame Pop" 12231 id="FramePop" const="JVMTI_EVENT_FRAME_POP" filtered="thread" num="61"> 12232 <description> 12233 Frame pop events are generated upon exit from a single method 12234 in a single frame as specified 12235 in a call to <functionlink id="NotifyFramePop"></functionlink>. 12236 This is true whether termination is caused by 12237 executing its return instruction 12238 or by throwing an exception to its caller 12239 (see <paramlink id="was_popped_by_exception"></paramlink>). 12240 However, frame pops caused by the <functionlink id="PopFrame"/> 12241 function are not reported. 12242 <p/> 12243 The location reported by <functionlink id="GetFrameLocation"></functionlink> 12244 identifies the executable location in the returning method, 12245 immediately prior to the return. 12246 </description> 12247 <origin>jvmdi</origin> 12248 <capabilities> 12249 <required id="can_generate_frame_pop_events"></required> 12250 </capabilities> 12251 <parameters> 12252 <param id="jni_env"> 12253 <outptr> 12254 <struct>JNIEnv</struct> 12255 </outptr> 12256 <description> 12257 The JNI environment of the event (current) thread 12258 </description> 12259 </param> 12260 <param id="thread"> 12261 <jthread/> 12262 <description> 12263 Thread that is popping the frame 12264 </description> 12265 </param> 12266 <param id="klass"> 12267 <jclass method="method"/> 12268 <description> 12269 Class of the method being popped 12270 </description> 12271 </param> 12272 <param id="method"> 12273 <jmethodID class="klass"/> 12274 <description> 12275 Method being popped 12276 </description> 12277 </param> 12278 <param id="was_popped_by_exception"> 12279 <jboolean/> 12280 <description> 12281 True if frame was popped by a thrown exception. 12282 False if method exited through its return instruction. 12283 </description> 12284 </param> 12285 </parameters> 12286 </event> 12287 12288 <event label="Method Entry" 12289 id="MethodEntry" const="JVMTI_EVENT_METHOD_ENTRY" filtered="thread" num="65"> 12290 <description> 12291 Method entry events are generated upon entry of Java 12292 programming language methods (including native methods). 12293 <p/> 12294 The location reported by <functionlink id="GetFrameLocation"></functionlink> 12295 identifies the initial executable location in 12296 the method. 12297 <p/> 12298 Enabling method 12299 entry or exit events will significantly degrade performance on many platforms and is thus 12300 not advised for performance critical usage (such as profiling). 12301 <internallink id="bci">Bytecode instrumentation</internallink> should be 12302 used in these cases. 12303 </description> 12304 <origin>jvmdi</origin> 12305 <capabilities> 12306 <required id="can_generate_method_entry_events"></required> 12307 </capabilities> 12308 <parameters> 12309 <param id="jni_env"> 12310 <outptr> 12311 <struct>JNIEnv</struct> 12312 </outptr> 12313 <description> 12314 The JNI environment of the event (current) thread 12315 </description> 12316 </param> 12317 <param id="thread"> 12318 <jthread/> 12319 <description> 12320 Thread entering the method 12321 </description> 12322 </param> 12323 <param id="klass"> 12324 <jclass method="method"/> 12325 <description> 12326 Class of the method being entered 12327 </description> 12328 </param> 12329 <param id="method"> 12330 <jmethodID class="klass"/> 12331 <description> 12332 Method being entered 12333 </description> 12334 </param> 12335 </parameters> 12336 </event> 12337 12338 <event label="Method Exit" 12339 id="MethodExit" const="JVMTI_EVENT_METHOD_EXIT" filtered="thread" num="66"> 12340 <description> 12341 Method exit events are generated upon exit from Java 12342 programming language methods (including native methods). 12343 This is true whether termination is caused by 12344 executing its return instruction 12345 or by throwing an exception to its caller 12346 (see <paramlink id="was_popped_by_exception"></paramlink>). 12347 <p/> 12348 The <code>method</code> field uniquely identifies the 12349 method being entered or exited. The <code>frame</code> field provides 12350 access to the stack frame for the method. 12351 <p/> 12352 The location reported by <functionlink id="GetFrameLocation"></functionlink> 12353 identifies the executable location in the returning method 12354 immediately prior to the return. 12355 <p/> 12356 Enabling method 12357 entry or exit events will significantly degrade performance on many platforms and is thus 12358 not advised for performance critical usage (such as profiling). 12359 <internallink id="bci">Bytecode instrumentation</internallink> should be 12360 used in these cases. 12361 </description> 12362 <origin>jvmdi</origin> 12363 <capabilities> 12364 <required id="can_generate_method_exit_events"></required> 12365 </capabilities> 12366 <parameters> 12367 <param id="jni_env"> 12368 <outptr> 12369 <struct>JNIEnv</struct> 12370 </outptr> 12371 <description> 12372 The JNI environment of the event (current) thread 12373 </description> 12374 </param> 12375 <param id="thread"> 12376 <jthread/> 12377 <description> 12378 Thread exiting the method 12379 </description> 12380 </param> 12381 <param id="klass"> 12382 <jclass method="method"/> 12383 <description> 12384 Class of the method being exited 12385 </description> 12386 </param> 12387 <param id="method"> 12388 <jmethodID class="klass"/> 12389 <description> 12390 Method being exited 12391 </description> 12392 </param> 12393 <param id="was_popped_by_exception"> 12394 <jboolean/> 12395 <description> 12396 True if frame was popped by a thrown exception. 12397 False if method exited through its return instruction. 12398 </description> 12399 </param> 12400 <param id="return_value"> 12401 <jvalue/> 12402 <description> 12403 The return value of the method being exited. 12404 Undefined and should not be used if 12405 <paramlink id="was_popped_by_exception"></paramlink> 12406 is true. 12407 </description> 12408 </param> 12409 </parameters> 12410 </event> 12411 12412 <event label="Native Method Bind" phase="any" 12413 id="NativeMethodBind" const="JVMTI_EVENT_NATIVE_METHOD_BIND" num="67"> 12414 <description> 12415 A Native Method Bind event is sent when a VM binds a 12416 Java programming language native method 12417 to the address of a function that implements the native method. 12418 This will occur when the native method is called for the first time 12419 and also occurs when the JNI function <code>RegisterNatives</code> is called. 12420 This event allows the bind to be redirected to an agent-specified 12421 proxy function. 12422 This event is not sent when the native method is unbound. 12423 Typically, this proxy function will need to be specific to a 12424 particular method or, to handle the general case, automatically 12425 generated assembly code, since after instrumentation code is 12426 executed the function at the original binding 12427 address will usually be invoked. 12428 The original binding can be restored or the redirection changed 12429 by use of the JNI function <code>RegisterNatives</code>. 12430 Some events may be sent during the primordial phase, JNI and 12431 most of <jvmti/> cannot be used at this time but the method and 12432 address can be saved for use later. 12433 </description> 12434 <origin>new</origin> 12435 <capabilities> 12436 <required id="can_generate_native_method_bind_events"></required> 12437 </capabilities> 12438 <parameters> 12439 <param id="jni_env"> 12440 <outptr> 12441 <struct>JNIEnv</struct> 12442 </outptr> 12443 <description> 12444 The JNI environment of the event (current) thread 12445 Will be <code>NULL</code> if sent during the primordial 12446 <functionlink id="GetPhase">phase</functionlink>. 12447 </description> 12448 </param> 12449 <param id="thread"> 12450 <jthread/> 12451 <description> 12452 Thread requesting the bind 12453 </description> 12454 </param> 12455 <param id="klass"> 12456 <jclass method="method"/> 12457 <description> 12458 Class of the method being bound 12459 </description> 12460 </param> 12461 <param id="method"> 12462 <jmethodID class="klass"/> 12463 <description> 12464 Native method being bound 12465 </description> 12466 </param> 12467 <param id="address"> 12468 <outptr><void/></outptr> 12469 <description> 12470 The address the VM is about to bind to--that is, the 12471 address of the implementation of the native method 12472 </description> 12473 </param> 12474 <param id="new_address_ptr"> 12475 <agentbuf><void/></agentbuf> 12476 <description> 12477 if the referenced address is changed (that is, if 12478 <code>*new_address_ptr</code> is set), the binding 12479 will instead be made to the supplied address. 12480 </description> 12481 </param> 12482 </parameters> 12483 </event> 12484 12485 <event label="Exception" 12486 id="Exception" const="JVMTI_EVENT_EXCEPTION" filtered="thread" num="58"> 12487 <description> 12488 Exception events are generated whenever an exception is first detected 12489 in a Java programming language method. 12490 Where "exception" means any <code>java.lang.Throwable</code>. 12491 The exception may have been thrown by a Java programming language or native 12492 method, but in the case of native methods, the event is not generated 12493 until the exception is first seen by a Java programming language method. If an exception is 12494 set and cleared in a native method (and thus is never visible to Java programming language code), 12495 no exception event is generated. 12496 <p/> 12497 The <code>method</code> and <code>location</code> 12498 parameters uniquely identify the current location 12499 (where the exception was detected) and allow 12500 the mapping to source file and line number when that information is 12501 available. The <code>exception</code> field identifies the thrown 12502 exception object. The <code>catch_method</code> 12503 and <code>catch_location</code> identify the location of the catch clause, 12504 if any, that handles the thrown exception. If there is no such catch clause, 12505 each field is set to 0. There is no guarantee that the thread will ever 12506 reach this catch clause. If there are native methods on the call stack 12507 between the throw location and the catch clause, the exception may 12508 be reset by one of those native methods. 12509 Similarly, exceptions that are reported as uncaught (<code>catch_klass</code> 12510 et al. set to 0) may in fact be caught by native code. 12511 Agents can check for these occurrences by monitoring 12512 <eventlink id="ExceptionCatch"></eventlink> events. 12513 Note that finally clauses are implemented as catch and re-throw. Therefore they 12514 will be reported in the catch location. 12515 </description> 12516 <origin>jvmdi</origin> 12517 <capabilities> 12518 <required id="can_generate_exception_events"></required> 12519 </capabilities> 12520 <parameters> 12521 <param id="jni_env"> 12522 <outptr> 12523 <struct>JNIEnv</struct> 12524 </outptr> 12525 <description> 12526 The JNI environment of the event (current) thread 12527 </description> 12528 </param> 12529 <param id="thread"> 12530 <jthread/> 12531 <description> 12532 Thread generating the exception 12533 </description> 12534 </param> 12535 <param id="klass"> 12536 <jclass method="method"/> 12537 <description> 12538 Class generating the exception 12539 </description> 12540 </param> 12541 <param id="method"> 12542 <jmethodID class="klass"/> 12543 <description> 12544 Method generating the exception 12545 </description> 12546 </param> 12547 <param id="location"> 12548 <jlocation/> 12549 <description> 12550 Location where exception occurred 12551 </description> 12552 </param> 12553 <param id="exception"> 12554 <jobject/> 12555 <description> 12556 The exception being thrown 12557 </description> 12558 </param> 12559 <param id="catch_klass"> 12560 <jclass method="catch_method"/> 12561 <description> 12562 Class that will catch the exception, or <code>NULL</code> if no known catch 12563 </description> 12564 </param> 12565 <param id="catch_method"> 12566 <jmethodID class="catch_klass"/> 12567 <description> 12568 Method that will catch the exception, or <code>NULL</code> if no known catch 12569 </description> 12570 </param> 12571 <param id="catch_location"> 12572 <jlocation/> 12573 <description> 12574 location which will catch the exception or zero if no known catch 12575 </description> 12576 </param> 12577 </parameters> 12578 </event> 12579 12580 <event label="Exception Catch" 12581 id="ExceptionCatch" const="JVMTI_EVENT_EXCEPTION_CATCH" filtered="thread" num="59"> 12582 <description> 12583 Exception catch events are generated whenever a thrown exception is caught. 12584 Where "exception" means any <code>java.lang.Throwable</code>. 12585 If the exception is caught in a Java programming language method, the event is generated 12586 when the catch clause is reached. If the exception is caught in a native 12587 method, the event is generated as soon as control is returned to a Java programming language 12588 method. Exception catch events are generated for any exception for which 12589 a throw was detected in a Java programming language method. 12590 Note that finally clauses are implemented as catch and re-throw. Therefore they 12591 will generate exception catch events. 12592 <p/> 12593 The <code>method</code> and <code>location</code> 12594 parameters uniquely identify the current location 12595 and allow the mapping to source file and line number when that information is 12596 available. For exceptions caught in a Java programming language method, the 12597 <code>exception</code> object identifies the exception object. Exceptions 12598 caught in native methods are not necessarily available by the time the 12599 exception catch is reported, so the <code>exception</code> field is set 12600 to <code>NULL</code>. 12601 </description> 12602 <origin>jvmdi</origin> 12603 <capabilities> 12604 <required id="can_generate_exception_events"></required> 12605 </capabilities> 12606 <parameters> 12607 <param id="jni_env"> 12608 <outptr> 12609 <struct>JNIEnv</struct> 12610 </outptr> 12611 <description> 12612 The JNI environment of the event (current) thread 12613 </description> 12614 </param> 12615 <param id="thread"> 12616 <jthread/> 12617 <description> 12618 Thread catching the exception 12619 </description> 12620 </param> 12621 <param id="klass"> 12622 <jclass method="method"/> 12623 <description> 12624 Class catching the exception 12625 </description> 12626 </param> 12627 <param id="method"> 12628 <jmethodID class="klass"/> 12629 <description> 12630 Method catching the exception 12631 </description> 12632 </param> 12633 <param id="location"> 12634 <jlocation/> 12635 <description> 12636 Location where exception is being caught 12637 </description> 12638 </param> 12639 <param id="exception"> 12640 <jobject/> 12641 <description> 12642 Exception being caught 12643 </description> 12644 </param> 12645 </parameters> 12646 </event> 12647 12648 <event label="Thread Start" 12649 id="ThreadStart" const="JVMTI_EVENT_THREAD_START" num="52" phase="start"> 12650 <description> 12651 Thread start events are generated by a new thread before its initial 12652 method executes. 12653 <p/> 12654 A thread may be listed in the array returned by 12655 <functionlink id="GetAllThreads"></functionlink> 12656 before its thread start event is generated. 12657 It is possible for other events to be generated 12658 on a thread before its thread start event. 12659 <p/> 12660 The event is sent on the newly started <paramlink id="thread"></paramlink>. 12661 </description> 12662 <origin>jvmdi</origin> 12663 <capabilities> 12664 </capabilities> 12665 <parameters> 12666 <param id="jni_env"> 12667 <outptr> 12668 <struct>JNIEnv</struct> 12669 </outptr> 12670 <description> 12671 The JNI environment of the event (current) thread. 12672 </description> 12673 </param> 12674 <param id="thread"> 12675 <jthread/> 12676 <description> 12677 Thread starting 12678 </description> 12679 </param> 12680 </parameters> 12681 </event> 12682 12683 <event label="Thread End" 12684 id="ThreadEnd" const="JVMTI_EVENT_THREAD_END" filtered="thread" num="53" phase="start"> 12685 <description> 12686 Thread end events are generated by a terminating thread 12687 after its initial method has finished execution. 12688 <p/> 12689 A thread may be listed in the array returned by 12690 <functionlink id="GetAllThreads"></functionlink> 12691 after its thread end event is generated. 12692 No events are generated on a thread 12693 after its thread end event. 12694 <p/> 12695 The event is sent on the dying <paramlink id="thread"></paramlink>. 12696 </description> 12697 <origin>jvmdi</origin> 12698 <capabilities> 12699 </capabilities> 12700 <parameters> 12701 <param id="jni_env"> 12702 <outptr> 12703 <struct>JNIEnv</struct> 12704 </outptr> 12705 <description> 12706 The JNI environment of the event (current) thread. 12707 </description> 12708 </param> 12709 <param id="thread"> 12710 <jthread/> 12711 <description> 12712 Thread ending 12713 </description> 12714 </param> 12715 </parameters> 12716 </event> 12717 12718 <event label="Class Load" 12719 id="ClassLoad" const="JVMTI_EVENT_CLASS_LOAD" filtered="thread" phase="start" num="55"> 12720 <description> 12721 A class load event is generated when a class is first loaded. The order 12722 of class load events generated by a particular thread are guaranteed 12723 to match the order of class loading within that thread. 12724 Array class creation does not generate a class load event. 12725 The creation of a primitive class (for example, java.lang.Integer.TYPE) 12726 does not generate a class load event. 12727 <p/> 12728 This event is sent at an early stage in loading the class. As 12729 a result the class should be used carefully. Note, for example, 12730 that methods and fields are not yet loaded, so queries for methods, 12731 fields, subclasses, and so on will not give correct results. 12732 See "Loading of Classes and Interfaces" in the <i>Java Language 12733 Specification</i>. For most 12734 purposes the <eventlink id="ClassPrepare"></eventlink> event will 12735 be more useful. 12736 </description> 12737 <origin>jvmdi</origin> 12738 <capabilities> 12739 </capabilities> 12740 <parameters> 12741 <param id="jni_env"> 12742 <outptr> 12743 <struct>JNIEnv</struct> 12744 </outptr> 12745 <description> 12746 The JNI environment of the event (current) thread 12747 </description> 12748 </param> 12749 <param id="thread"> 12750 <jthread/> 12751 <description> 12752 Thread loading the class 12753 </description> 12754 </param> 12755 <param id="klass"> 12756 <jclass/> 12757 <description> 12758 Class being loaded 12759 </description> 12760 </param> 12761 </parameters> 12762 </event> 12763 12764 <elide> 12765 <event label="Class Unload" 12766 id="ClassUnload" const="JVMTI_EVENT_CLASS_UNLOAD" num="57"> 12767 <description> 12768 A class unload event is generated when the class is about to be unloaded. 12769 Class unload events take place during garbage collection and must be 12770 handled extremely carefully. The garbage collector holds many locks 12771 and has suspended all other threads, so the event handler cannot depend 12772 on the ability to acquire any locks. The class unload event handler should 12773 do as little as possible, perhaps by queuing information to be processed 12774 later. In particular, the <code>jclass</code> should be used only in 12775 the JNI function <code>isSameObject</code> or in the following <jvmti/> functions: 12776 <ul> 12777 <li><functionlink id="GetClassSignature"></functionlink></li> 12778 <li><functionlink id="GetSourceFileName"></functionlink></li> 12779 <li><functionlink id="IsInterface"></functionlink></li> 12780 <li><functionlink id="IsArrayClass"></functionlink></li> 12781 </ul> 12782 </description> 12783 <origin>jvmdi</origin> 12784 <capabilities> 12785 </capabilities> 12786 <parameters> 12787 <param id="jni_env"> 12788 <outptr> 12789 <struct>JNIEnv</struct> 12790 </outptr> 12791 <description> 12792 The JNI environment of the event (current) thread 12793 </description> 12794 </param> 12795 <param id="thread"> 12796 <jthread/> 12797 <description> 12798 Thread generating the class unload 12799 </description> 12800 </param> 12801 <param id="klass"> 12802 <jclass/> 12803 <description> 12804 Class being unloaded 12805 </description> 12806 </param> 12807 </parameters> 12808 </event> 12809 </elide> 12810 12811 <event label="Class Prepare" 12812 id="ClassPrepare" const="JVMTI_EVENT_CLASS_PREPARE" filtered="thread" phase="start" num="56"> 12813 <description> 12814 A class prepare event is generated when class preparation is complete. 12815 At this point, class fields, methods, and implemented interfaces are 12816 available, and no code from the class has been executed. Since array 12817 classes never have fields or methods, class prepare events are not 12818 generated for them. Class prepare events are not generated for 12819 primitive classes (for example, <code>java.lang.Integer.TYPE</code>). 12820 </description> 12821 <origin>jvmdi</origin> 12822 <capabilities> 12823 </capabilities> 12824 <parameters> 12825 <param id="jni_env"> 12826 <outptr> 12827 <struct>JNIEnv</struct> 12828 </outptr> 12829 <description> 12830 The JNI environment of the event (current) thread 12831 </description> 12832 </param> 12833 <param id="thread"> 12834 <jthread/> 12835 <description> 12836 Thread generating the class prepare 12837 </description> 12838 </param> 12839 <param id="klass"> 12840 <jclass/> 12841 <description> 12842 Class being prepared 12843 </description> 12844 </param> 12845 </parameters> 12846 </event> 12847 12848 <event label="Class File Load Hook" phase="any" 12849 id="ClassFileLoadHook" const="JVMTI_EVENT_CLASS_FILE_LOAD_HOOK" num="54"> 12850 <description> 12851 This event is sent when the VM obtains class file data, 12852 but before it constructs 12853 the in-memory representation for that class. 12854 This event is also sent when the class is being modified by the 12855 <functionlink id="RetransformClasses"/> function or 12856 the <functionlink id="RedefineClasses"/> function, 12857 called in any <jvmti/> environment. 12858 The agent can instrument 12859 the existing class file data sent by the VM to include profiling/debugging hooks. 12860 See the description of 12861 <internallink id="bci">bytecode instrumentation</internallink> 12862 for usage information. 12863 <p/> 12864 When the capabilities 12865 <internallink id="jvmtiCapabilities.can_generate_early_class_hook_events"> 12866 <code>can_generate_early_class_hook_events</code></internallink> and 12867 <internallink id="jvmtiCapabilities.can_generate_all_class_hook_events"> 12868 <code>can_generate_all_class_hook_events</code></internallink> 12869 are enabled then this event may be sent in the primordial phase. 12870 Otherwise, this event may be sent before the VM is initialized (the start 12871 <functionlink id="GetPhase">phase</functionlink>). 12872 Some classes might not be compatible 12873 with the function (eg. ROMized classes or implementation defined classes) and this event will 12874 not be generated for these classes. 12875 <p/> 12876 The agent must allocate the space for the modified 12877 class file data buffer 12878 using the memory allocation function 12879 <functionlink id="Allocate"></functionlink> because the 12880 VM is responsible for freeing the new class file data buffer 12881 using <functionlink id="Deallocate"></functionlink>. 12882 <p/> 12883 If the agent wishes to modify the class file, it must set 12884 <code>new_class_data</code> to point 12885 to the newly instrumented class file data buffer and set 12886 <code>new_class_data_len</code> to the length of that 12887 buffer before returning 12888 from this call. If no modification is desired, the agent simply 12889 does not set <code>new_class_data</code>. If multiple agents 12890 have enabled this event the results are chained. That is, if 12891 <code>new_class_data</code> has been set, it becomes the 12892 <code>class_data</code> for the next agent. 12893 <p/> 12894 When handling a class load in the live phase, then the 12895 <functionlink id="GetNamedModule"></functionlink> 12896 function can be used to map class loader and a package name to a module. 12897 When a class is being redefined or retransformed then 12898 <code>class_being_redefined</code> is non <code>NULL</code> and so 12899 the JNI <code>GetModule</code> function can also be used 12900 to obtain the Module. 12901 <p/> 12902 The order that this event is sent to each environment differs 12903 from other events. 12904 This event is sent to environments in the following order: 12905 <ul> 12906 <li><fieldlink id="can_retransform_classes" 12907 struct="jvmtiCapabilities">retransformation 12908 incapable</fieldlink> 12909 environments, in the 12910 order in which they were created 12911 </li> 12912 <li><fieldlink id="can_retransform_classes" 12913 struct="jvmtiCapabilities">retransformation 12914 capable</fieldlink> 12915 environments, in the 12916 order in which they were created 12917 </li> 12918 </ul> 12919 When triggered by <functionlink id="RetransformClasses"/>, 12920 this event is sent only to <fieldlink id="can_retransform_classes" 12921 struct="jvmtiCapabilities">retransformation 12922 capable</fieldlink> 12923 environments. 12924 </description> 12925 <origin>jvmpi</origin> 12926 <capabilities> 12927 <capability id="can_generate_all_class_hook_events"></capability> 12928 <capability id="can_generate_early_class_hook_events"></capability> 12929 </capabilities> 12930 <parameters> 12931 <param id="jni_env"> 12932 <outptr> 12933 <struct>JNIEnv</struct> 12934 </outptr> 12935 <description> 12936 The JNI environment of the event (current) thread. 12937 </description> 12938 </param> 12939 <param id="class_being_redefined"> 12940 <jclass/> 12941 <description> 12942 The class being 12943 <functionlink id="RedefineClasses">redefined</functionlink> or 12944 <functionlink id="RetransformClasses">retransformed</functionlink>. 12945 <code>NULL</code> if sent by class load. 12946 </description> 12947 </param> 12948 <param id="loader"> 12949 <jobject/> 12950 <description> 12951 The class loader loading the class. 12952 <code>NULL</code> if the bootstrap class loader. 12953 </description> 12954 </param> 12955 <param id="name"> 12956 <vmbuf><char/></vmbuf> 12957 <description> 12958 Name of class being loaded as a VM internal qualified name 12959 (for example, "java/util/List"), encoded as a 12960 <internallink id="mUTF">modified UTF-8</internallink> string. 12961 Note: if the class is defined with a <code>NULL</code> name or 12962 without a name specified, <code>name</code> will be <code>NULL</code>. 12963 </description> 12964 </param> 12965 <param id="protection_domain"> 12966 <jobject/> 12967 <description> 12968 The <code>ProtectionDomain</code> of the class. 12969 </description> 12970 </param> 12971 <param id="class_data_len"> 12972 <jint/> 12973 <description> 12974 Length of current class file data buffer. 12975 </description> 12976 </param> 12977 <param id="class_data"> 12978 <vmbuf><uchar/></vmbuf> 12979 <description> 12980 Pointer to the current class file data buffer. 12981 </description> 12982 </param> 12983 <param id="new_class_data_len"> 12984 <outptr><jint/></outptr> 12985 <description> 12986 Pointer to the length of the new class file data buffer. 12987 </description> 12988 </param> 12989 <param id="new_class_data"> 12990 <agentbuf incount="new_class_data_len"><uchar/></agentbuf> 12991 <description> 12992 Pointer to the pointer to the instrumented class file data buffer. 12993 </description> 12994 </param> 12995 </parameters> 12996 </event> 12997 12998 <event label="VM Start Event" 12999 id="VMStart" const="JVMTI_EVENT_VM_START" num="57" phase="start"> 13000 <description> 13001 The VM start event signals the start of the VM. 13002 At this time JNI is live but the VM is not yet fully initialized. 13003 Once this event is generated, the agent is free to call any JNI function. 13004 This event signals the beginning of the start phase, 13005 <jvmti/> functions permitted in the start phase may be called. 13006 <p/> 13007 The timing of this event may depend on whether the agent has added the 13008 <internallink id="jvmtiCapabilities.can_generate_early_vmstart"> 13009 <code>can_generate_early_vmstart</code></internallink> capability or not. 13010 If the capability has been added then the VM posts the event as early 13011 as possible. The VM is capable of executing bytecode but it may not have 13012 initialized to the point where it can load classes in modules other than 13013 <code>java.base</code>, or even arbitrary classes in <code>java.base</code>. 13014 Agents that do load-time instrumentation in this 13015 phase must take great care when instrumenting code that potentially 13016 executes in this phase. Extreme care should also be taken with JNI 13017 <code>FindClass</code> as it may not be possible to load classes and attempts 13018 to do so may result in unpredictable behavior, maybe even stability issues 13019 on some VM implementations. 13020 If the capability has not been added then the VM delays posting this 13021 event until it is capable of loading classes in modules other than 13022 <code>java.base</code> or the VM has completed its initialization. 13023 Agents that create more than one JVM TI environment, where the 13024 capability is added to some but not all environments, may observe the 13025 start phase beginning earlier in the JVM TI environments that possess 13026 the capability. 13027 <p/> 13028 In the case of VM start-up failure, this event will not be sent. 13029 </description> 13030 <origin>jvmdi</origin> 13031 <capabilities> 13032 </capabilities> 13033 <parameters> 13034 <param id="jni_env"> 13035 <outptr> 13036 <struct>JNIEnv</struct> 13037 </outptr> 13038 <description> 13039 The JNI environment of the event (current) thread. 13040 </description> 13041 </param> 13042 </parameters> 13043 </event> 13044 13045 <event label="VM Initialization Event" 13046 id="VMInit" const="JVMTI_EVENT_VM_INIT" num="50"> 13047 <description> 13048 The VM initialization event signals the completion of VM initialization. Once 13049 this event is generated, the agent is free to call any JNI or <jvmti/> 13050 function. The VM initialization event can be preceded by or can be concurrent 13051 with other events, but 13052 the preceding events should be handled carefully, if at all, because the 13053 VM has not completed its initialization. The thread start event for the 13054 main application thread is guaranteed not to occur until after the 13055 handler for the VM initialization event returns. 13056 <p/> 13057 In the case of VM start-up failure, this event will not be sent. 13058 </description> 13059 <origin>jvmdi</origin> 13060 <capabilities> 13061 </capabilities> 13062 <parameters> 13063 <param id="jni_env"> 13064 <outptr> 13065 <struct>JNIEnv</struct> 13066 </outptr> 13067 <description> 13068 The JNI environment of the event (current) thread. 13069 </description> 13070 </param> 13071 <param id="thread"> 13072 <jthread/> 13073 <description> 13074 The initial thread 13075 </description> 13076 </param> 13077 </parameters> 13078 </event> 13079 13080 <event label="VM Death Event" 13081 id="VMDeath" const="JVMTI_EVENT_VM_DEATH" num="51"> 13082 <description> 13083 The VM death event notifies the agent of the termination of the VM. 13084 No events will occur after the VMDeath event. 13085 <p/> 13086 In the case of VM start-up failure, this event will not be sent. 13087 Note that <internallink id="onunload">Agent_OnUnload</internallink> 13088 will still be called in these cases. 13089 </description> 13090 <origin>jvmdi</origin> 13091 <capabilities> 13092 </capabilities> 13093 <parameters> 13094 <param id="jni_env"> 13095 <outptr> 13096 <struct>JNIEnv</struct> 13097 </outptr> 13098 <description> 13099 The JNI environment of the event (current) thread 13100 </description> 13101 </param> 13102 </parameters> 13103 </event> 13104 13105 <event label="Compiled Method Load" phase="start" 13106 id="CompiledMethodLoad" const="JVMTI_EVENT_COMPILED_METHOD_LOAD" num="68"> 13107 <description> 13108 Sent when a method is compiled and loaded into memory by the VM. 13109 If it is unloaded, the <eventlink id="CompiledMethodUnload"/> event is sent. 13110 If it is moved, the <eventlink id="CompiledMethodUnload"/> event is sent, 13111 followed by a new <code>CompiledMethodLoad</code> event. 13112 Note that a single method may have multiple compiled forms, and that 13113 this event will be sent for each form. 13114 Note also that several methods may be inlined into a single 13115 address range, and that this event will be sent for each method. 13116 <p/> 13117 These events can be sent after their initial occurrence with 13118 <functionlink id="GenerateEvents"></functionlink>. 13119 </description> 13120 <origin>jvmpi</origin> 13121 <typedef id="jvmtiAddrLocationMap" label="Native address to location entry"> 13122 <field id="start_address"> 13123 <vmbuf><void/></vmbuf> 13124 <description> 13125 Starting native address of code corresponding to a location 13126 </description> 13127 </field> 13128 <field id="location"> 13129 <jlocation/> 13130 <description> 13131 Corresponding location. See 13132 <functionlink id="GetJLocationFormat"></functionlink> 13133 for the meaning of location. 13134 </description> 13135 </field> 13136 </typedef> 13137 <capabilities> 13138 <required id="can_generate_compiled_method_load_events"></required> 13139 </capabilities> 13140 <parameters> 13141 <param id="klass"> 13142 <jclass method="method"/> 13143 <description> 13144 Class of the method being compiled and loaded 13145 </description> 13146 </param> 13147 <param id="method"> 13148 <jmethodID class="klass"/> 13149 <description> 13150 Method being compiled and loaded 13151 </description> 13152 </param> 13153 <param id="code_size"> 13154 <jint/> 13155 <description> 13156 Size of compiled code 13157 </description> 13158 </param> 13159 <param id="code_addr"> 13160 <vmbuf><void/></vmbuf> 13161 <description> 13162 Address where compiled method code is loaded 13163 </description> 13164 </param> 13165 <param id="map_length"> 13166 <jint/> 13167 <description> 13168 Number of <typelink id="jvmtiAddrLocationMap"></typelink> 13169 entries in the address map. 13170 Zero if mapping information cannot be supplied. 13171 </description> 13172 </param> 13173 <param id="map"> 13174 <vmbuf><struct>jvmtiAddrLocationMap</struct></vmbuf> 13175 <description> 13176 Map from native addresses to location. 13177 The native address range of each entry is from 13178 <fieldlink id="start_address" struct="jvmtiAddrLocationMap"></fieldlink> 13179 to <code>start_address-1</code> of the next entry. 13180 <code>NULL</code> if mapping information cannot be supplied. 13181 </description> 13182 </param> 13183 <param id="compile_info"> 13184 <vmbuf><void/></vmbuf> 13185 <description> 13186 VM-specific compilation information. 13187 The referenced compile information is managed by the VM 13188 and must not depend on the agent for collection. 13189 A VM implementation defines the content and lifetime 13190 of the information. 13191 </description> 13192 </param> 13193 </parameters> 13194 </event> 13195 13196 <event label="Compiled Method Unload" phase="start" 13197 id="CompiledMethodUnload" const="JVMTI_EVENT_COMPILED_METHOD_UNLOAD" num="69"> 13198 <description> 13199 Sent when a compiled method is unloaded from memory. 13200 This event might not be sent on the thread which performed the unload. 13201 This event may be sent sometime after the unload occurs, but 13202 will be sent before the memory is reused 13203 by a newly generated compiled method. This event may be sent after 13204 the class is unloaded. 13205 </description> 13206 <origin>jvmpi</origin> 13207 <capabilities> 13208 <required id="can_generate_compiled_method_load_events"></required> 13209 </capabilities> 13210 <parameters> 13211 <param id="klass"> 13212 <jclass method="method"/> 13213 <description> 13214 Class of the compiled method being unloaded. 13215 </description> 13216 </param> 13217 <param id="method"> 13218 <jmethodID class="klass"/> 13219 <description> 13220 Compiled method being unloaded. 13221 For identification of the compiled method only -- the class 13222 may be unloaded and therefore the method should not be used 13223 as an argument to further JNI or <jvmti/> functions. 13224 </description> 13225 </param> 13226 <param id="code_addr"> 13227 <vmbuf><void/></vmbuf> 13228 <description> 13229 Address where compiled method code was loaded. 13230 For identification of the compiled method only -- 13231 the space may have been reclaimed. 13232 </description> 13233 </param> 13234 </parameters> 13235 </event> 13236 13237 <event label="Dynamic Code Generated" phase="any" 13238 id="DynamicCodeGenerated" const="JVMTI_EVENT_DYNAMIC_CODE_GENERATED" num="70"> 13239 <description> 13240 Sent when a component of the virtual machine is generated dynamically. 13241 This does not correspond to Java programming language code that is 13242 compiled--see <eventlink id="CompiledMethodLoad"></eventlink>. 13243 This is for native code--for example, an interpreter that is generated 13244 differently depending on command-line options. 13245 <p/> 13246 Note that this event has no controlling capability. 13247 If a VM cannot generate these events, it simply does not send any. 13248 <p/> 13249 These events can be sent after their initial occurrence with 13250 <functionlink id="GenerateEvents"></functionlink>. 13251 </description> 13252 <origin>jvmpi</origin> 13253 <capabilities> 13254 </capabilities> 13255 <parameters> 13256 <param id="name"> 13257 <vmbuf><char/></vmbuf> 13258 <description> 13259 Name of the code, encoded as a 13260 <internallink id="mUTF">modified UTF-8</internallink> string. 13261 Intended for display to an end-user. 13262 The name might not be unique. 13263 </description> 13264 </param> 13265 <param id="address"> 13266 <vmbuf><void/></vmbuf> 13267 <description> 13268 Native address of the code 13269 </description> 13270 </param> 13271 <param id="length"> 13272 <jint/> 13273 <description> 13274 Length in bytes of the code 13275 </description> 13276 </param> 13277 </parameters> 13278 </event> 13279 13280 <event label="Data Dump Request" 13281 id="DataDumpRequest" const="JVMTI_EVENT_DATA_DUMP_REQUEST" num="71"> 13282 <description> 13283 Sent by the VM to request the agent to dump its data. This 13284 is just a hint and the agent need not react to this event. 13285 This is useful for processing command-line signals from users. For 13286 example, in the Java 2 SDK a CTRL-Break on Win32 and a CTRL-\ on Solaris 13287 causes the VM to send this event to the agent. 13288 </description> 13289 <origin>jvmpi</origin> 13290 <capabilities> 13291 </capabilities> 13292 <parameters> 13293 </parameters> 13294 </event> 13295 13296 <event label="Monitor Contended Enter" 13297 id="MonitorContendedEnter" const="JVMTI_EVENT_MONITOR_CONTENDED_ENTER" filtered="thread" num="75"> 13298 <description> 13299 Sent when a thread is attempting to enter a Java programming language 13300 monitor already acquired by another thread. 13301 </description> 13302 <origin>jvmpi</origin> 13303 <capabilities> 13304 <required id="can_generate_monitor_events"></required> 13305 </capabilities> 13306 <parameters> 13307 <param id="jni_env"> 13308 <outptr> 13309 <struct>JNIEnv</struct> 13310 </outptr> 13311 <description> 13312 The JNI environment of the event (current) thread 13313 </description> 13314 </param> 13315 <param id="thread"> 13316 <jthread/> 13317 <description> 13318 JNI local reference to the thread 13319 attempting to enter the monitor 13320 </description> 13321 </param> 13322 <param id="object"> 13323 <jobject/> 13324 <description> 13325 JNI local reference to the monitor 13326 </description> 13327 </param> 13328 </parameters> 13329 </event> 13330 13331 <event label="Monitor Contended Entered" 13332 id="MonitorContendedEntered" const="JVMTI_EVENT_MONITOR_CONTENDED_ENTERED" filtered="thread" num="76"> 13333 <description> 13334 Sent when a thread enters a Java programming language 13335 monitor after waiting for it to be released by another thread. 13336 </description> 13337 <origin>jvmpi</origin> 13338 <capabilities> 13339 <required id="can_generate_monitor_events"></required> 13340 </capabilities> 13341 <parameters> 13342 <param id="jni_env"> 13343 <outptr> 13344 <struct>JNIEnv</struct> 13345 </outptr> 13346 <description> 13347 The JNI environment of the event (current) thread 13348 </description> 13349 </param> 13350 <param id="thread"> 13351 <jthread/> 13352 <description> 13353 JNI local reference to the thread entering 13354 the monitor 13355 </description> 13356 </param> 13357 <param id="object"> 13358 <jobject/> 13359 <description> 13360 JNI local reference to the monitor 13361 </description> 13362 </param> 13363 </parameters> 13364 </event> 13365 13366 <event label="Monitor Wait" 13367 id="MonitorWait" const="JVMTI_EVENT_MONITOR_WAIT" filtered="thread" num="73"> 13368 <description> 13369 Sent when a thread is about to wait on an object. 13370 </description> 13371 <origin>jvmpi</origin> 13372 <capabilities> 13373 <required id="can_generate_monitor_events"></required> 13374 </capabilities> 13375 <parameters> 13376 <param id="jni_env"> 13377 <outptr> 13378 <struct>JNIEnv</struct> 13379 </outptr> 13380 <description> 13381 The JNI environment of the event (current) thread 13382 </description> 13383 </param> 13384 <param id="thread"> 13385 <jthread/> 13386 <description> 13387 JNI local reference to the thread about to wait 13388 </description> 13389 </param> 13390 <param id="object"> 13391 <jobject/> 13392 <description> 13393 JNI local reference to the monitor 13394 </description> 13395 </param> 13396 <param id="timeout"> 13397 <jlong/> 13398 <description> 13399 The number of milliseconds the thread will wait 13400 </description> 13401 </param> 13402 </parameters> 13403 </event> 13404 13405 <event label="Monitor Waited" 13406 id="MonitorWaited" const="JVMTI_EVENT_MONITOR_WAITED" filtered="thread" num="74"> 13407 <description> 13408 Sent when a thread finishes waiting on an object. 13409 </description> 13410 <origin>jvmpi</origin> 13411 <capabilities> 13412 <required id="can_generate_monitor_events"></required> 13413 </capabilities> 13414 <parameters> 13415 <param id="jni_env"> 13416 <outptr> 13417 <struct>JNIEnv</struct> 13418 </outptr> 13419 <description> 13420 The JNI environment of the event (current) thread 13421 </description> 13422 </param> 13423 <param id="thread"> 13424 <jthread/> 13425 <description> 13426 JNI local reference to the thread that was finished waiting 13427 </description> 13428 </param> 13429 <param id="object"> 13430 <jobject/> 13431 <description> 13432 JNI local reference to the monitor. 13433 </description> 13434 </param> 13435 <param id="timed_out"> 13436 <jboolean/> 13437 <description> 13438 True if the monitor timed out 13439 </description> 13440 </param> 13441 </parameters> 13442 </event> 13443 13444 <event label="Resource Exhausted" 13445 id="ResourceExhausted" const="JVMTI_EVENT_RESOURCE_EXHAUSTED" num="80" 13446 since="1.1"> 13447 <description> 13448 Sent when a VM resource needed by a running application has been exhausted. 13449 Except as required by the optional capabilities, the set of resources 13450 which report exhaustion is implementation dependent. 13451 <p/> 13452 The following bit flags define the properties of the resource exhaustion: 13453 <constants id="jvmtiResourceExhaustionFlags" 13454 label="Resource Exhaustion Flags" 13455 kind="bits" 13456 since="1.1"> 13457 <constant id="JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR" num="0x0001"> 13458 After this event returns, the VM will throw a 13459 <code>java.lang.OutOfMemoryError</code>. 13460 </constant> 13461 <constant id="JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP" num="0x0002"> 13462 The VM was unable to allocate memory from the <tm>Java</tm> 13463 platform <i>heap</i>. 13464 The <i>heap</i> is the runtime 13465 data area from which memory for all class instances and 13466 arrays are allocated. 13467 </constant> 13468 <constant id="JVMTI_RESOURCE_EXHAUSTED_THREADS" num="0x0004"> 13469 The VM was unable to create a thread. 13470 </constant> 13471 </constants> 13472 </description> 13473 <origin>new</origin> 13474 <capabilities> 13475 <capability id="can_generate_resource_exhaustion_heap_events"> 13476 Can generate events when the VM is unable to allocate memory from the 13477 <internallink id="JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP">heap</internallink>. 13478 </capability> 13479 <capability id="can_generate_resource_exhaustion_threads_events"> 13480 Can generate events when the VM is unable to 13481 <internallink id="JVMTI_RESOURCE_EXHAUSTED_THREADS">create 13482 a thread</internallink>. 13483 </capability> 13484 </capabilities> 13485 <parameters> 13486 <param id="jni_env"> 13487 <outptr> 13488 <struct>JNIEnv</struct> 13489 </outptr> 13490 <description> 13491 The JNI environment of the event (current) thread 13492 </description> 13493 </param> 13494 <param id="flags"> 13495 <jint/> 13496 <description> 13497 Flags defining the properties of the of resource exhaustion 13498 as specified by the 13499 <internallink id="jvmtiResourceExhaustionFlags">Resource 13500 Exhaustion Flags</internallink>. 13501 </description> 13502 </param> 13503 <param id="reserved"> 13504 <vmbuf><void/></vmbuf> 13505 <description> 13506 Reserved. 13507 </description> 13508 </param> 13509 <param id="description"> 13510 <vmbuf><char/></vmbuf> 13511 <description> 13512 Description of the resource exhaustion, encoded as a 13513 <internallink id="mUTF">modified UTF-8</internallink> string. 13514 </description> 13515 </param> 13516 </parameters> 13517 </event> 13518 13519 <event label="VM Object Allocation" 13520 id="VMObjectAlloc" const="JVMTI_EVENT_VM_OBJECT_ALLOC" num="84"> 13521 <description> 13522 Sent when a method causes the virtual machine to directly allocate an 13523 Object visible to Java programming language code. 13524 Generally object allocation should be detected by instrumenting 13525 the bytecodes of allocating methods. 13526 Object allocation generated in native code by JNI function 13527 calls should be detected using 13528 <internallink id="jniIntercept">JNI function interception</internallink>. 13529 Some methods might not have associated bytecodes and are not 13530 native methods, they instead are executed directly by the 13531 VM. These methods should send this event. 13532 Virtual machines which are incapable of bytecode instrumentation 13533 for some or all of their methods can send this event. 13534 13535 Note that the <internallink 13536 id="SampledObjectAlloc">SampledObjectAlloc</internallink> 13537 event is triggered on all Java object allocations, including those 13538 caused by bytecode method execution, JNI method execution, and 13539 directly by VM methods. 13540 <p/> 13541 Typical examples where this event might be sent: 13542 <ul> 13543 <li>Reflection -- for example, <code>java.lang.Class.newInstance()</code></li> 13544 <li>Methods not represented by bytecodes -- for example, VM intrinsics and 13545 J2ME preloaded classes</li> 13546 </ul> 13547 Cases where this event would not be generated: 13548 <ul> 13549 <li>Allocation due to bytecodes -- for example, the <code>new</code> 13550 and <code>newarray</code> VM instructions</li> 13551 <li>Allocation due to JNI function calls -- for example, 13552 <code>AllocObject</code></li> 13553 <li>Allocations during VM initialization</li> 13554 <li>VM internal objects</li> 13555 </ul> 13556 </description> 13557 <origin>new</origin> 13558 <capabilities> 13559 <required id="can_generate_vm_object_alloc_events"></required> 13560 </capabilities> 13561 <parameters> 13562 <param id="jni_env"> 13563 <outptr> 13564 <struct>JNIEnv</struct> 13565 </outptr> 13566 <description> 13567 The JNI environment of the event (current) thread 13568 </description> 13569 </param> 13570 <param id="thread"> 13571 <jthread/> 13572 <description> 13573 Thread allocating the object. 13574 </description> 13575 </param> 13576 <param id="object"> 13577 <jobject/> 13578 <description> 13579 JNI local reference to the object that was allocated. 13580 </description> 13581 </param> 13582 <param id="object_klass"> 13583 <jclass/> 13584 <description> 13585 JNI local reference to the class of the object. 13586 </description> 13587 </param> 13588 <param id="size"> 13589 <jlong/> 13590 <description> 13591 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 13592 </description> 13593 </param> 13594 </parameters> 13595 </event> 13596 13597 <event label="Sampled Object Allocation" 13598 id="SampledObjectAlloc" const="JVMTI_EVENT_SAMPLED_OBJECT_ALLOC" num="86" since="11"> 13599 <description> 13600 Sent when an allocated object is sampled. 13601 By default, the sampling interval is set to 512KB. The sampling is semi-random to avoid 13602 pattern-based bias and provides an approximate overall average interval over long periods of 13603 sampling. 13604 <p/> 13605 Each thread tracks how many bytes it has allocated since it sent the last event. 13606 When the number of bytes exceeds the sampling interval, it will send another event. 13607 This implies that, on average, one object will be sampled every time a thread has 13608 allocated 512KB bytes since the last sample. 13609 <p/> 13610 Note that the sampler is pseudo-random: it will not sample every 512KB precisely. 13611 The goal of this is to ensure high quality sampling even if allocation is 13612 happening in a fixed pattern (i.e., the same set of objects are being allocated 13613 every 512KB). 13614 <p/> 13615 If another sampling interval is required, the user can call 13616 <functionlink id="SetHeapSamplingInterval"></functionlink> with a strictly positive integer value, 13617 representing the new sampling interval. 13618 <p/> 13619 This event is sent once the sampled allocation has been performed. It provides the object, stack trace 13620 of the allocation, the thread allocating, the size of allocation, and the object's class. 13621 <p/> 13622 A typical use case of this system is to determine where heap allocations originate. 13623 In conjunction with weak references and the function 13624 <functionlink id="GetStackTrace"></functionlink>, a user can track which objects were allocated from which 13625 stack trace, and which are still live during the execution of the program. 13626 </description> 13627 <origin>new</origin> 13628 <capabilities> 13629 <required id="can_generate_sampled_object_alloc_events"></required> 13630 </capabilities> 13631 <parameters> 13632 <param id="jni_env"> 13633 <outptr> 13634 <struct>JNIEnv</struct> 13635 </outptr> 13636 <description> 13637 The JNI environment of the event (current) thread. 13638 </description> 13639 </param> 13640 <param id="thread"> 13641 <jthread/> 13642 <description> 13643 Thread allocating the object. 13644 </description> 13645 </param> 13646 <param id="object"> 13647 <jobject/> 13648 <description> 13649 JNI local reference to the object that was allocated. 13650 </description> 13651 </param> 13652 <param id="object_klass"> 13653 <jclass/> 13654 <description> 13655 JNI local reference to the class of the object 13656 </description> 13657 </param> 13658 <param id="size"> 13659 <jlong/> 13660 <description> 13661 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 13662 </description> 13663 </param> 13664 </parameters> 13665 </event> 13666 13667 <event label="Object Free" 13668 id="ObjectFree" const="JVMTI_EVENT_OBJECT_FREE" num="83"> 13669 <description> 13670 An Object Free event is sent when the garbage collector frees an object. 13671 Events are only sent for tagged objects--see 13672 <internallink id="Heap">heap functions</internallink>. 13673 <p/> 13674 The event handler must not use JNI functions and 13675 must not use <jvmti/> functions except those which 13676 specifically allow such use (see the raw monitor, memory management, 13677 and environment local storage functions). 13678 </description> 13679 <origin>new</origin> 13680 <capabilities> 13681 <required id="can_generate_object_free_events"></required> 13682 </capabilities> 13683 <parameters> 13684 <param id="tag"> 13685 <jlong/> 13686 <description> 13687 The freed object's tag 13688 </description> 13689 </param> 13690 </parameters> 13691 </event> 13692 13693 <event label="Garbage Collection Start" 13694 id="GarbageCollectionStart" const="JVMTI_EVENT_GARBAGE_COLLECTION_START" num="81"> 13695 <description> 13696 A Garbage Collection Start event is sent when a 13697 garbage collection pause begins. 13698 Only stop-the-world collections are reported--that is, collections during 13699 which all threads cease to modify the state of the Java virtual machine. 13700 This means that some collectors will never generate these events. 13701 This event is sent while the VM is still stopped, thus 13702 the event handler must not use JNI functions and 13703 must not use <jvmti/> functions except those which 13704 specifically allow such use (see the raw monitor, memory management, 13705 and environment local storage functions). 13706 <p/> 13707 This event is always sent as a matched pair with 13708 <eventlink id="GarbageCollectionFinish"/> 13709 (assuming both events are enabled) and no garbage collection 13710 events will occur between them. 13711 </description> 13712 <origin>new</origin> 13713 <capabilities> 13714 <required id="can_generate_garbage_collection_events"></required> 13715 </capabilities> 13716 <parameters> 13717 </parameters> 13718 </event> 13719 13720 <event label="Garbage Collection Finish" 13721 id="GarbageCollectionFinish" const="JVMTI_EVENT_GARBAGE_COLLECTION_FINISH" num="82"> 13722 <description> 13723 A Garbage Collection Finish event is sent when a 13724 garbage collection pause ends. 13725 This event is sent while the VM is still stopped, thus 13726 the event handler must not use JNI functions and 13727 must not use <jvmti/> functions except those which 13728 specifically allow such use (see the raw monitor, memory management, 13729 and environment local storage functions). 13730 <p/> 13731 Some agents may need to do post garbage collection operations that 13732 require the use of the disallowed <jvmti/> or JNI functions. For these 13733 cases an agent thread can be created which waits on a raw monitor, 13734 and the handler for the Garbage Collection Finish event simply 13735 notifies the raw monitor 13736 <p/> 13737 This event is always sent as a matched pair with 13738 <eventlink id="GarbageCollectionStart"/> (assuming both events are enabled). 13739 <issue> 13740 The most important use of this event is to provide timing information, 13741 and thus additional information is not required. However, 13742 information about the collection which is "free" should be included - 13743 what that information is needs to be determined. 13744 </issue> 13745 </description> 13746 <origin>new</origin> 13747 <capabilities> 13748 <required id="can_generate_garbage_collection_events"></required> 13749 </capabilities> 13750 <parameters> 13751 </parameters> 13752 </event> 13753 13754 <elide> 13755 <event label="Verbose Output" phase="any" 13756 id="VerboseOutput" const="JVMTI_EVENT_VERBOSE_OUTPUT" num="85"> 13757 <description> 13758 Send verbose messages as strings. 13759 <issue> 13760 This format is extremely fragile, as it can change with each 13761 platform, collector and version. Alternatives include: 13762 <ul> 13763 <li>building off Java programming language M and M APIs</li> 13764 <li>XML</li> 13765 <li>key/value pairs</li> 13766 <li>removing it</li> 13767 </ul> 13768 </issue> 13769 <issue> 13770 Though this seemed trivial to implement. 13771 In the RI it appears this will be quite complex. 13772 </issue> 13773 </description> 13774 <origin>new</origin> 13775 <capabilities> 13776 </capabilities> 13777 <parameters> 13778 <param id="flag"> 13779 <enum>jvmtiVerboseFlag</enum> 13780 <description> 13781 Which verbose output is being sent. 13782 </description> 13783 </param> 13784 <param id="message"> 13785 <vmbuf><char/></vmbuf> 13786 <description> 13787 Message text, encoded as a 13788 <internallink id="mUTF">modified UTF-8</internallink> string. 13789 </description> 13790 </param> 13791 </parameters> 13792 </event> 13793 </elide> 13794 13795 </eventsection> 13796 13797 <datasection> 13798 <intro> 13799 <jvmti/> extends the data types defined by JNI. 13800 </intro> 13801 <basetypes id="jniTypes" label="JNI Types Used in the JVM Tool Interface"> 13802 <basetype id="jboolean"> 13803 <description> 13804 Holds a Java programming language <code>boolean</code>. 13805 Unsigned 8 bits. 13806 </description> 13807 </basetype> 13808 <basetype id="jchar"> 13809 <description> 13810 Holds a Java programming language <code>char</code>. 13811 Unsigned 16 bits. 13812 </description> 13813 </basetype> 13814 <basetype id="jint"> 13815 <description> 13816 Holds a Java programming language <code>int</code>. 13817 Signed 32 bits. 13818 </description> 13819 </basetype> 13820 <basetype id="jlong"> 13821 <description> 13822 Holds a Java programming language <code>long</code>. 13823 Signed 64 bits. 13824 </description> 13825 </basetype> 13826 <basetype id="jfloat"> 13827 <description> 13828 Holds a Java programming language <code>float</code>. 13829 32 bits. 13830 </description> 13831 </basetype> 13832 <basetype id="jdouble"> 13833 <description> 13834 Holds a Java programming language <code>double</code>. 13835 64 bits. 13836 </description> 13837 </basetype> 13838 <basetype id="jobject"> 13839 <description> 13840 Holds a Java programming language object. 13841 </description> 13842 </basetype> 13843 <basetype id="jclass"> 13844 <description> 13845 Holds a Java programming language class. 13846 </description> 13847 </basetype> 13848 <basetype id="jvalue"> 13849 <description> 13850 Is a union of all primitive types and <code>jobject</code>. Thus, holds any Java 13851 programming language value. 13852 </description> 13853 </basetype> 13854 <basetype id="jfieldID"> 13855 <description> 13856 Identifies a Java programming language field. 13857 <code>jfieldID</code>s returned by <jvmti/> functions and events may be 13858 safely stored. 13859 </description> 13860 </basetype> 13861 <basetype id="jmethodID"> 13862 <description> 13863 Identifies a Java programming language method, initializer, or constructor. 13864 <code>jmethodID</code>s returned by <jvmti/> functions and events may be 13865 safely stored. However, if the class is unloaded, they become invalid 13866 and must not be used. 13867 </description> 13868 </basetype> 13869 <basetype id="JNIEnv"> 13870 <description> 13871 Pointer to the JNI function table. Pointer to this (<code>JNIEnv *</code>) 13872 is a JNI environment. 13873 </description> 13874 </basetype> 13875 </basetypes> 13876 13877 <basetypes id="jvmtiTypes" label="JVM Tool Interface Base Types"> 13878 <basetype id="jvmtiEnv"> 13879 <description> 13880 The <jvmti/> <internallink id="environments">environment</internallink> pointer. 13881 See the <internallink id="FunctionSection">Function Section</internallink>. 13882 <code>jvmtiEnv</code> points to the 13883 <internallink id="FunctionTable">function table</internallink> pointer. 13884 </description> 13885 </basetype> 13886 <basetype id="jthread"> 13887 <definition>typedef jobject jthread;</definition> 13888 <description> 13889 Subtype of <datalink id="jobject"></datalink> that holds a thread. 13890 </description> 13891 </basetype> 13892 <basetype id="jthreadGroup"> 13893 <definition>typedef jobject jthreadGroup;</definition> 13894 <description> 13895 Subtype of <datalink id="jobject"></datalink> that holds a thread group. 13896 </description> 13897 </basetype> 13898 <basetype id="jlocation"> 13899 <definition>typedef jlong jlocation;</definition> 13900 <description> 13901 A 64 bit value, representing a monotonically increasing 13902 executable position within a method. 13903 <code>-1</code> indicates a native method. 13904 See <functionlink id="GetJLocationFormat"></functionlink> for the format on a 13905 given VM. 13906 </description> 13907 </basetype> 13908 <basetype id="jrawMonitorID"> 13909 <definition>struct _jrawMonitorID; 13910 typedef struct _jrawMonitorID *jrawMonitorID;</definition> 13911 <description> 13912 A raw monitor. 13913 </description> 13914 </basetype> 13915 <basetype id="jvmtiError"> 13916 <description> 13917 Holds an error return code. 13918 See the <internallink id="ErrorSection">Error section</internallink> for possible values. 13919 <example> 13920 typedef enum { 13921 JVMTI_ERROR_NONE = 0, 13922 JVMTI_ERROR_INVALID_THREAD = 10, 13923 ... 13924 } jvmtiError; 13925 </example> 13926 </description> 13927 </basetype> 13928 <basetype id="jvmtiEvent"> 13929 <description> 13930 An identifier for an event type. 13931 See the <internallink id="EventSection">Event section</internallink> for possible values. 13932 It is guaranteed that future versions of this specification will 13933 never assign zero as an event type identifier. 13934 <example> 13935 typedef enum { 13936 JVMTI_EVENT_SINGLE_STEP = 1, 13937 JVMTI_EVENT_BREAKPOINT = 2, 13938 ... 13939 } jvmtiEvent; 13940 </example> 13941 </description> 13942 </basetype> 13943 <basetype id="jvmtiEventCallbacks" name="eventCallbacks"> 13944 <description> 13945 The callbacks used for events. 13946 <example> 13947 typedef struct { 13948 jvmtiEventVMInit VMInit; 13949 jvmtiEventVMDeath VMDeath; 13950 ... 13951 } jvmtiEventCallbacks; 13952 </example> 13953 See <internallink id="jvmtiEventCallbacks">event callbacks</internallink> 13954 for the complete structure. 13955 <p/> 13956 Where, for example, the VM initialization callback is defined: 13957 <example> 13958 typedef void (JNICALL *jvmtiEventVMInit) 13959 (jvmtiEnv *jvmti_env, 13960 JNIEnv* jni_env, 13961 jthread thread); 13962 </example> 13963 See the individual events for the callback function definition. 13964 </description> 13965 </basetype> 13966 <basetype id="jniNativeInterface"> 13967 <definition>typedef struct JNINativeInterface_ jniNativeInterface;</definition> 13968 <description> 13969 Typedef for the JNI function table <code>JNINativeInterface</code> 13970 defined in the 13971 <externallink id="jni/functions.html#interface-function-table"> 13972 JNI Specification</externallink>. 13973 The JNI reference implementation defines this with an underscore. 13974 </description> 13975 </basetype> 13976 </basetypes> 13977 13978 </datasection> 13979 13980 <issuessection label="Issues"> 13981 <intro id="suspendRequired" label="Resolved Issue: Suspend - Required or Automatic"> 13982 JVMDI requires that the agent suspend threads before calling 13983 certain sensitive functions. JVMPI requires garbage collection to be 13984 disabled before calling certain sensitive functions. 13985 It was suggested that rather than have this requirement, that 13986 VM place itself in a suitable state before performing an 13987 operation. This makes considerable sense since each VM 13988 knows its requirements and can most easily arrange a 13989 safe state. 13990 <p/> 13991 The ability to externally suspend/resume threads will, of 13992 course, remain. The ability to enable/disable garbage collection will not. 13993 <p/> 13994 This issue is resolved--suspend will not 13995 be required. The spec has been updated to reflect this. 13996 </intro> 13997 13998 <intro id="stackSampling" label="Resolved Issue: Call Stack Sampling"> 13999 There are a variety of approaches to sampling call stacks. 14000 The biggest bifurcation is between VM controlled and agent 14001 controlled. 14002 <p/> 14003 This issue is resolved--agent controlled 14004 sampling will be the approach. 14005 </intro> 14006 14007 <intro id="threadRepresentation" label="Resolved Issue: Thread Representation"> 14008 JVMDI represents threads as jthread. JVMPI primarily 14009 uses JNIEnv* to represent threads. 14010 <p/> 14011 The Expert Group has chosen jthread as the representation 14012 for threads in <jvmti/>. 14013 JNIEnv* is sent by 14014 events since it is needed to JNI functions. JNIEnv, per the 14015 JNI spec, are not supposed to be used outside their thread. 14016 </intro> 14017 14018 <intro id="design" label="Resolved Issue: Method Representation"> 14019 The JNI spec allows an implementation to depend on jclass/jmethodID 14020 pairs, rather than simply a jmethodID, to reference a method. 14021 JVMDI, for consistency, choose the same representation. 14022 JVMPI, however, specifies that a jmethodID alone maps to a 14023 method. Both of the Sun <tm>J2SE</tm> virtual machines (Classic and <tm>HotSpot</tm>) store 14024 pointers in jmethodIDs, and as a result, a jmethodID is sufficient. 14025 In fact, any JVM implementation that supports JVMPI must have 14026 such a representation. 14027 <jvmti/> will use jmethodID as a unique representation of a method 14028 (no jclass is used). 14029 There should be efficiency gains, particularly in 14030 functionality like stack dumping, to this representation. 14031 <p/> 14032 Note that fields were not used in JVMPI and that the access profile 14033 of fields differs from methods--for implementation efficiency 14034 reasons, a jclass/jfieldID pair will still be needed for field 14035 reference. 14036 </intro> 14037 14038 <intro id="localReferenceIssue" label="Resolved Issue: Local References"> 14039 Functions return local references. 14040 </intro> 14041 14042 <intro id="frameRep" label="Resolved Issue: Representation of frames"> 14043 In JVMDI, a frame ID is used to represent a frame. Problem with this 14044 is that a VM must track when a frame becomes invalid, a far better 14045 approach, and the one used in <jvmti/>, is to reference frames by depth. 14046 </intro> 14047 14048 <intro id="requiredCapabilities" label="Issue: Required Capabilities"> 14049 Currently, having a required capabilities means that the functionality 14050 is optional. Capabilities are useful even for required functionality 14051 since they can inform the VM is needed set-up. Thus, there should be 14052 a set of capabilities that a conformant implementation must provide 14053 (if requested during Agent_OnLoad). 14054 </intro> 14055 14056 <intro id="taghint" label="Proposal: add tag hint function"> 14057 A hint of the percentage of objects that will be tagged would 14058 help the VM pick a good implementation. 14059 </intro> 14060 14061 <intro id="moreMonitorQueries" label="Request: More Monitor Quires"> 14062 How difficult or easy would be to extend the monitor_info category to include 14063 <pre> 14064 - current number of monitors 14065 - enumeration of monitors 14066 - enumeration of threads waiting on a given monitor 14067 </pre> 14068 The reason for my question is the fact that current get_monitor_info support 14069 requires the agent to specify a given thread to get the info which is probably 14070 OK in the profiling/debugging space, while in the monitoring space the agent 14071 could be watching the monitor list and then decide which thread to ask for 14072 the info. You might ask why is this important for monitoring .... I think it 14073 can aid in the detection/prediction of application contention caused by hot-locks. 14074 </intro> 14075 </issuessection> 14076 14077 <changehistory id="ChangeHistory" update="09/05/07"> 14078 <intro> 14079 The <jvmti/> specification is an evolving document with major, minor, 14080 and micro version numbers. 14081 A released version of the specification is uniquely identified 14082 by its major and minor version. 14083 The functions, events, and capabilities in this specification 14084 indicate a "Since" value which is the major and minor version in 14085 which it was introduced. 14086 The version of the specification implemented by the VM can 14087 be retrieved at runtime with the <functionlink id="GetVersionNumber"/> 14088 function. 14089 </intro> 14090 <change date="14 Nov 2002"> 14091 Converted to XML document. 14092 </change> 14093 <change date="14 Nov 2002"> 14094 Elided heap dump functions (for now) since what was there 14095 was wrong. 14096 </change> 14097 <change date="18 Nov 2002"> 14098 Added detail throughout. 14099 </change> 14100 <change date="18 Nov 2002"> 14101 Changed JVMTI_THREAD_STATUS_RUNNING to JVMTI_THREAD_STATUS_RUNNABLE. 14102 </change> 14103 <change date="19 Nov 2002"> 14104 Added AsyncGetStackTrace. 14105 </change> 14106 <change date="19 Nov 2002"> 14107 Added jframeID return to GetStackTrace. 14108 </change> 14109 <change date="19 Nov 2002"> 14110 Elided GetCurrentFrame and GetCallingFrame functions (for now) since what was there 14111 since they are redundant with GetStackTrace. 14112 </change> 14113 <change date="19 Nov 2002"> 14114 Elided ClearAllBreakpoints since it has always been redundant. 14115 </change> 14116 <change date="19 Nov 2002"> 14117 Added GetSystemProperties. 14118 </change> 14119 <change date="19 Nov 2002"> 14120 Changed the thread local storage functions to use jthread. 14121 </change> 14122 <change date="20 Nov 2002"> 14123 Added GetJLocationFormat. 14124 </change> 14125 <change date="22 Nov 2002"> 14126 Added events and introductory text. 14127 </change> 14128 <change date="22 Nov 2002"> 14129 Cross reference type and constant definitions. 14130 </change> 14131 <change date="24 Nov 2002"> 14132 Added DTD. 14133 </change> 14134 <change date="24 Nov 2002"> 14135 Added capabilities function section. 14136 </change> 14137 <change date="29 Nov 2002"> 14138 Assign capabilities to each function and event. 14139 </change> 14140 <change date="29 Nov 2002"> 14141 Add <internallink id="jniIntercept">JNI interception functions</internallink>. 14142 </change> 14143 <change date="30 Nov 2002"> 14144 Auto generate SetEventNotificationMode capabilities. 14145 </change> 14146 <change date="30 Nov 2002"> 14147 Add <eventlink id="VMObjectAlloc"></eventlink> event. 14148 </change> 14149 <change date="30 Nov 2002"> 14150 Add <eventlink id="DynamicCodeGenerated"></eventlink> event. 14151 </change> 14152 <change date="30 Nov 2002"> 14153 Add const to declarations. 14154 </change> 14155 <change date="30 Nov 2002"> 14156 Change method exit and frame pop to send on exception. 14157 </change> 14158 <change date="1 Dec 2002"> 14159 Add ForceGarbageCollection. 14160 </change> 14161 <change date="2 Dec 2002"> 14162 Redo Xrun section; clarify GetStackTrace and add example; 14163 Fix width problems; use "agent" consistently. 14164 </change> 14165 <change date="8 Dec 2002"> 14166 Remove previous start-up intro. 14167 Add <internallink id="environments"><jvmti/> Environments</internallink> 14168 section. 14169 </change> 14170 <change date="8 Dec 2002"> 14171 Add <functionlink id="DisposeEnvironment"></functionlink>. 14172 </change> 14173 <change date="9 Dec 2002"> 14174 Numerous minor updates. 14175 </change> 14176 <change date="15 Dec 2002"> 14177 Add heap profiling functions added: 14178 get/set annotation, iterate live objects/heap. 14179 Add heap profiling functions place holder added: 14180 heap roots. 14181 Heap profiling event added: object free. 14182 Heap profiling event redesigned: vm object allocation. 14183 Heap profiling event placeholders added: garbage collection start/finish. 14184 Native method bind event added. 14185 </change> 14186 <change date="19 Dec 2002"> 14187 Revamp suspend/resume functions. 14188 Add origin information with jvmdi tag. 14189 Misc fixes. 14190 </change> 14191 <change date="24 Dec 2002"> 14192 Add semantics to types. 14193 </change> 14194 <change date="27 Dec 2002"> 14195 Add local reference section. 14196 Autogenerate parameter descriptions from types. 14197 </change> 14198 <change date="28 Dec 2002"> 14199 Document that RunAgentThread sends threadStart. 14200 </change> 14201 <change date="29 Dec 2002"> 14202 Remove redundant local ref and dealloc warning. 14203 Convert GetRawMonitorName to allocated buffer. 14204 Add GenerateEvents. 14205 </change> 14206 <change date="30 Dec 2002"> 14207 Make raw monitors a type and rename to "jrawMonitorID". 14208 </change> 14209 <change date="1 Jan 2003"> 14210 Include origin information. 14211 Clean-up JVMDI issue references. 14212 Remove Deallocate warnings which are now automatically generated. 14213 </change> 14214 <change date="2 Jan 2003"> 14215 Fix representation issues for jthread. 14216 </change> 14217 <change date="3 Jan 2003"> 14218 Make capabilities buffered out to 64 bits - and do it automatically. 14219 </change> 14220 <change date="4 Jan 2003"> 14221 Make constants which are enumeration into enum types. 14222 Parameters now of enum type. 14223 Clean-up and index type section. 14224 Replace remaining datadef entities with callback. 14225 </change> 14226 <change date="7 Jan 2003"> 14227 Correct GenerateEvents description. 14228 More internal semantics work. 14229 </change> 14230 <change date="9 Jan 2003"> 14231 Replace previous GetSystemProperties with two functions 14232 which use allocated information instead fixed. 14233 Add SetSystemProperty. 14234 More internal semantics work. 14235 </change> 14236 <change date="12 Jan 2003"> 14237 Add varargs to end of SetEventNotificationMode. 14238 </change> 14239 <change date="20 Jan 2003"> 14240 Finish fixing spec to reflect that alloc sizes are jlong. 14241 </change> 14242 <change date="22 Jan 2003"> 14243 Allow NULL as RunAgentThread arg. 14244 </change> 14245 <change date="22 Jan 2003"> 14246 Fixed names to standardized naming convention 14247 Removed AsyncGetStackTrace. 14248 </change> 14249 <change date="29 Jan 2003"> 14250 Since we are using jthread, removed GetThread. 14251 </change> 14252 <change date="31 Jan 2003"> 14253 Change GetFieldName to allow NULLs like GetMethodName. 14254 </change> 14255 <change date="29 Feb 2003" version="v40"> 14256 Rewrite the introductory text, adding sections on 14257 start-up, environments and bytecode instrumentation. 14258 Change the command line arguments per EG discussions. 14259 Add an introduction to the capabilities section. 14260 Add the extension mechanism category and functions. 14261 Mark for deletion, but clarified anyhow, SuspendAllThreads. 14262 Rename IterateOverLiveObjects to IterateOverReachableObjects and 14263 change the text accordingly. 14264 Clarify IterateOverHeap. 14265 Clarify CompiledMethodLoad. 14266 Discuss prerequisite state for Calling Functions. 14267 Clarify SetAllocationHooks. 14268 Added issues ("To be resolved:") through-out. 14269 And so on... 14270 </change> 14271 <change date="6 Mar 2003" version="v41"> 14272 Remove struct from the call to GetOwnedMonitorInfo. 14273 Automatically generate most error documentation, remove 14274 (rather broken) hand written error doc. 14275 Better describe capability use (empty initial set). 14276 Add min value to jint params. 14277 Remove the capability can_access_thread_local_storage. 14278 Rename error JVMTI_ERROR_NOT_IMPLEMENTED to JVMTI_ERROR_MUST_POSSESS_CAPABILITY; 14279 same for *NOT_IMPLEMENTED. 14280 Description fixes. 14281 </change> 14282 <change date="8 Mar 2003" version="v42"> 14283 Rename GetClassSignature to GetClassName. 14284 Rename IterateOverClassObjects to IterateOverInstancesOfClass. 14285 Remove GetMaxStack (operand stack isn't used in <jvmti/>). 14286 Description fixes: define launch-time, remove native frame pop 14287 from PopFrame, and assorted clarifications. 14288 </change> 14289 <change date="8 Mar 2003" version="v43"> 14290 Fix minor editing problem. 14291 </change> 14292 <change date="10 Mar 2003" version="v44"> 14293 Add phase information. 14294 Remap (compact) event numbers. 14295 </change> 14296 <change date="11 Mar 2003" version="v45"> 14297 More phase information - allow "any". 14298 Elide raw monitor queries and events. 14299 Minor description fixes. 14300 </change> 14301 <change date="12 Mar 2003" version="v46"> 14302 Add GetPhase. 14303 Use "phase" through document. 14304 Elide GetRawMonitorName. 14305 Elide GetObjectMonitors. 14306 </change> 14307 <change date="12 Mar 2003" version="v47"> 14308 Fixes from link, XML, and spell checking. 14309 Auto-generate the callback structure. 14310 </change> 14311 <change date="13 Mar 2003" version="v48"> 14312 One character XML fix. 14313 </change> 14314 <change date="13 Mar 2003" version="v49"> 14315 Change function parameter names to be consistent with 14316 event parameters (fooBarBaz becomes foo_bar_baz). 14317 </change> 14318 <change date="14 Mar 2003" version="v50"> 14319 Fix broken link. Fix thread markers. 14320 </change> 14321 <change date="14 Mar 2003" version="v51"> 14322 Change constants so they are under 128 to workaround 14323 compiler problems. 14324 </change> 14325 <change date="23 Mar 2003" version="v52"> 14326 Overhaul capabilities. Separate GetStackTrace into 14327 GetStackTrace and GetStackFrames. 14328 </change> 14329 <change date="8 Apr 2003" version="v54"> 14330 Use depth instead of jframeID to reference frames. 14331 Remove the now irrelevant GetCurrentFrame, GetCallerFrame and GetStackFrames. 14332 Remove frame arg from events. 14333 </change> 14334 <change date="9 Apr 2003" version="v55"> 14335 Remove GetObjectWithAnnotation since tests show bufferred approach more efficient. 14336 Add missing annotation_count to GetObjectsWithAnnotations 14337 </change> 14338 <change date="10 Apr 2003" version="v56"> 14339 Remove confusing parenthetical statement in GetObjectsWithAnnotations 14340 </change> 14341 <change date="13 Apr 2003" version="v58"> 14342 Replace jclass/jmethodID representation of method with simply jmethodID; 14343 Pass JvmtiEnv* as first arg of every event; remove JNIEnv* where inappropriate. 14344 Replace can_access_frames with can_access_local_variables; remove from purely stack access. 14345 Use can_get_synthetic_attribute; fix description. 14346 Clarify that zero length arrays must be deallocated. 14347 Clarify RelinquishCapabilities. 14348 Generalize JVMTI_ERROR_VM_DEAD to JVMTI_ERROR_WRONG_PHASE. 14349 </change> 14350 <change date="27 Apr 2003" version="v59"> 14351 Remove lingering indirect references to OBSOLETE_METHOD_ID. 14352 </change> 14353 <change date="4 May 2003" version="v60"> 14354 Allow DestroyRawMonitor during OnLoad. 14355 </change> 14356 <change date="7 May 2003" version="v61"> 14357 Added not monitor owner error return to DestroyRawMonitor. 14358 </change> 14359 <change date="13 May 2003" version="v62"> 14360 Clarify semantics of raw monitors. 14361 Change flags on <code>GetThreadStatus</code>. 14362 <code>GetClassLoader</code> return NULL for the bootstrap class loader. 14363 Add <code>GetClassName</code> issue. 14364 Define local variable signature. 14365 Disallow zero in annotations array of <code>GetObjectsWithAnnotations</code>. 14366 Remove over specification in <code>GetObjectsWithAnnotations</code>. 14367 Elide <code>SetAllocationHooks</code>. 14368 Elide <code>SuspendAllThreads</code>. 14369 </change> 14370 <change date="14 May 2003" version="v63"> 14371 Define the data type <code>jvmtiEventCallbacks</code>. 14372 Zero length allocations return NULL. 14373 Keep SetAllocationHooks in JVMDI, but remove from <jvmti/>. 14374 Add JVMTI_THREAD_STATUS_FLAG_INTERRUPTED. 14375 </change> 14376 <change date="15 May 2003" version="v64"> 14377 Better wording, per review. 14378 </change> 14379 <change date="15 May 2003" version="v65"> 14380 First Alpha. 14381 Make jmethodID and jfieldID unique, jclass not used. 14382 </change> 14383 <change date="27 May 2003" version="v66"> 14384 Fix minor XSLT errors. 14385 </change> 14386 <change date="13 June 2003" version="v67"> 14387 Undo making jfieldID unique (jmethodID still is). 14388 </change> 14389 <change date="17 June 2003" version="v68"> 14390 Changes per June 11th Expert Group meeting -- 14391 Overhaul Heap functionality: single callback, 14392 remove GetHeapRoots, add reachable iterators, 14393 and rename "annotation" to "tag". 14394 NULL thread parameter on most functions is current 14395 thread. 14396 Add timers. 14397 Remove ForceExit. 14398 Add GetEnvironmentLocalStorage. 14399 Add verbose flag and event. 14400 Add AddToBootstrapClassLoaderSearch. 14401 Update ClassFileLoadHook. 14402 </change> 14403 <change date="18 June 2003" version="v69"> 14404 Clean up issues sections. 14405 Rename GetClassName back to GetClassSignature and 14406 fix description. 14407 Add generic signature to GetClassSignature, 14408 GetFieldSignature, GetMethodSignature, and 14409 GetLocalVariableTable. 14410 Elide EstimateCostOfCapabilities. 14411 Clarify that the system property functions operate 14412 on the VM view of system properties. 14413 Clarify Agent_OnLoad. 14414 Remove "const" from JNIEnv* in events. 14415 Add metadata accessors. 14416 </change> 14417 <change date="18 June 2003" version="v70"> 14418 Add start_depth to GetStackTrace. 14419 Move system properties to a new category. 14420 Add GetObjectSize. 14421 Remove "X" from command line flags. 14422 XML, HTML, and spell check corrections. 14423 </change> 14424 <change date="19 June 2003" version="v71"> 14425 Fix JVMTI_HEAP_ROOT_THREAD to be 6. 14426 Make each synopsis match the function name. 14427 Fix unclear wording. 14428 </change> 14429 <change date="26 June 2003" version="v72"> 14430 SetThreadLocalStorage and SetEnvironmentLocalStorage should allow value 14431 to be set to NULL. 14432 NotifyFramePop, GetFrameLocationm and all the local variable operations 14433 needed to have their wording about frames fixed. 14434 Grammar and clarity need to be fixed throughout. 14435 Capitalization and puntuation need to be consistent. 14436 Need micro version number and masks for accessing major, minor, and micro. 14437 The error code lists should indicate which must be returned by 14438 an implementation. 14439 The command line properties should be visible in the properties functions. 14440 Disallow popping from the current thread. 14441 Allow implementations to return opaque frame error when they cannot pop. 14442 The NativeMethodBind event should be sent during any phase. 14443 The DynamicCodeGenerated event should be sent during any phase. 14444 The following functions should be allowed to operate before VMInit: 14445 Set/GetEnvironmentLocalStorage 14446 GetMethodDeclaringClass 14447 GetClassSignature 14448 GetClassModifiers 14449 IsInterface 14450 IsArrayClass 14451 GetMethodName 14452 GetMethodModifiers 14453 GetMaxLocals 14454 GetArgumentsSize 14455 GetLineNumberTable 14456 GetMethodLocation 14457 IsMethodNative 14458 IsMethodSynthetic. 14459 Other changes (to XSL): 14460 Argument description should show asterisk after not before pointers. 14461 NotifyFramePop, GetFrameLocationm and all the local variable operations 14462 should hsve the NO_MORE_FRAMES error added. 14463 Not alive threads should have a different error return than invalid thread. 14464 </change> 14465 <change date="7 July 2003" version="v73"> 14466 VerboseOutput event was missing message parameter. 14467 Minor fix-ups. 14468 </change> 14469 <change date="14 July 2003" version="v74"> 14470 Technical Publications Department corrections. 14471 Allow thread and environment local storage to be set to NULL. 14472 </change> 14473 <change date="23 July 2003" version="v75"> 14474 Use new Agent_OnLoad rather than overloaded JVM_OnLoad. 14475 Add JNICALL to callbacks (XSL). 14476 Document JNICALL requirement for both events and callbacks (XSL). 14477 Restrict RedefineClasses to methods and attributes. 14478 Elide the VerboseOutput event. 14479 VMObjectAlloc: restrict when event is sent and remove method parameter. 14480 Finish loose ends from Tech Pubs edit. 14481 </change> 14482 <change date="24 July 2003" version="v76"> 14483 Change ClassFileLoadHook event to send the class instead of a boolean of redefine. 14484 </change> 14485 <change date="24 July 2003" version="v77"> 14486 XML fixes. 14487 Minor text clarifications and corrections. 14488 </change> 14489 <change date="24 July 2003" version="v78"> 14490 Remove GetExceptionHandlerTable and GetThrownExceptions from <jvmti/>. 14491 Clarify that stack frames are JVM Spec frames. 14492 Split can_get_source_info into can_get_source_file_name, can_get_line_numbers, 14493 and can_get_source_debug_extension. 14494 PopFrame cannot have a native calling method. 14495 Removed incorrect statement in GetClassloaderClasses 14496 (see <vmspec chapter="4.4"/>). 14497 </change> 14498 <change date="24 July 2003" version="v79"> 14499 XML and text fixes. 14500 Move stack frame description into Stack Frame category. 14501 </change> 14502 <change date="26 July 2003" version="v80"> 14503 Allow NULL (means bootstrap loader) for GetClassloaderClasses. 14504 Add new heap reference kinds for references from classes. 14505 Add timer information struct and query functions. 14506 Add AvailableProcessors. 14507 Rename GetOtherThreadCpuTime to GetThreadCpuTime. 14508 Explicitly add JVMTI_ERROR_INVALID_THREAD and JVMTI_ERROR_THREAD_NOT_ALIVE 14509 to SetEventNotification mode. 14510 Add initial thread to the VM_INIT event. 14511 Remove platform assumptions from AddToBootstrapClassLoaderSearch. 14512 </change> 14513 <change date="26 July 2003" version="v81"> 14514 Grammar and clarity changes per review. 14515 </change> 14516 <change date="27 July 2003" version="v82"> 14517 More grammar and clarity changes per review. 14518 Add Agent_OnUnload. 14519 </change> 14520 <change date="28 July 2003" version="v83"> 14521 Change return type of Agent_OnUnload to void. 14522 </change> 14523 <change date="28 July 2003" version="v84"> 14524 Rename JVMTI_REFERENCE_ARRAY to JVMTI_REFERENCE_ARRAY_ELEMENT. 14525 </change> 14526 <change date="28 July 2003" version="v85"> 14527 Steal java.lang.Runtime.availableProcessors() wording for 14528 AvailableProcessors(). 14529 Guarantee that zero will never be an event ID. 14530 Remove some issues which are no longer issues. 14531 Per review, rename and more completely document the timer 14532 information functions. 14533 </change> 14534 <change date="29 July 2003" version="v86"> 14535 Non-spec visible change to XML controlled implementation: 14536 SetThreadLocalStorage must run in VM mode. 14537 </change> 14538 <change date="5 August 2003" version="0.1.87"> 14539 Add GetErrorName. 14540 Add varargs warning to jvmtiExtensionEvent. 14541 Remove "const" on the jvmtiEnv* of jvmtiExtensionEvent. 14542 Remove unused can_get_exception_info capability. 14543 Pass jvmtiEnv* and JNIEnv* to the jvmtiStartFunction. 14544 Fix jvmtiExtensionFunctionInfo.func declared type. 14545 Extension function returns error code. 14546 Use new version numbering. 14547 </change> 14548 <change date="5 August 2003" version="0.2.88"> 14549 Remove the ClassUnload event. 14550 </change> 14551 <change date="8 August 2003" version="0.2.89"> 14552 Heap reference iterator callbacks return an enum that 14553 allows outgoing object references to be ignored. 14554 Allow JNIEnv as a param type to extension events/functions. 14555 </change> 14556 <change date="15 August 2003" version="0.2.90"> 14557 Fix a typo. 14558 </change> 14559 <change date="2 September 2003" version="0.2.91"> 14560 Remove all metadata functions: GetClassMetadata, 14561 GetFieldMetadata, and GetMethodMetadata. 14562 </change> 14563 <change date="1 October 2003" version="0.2.92"> 14564 Mark the functions Allocate. Deallocate, RawMonitor*, 14565 SetEnvironmentLocalStorage, and GetEnvironmentLocalStorage 14566 as safe for use in heap callbacks and GC events. 14567 </change> 14568 <change date="24 November 2003" version="0.2.93"> 14569 Add pass through opaque user data pointer to heap iterate 14570 functions and callbacks. 14571 In the CompiledMethodUnload event, send the code address. 14572 Add GarbageCollectionOccurred event. 14573 Add constant pool reference kind. 14574 Mark the functions CreateRawMonitor and DestroyRawMonitor 14575 as safe for use in heap callbacks and GC events. 14576 Clarify: VMDeath, GetCurrentThreadCpuTimerInfo, 14577 GetThreadCpuTimerInfo, IterateOverReachableObjects, 14578 IterateOverObjectsReachableFromObject, GetTime and 14579 JVMTI_ERROR_NULL_POINTER. 14580 Add missing errors to: GenerateEvents and 14581 AddToBootstrapClassLoaderSearch. 14582 Fix description of ClassFileLoadHook name parameter. 14583 In heap callbacks and GC/ObjectFree events, specify 14584 that only explicitly allowed functions can be called. 14585 Allow GetCurrentThreadCpuTimerInfo, GetCurrentThreadCpuTime, 14586 GetTimerInfo, and GetTime during callback. 14587 Allow calling SetTag/GetTag during the onload phase. 14588 SetEventNotificationMode, add: error attempted inappropriate 14589 thread level control. 14590 Remove jvmtiExceptionHandlerEntry. 14591 Fix handling of native methods on the stack -- 14592 location_ptr param of GetFrameLocation, remove 14593 JVMTI_ERROR_OPAQUE_FRAME from GetFrameLocation, 14594 jvmtiFrameInfo.location, and jlocation. 14595 Remove typo (from JVMPI) implying that the MonitorWaited 14596 event is sent on sleep. 14597 </change> 14598 <change date="25 November 2003" version="0.2.94"> 14599 Clarifications and typos. 14600 </change> 14601 <change date="3 December 2003" version="0.2.95"> 14602 Allow NULL user_data in heap iterators. 14603 </change> 14604 <change date="28 January 2004" version="0.2.97"> 14605 Add GetThreadState, deprecate GetThreadStatus. 14606 </change> 14607 <change date="29 January 2004" version="0.2.98"> 14608 INVALID_SLOT and TYPE_MISMATCH errors should be optional. 14609 </change> 14610 <change date="12 February 2004" version="0.2.102"> 14611 Remove MonitorContendedExit. 14612 Added JNIEnv parameter to VMObjectAlloc. 14613 Clarified definition of class_tag and referrer_index 14614 parameters to heap callbacks. 14615 </change> 14616 <change date="16 Febuary 2004" version="0.2.103"> 14617 Document JAVA_TOOL_OPTIONS. 14618 </change> 14619 <change date="17 Febuary 2004" version="0.2.105"> 14620 Divide start phase into primordial and start. 14621 Add VMStart event 14622 Change phase associations of functions and events. 14623 </change> 14624 <change date="18 Febuary 2004" version="0.3.6"> 14625 Elide deprecated GetThreadStatus. 14626 Bump minor version, subtract 100 from micro version 14627 </change> 14628 <change date="18 Febuary 2004" version="0.3.7"> 14629 Document that timer nanosecond values are unsigned. 14630 Clarify text having to do with native methods. 14631 </change> 14632 <change date="19 Febuary 2004" version="0.3.8"> 14633 Fix typos. 14634 Remove elided deprecated GetThreadStatus. 14635 </change> 14636 <change date="23 Febuary 2004" version="0.3.9"> 14637 Require NotifyFramePop to act on suspended threads. 14638 </change> 14639 <change date="24 Febuary 2004" version="0.3.10"> 14640 Add capabilities 14641 (<internallink id="jvmtiCapabilities.can_redefine_any_class" 14642 ><code>can_redefine_any_class</code></internallink> 14643 and 14644 <internallink id="jvmtiCapabilities.can_generate_all_class_hook_events" 14645 ><code>can_generate_all_class_hook_events</code></internallink>) 14646 and an error (<errorlink id="JVMTI_ERROR_UNMODIFIABLE_CLASS"></errorlink>) 14647 which allow some classes to be unmodifiable. 14648 </change> 14649 <change date="28 Febuary 2004" version="0.3.11"> 14650 Add JVMTI_ERROR_MUST_POSSESS_CAPABILITY to SetEventNotificationMode. 14651 </change> 14652 <change date="8 March 2004" version="0.3.12"> 14653 Clarified CompiledMethodUnload so that it is clear the event 14654 may be posted after the class has been unloaded. 14655 </change> 14656 <change date="5 March 2004" version="0.3.13"> 14657 Change the size parameter of VMObjectAlloc to jlong to match GetObjectSize. 14658 </change> 14659 <change date="13 March 2004" version="0.3.14"> 14660 Added guideline for the use of the JNI FindClass function in event 14661 callback functions. 14662 </change> 14663 <change date="15 March 2004" version="0.3.15"> 14664 Add GetAllStackTraces and GetThreadListStackTraces. 14665 </change> 14666 <change date="19 March 2004" version="0.3.16"> 14667 ClassLoad and ClassPrepare events can be posted during start phase. 14668 </change> 14669 <change date="25 March 2004" version="0.3.17"> 14670 Add JVMTI_ERROR_NATIVE_METHOD to GetLineNumberTable, GetLocalVariableTable, 14671 GetMaxLocals, GetArgumentsSize, GetMethodLocation, GetBytecodes. 14672 </change> 14673 <change date="29 March 2004" version="0.3.18"> 14674 Return the timer kind in the timer information structure. 14675 </change> 14676 <change date="31 March 2004" version="0.3.19"> 14677 Spec clarifications: 14678 JVMTI_THREAD_STATE_IN_NATIVE might not include JNI or <jvmti/>. 14679 ForceGarbageCollection does not run finalizers. 14680 The context of the specification is the Java platform. 14681 Warn about early instrumentation. 14682 </change> 14683 <change date="1 April 2004" version="0.3.20"> 14684 Refinements to the above clarifications and 14685 Clarify that an error returned by Agent_OnLoad terminates the VM. 14686 </change> 14687 <change date="1 April 2004" version="0.3.21"> 14688 Array class creation does not generate a class load event. 14689 </change> 14690 <change date="7 April 2004" version="0.3.22"> 14691 Align thread state hierarchy more closely with java.lang.Thread.State. 14692 </change> 14693 <change date="12 April 2004" version="0.3.23"> 14694 Clarify the documentation of thread state. 14695 </change> 14696 <change date="19 April 2004" version="0.3.24"> 14697 Remove GarbageCollectionOccurred event -- can be done by agent. 14698 </change> 14699 <change date="22 April 2004" version="0.3.25"> 14700 Define "command-line option". 14701 </change> 14702 <change date="29 April 2004" version="0.3.26"> 14703 Describe the intended use of bytecode instrumentation. 14704 Fix description of extension event first parameter. 14705 </change> 14706 <change date="30 April 2004" version="0.3.27"> 14707 Clarification and typos. 14708 </change> 14709 <change date="18 May 2004" version="0.3.28"> 14710 Remove DataDumpRequest event. 14711 </change> 14712 <change date="18 May 2004" version="0.3.29"> 14713 Clarify RawMonitorWait with zero timeout. 14714 Clarify thread state after RunAgentThread. 14715 </change> 14716 <change date="24 May 2004" version="0.3.30"> 14717 Clean-up: fix bad/old links, etc. 14718 </change> 14719 <change date="30 May 2004" version="0.3.31"> 14720 Clarifications including: 14721 All character strings are modified UTF-8. 14722 Agent thread visibiity. 14723 Meaning of obsolete method version. 14724 Thread invoking heap callbacks, 14725 </change> 14726 <change date="1 June 2004" version="1.0.32"> 14727 Bump major.minor version numbers to "1.0". 14728 </change> 14729 <change date="2 June 2004" version="1.0.33"> 14730 Clarify interaction between ForceGarbageCollection 14731 and ObjectFree. 14732 </change> 14733 <change date="6 June 2004" version="1.0.34"> 14734 Restrict AddToBootstrapClassLoaderSearch and 14735 SetSystemProperty to the OnLoad phase only. 14736 </change> 14737 <change date="11 June 2004" version="1.0.35"> 14738 Fix typo in SetTag. 14739 </change> 14740 <change date="18 June 2004" version="1.0.36"> 14741 Fix trademarks. 14742 Add missing parameter in example GetThreadState usage. 14743 </change> 14744 <change date="4 August 2004" version="1.0.37"> 14745 Copyright updates. 14746 </change> 14747 <change date="5 November 2004" version="1.0.38"> 14748 Add missing function table layout. 14749 Add missing description of C++ member function format of functions. 14750 Clarify that name in CFLH can be NULL. 14751 Released as part of <tm>J2SE</tm> 5.0. 14752 </change> 14753 <change date="24 April 2005" version="1.1.47"> 14754 Bump major.minor version numbers to "1.1". 14755 Add ForceEarlyReturn* functions. 14756 Add GetOwnedMonitorStackDepthInfo function. 14757 Add GetCurrentThread function. 14758 Add "since" version marker. 14759 Add AddToSystemClassLoaderSearch. 14760 Allow AddToBootstrapClassLoaderSearch be used in live phase. 14761 Fix historic rubbish in the descriptions of the heap_object_callback 14762 parameter of IterateOverHeap and IterateOverInstancesOfClass functions; 14763 disallow NULL for this parameter. 14764 Clarify, correct and make consistent: wording about current thread, 14765 opaque frames and insufficient number of frames in PopFrame. 14766 Consistently use "current frame" rather than "topmost". 14767 Clarify the JVMTI_ERROR_TYPE_MISMATCH errors in GetLocal* and SetLocal* 14768 by making them compatible with those in ForceEarlyReturn*. 14769 Many other clarifications and wording clean ups. 14770 </change> 14771 <change date="25 April 2005" version="1.1.48"> 14772 Add GetConstantPool. 14773 Switch references to the first edition of the VM Spec, to the seconds edition. 14774 </change> 14775 <change date="26 April 2005" version="1.1.49"> 14776 Clarify minor/major version order in GetConstantPool. 14777 </change> 14778 <change date="26 April 2005" version="1.1.50"> 14779 Add SetNativeMethodPrefix and SetNativeMethodPrefixes. 14780 Reassign GetOwnedMonitorStackDepthInfo to position 153. 14781 Break out Class Loader Search in its own documentation category. 14782 Deal with overly long lines in XML source. 14783 </change> 14784 <change date="29 April 2005" version="1.1.51"> 14785 Allow agents be started in the live phase. 14786 Added paragraph about deploying agents. 14787 </change> 14788 <change date="30 April 2005" version="1.1.52"> 14789 Add specification description to SetNativeMethodPrefix(es). 14790 Better define the conditions on GetConstantPool. 14791 </change> 14792 <change date="30 April 2005" version="1.1.53"> 14793 Break out the GetClassVersionNumber function from GetConstantPool. 14794 Clean-up the references to the VM Spec. 14795 </change> 14796 <change date="1 May 2005" version="1.1.54"> 14797 Allow SetNativeMethodPrefix(es) in any phase. 14798 Add clarifications about the impact of redefinition on GetConstantPool. 14799 </change> 14800 <change date="2 May 2005" version="1.1.56"> 14801 Various clarifications to SetNativeMethodPrefix(es). 14802 </change> 14803 <change date="2 May 2005" version="1.1.57"> 14804 Add missing performance warning to the method entry event. 14805 </change> 14806 <change date="5 May 2005" version="1.1.58"> 14807 Remove internal JVMDI support. 14808 </change> 14809 <change date="8 May 2005" version="1.1.59"> 14810 Add <functionlink id="RetransformClasses"/>. 14811 Revamp the bytecode instrumentation documentation. 14812 Change <functionlink id="IsMethodObsolete"/> to no longer 14813 require the can_redefine_classes capability. 14814 </change> 14815 <change date="11 May 2005" version="1.1.63"> 14816 Clarifications for retransformation. 14817 </change> 14818 <change date="11 May 2005" version="1.1.64"> 14819 Clarifications for retransformation, per review. 14820 Lock "retransformation (in)capable" at class load enable time. 14821 </change> 14822 <change date="4 June 2005" version="1.1.67"> 14823 Add new heap functionity which supports reporting primitive values, 14824 allows setting the referrer tag, and has more powerful filtering: 14825 FollowReferences, IterateThroughHeap, and their associated 14826 callbacks, structs, enums, and constants. 14827 </change> 14828 <change date="4 June 2005" version="1.1.68"> 14829 Clarification. 14830 </change> 14831 <change date="6 June 2005" version="1.1.69"> 14832 FollowReferences, IterateThroughHeap: Put callbacks in a struct; 14833 Add missing error codes; reduce bits in the visit control flags. 14834 </change> 14835 <change date="14 June 2005" version="1.1.70"> 14836 More on new heap functionity: spec clean-up per review. 14837 </change> 14838 <change date="15 June 2005" version="1.1.71"> 14839 More on new heap functionity: Rename old heap section to Heap (1.0). 14840 </change> 14841 <change date="21 June 2005" version="1.1.72"> 14842 Fix typos. 14843 </change> 14844 <change date="27 June 2005" version="1.1.73"> 14845 Make referrer info structure a union. 14846 </change> 14847 <change date="9 September 2005" version="1.1.74"> 14848 In new heap functions: 14849 Add missing superclass reference kind. 14850 Use a single scheme for computing field indexes. 14851 Remove outdated references to struct based referrer info. 14852 </change> 14853 <change date="12 September 2005" version="1.1.75"> 14854 Don't callback during FollowReferences on frivolous java.lang.Object superclass. 14855 </change> 14856 <change date="13 September 2005" version="1.1.76"> 14857 In string primitive callback, length now Unicode length. 14858 In array and string primitive callbacks, value now "const". 14859 Note possible compiler impacts on setting JNI function table. 14860 </change> 14861 <change date="13 September 2005" version="1.1.77"> 14862 GetClassVersionNumbers() and GetConstantPool() should return 14863 error on array or primitive class. 14864 </change> 14865 <change date="14 September 2005" version="1.1.78"> 14866 Grammar fixes. 14867 </change> 14868 <change date="26 September 2005" version="1.1.79"> 14869 Add IsModifiableClass query. 14870 </change> 14871 <change date="9 February 2006" version="1.1.81"> 14872 Add referrer_class_tag parameter to jvmtiHeapReferenceCallback. 14873 </change> 14874 <change date="13 February 2006" version="1.1.82"> 14875 Doc fixes: update can_redefine_any_class to include retransform. 14876 Clarify that exception events cover all Throwables. 14877 In GetStackTrace, no test is done for start_depth too big if start_depth is zero, 14878 Clarify fields reported in Primitive Field Callback -- static vs instance. 14879 Repair confusing names of heap types, including callback names. 14880 Require consistent usage of stack depth in the face of thread launch methods. 14881 Note incompatibility of <jvmti/> memory management with other systems. 14882 </change> 14883 <change date="14 February 2006" version="1.1.85"> 14884 Fix typos and missing renames. 14885 </change> 14886 <change date="13 March 2006" version="1.1.86"> 14887 Clarify that jmethodIDs and jfieldIDs can be saved. 14888 Clarify that Iterate Over Instances Of Class includes subclasses. 14889 </change> 14890 <change date="14 March 2006" version="1.1.87"> 14891 Better phrasing. 14892 </change> 14893 <change date="16 March 2006" version="1.1.88"> 14894 Match the referrer_index for static fields in Object Reference Callback 14895 with the Reference Implementation (and all other known implementations); 14896 that is, make it match the definition for instance fields. 14897 In GetThreadListStackTraces, add JVMTI_ERROR_INVALID_THREAD to cover 14898 an invalid thread in the list; and specify that not started threads 14899 return empty stacks. 14900 </change> 14901 <change date="17 March 2006" version="1.1.89"> 14902 Typo. 14903 </change> 14904 <change date="25 March 2006" version="1.1.90"> 14905 Typo. 14906 </change> 14907 <change date="6 April 2006" version="1.1.91"> 14908 Remove restrictions on AddToBootstrapClassLoaderSearch and 14909 AddToSystemClassLoaderSearch. 14910 </change> 14911 <change date="1 May 2006" version="1.1.93"> 14912 Changed spec to return -1 for monitor stack depth for the 14913 implementation which can not determine stack depth. 14914 </change> 14915 <change date="3 May 2006" version="1.1.94"> 14916 Corrections for readability and accuracy courtesy of Alan Pratt of IBM. 14917 List the object relationships reported in FollowReferences. 14918 </change> 14919 <change date="5 May 2006" version="1.1.95"> 14920 Clarify the object relationships reported in FollowReferences. 14921 </change> 14922 <change date="28 June 2006" version="1.1.98"> 14923 Clarify DisposeEnvironment; add warning. 14924 Fix typos in SetLocalXXX "retrieve" => "set". 14925 Clarify that native method prefixes must remain set while used. 14926 Clarify that exactly one Agent_OnXXX is called per agent. 14927 Clarify that library loading is independent from start-up. 14928 Remove ambiguous reference to Agent_OnLoad in the Agent_OnUnload spec. 14929 </change> 14930 <change date="31 July 2006" version="1.1.99"> 14931 Clarify the interaction between functions and exceptions. 14932 Clarify and give examples of field indices. 14933 Remove confusing "That is" sentence from MonitorWait and MonitorWaited events. 14934 Update links to point to Java 6. 14935 </change> 14936 <change date="6 August 2006" version="1.1.102"> 14937 Add ResourceExhaustedEvent. 14938 </change> 14939 <change date="11 October 2012" version="1.2.2"> 14940 Fixed the "HTTP" and "Missing Anchor" errors reported by the LinkCheck tool. 14941 </change> 14942 <change date="19 June 2013" version="1.2.3"> 14943 Added support for statically linked agents. 14944 </change> 14945 <change date="13 October 2016" version="9.0.0"> 14946 Support for modules: 14947 - The majorversion is 9 now 14948 - The ClassFileLoadHook events are not sent during the primordial phase anymore. 14949 - Allow CompiledMethodLoad events at start phase 14950 - Add new capabilities: 14951 - can_generate_early_vmstart 14952 - can_generate_early_class_hook_events 14953 - Add new functions: 14954 - GetAllModules 14955 - AddModuleReads, AddModuleExports, AddModuleOpens, AddModuleUses, AddModuleProvides 14956 - IsModifiableModule 14957 Clarified can_redefine_any_classes, can_retransform_any_classes and IsModifiableClass API to 14958 disallow some implementation defined classes. 14959 </change> 14960 <change date="12 February 2017" version="9.0.0"> 14961 Minor update for GetCurrentThread function: 14962 - The function may return NULL in the start phase if the 14963 can_generate_early_vmstart capability is enabled. 14964 </change> 14965 <change date="7 February 2018" version="11.0.0"> 14966 Minor update for new class file NestHost and NestMembers attributes: 14967 - Specify that RedefineClasses and RetransformClasses are not allowed 14968 to change the class file NestHost and NestMembers attributes. 14969 - Add new error JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED 14970 that can be returned by RedefineClasses and RetransformClasses. 14971 </change> 14972 </changehistory> 14973 14974 </specification> 14975 <!-- Keep this comment at the end of the file 14976 Local variables: 14977 mode: sgml 14978 sgml-omittag:t 14979 sgml-shorttag:t 14980 sgml-namecase-general:t 14981 sgml-general-insert-case:lower 14982 sgml-minimize-attributes:nil 14983 sgml-always-quote-attributes:t 14984 sgml-indent-step:2 14985 sgml-indent-data:t 14986 sgml-parent-document:nil 14987 sgml-exposed-tags:nil 14988 sgml-local-catalogs:nil 14989 sgml-local-ecat-files:nil 14990 End: 14991 -->