1 <?xml version="1.0" encoding="ISO-8859-1"?> 2 <?xml-stylesheet type="text/xsl" href="jvmti.xsl"?> 3 <!-- 4 Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. 5 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 7 This code is free software; you can redistribute it and/or modify it 8 under the terms of the GNU General Public License version 2 only, as 9 published by the Free Software Foundation. 10 11 This code is distributed in the hope that it will be useful, but WITHOUT 12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 version 2 for more details (a copy is included in the LICENSE file that 15 accompanied this code). 16 17 You should have received a copy of the GNU General Public License version 18 2 along with this work; if not, write to the Free Software Foundation, 19 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 21 Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 or visit www.oracle.com if you need additional information or have any 23 questions. 24 --> 25 26 <!DOCTYPE specification [ 27 <!ELEMENT specification (title, intro*, functionsection, errorsection, 28 eventsection, datasection, issuessection, changehistory)> 29 <!ATTLIST specification label CDATA #REQUIRED 30 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 intro ANY> 38 <!ATTLIST intro id CDATA #IMPLIED 39 label CDATA ""> 40 41 <!ELEMENT functionsection (intro*, category*)> 42 <!ATTLIST functionsection label CDATA #REQUIRED> 43 44 <!ELEMENT category ((intro|typedef|uniontypedef|capabilitiestypedef)*, 45 (function|callback|elide)*)> 46 <!ATTLIST category id CDATA #REQUIRED 47 label CDATA #REQUIRED> 48 49 <!ELEMENT function (synopsis, typedef*, description?, origin, 50 (capabilities|eventcapabilities), 51 parameters, errors)> 52 <!ATTLIST function id CDATA #REQUIRED 53 num CDATA #REQUIRED 54 phase (onload|onloadOnly|start|live|any) #IMPLIED 55 callbacksafe (safe|unsafe) #IMPLIED 56 impl CDATA #IMPLIED 57 hide CDATA #IMPLIED 58 jkernel (yes|no) #IMPLIED 59 since CDATA "1.0"> 60 61 <!ELEMENT callback ((jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|jthreadGroup|jobject| 62 jvalue|enum|jint|jlong|jfloat|jdouble|jlocation|jboolean|char|uchar|size_t|void), 63 synopsis, description?, parameters)> 64 <!ATTLIST callback id CDATA #REQUIRED 65 since CDATA "1.0"> 66 67 <!ELEMENT synopsis (#PCDATA|jvmti)*> 68 69 <!ELEMENT typedef (description?, field*)> 70 <!ATTLIST typedef id CDATA #REQUIRED 71 label CDATA #REQUIRED 72 since CDATA "1.0"> 73 74 <!ELEMENT uniontypedef (description?, field*)> 75 <!ATTLIST uniontypedef id CDATA #REQUIRED 76 label CDATA #REQUIRED 77 since CDATA "1.0"> 78 79 <!ELEMENT field ((jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|jthreadGroup|jobject| 80 jvalue|enum|jint|jlong|jfloat|jdouble|jlocation|jboolean|char|uchar|size_t|void|allocfieldbuf|inptr|inbuf|outbuf|vmbuf|ptrtype|struct), 81 description)> 82 <!ATTLIST field id CDATA #REQUIRED> 83 84 <!ELEMENT capabilitiestypedef (description?, capabilityfield*)> 85 <!ATTLIST capabilitiestypedef id CDATA #REQUIRED 86 label CDATA #REQUIRED> 87 88 <!ELEMENT capabilityfield (description)> 89 <!ATTLIST capabilityfield id CDATA #REQUIRED 90 disp1 CDATA "" 91 disp2 CDATA "" 92 since CDATA "1.0"> 93 94 <!ELEMENT description ANY> 95 96 <!ELEMENT capabilities (required*, capability*)> 97 98 <!ELEMENT eventcapabilities EMPTY> 99 100 <!ELEMENT required ANY> 101 <!ATTLIST required id CDATA #REQUIRED> 102 103 <!ELEMENT capability ANY> 104 <!ATTLIST capability id CDATA #REQUIRED> 105 106 <!ELEMENT parameters (param*)> 107 108 <!ELEMENT param ((jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|jthreadGroup|jobject| 109 jvalue|enum|jint|jlong|jfloat|jdouble|jlocation|jboolean|char|uchar|size_t|void|varargs|struct|ptrtype| 110 outptr|allocbuf|allocallocbuf|inptr|inbuf|outbuf|vmbuf|agentbuf), 111 description)> 112 <!ATTLIST param id CDATA #REQUIRED> 113 114 <!ELEMENT jmethodID EMPTY> 115 <!ATTLIST jmethodID class CDATA #IMPLIED 116 native CDATA #IMPLIED> 117 118 <!ELEMENT jfieldID EMPTY> 119 <!ATTLIST jfieldID class CDATA #IMPLIED> 120 121 <!ELEMENT jclass EMPTY> 122 <!ATTLIST jclass method CDATA #IMPLIED 123 field CDATA #IMPLIED> 124 125 <!ELEMENT jframeID EMPTY> 126 <!ATTLIST jframeID thread CDATA #IMPLIED> 127 128 <!ELEMENT jrawMonitorID EMPTY> 129 130 <!ELEMENT jthread EMPTY> 131 <!ATTLIST jthread started CDATA #IMPLIED 132 null CDATA #IMPLIED 133 frame CDATA #IMPLIED 134 impl CDATA #IMPLIED> 135 136 <!ELEMENT varargs EMPTY> 137 138 <!ELEMENT jthreadGroup EMPTY> 139 <!ELEMENT jobject EMPTY> 140 <!ELEMENT jvalue EMPTY> 141 <!ELEMENT jchar EMPTY> 142 <!ELEMENT jint EMPTY> 143 <!ATTLIST jint min CDATA #IMPLIED> 144 <!ELEMENT jlong EMPTY> 145 <!ELEMENT jfloat EMPTY> 146 <!ELEMENT jdouble EMPTY> 147 <!ELEMENT jlocation EMPTY> 148 <!ELEMENT jboolean EMPTY> 149 <!ELEMENT char EMPTY> 150 <!ELEMENT uchar EMPTY> 151 <!ELEMENT size_t EMPTY> 152 <!ELEMENT void EMPTY> 153 <!ELEMENT enum (#PCDATA)*> 154 <!ELEMENT struct (#PCDATA)*> 155 156 <!ELEMENT nullok ANY> 157 158 <!ELEMENT ptrtype ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread| 159 jthreadGroup|jobject|jvalue), nullok?)> 160 161 <!ELEMENT outptr ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread| 162 jthreadGroup|jobject|jvalue|enum|jchar|jint|jlong|jfloat|jdouble| 163 jlocation|jboolean|char|uchar|size_t|void), nullok?)> 164 165 <!ELEMENT allocbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread| 166 jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble| 167 jlocation|jboolean|char|uchar|size_t|void), nullok?)> 168 <!ATTLIST allocbuf incount CDATA #IMPLIED 169 outcount CDATA #IMPLIED> 170 171 <!ELEMENT allocallocbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread| 172 jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble| 173 jlocation|jboolean|char|uchar|size_t|void), nullok?)> 174 <!ATTLIST allocallocbuf incount CDATA #IMPLIED 175 outcount CDATA #IMPLIED> 176 177 <!ELEMENT inptr (struct, nullok?)> 178 179 <!ELEMENT inbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread| 180 jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble| 181 jlocation|jboolean|char|uchar|size_t|void), nullok?)> 182 <!ATTLIST inbuf incount CDATA #IMPLIED> 183 184 <!ELEMENT outbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread| 185 jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble| 186 jlocation|jboolean|char|uchar|size_t|void|outbuf), nullok?)> 187 <!ATTLIST outbuf incount CDATA #IMPLIED 188 outcount CDATA #IMPLIED> 189 190 <!ELEMENT vmbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread| 191 jthreadGroup|jobject|jvalue|enum|jchar|jint|jlong|jfloat|jdouble| 192 jlocation|jboolean|char|uchar|size_t|void), nullok?)> 193 <!ATTLIST vmbuf incount CDATA #IMPLIED 194 outcount CDATA #IMPLIED> 195 196 <!ELEMENT agentbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread| 197 jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble| 198 jlocation|jboolean|char|uchar|size_t|void), nullok?)> 199 <!ATTLIST agentbuf incount CDATA #IMPLIED 200 outcount CDATA #IMPLIED> 201 202 <!ELEMENT allocfieldbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread| 203 jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble| 204 jlocation|jboolean|char|uchar|size_t|void))> 205 <!ATTLIST allocfieldbuf outcount CDATA #IMPLIED> 206 207 <!ELEMENT errors (error*)> 208 209 <!ELEMENT error ANY> 210 <!ATTLIST error id CDATA #REQUIRED> 211 212 <!ELEMENT errorsection (intro*, errorcategory*)> 213 <!ATTLIST errorsection label CDATA #REQUIRED> 214 215 <!ELEMENT errorcategory (intro*, errorid*)> 216 <!ATTLIST errorcategory id CDATA #REQUIRED 217 label CDATA #REQUIRED> 218 219 <!ELEMENT errorid ANY> 220 <!ATTLIST errorid id CDATA #REQUIRED 221 num CDATA #REQUIRED> 222 223 <!ELEMENT datasection (intro*, basetypes*)> 224 225 <!ELEMENT basetypes (intro*, basetype*)> 226 <!ATTLIST basetypes id CDATA #REQUIRED 227 label CDATA #REQUIRED> 228 229 <!ELEMENT basetype (definition?,description)> 230 <!ATTLIST basetype id CDATA #REQUIRED> 231 232 <!ELEMENT definition (#PCDATA|jvmti)*> 233 234 <!ELEMENT eventsection (intro*, (event|elide)*)> 235 <!ATTLIST eventsection label CDATA #REQUIRED> 236 237 <!ELEMENT event (description, origin, typedef*, capabilities, parameters)> 238 <!ATTLIST event id CDATA #REQUIRED 239 label CDATA #REQUIRED 240 const CDATA #REQUIRED 241 num CDATA #REQUIRED 242 phase (onload|start|live|any) #IMPLIED 243 filtered (thread|global) #IMPLIED 244 since CDATA "1.0"> 245 246 <!ELEMENT issuessection (intro*)> 247 <!ATTLIST issuessection label CDATA #REQUIRED> 248 249 <!ELEMENT changehistory (intro*, change*)> 250 <!ATTLIST changehistory update CDATA #REQUIRED 251 id CDATA #REQUIRED> 252 253 <!ELEMENT change ANY> 254 <!ATTLIST change date CDATA #REQUIRED 255 version CDATA #IMPLIED> 256 257 <!ELEMENT functionlink (#PCDATA|jvmti|code|i|b)*> 258 <!ATTLIST functionlink id CDATA #REQUIRED> 259 260 <!ELEMENT datalink (#PCDATA|jvmti|code|i|b)*> 261 <!ATTLIST datalink id CDATA #REQUIRED> 262 263 <!ELEMENT typelink (#PCDATA|jvmti|code|i|b)*> 264 <!ATTLIST typelink id CDATA #REQUIRED> 265 266 <!ELEMENT fieldlink (#PCDATA|jvmti|code|i|b)*> 267 <!ATTLIST fieldlink id CDATA #REQUIRED 268 struct CDATA #REQUIRED> 269 270 <!ELEMENT paramlink (#PCDATA|jvmti|code|i|b)*> 271 <!ATTLIST paramlink id CDATA #REQUIRED> 272 273 <!ELEMENT eventlink (#PCDATA|jvmti|code|i|b)*> 274 <!ATTLIST eventlink id CDATA #REQUIRED> 275 276 <!ELEMENT errorlink (#PCDATA|jvmti|code|i|b|tm)*> 277 <!ATTLIST errorlink id CDATA #REQUIRED> 278 279 <!ELEMENT externallink (#PCDATA|jvmti|code|i|b|tm)*> 280 <!ATTLIST externallink id CDATA #REQUIRED> 281 282 <!ELEMENT vmspec EMPTY> 283 <!ATTLIST vmspec chapter CDATA #IMPLIED> 284 285 <!ELEMENT internallink (#PCDATA|jvmti|code|i|b)*> 286 <!ATTLIST internallink id CDATA #REQUIRED> 287 288 <!ELEMENT functionphaselist EMPTY> 289 <!ATTLIST functionphaselist phase (onload|onloadOnly|start|live|any) #REQUIRED> 290 291 <!ELEMENT eventphaselist EMPTY> 292 <!ATTLIST eventphaselist phase (onload|start|live|any) #REQUIRED> 293 294 <!ELEMENT issue ANY> 295 296 <!ELEMENT rationale ANY> 297 298 <!ELEMENT todo ANY> 299 300 <!ELEMENT origin (#PCDATA)*> 301 302 <!ELEMENT elide (intro|function|callback|event)*> 303 <!ATTLIST elide why CDATA #IMPLIED> 304 305 <!ELEMENT constants (constant*)> 306 <!ATTLIST constants id CDATA #REQUIRED 307 label CDATA #REQUIRED 308 kind (enum|bits|const) #REQUIRED 309 since CDATA "1.0"> 310 311 <!ELEMENT constant ANY> 312 <!ATTLIST constant id CDATA #REQUIRED 313 num CDATA #REQUIRED> 314 315 <!ELEMENT tm (#PCDATA)> 316 317 <!ELEMENT i (#PCDATA|jvmti|tm)*> 318 319 <!ELEMENT b (#PCDATA|jvmti|code)*> 320 321 <!ELEMENT code (#PCDATA|space)*> 322 323 <!ELEMENT pre ANY> 324 325 <!ELEMENT space EMPTY> 326 327 <!ELEMENT jvmti EMPTY> 328 329 <!ELEMENT example (#PCDATA|i)*> 330 331 <!ELEMENT br EMPTY> 332 333 <!ELEMENT p EMPTY> 334 335 <!ELEMENT dl (dt|dd)+> 336 337 <!ELEMENT dd ANY> 338 339 <!ELEMENT dt (#PCDATA|jvmti|code|i|b)*> 340 341 <!ELEMENT table (tr)+> 342 343 <!ELEMENT tr (td|th)*> 344 345 <!ELEMENT td ANY> 346 <!ATTLIST td align (left|right|center) "center"> 347 348 <!ELEMENT th ANY> 349 <!ATTLIST th align (left|right|center) "center"> 350 351 <!ELEMENT ul (li)+> 352 <!ATTLIST ul type (disc|circle|square) "disc"> 353 354 <!ELEMENT li ANY> 355 ]> 356 357 <specification label="JVM(TM) Tool Interface" 358 majorversion="9" 359 minorversion="0" 360 microversion="0"> 361 <title subtitle="Version"> 362 <tm>JVM</tm> Tool Interface 363 </title> 364 365 <intro id="whatIs" label="What is the JVM Tool Interface?"> 366 The <tm>JVM</tm> Tool Interface (<jvmti/>) 367 is a programming interface used by development and monitoring tools. 368 It provides both a way to inspect the state and 369 to control the execution of applications running in the 370 <tm>Java</tm> virtual machine (VM). 371 <p/> 372 <jvmti/> is intended to provide a VM interface for the full breadth of tools 373 that need access to VM state, including but not limited to: profiling, 374 debugging, monitoring, thread analysis, and coverage analysis tools. 375 <p/> 376 <jvmti/> may not be available in all implementations of the <tm>Java</tm> virtual 377 machine. 378 <p/> 379 <jvmti/> is a two-way interface. 380 A client of <jvmti/>, hereafter called an <i>agent</i>, 381 can be notified of 382 interesting occurrences through <internallink id="EventSection">events</internallink>. 383 <jvmti/> 384 can query and control the application through many 385 <internallink id="FunctionSection">functions</internallink>, 386 either in response to events or 387 independent of them. 388 <p/> 389 Agents run in the same process with and communicate directly with 390 the virtual machine executing 391 the application being examined. This communication is 392 through a native interface (<jvmti/>). The native in-process interface allows 393 maximal control with minimal intrusion on the part of a tool. 394 Typically, agents are relatively compact. They can be controlled 395 by a separate process which implements the bulk of a tool's 396 function without interfering with the target application's normal execution. 397 </intro> 398 399 <intro id="architecture" label="Architecture"> 400 Tools can be written directly to <jvmti/> or indirectly 401 through higher level interfaces. 402 The Java Platform Debugger Architecture includes <jvmti/>, but also 403 contains higher-level, out-of-process debugger interfaces. The higher-level 404 interfaces are more appropriate than <jvmti/> for many tools. 405 For more information on the Java Platform Debugger Architecture, 406 see the 407 <externallink id="docs/technotes/guides/jpda/architecture.html">Java 408 Platform Debugger Architecture website</externallink>. 409 </intro> 410 411 <intro id="writingAgents" label="Writing Agents"> 412 Agents can be written in any native language that supports C 413 language calling conventions and C or C++ 414 definitions. 415 <p/> 416 The function, event, data type, and constant definitions needed for 417 using <jvmti/> are defined in the include file <code>jvmti.h</code>. 418 To use these definitions add the <tm>J2SE</tm> include directory 419 to your include path and add 420 <example> 421 #include <jvmti.h> 422 </example> 423 to your source code. 424 </intro> 425 426 <intro id="deployingAgents" label="Deploying Agents"> 427 An agent is deployed in a platform specific manner but is typically the 428 platform equivalent of a dynamic library. On the <tm>Windows</tm> operating 429 system, for example, an agent library is a "Dynamic Linked Library" (DLL). 430 On the <tm>Solaris</tm> Operating Environment, an agent library is a shared 431 object (<code>.so</code> file). 432 <p/> 433 434 An agent may be started at VM startup by specifying the agent library 435 name using a <internallink id="starting">command line option</internallink>. 436 Some implementations may support a mechanism to <internallink id="onattach"> 437 start agents</internallink> in the live <functionlink id="GetPhase">phase</functionlink>. 438 The details of how this is initiated are implementation specific. 439 </intro> 440 441 <intro id="entry point" label="Statically Linked Agents (since version 1.2.3)"> 442 443 A native JVMTI Agent may be <i>statically linked</i> with the VM. 444 The manner in which the library and VM image are combined is 445 implementation-dependent. 446 An agent L whose image has been combined with the VM is defined as 447 <i>statically linked</i> if and only if the agent exports a function 448 called Agent_OnLoad_L. 449 <p/> 450 If a <i>statically linked</i> agent L exports a function called 451 Agent_OnLoad_L and a function called Agent_OnLoad, the Agent_OnLoad 452 function will be ignored. 453 If an agent L is <i>statically linked</i>, an Agent_OnLoad_L 454 function will be invoked with the same arguments and expected return 455 value as specified for the Agent_OnLoad function. 456 An agent L that is <i>statically linked</i> will prohibit an agent of 457 the same name from being loaded dynamically. 458 <p/> 459 The VM will invoke the Agent_OnUnload_L function of the agent, if such 460 a function is exported, at the same point during VM execution as it would 461 have called the dynamic entry point Agent_OnUnLoad. A statically loaded 462 agent cannot be unloaded. The Agent_OnUnload_L function will still be 463 called to do any other agent shutdown related tasks. 464 If a <i>statically linked</i> agent L exports a function called 465 Agent_OnUnLoad_L and a function called Agent_OnUnLoad, the Agent_OnUnLoad 466 function will be ignored. 467 <p/> 468 If an agent L is <i>statically linked</i>, an Agent_OnAttach_L function 469 will be invoked with the same arguments and expected return value as 470 specified for the Agent_OnAttach function. 471 If a <i>statically linked</i> agent L exports a function called 472 Agent_OnAttach_L and a function called Agent_OnAttach, the Agent_OnAttach 473 function will be ignored. 474 </intro> 475 476 <intro id="starting" label="Agent Command Line Options"> 477 The term "command-line option" is used below to 478 mean options supplied in the <code>JavaVMInitArgs</code> argument 479 to the <code>JNI_CreateJavaVM</code> function of the JNI 480 Invocation API. 481 <p/> 482 One of the two following 483 command-line options is used on VM startup to 484 properly load and run agents. 485 These arguments identify the library containing 486 the agent as well as an options 487 string to be passed in at startup. 488 <dl> 489 <dt><code>-agentlib:</code><i><agent-lib-name></i><code>=</code><i><options></i></dt> 490 <dd> 491 The name following <code>-agentlib:</code> is the name of the 492 library to load. Lookup of the library, both its full name and location, 493 proceeds in a platform-specific manner. 494 Typically, the <i><agent-lib-name></i> is expanded to an 495 operating system specific file name. 496 The <i><options></i> will be passed to the agent on start-up. 497 For example, if the option 498 <code>-agentlib:foo=opt1,opt2</code> is specified, the VM will attempt to 499 load the shared library <code>foo.dll</code> from the system <code>PATH</code> 500 under <tm>Windows</tm> or <code>libfoo.so</code> from the 501 <code>LD_LIBRARY_PATH</code> under the <tm>Solaris</tm> operating 502 environment. 503 If the agent library is statically linked into the executable 504 then no actual loading takes place. 505 <p/> 506 </dd> 507 <dt><code>-agentpath:</code><i><path-to-agent></i><code>=</code><i><options></i></dt> 508 <dd> 509 The path following <code>-agentpath:</code> is the absolute path from which 510 to load the library. 511 No library name expansion will occur. 512 The <i><options></i> will be passed to the agent on start-up. 513 For example, if the option 514 <code>-agentpath:c:\myLibs\foo.dll=opt1,opt2</code> is specified, the VM will attempt to 515 load the shared library <code>c:\myLibs\foo.dll</code>. If the agent 516 library is statically linked into the executable 517 then no actual loading takes place. 518 <p/> 519 </dd> 520 </dl> 521 For a dynamic shared library agent, the start-up routine 522 <internallink id="onload"><code>Agent_OnLoad</code></internallink> 523 in the library will be invoked. If the agent library is statically linked 524 into the executable then the system will attempt to invoke the 525 <code>Agent_OnLoad_<agent-lib-name></code> entry point where 526 <agent-lib-name> is the basename of the 527 agent. In the above example <code>-agentpath:c:\myLibs\foo.dll=opt1,opt2</code>, 528 the system will attempt to find and call the <code>Agent_OnLoad_foo</code> start-up routine. 529 <p/> 530 Libraries loaded with <code>-agentlib:</code> or <code>-agentpath:</code> 531 will be searched for JNI native method implementations to facilitate the 532 use of Java programming language code in tools, as is needed for 533 <internallink id="bci">bytecode instrumentation</internallink>. 534 <p/> 535 The agent libraries will be searched after all other libraries have been 536 searched (agents wishing to override or intercept the native method 537 implementations of non-agent methods can use the 538 <eventlink id="NativeMethodBind">NativeMethodBind event</eventlink>). 539 <p/> 540 These switches do the above and nothing more - they do not change the 541 state of the VM or <jvmti/>. No command line options are needed 542 to enable <jvmti/> 543 or aspects of <jvmti/>, this is handled programmatically 544 by the use of 545 <internallink id="capability">capabilities</internallink>. 546 </intro> 547 548 <intro id="startup" label="Agent Start-Up"> 549 The VM starts each agent by invoking a start-up function. 550 If the agent is started in the <code>OnLoad</code> 551 <functionlink id="GetPhase">phase</functionlink> the function 552 <internallink id="onload"><code>Agent_OnLoad</code></internallink> 553 or <internallink id="onload"><code>Agent_OnLoad_L</code></internallink> 554 for statically linked agents will be invoked. 555 If the agent is started in the live 556 <functionlink id="GetPhase">phase</functionlink> the function 557 <internallink id="onattach"><code>Agent_OnAttach</code></internallink> 558 or <internallink id="onattach"><code>Agent_OnAttach_L</code></internallink> 559 for statically linked agents will be invoked. 560 Exactly one call to a start-up function is made per agent. 561 </intro> 562 563 <intro id="onload" label="Agent Start-Up (OnLoad phase)"> 564 If an agent is started during the <code>OnLoad</code> phase then its 565 agent library must export a start-up function with the following prototype: 566 <example> 567 JNIEXPORT jint JNICALL 568 Agent_OnLoad(JavaVM *vm, char *options, void *reserved)</example> 569 Or for a statically linked agent named 'L': 570 <example> 571 JNIEXPORT jint JNICALL 572 Agent_OnLoad_L(JavaVM *vm, char *options, void *reserved)</example> 573 574 The VM will start the agent by calling this function. 575 It will be called early enough in VM initialization that: 576 <ul> 577 <li><functionlink id="SetSystemProperty">system properties</functionlink> 578 may be set before they have been used in the start-up of the VM</li> 579 <li>the full set of 580 <internallink id="capability">capabilities</internallink> 581 is still available (note that capabilities that configure the VM 582 may only be available at this time--see the 583 <internallink id="capability">Capability function section</internallink>)</li> 584 <li>no bytecodes have executed</li> 585 <li>no classes have been loaded</li> 586 <li>no objects have been created</li> 587 </ul> 588 <p/> 589 The VM will call the <code>Agent_OnLoad</code> or 590 <code>Agent_OnLoad_<agent-lib-name></code> function with 591 <i><options></i> as the second argument - 592 that is, using the command-line option examples, 593 <code>"opt1,opt2"</code> will be passed to the <code>char *options</code> 594 argument of <code>Agent_OnLoad</code>. 595 The <code>options</code> argument is encoded as a 596 <internallink id="mUTF">modified UTF-8</internallink> string. 597 If <i>=<options></i> is not specified, 598 a zero length string is passed to <code>options</code>. 599 The lifespan of the <code>options</code> string is the 600 <code>Agent_OnLoad</code> or <code>Agent_OnLoad_<agent-lib-name></code> 601 call. If needed beyond this time the string or parts of the string must 602 be copied. 603 The period between when <code>Agent_OnLoad</code> is called and when it 604 returns is called the <i>OnLoad phase</i>. 605 Since the VM is not initialized during the OnLoad 606 <functionlink id="GetPhase">phase</functionlink>, 607 the set of allowed operations 608 inside <code>Agent_OnLoad</code> is restricted (see the function descriptions for the 609 functionality available at this time). 610 The agent can safely process the options and set 611 event callbacks with <functionlink id="SetEventCallbacks"></functionlink>. Once 612 the VM initialization event is received 613 (that is, the <eventlink id="VMInit">VMInit</eventlink> 614 callback is invoked), the agent 615 can complete its initialization. 616 <rationale> 617 Early startup is required so that agents can set the desired capabilities, 618 many of which must be set before the VM is initialized. 619 In JVMDI, the -Xdebug command-line option provided 620 very coarse-grain control of capabilities. 621 JVMPI implementations use various tricks to provide a single "JVMPI on" switch. 622 No reasonable command-line 623 option could provide the fine-grain of control required to balance needed capabilities vs 624 performance impact. 625 Early startup is also needed so that agents can control the execution 626 environment - modifying the file system and system properties to install 627 their functionality. 628 </rationale> 629 <p/> 630 The return value from <code>Agent_OnLoad</code> or 631 <code>Agent_OnLoad_<agent-lib-name></code> is used to indicate an error. 632 Any value other than zero indicates an error and causes termination of the VM. 633 </intro> 634 635 <intro id="onattach" label="Agent Start-Up (Live phase)"> 636 A VM may support a mechanism that allows agents to be started in the VM during the live 637 <functionlink id="GetPhase">phase</functionlink>. The details of how this is supported, 638 are implementation specific. For example, a tool may use some platform specific mechanism, 639 or implementation specific API, to attach to the running VM, and request it start a given 640 agent. 641 <p/> 642 If an agent is started during the live phase then its agent library 643 must export a start-up function 644 with the following prototype: 645 <example> 646 JNIEXPORT jint JNICALL 647 Agent_OnAttach(JavaVM* vm, char *options, void *reserved)</example> 648 Or for a statically linked agent named 'L': 649 <example> 650 JNIEXPORT jint JNICALL 651 Agent_OnAttach_L(JavaVM* vm, char *options, void *reserved)</example> 652 653 <p/> 654 The VM will start the agent by calling this function. 655 It will be called in the context of a thread 656 that is attached to the VM. The first argument <i><vm></i> is the Java VM. 657 The <i><options></i> argument is the startup options provided to the agent. 658 <i><options></i> is encoded as a <internallink id="mUTF">modified UTF-8 659 </internallink> string. 660 If startup options were not provided, a zero length string is passed to 661 <code>options</code>. The lifespan of the <code>options</code> string is the 662 <code>Agent_OnAttach</code> or <code>Agent_OnAttach_<agent-lib-name></code> call. 663 If needed beyond this time the string or parts of the string must be copied. 664 <p/> 665 Note that some <internallink id="capability">capabilities</internallink> 666 may not be available in the live phase. 667 <p/> 668 The <code>Agent_OnAttach</code> or <code>Agent_OnAttach_<agent-lib-name 669 ></code> function initializes the agent and returns a value 670 to the VM to indicate if an error occurred. Any value other than zero indicates an error. 671 An error does not cause the VM to terminate. Instead the VM ignores the error, or takes 672 some implementation specific action -- for example it might print an error to standard error, 673 or record the error in a system log. 674 </intro> 675 676 <intro id="onunload" label="Agent Shutdown"> 677 The library may optionally export a 678 shutdown function with the following prototype: 679 <example> 680 JNIEXPORT void JNICALL 681 Agent_OnUnload(JavaVM *vm)</example> 682 Or for a statically linked agent named 'L': 683 <example> 684 JNIEXPORT void JNICALL 685 Agent_OnUnload_L(JavaVM *vm)</example> 686 687 This function will be called by the VM when the library is about to be unloaded. 688 The library will be unloaded (unless it is statically linked into the 689 executable) and this function will be called if some platform specific 690 mechanism causes the unload (an unload mechanism is not specified in this document) 691 or the library is (in effect) unloaded by the termination of the VM whether through 692 normal termination or VM failure, including start-up failure. 693 Uncontrolled shutdown is, of couse, an exception to this rule. 694 Note the distinction between this function and the 695 <eventlink id="VMDeath">VM Death event</eventlink>: for the VM Death event 696 to be sent, the VM must have run at least to the point of initialization and a valid 697 <jvmti/> environment must exist which has set a callback for VMDeath 698 and enabled the event. 699 None of these are required for <code>Agent_OnUnload</code> or 700 <code>Agent_OnUnload_<agent-lib-name></code> and this function 701 is also called if the library is unloaded for other reasons. 702 In the case that a VM Death event is sent, it will be sent before this 703 function is called (assuming this function is called due to VM termination). 704 This function can be used to clean-up resources allocated by the agent. 705 </intro> 706 707 <intro id="tooloptions" label="JAVA_TOOL_OPTIONS"> 708 Since the command-line cannot always be accessed or modified, for example in embedded VMs 709 or simply VMs launched deep within scripts, a <code>JAVA_TOOL_OPTIONS</code> variable is 710 provided so that agents may be launched in these cases. 711 <p/> 712 Platforms which support environment variables or other named strings, may support the 713 <code>JAVA_TOOL_OPTIONS</code> variable. This variable will be broken into options at white-space 714 boundaries. White-space characters include space, tab, carriage-return, new-line, 715 vertical-tab, and form-feed. Sequences of white-space characters are considered 716 equivalent to a single white-space character. No white-space is included in the options 717 unless quoted. Quoting is as follows: 718 <ul> 719 <li>All characters enclosed between a pair of single quote marks (''), except a single 720 quote, are quoted.</li> 721 <li>Double quote characters have no special meaning inside a pair of single quote marks.</li> 722 <li>All characters enclosed between a pair of double quote marks (""), except a double 723 quote, are quoted.</li> 724 <li>Single quote characters have no special meaning inside a pair of double quote marks.</li> 725 <li>A quoted part can start or end anywhere in the variable.</li> 726 <li>White-space characters have no special meaning when quoted -- they are included in 727 the option like any other character and do not mark white-space boundaries.</li> 728 <li>The pair of quote marks is not included in the option.</li> 729 </ul> 730 <code>JNI_CreateJavaVM</code> (in the JNI Invocation API) will prepend these options to the options supplied 731 in its <code>JavaVMInitArgs</code> argument. Platforms may disable this feature in cases where security is 732 a concern; for example, the Reference Implementation disables this feature on Unix systems when 733 the effective user or group ID differs from the real ID. 734 This feature is intended to support the initialization of tools -- specifically including the 735 launching of native or Java programming language agents. Multiple tools may wish to use this 736 feature, so the variable should not be overwritten, instead, options should be appended to 737 the variable. Note that since the variable is processed at the time of the JNI Invocation 738 API create VM call, options processed by a launcher (e.g., VM selection options) will not be handled. 739 </intro> 740 741 <intro id="environments" label="Environments"> 742 The <jvmti/> specification supports the use of multiple simultaneous 743 <jvmti/> agents. 744 Each agent has its own <jvmti/> environment. 745 That is, the <jvmti/> state is 746 separate for each agent - changes to one environment do not affect the 747 others. The state of a <jvmti/> 748 environment includes: 749 <ul> 750 <li><functionlink id="SetEventCallbacks">the event callbacks</functionlink></li> 751 <li><functionlink id="SetEventNotificationMode">the set of events which are enabled</functionlink></li> 752 <li><internallink id="capability">the capabilities</internallink></li> 753 <li><internallink id="memory">the memory allocation/deallocation hooks</internallink></li> 754 </ul> 755 Although their <jvmti/> state 756 is separate, agents inspect and modify the shared state 757 of the VM, they also share the native environment in which they execute. 758 As such, an agent can perturb the results of other agents or cause them 759 to fail. It is the responsibility of the agent writer to specify the level 760 of compatibility with other agents. <jvmti/> implementations are not capable 761 of preventing destructive interactions between agents. Techniques to reduce 762 the likelihood of these occurrences are beyond the scope of this document. 763 <p/> 764 An agent creates a <jvmti/> environment 765 by passing a <jvmti/> version 766 as the interface ID to the JNI Invocation API function 767 <externallink id="docs/technotes/guides/jni/spec/invocation.html#GetEnv"> 768 <code>GetEnv</code></externallink>. 769 See <internallink id="jvmtiEnvAccess">Accessing <jvmti/> Functions</internallink> 770 for more details on the creation and use of 771 <jvmti/> environments. 772 Typically, <jvmti/> environments are created by calling <code>GetEnv</code> from 773 <internallink id="onload"><code>Agent_OnLoad</code></internallink>. 774 </intro> 775 776 <intro id="bci" label="Bytecode Instrumentation"> 777 This interface does not include some events that one might expect in an interface with 778 profiling support. Some examples include object allocation events and full speed 779 method enter and exit events. The interface instead provides support for 780 <i>bytecode instrumentation</i>, the ability to alter the Java virtual machine 781 bytecode instructions which comprise the target program. Typically, these alterations 782 are to add "events" to the code of a method - for example, to add, at the beginning of a method, 783 a call to <code>MyProfiler.methodEntered()</code>. 784 Since the changes are purely additive, they do not modify application 785 state or behavior. 786 Because the inserted agent code is standard bytecodes, the VM can run at full speed, 787 optimizing not only the target program but also the instrumentation. If the 788 instrumentation does not involve switching from bytecode execution, no expensive 789 state transitions are needed. The result is high performance events. 790 This approach also provides complete control to the agent: instrumentation can be 791 restricted to "interesting" portions of the code (e.g., the end user's code) and 792 can be conditional. Instrumentation can run entirely in Java programming language 793 code or can call into the native agent. Instrumentation can simply maintain 794 counters or can statistically sample events. 795 <p/> 796 Instrumentation can be inserted in one of three ways: 797 <ul> 798 <li> 799 Static Instrumentation: The class file is instrumented before it 800 is loaded into the VM - for example, by creating a duplicate directory of 801 <code>*.class</code> files which have been modified to add the instrumentation. 802 This method is extremely awkward and, in general, an agent cannot know 803 the origin of the class files which will be loaded. 804 </li> 805 <li> 806 Load-Time Instrumentation: When a class file is loaded by the VM, the raw 807 bytes of the class file are sent for instrumentation to the agent. 808 The <eventlink id="ClassFileLoadHook"/> 809 event, triggered by the class load, 810 provides this functionality. This mechanism provides efficient 811 and complete access to one-time instrumentation. 812 </li> 813 <li> 814 Dynamic Instrumentation: A class which is already loaded (and possibly 815 even running) is modified. This optional feature is provided by the 816 <eventlink id="ClassFileLoadHook"/> event, triggered by calling the 817 <functionlink id="RetransformClasses"/> function. 818 Classes can be modified multiple times and can be returned to their 819 original state. 820 The mechanism allows instrumentation which changes during the 821 course of execution. 822 </li> 823 </ul> 824 <p/> 825 The class modification functionality provided in this interface 826 is intended to provide a mechanism for instrumentation 827 (the <eventlink id="ClassFileLoadHook"/> event 828 and the <functionlink id="RetransformClasses"/> function) 829 and, during development, for fix-and-continue debugging 830 (the <functionlink id="RedefineClasses"/> function). 831 <p/> 832 Care must be taken to avoid perturbing dependencies, especially when 833 instrumenting core classes. For example, an approach to getting notification 834 of every object allocation is to instrument the constructor on 835 <code>Object</code>. Assuming that the constructor is initially 836 empty, the constructor could be changed to: 837 <example> 838 public Object() { 839 MyProfiler.allocationTracker(this); 840 } 841 </example> 842 However, if this change was made using the 843 <eventlink id="ClassFileLoadHook"/> 844 event then this might impact a typical VM as follows: 845 the first created object will call the constructor causing a class load of 846 <code>MyProfiler</code>; which will then cause 847 object creation, and since <code>MyProfiler</code> isn't loaded yet, 848 infinite recursion; resulting in a stack overflow. A refinement of this 849 would be to delay invoking the tracking method until a safe time. For 850 example, <code>trackAllocations</code> could be set in the 851 handler for the <code>VMInit</code> event. 852 <example> 853 static boolean trackAllocations = false; 854 855 public Object() { 856 if (trackAllocations) { 857 MyProfiler.allocationTracker(this); 858 } 859 } 860 </example> 861 <p/> 862 The <functionlink id="SetNativeMethodPrefix"/> allows native methods 863 to be instrumented by the use of wrapper methods. 864 </intro> 865 866 <intro id="bcimodules" label="Bytecode Instrumentation of code in modules"> 867 Agents that instrument code in named modules may need to arrange for those 868 modules to read other modules. If code is instrumented to invoke a method 869 in a support class in another module, then the module of the instrumented 870 code should read the module of the supporting class. Furthermore, the 871 supporting class will only be accessible to the instrumented code if 872 it is <code>public</code> and in a package that is exported by its module. 873 Agents can use the JNI functions <code>CanReadModule</code> and 874 <code>AddModuleReads</code> to test and update a module to read another. 875 <p/> 876 As an aid to agents that deploy supporting classes on the search path of 877 the bootstrap class loader, or the search path of the class loader that 878 loads the main class, the Java virtual machine arranges for the module 879 of classes transformed by the <eventlink id="ClassFileLoadHook"/> event to 880 read the unnamed module of both class loaders. 881 </intro> 882 883 <intro id="mUTF" label="Modified UTF-8 String Encoding"> 884 <jvmti/> uses modified UTF-8 to encode character strings. 885 This is the same encoding used by JNI. 886 Modified UTF-8 differs 887 from standard UTF-8 in the representation of supplementary characters 888 and of the null character. See the 889 <externallink id="docs/technotes/guides/jni/spec/types.html#modified_utf_8_strings"> 890 Modified UTF-8 Strings</externallink> 891 section of the JNI specification for details. 892 </intro> 893 894 <intro id="context" label="Specification Context"> 895 Since this interface provides access to the state of applications running in the 896 Java virtual machine; 897 terminology refers to the Java platform and not the native 898 platform (unless stated otherwise). For example: 899 <ul> 900 <li>"thread" means Java programming language thread.</li> 901 <li>"stack frame" means Java virtual machine stack frame.</li> 902 <li>"class" means Java programming language class.</li> 903 <li>"heap" means Java virtual machine heap.</li> 904 <li>"monitor" means Java programming language object monitor.</li> 905 </ul> 906 <p/> 907 Sun, Sun Microsystems, the Sun logo, Java, and JVM 908 are trademarks or registered trademarks of Oracle 909 and/or its affiliates, in the U.S. and other countries. 910 </intro> 911 912 913 <functionsection label="Functions"> 914 <intro id="jvmtiEnvAccess" label="Accessing Functions"> 915 Native code accesses <jvmti/> features 916 by calling <jvmti/> functions. 917 Access to <jvmti/> functions is by use of an interface pointer 918 in the same manner as 919 <externallink id="docs/technotes/guides/jni/spec/design.html">Java 920 Native Interface (JNI) functions</externallink> are accessed. 921 The <jvmti/> interface pointer is called the 922 <i>environment pointer</i>. 923 <p/> 924 An environment pointer is a pointer to an environment and has 925 the type <code>jvmtiEnv*</code>. 926 An environment has information about its <jvmti/> connection. 927 The first value in the environment is a pointer to the function table. 928 The function table is an array of pointers to <jvmti/> functions. 929 Every function pointer is at a predefined offset inside the 930 array. 931 <p/> 932 When used from the C language: 933 double indirection is used to access the functions; 934 the environment pointer provides context and is the first 935 parameter of each function call; for example: 936 <example> 937 jvmtiEnv *jvmti; 938 ... 939 jvmtiError err = (*jvmti)->GetLoadedClasses(jvmti, &class_count, &classes); 940 </example> 941 <p/> 942 When used from the C++ language: 943 functions are accessed as member functions of <code>jvmtiEnv</code>; 944 the environment pointer is not passed to the function call; for example: 945 <example> 946 jvmtiEnv *jvmti; 947 ... 948 jvmtiError err = jvmti->GetLoadedClasses(&class_count, &classes); 949 </example> 950 Unless otherwise stated, all examples and declarations in this 951 specification use the C language. 952 <p/> 953 A <jvmti/> environment can be obtained through the JNI Invocation API 954 <code>GetEnv</code> function: 955 <example> 956 jvmtiEnv *jvmti; 957 ... 958 (*jvm)->GetEnv(jvm, &jvmti, JVMTI_VERSION_1_0); 959 </example> 960 Each call to <code>GetEnv</code> 961 creates a new <jvmti/> connection and thus 962 a new <jvmti/> environment. 963 The <code>version</code> argument of <code>GetEnv</code> must be 964 a <jvmti/> version. 965 The returned environment may have a different version than the 966 requested version but the returned environment must be compatible. 967 <code>GetEnv</code> will return <code>JNI_EVERSION</code> if a 968 compatible version is not available, if <jvmti/> is not supported or 969 <jvmti/> is not supported in the current VM configuration. 970 Other interfaces may be added for creating <jvmti/> environments 971 in specific contexts. 972 Each environment has its own state (for example, 973 <functionlink id="SetEventNotificationMode">desired events</functionlink>, 974 <functionlink id="SetEventCallbacks">event handling functions</functionlink>, and 975 <functionlink id="AddCapabilities">capabilities</functionlink>). 976 An environment is released with 977 <functionlink id="DisposeEnvironment"></functionlink>. 978 Thus, unlike JNI which has one environment per thread, <jvmti/> environments work 979 across threads and are created dynamically. 980 </intro> 981 982 <intro id="functionReturn" label="Function Return Values"> 983 <jvmti/> functions always return an 984 <internallink id="ErrorSection">error code</internallink> via the 985 <datalink id="jvmtiError"/> function return value. 986 Some functions can return additional 987 values through pointers provided by the calling function. 988 In some cases, <jvmti/> functions allocate memory that your program must 989 explicitly deallocate. This is indicated in the individual <jvmti/> 990 function descriptions. Empty lists, arrays, sequences, etc are 991 returned as <code>NULL</code>. 992 <p/> 993 In the event that the <jvmti/> function encounters 994 an error (any return value other than <code>JVMTI_ERROR_NONE</code>) the values 995 of memory referenced by argument pointers is undefined, but no memory 996 will have been allocated and no global references will have been allocated. 997 If the error occurs because of invalid input, no action will have occurred. 998 </intro> 999 1000 <intro id="refs" label="Managing JNI Object References"> 1001 <jvmti/> functions identify objects with JNI references 1002 (<datalink id="jobject"/> and <datalink id="jclass"/>) 1003 and their derivatives 1004 (<datalink id="jthread"/> and <datalink id="jthreadGroup"/>). 1005 References passed to 1006 <jvmti/> functions can be either global or local, but they must be 1007 strong references. All references returned by <jvmti/> functions are 1008 local references--these local references are created 1009 during the <jvmti/> call. 1010 Local references are a resource that must be managed (see the 1011 <externallink id="docs/technotes/guides/jni/spec/functions.html#local_references"> 1012 JNI Documentation</externallink>). 1013 When threads return from native code all local references 1014 are freed. Note that some threads, including typical 1015 agent threads, will never return from native code. 1016 A thread is ensured the ability to create sixteen local 1017 references without the need for any explicit management. 1018 For threads executing a limited number of <jvmti/> calls before 1019 returning from native code 1020 (for example, threads processing events), 1021 it may be determined that no explicit management 1022 is needed. 1023 However, long running agent threads will need explicit 1024 local reference management--usually with the JNI functions 1025 <code>PushLocalFrame</code> and <code>PopLocalFrame</code>. 1026 Conversely, to preserve references beyond the 1027 return from native code, they must be converted to global references. 1028 These rules do not apply to <datalink id="jmethodID"/> and <datalink id="jfieldID"/> 1029 as they are not <datalink id="jobject"/>s. 1030 </intro> 1031 1032 <intro id="prereqState" label="Prerequisite State for Calling Functions"> 1033 Unless the function explicitly states that the agent must bring 1034 a thread or the VM to a particular state (for example, suspended), 1035 the <jvmti/> implementation is responsible for bringing the VM to a 1036 safe and consistent state for performing the function. 1037 </intro> 1038 1039 <intro id="functionsExceptions" label="Exceptions and Functions"> 1040 <jvmti/> functions never throw exceptions; error conditions are 1041 communicated via the 1042 <internallink id="functionReturn">function return value</internallink>. 1043 Any existing exception state is preserved across a call to a 1044 <jvmti/> function. 1045 See the 1046 <externallink 1047 id="docs/technotes/guides/jni/spec/design.html#java_exceptions" 1048 >Java Exceptions</externallink> 1049 section of the JNI specification for information on handling exceptions. 1050 </intro> 1051 1052 <category id="memory" label="Memory Management"> 1053 <intro> 1054 These functions provide for the allocation and deallocation of 1055 memory used by <jvmti/> functionality and can be used to provide 1056 working memory for agents. 1057 Memory managed by <jvmti/> is not compatible with other memory 1058 allocation libraries and mechanisms. 1059 </intro> 1060 1061 <function id="Allocate" jkernel="yes" phase="any" callbacksafe="safe" impl="notrace" num="46"> 1062 <synopsis>Allocate</synopsis> 1063 <description> 1064 Allocate an area of memory through the <jvmti/> allocator. 1065 The allocated 1066 memory should be freed with <functionlink id="Deallocate"></functionlink>. 1067 </description> 1068 <origin>jvmdi</origin> 1069 <capabilities> 1070 </capabilities> 1071 <parameters> 1072 <param id="size"> 1073 <jlong/> 1074 <description> 1075 The number of bytes to allocate. 1076 <rationale> 1077 <code>jlong</code> is used for compatibility with JVMDI. 1078 </rationale> 1079 </description> 1080 </param> 1081 <param id="mem_ptr"> 1082 <allocbuf incount="size"><uchar/></allocbuf> 1083 <description> 1084 On return, a pointer to the beginning of the allocated memory. 1085 If <code>size</code> is zero, <code>NULL</code> is returned. 1086 </description> 1087 </param> 1088 </parameters> 1089 <errors> 1090 <error id="JVMTI_ERROR_OUT_OF_MEMORY"> 1091 Memory request cannot be honored. 1092 </error> 1093 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 1094 <paramlink id="size"></paramlink> is less than zero. 1095 </error> 1096 </errors> 1097 </function> 1098 1099 <function id="Deallocate" jkernel="yes" phase="any" callbacksafe="safe" impl="notrace" num="47"> 1100 <synopsis>Deallocate</synopsis> 1101 <description> 1102 Deallocate <code>mem</code> using the <jvmti/> allocator. 1103 This function should 1104 be used to deallocate any memory allocated and returned 1105 by a <jvmti/> function 1106 (including memory allocated with <functionlink id="Allocate"></functionlink>). 1107 All allocated memory must be deallocated 1108 or the memory cannot be reclaimed. 1109 </description> 1110 <origin>jvmdi</origin> 1111 <capabilities> 1112 </capabilities> 1113 <parameters> 1114 <param id="mem"> 1115 <outbuf> 1116 <uchar/> 1117 <nullok>the call is ignored</nullok> 1118 </outbuf> 1119 <description> 1120 A pointer to the beginning of the allocated memory. 1121 Please ignore "On return, the elements are set." 1122 <todo>keep it from generating "On return, the elements are set"</todo> 1123 </description> 1124 </param> 1125 </parameters> 1126 <errors> 1127 </errors> 1128 </function> 1129 </category> 1130 1131 <category id="threadCategory" label="Thread"> 1132 <intro> 1133 </intro> 1134 1135 <function id="GetThreadState" num="17"> 1136 <synopsis>Get Thread State</synopsis> 1137 <description> 1138 Get the state of a thread. The state of the thread is represented by the 1139 answers to the hierarchical set of questions below: 1140 <ul type="circle"> 1141 <li><i>Alive?</i> 1142 <ul> 1143 <li>Not alive. 1144 <ul type="circle"> 1145 <li><i>Why not alive?</i> 1146 <ul> 1147 <li>New.</li> 1148 <li>Terminated (<datalink 1149 id="JVMTI_THREAD_STATE_TERMINATED"><code>JVMTI_THREAD_STATE_TERMINATED</code></datalink>)</li> 1150 </ul> 1151 </li> 1152 </ul> 1153 </li> 1154 <li>Alive (<datalink 1155 id="JVMTI_THREAD_STATE_ALIVE"><code>JVMTI_THREAD_STATE_ALIVE</code></datalink>) 1156 <ul type="circle"> 1157 <li><i>Suspended?</i> 1158 <ul> 1159 <li>Suspended (<datalink 1160 id="JVMTI_THREAD_STATE_SUSPENDED"><code>JVMTI_THREAD_STATE_SUSPENDED</code></datalink>)</li> 1161 <li>Not suspended</li> 1162 </ul> 1163 </li> 1164 <li><i>Interrupted?</i> 1165 <ul> 1166 <li>Interrupted (<datalink 1167 id="JVMTI_THREAD_STATE_INTERRUPTED"><code>JVMTI_THREAD_STATE_INTERRUPTED</code></datalink>)</li> 1168 <li>Not interrupted.</li> 1169 </ul> 1170 </li> 1171 <li><i>In native?</i> 1172 <ul> 1173 <li>In native code (<datalink 1174 id="JVMTI_THREAD_STATE_IN_NATIVE"><code>JVMTI_THREAD_STATE_IN_NATIVE</code></datalink>)</li> 1175 <li>In Java programming language code</li> 1176 </ul> 1177 </li> 1178 <li><i>What alive state?</i> 1179 <ul> 1180 <li>Runnable (<datalink 1181 id="JVMTI_THREAD_STATE_RUNNABLE"><code>JVMTI_THREAD_STATE_RUNNABLE</code></datalink>)</li> 1182 <li>Blocked (<datalink 1183 id="JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER"><code>JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER</code></datalink>)</li> 1184 <li>Waiting (<datalink 1185 id="JVMTI_THREAD_STATE_WAITING"><code>JVMTI_THREAD_STATE_WAITING</code></datalink>) 1186 <ul type="circle"> 1187 <li><i>Timed wait?</i> 1188 <ul> 1189 <li>Indefinite (<datalink 1190 id="JVMTI_THREAD_STATE_WAITING_INDEFINITELY"><code>JVMTI_THREAD_STATE_WAITING_INDEFINITELY</code></datalink></li> 1191 <li>Timed (<datalink 1192 id="JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT"><code>JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT</code></datalink>)</li> 1193 </ul> 1194 </li> 1195 <li><i>Why waiting?</i> 1196 <ul> 1197 <li>Object.wait (<datalink 1198 id="JVMTI_THREAD_STATE_IN_OBJECT_WAIT"><code>JVMTI_THREAD_STATE_IN_OBJECT_WAIT</code></datalink>)</li> 1199 <li>LockSupport.park (<datalink 1200 id="JVMTI_THREAD_STATE_PARKED"><code>JVMTI_THREAD_STATE_PARKED</code></datalink>)</li> 1201 <li>Sleeping (<datalink 1202 id="JVMTI_THREAD_STATE_SLEEPING"><code>JVMTI_THREAD_STATE_SLEEPING</code></datalink>)</li> 1203 </ul> 1204 </li> 1205 </ul> 1206 </li> 1207 </ul> 1208 </li> 1209 </ul> 1210 </li> 1211 </ul> 1212 </li> 1213 </ul> 1214 <p/> 1215 The answers are represented by the following bit vector. 1216 <constants id="jvmtiThreadState" label="Thread State Flags" kind="bits"> 1217 <constant id="JVMTI_THREAD_STATE_ALIVE" num="0x0001"> 1218 Thread is alive. Zero if thread is new (not started) or terminated. 1219 </constant> 1220 <constant id="JVMTI_THREAD_STATE_TERMINATED" num="0x0002"> 1221 Thread has completed execution. 1222 </constant> 1223 <constant id="JVMTI_THREAD_STATE_RUNNABLE" num="0x0004"> 1224 Thread is runnable. 1225 </constant> 1226 <constant id="JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER" num="0x0400"> 1227 Thread is waiting to enter a synchronization block/method or, 1228 after an <code>Object.wait()</code>, waiting to re-enter a 1229 synchronization block/method. 1230 </constant> 1231 <constant id="JVMTI_THREAD_STATE_WAITING" num="0x0080"> 1232 Thread is waiting. 1233 </constant> 1234 <constant id="JVMTI_THREAD_STATE_WAITING_INDEFINITELY" num="0x0010"> 1235 Thread is waiting without a timeout. 1236 For example, <code>Object.wait()</code>. 1237 </constant> 1238 <constant id="JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT" num="0x0020"> 1239 Thread is waiting with a maximum time to wait specified. 1240 For example, <code>Object.wait(long)</code>. 1241 </constant> 1242 <constant id="JVMTI_THREAD_STATE_SLEEPING" num="0x0040"> 1243 Thread is sleeping -- <code>Thread.sleep(long)</code>. 1244 </constant> 1245 <constant id="JVMTI_THREAD_STATE_IN_OBJECT_WAIT" num="0x0100"> 1246 Thread is waiting on an object monitor -- <code>Object.wait</code>. 1247 </constant> 1248 <constant id="JVMTI_THREAD_STATE_PARKED" num="0x0200"> 1249 Thread is parked, for example: <code>LockSupport.park</code>, 1250 <code>LockSupport.parkUtil</code> and <code>LockSupport.parkNanos</code>. 1251 </constant> 1252 <constant id="JVMTI_THREAD_STATE_SUSPENDED" num="0x100000"> 1253 Thread suspended. 1254 <code>java.lang.Thread.suspend()</code> 1255 or a <jvmti/> suspend function 1256 (such as <functionlink id="SuspendThread"></functionlink>) 1257 has been called on the thread. If this bit 1258 is set, the other bits refer to the thread state before suspension. 1259 </constant> 1260 <constant id="JVMTI_THREAD_STATE_INTERRUPTED" num="0x200000"> 1261 Thread has been interrupted. 1262 </constant> 1263 <constant id="JVMTI_THREAD_STATE_IN_NATIVE" num="0x400000"> 1264 Thread is in native code--that is, a native method is running 1265 which has not called back into the VM or Java programming 1266 language code. 1267 <p/> 1268 This flag is not set when running VM compiled Java programming 1269 language code nor is it set when running VM code or 1270 VM support code. Native VM interface functions, such as JNI and 1271 <jvmti/> functions, may be implemented as VM code. 1272 </constant> 1273 <constant id="JVMTI_THREAD_STATE_VENDOR_1" num="0x10000000"> 1274 Defined by VM vendor. 1275 </constant> 1276 <constant id="JVMTI_THREAD_STATE_VENDOR_2" num="0x20000000"> 1277 Defined by VM vendor. 1278 </constant> 1279 <constant id="JVMTI_THREAD_STATE_VENDOR_3" num="0x40000000"> 1280 Defined by VM vendor. 1281 </constant> 1282 </constants> 1283 The following definitions are used to convert <jvmti/> thread state 1284 to <code>java.lang.Thread.State</code> style states. 1285 <constants id="jvmtiJavaLangThreadState" label="java.lang.Thread.State Conversion Masks" kind="bits"> 1286 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_MASK" 1287 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"> 1288 Mask the state with this before comparison 1289 </constant> 1290 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_NEW" 1291 num="0"> 1292 <code>java.lang.Thread.State.NEW</code> 1293 </constant> 1294 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_TERMINATED" 1295 num="JVMTI_THREAD_STATE_TERMINATED"> 1296 <code>java.lang.Thread.State.TERMINATED</code> 1297 </constant> 1298 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_RUNNABLE" 1299 num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_RUNNABLE"> 1300 <code>java.lang.Thread.State.RUNNABLE</code> 1301 </constant> 1302 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_BLOCKED" 1303 num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER"> 1304 <code>java.lang.Thread.State.BLOCKED</code> 1305 </constant> 1306 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_WAITING" 1307 num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_INDEFINITELY"> 1308 <code>java.lang.Thread.State.WAITING</code> 1309 </constant> 1310 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_TIMED_WAITING" 1311 num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT"> 1312 <code>java.lang.Thread.State.TIMED_WAITING</code> 1313 </constant> 1314 </constants> 1315 <b>Rules</b> 1316 <p/> 1317 There can be no more than one answer to a question, although there can be no 1318 answer (because the answer is unknown, does not apply, or none of the answers is 1319 correct). An answer is set only when the enclosing answers match. 1320 That is, no more than one of 1321 <ul type="circle"> 1322 <li><code>JVMTI_THREAD_STATE_RUNNABLE</code></li> 1323 <li><code>JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER</code></li> 1324 <li><code>JVMTI_THREAD_STATE_WAITING</code></li> 1325 </ul> 1326 can be set (a <tm>J2SE</tm> compliant implementation will always set 1327 one of these if <code>JVMTI_THREAD_STATE_ALIVE</code> is set). 1328 And if any of these are set, the enclosing answer 1329 <code>JVMTI_THREAD_STATE_ALIVE</code> is set. 1330 No more than one of 1331 <ul type="circle"> 1332 <li><code>JVMTI_THREAD_STATE_WAITING_INDEFINITELY</code></li> 1333 <li><code>JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT</code></li> 1334 </ul> 1335 can be set (a <tm>J2SE</tm> compliant implementation will always set 1336 one of these if <code>JVMTI_THREAD_STATE_WAITING</code> is set). 1337 And if either is set, the enclosing answers 1338 <code>JVMTI_THREAD_STATE_ALIVE</code> and 1339 <code>JVMTI_THREAD_STATE_WAITING</code> are set. 1340 No more than one of 1341 <ul type="circle"> 1342 <li><code>JVMTI_THREAD_STATE_IN_OBJECT_WAIT</code></li> 1343 <li><code>JVMTI_THREAD_STATE_PARKED</code></li> 1344 <li><code>JVMTI_THREAD_STATE_SLEEPING</code></li> 1345 </ul> 1346 can be set. And if any of these is set, the enclosing answers 1347 <code>JVMTI_THREAD_STATE_ALIVE</code> and 1348 <code>JVMTI_THREAD_STATE_WAITING</code> are set. 1349 Also, if <code>JVMTI_THREAD_STATE_SLEEPING</code> is set, 1350 then <code>JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT</code> is set. 1351 If a state <i>A</i> is implemented using the mechanism of 1352 state <i>B</i> then it is state <i>A</i> which 1353 is returned by this function. 1354 For example, if <code>Thread.sleep(long)</code> 1355 is implemented using <code>Object.wait(long)</code> 1356 then it is still <code>JVMTI_THREAD_STATE_SLEEPING</code> 1357 which is returned. 1358 More than one of 1359 <ul type="circle"> 1360 <li><code>JVMTI_THREAD_STATE_SUSPENDED</code></li> 1361 <li><code>JVMTI_THREAD_STATE_INTERRUPTED</code></li> 1362 <li><code>JVMTI_THREAD_STATE_IN_NATIVE</code></li> 1363 </ul> 1364 can be set, but if any is set, 1365 <code>JVMTI_THREAD_STATE_ALIVE</code> is set. 1366 <p/> 1367 And finally, 1368 <code>JVMTI_THREAD_STATE_TERMINATED</code> cannot be set unless 1369 <code>JVMTI_THREAD_STATE_ALIVE</code> is not set. 1370 <p/> 1371 The thread state representation is designed for extension in future versions 1372 of the specification; thread state values should be used accordingly, that is 1373 they should not be used as ordinals. 1374 Most queries can be made by testing a single bit, if use in a switch statement is desired, 1375 the state bits should be masked with the interesting bits. 1376 All bits not defined above are reserved for future use. 1377 A VM, compliant to the current specification, must set reserved bits to zero. 1378 An agent should ignore reserved bits -- 1379 they should not be assumed to be zero and thus should not be included in comparisons. 1380 <p/> 1381 <b>Examples</b> 1382 <p/> 1383 Note that the values below exclude reserved and vendor bits. 1384 <p/> 1385 The state of a thread blocked at a <code>synchronized</code>-statement would be: 1386 <example> 1387 JVMTI_THREAD_STATE_ALIVE + JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER 1388 </example> 1389 The state of a thread which hasn't started yet would be: 1390 <example> 1391 0 1392 </example> 1393 The state of a thread at a <code>Object.wait(3000)</code> would be: 1394 <example> 1395 JVMTI_THREAD_STATE_ALIVE + JVMTI_THREAD_STATE_WAITING + 1396 JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT + 1397 JVMTI_THREAD_STATE_MONITOR_WAITING 1398 </example> 1399 The state of a thread suspended while runnable would be: 1400 <example> 1401 JVMTI_THREAD_STATE_ALIVE + JVMTI_THREAD_STATE_RUNNABLE + JVMTI_THREAD_STATE_SUSPENDED 1402 </example> 1403 <p/> 1404 <b>Testing the State</b> 1405 <p/> 1406 In most cases, the thread state can be determined by testing the one bit corresponding 1407 to that question. For example, the code to test if a thread is sleeping: 1408 <example> 1409 jint state; 1410 jvmtiError err; 1411 1412 err = (*jvmti)->GetThreadState(jvmti, thread, &state); 1413 if (err == JVMTI_ERROR_NONE) { 1414 if (state & JVMTI_THREAD_STATE_SLEEPING) { ... 1415 </example> 1416 <p/> 1417 For waiting (that is, in <code>Object.wait</code>, parked, or sleeping) it would be: 1418 <example> 1419 if (state & JVMTI_THREAD_STATE_WAITING) { ... 1420 </example> 1421 For some states, more than one bit will need to be tested as is the case 1422 when testing if a thread has not yet been started: 1423 <example> 1424 if ((state & (JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_TERMINATED)) == 0) { ... 1425 </example> 1426 To distinguish timed from untimed <code>Object.wait</code>: 1427 <example> 1428 if (state & JVMTI_THREAD_STATE_IN_OBJECT_WAIT) { 1429 if (state & JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT) { 1430 printf("in Object.wait(long timeout)\n"); 1431 } else { 1432 printf("in Object.wait()\n"); 1433 } 1434 } 1435 </example> 1436 <p/> 1437 <b>Relationship to <code>java.lang.Thread.State</code></b> 1438 <p/> 1439 The thread state represented by <code>java.lang.Thread.State</code> 1440 returned from <code>java.lang.Thread.getState()</code> is a subset of the 1441 information returned from this function. 1442 The corresponding <code>java.lang.Thread.State</code> can be determined 1443 by using the provided conversion masks. 1444 For example, this returns the name of the <code>java.lang.Thread.State</code> thread state: 1445 <example> 1446 err = (*jvmti)->GetThreadState(jvmti, thread, &state); 1447 abortOnError(err); 1448 switch (state & JVMTI_JAVA_LANG_THREAD_STATE_MASK) { 1449 case JVMTI_JAVA_LANG_THREAD_STATE_NEW: 1450 return "NEW"; 1451 case JVMTI_JAVA_LANG_THREAD_STATE_TERMINATED: 1452 return "TERMINATED"; 1453 case JVMTI_JAVA_LANG_THREAD_STATE_RUNNABLE: 1454 return "RUNNABLE"; 1455 case JVMTI_JAVA_LANG_THREAD_STATE_BLOCKED: 1456 return "BLOCKED"; 1457 case JVMTI_JAVA_LANG_THREAD_STATE_WAITING: 1458 return "WAITING"; 1459 case JVMTI_JAVA_LANG_THREAD_STATE_TIMED_WAITING: 1460 return "TIMED_WAITING"; 1461 } 1462 </example> 1463 </description> 1464 <origin>new</origin> 1465 <capabilities> 1466 </capabilities> 1467 <parameters> 1468 <param id="thread"> 1469 <jthread null="current" started="maybe" impl="noconvert"/> 1470 <description> 1471 The thread to query. 1472 </description> 1473 </param> 1474 <param id="thread_state_ptr"> 1475 <outptr><jint/></outptr> 1476 <description> 1477 On return, points to state flags, 1478 as defined by the <internallink id="jvmtiThreadState">Thread State Flags</internallink>. 1479 </description> 1480 </param> 1481 </parameters> 1482 <errors> 1483 </errors> 1484 </function> 1485 1486 <function id="GetCurrentThread" phase="start" num="18" since="1.1"> 1487 <synopsis>Get Current Thread</synopsis> 1488 <description> 1489 Get the current thread. 1490 The current thread is the Java programming language thread which has called the function. 1491 <p/> 1492 Note that most <jvmti/> functions that take a thread 1493 as an argument will accept <code>NULL</code> to mean 1494 the current thread. 1495 </description> 1496 <origin>new</origin> 1497 <capabilities> 1498 </capabilities> 1499 <parameters> 1500 <param id="thread_ptr"> 1501 <outptr><jthread/></outptr> 1502 <description> 1503 On return, points to the current thread. 1504 </description> 1505 </param> 1506 </parameters> 1507 <errors> 1508 </errors> 1509 </function> 1510 1511 <function id="GetAllThreads" num="4"> 1512 <synopsis>Get All Threads</synopsis> 1513 <description> 1514 Get all live threads. 1515 The threads are Java programming language threads; 1516 that is, threads that are attached to the VM. 1517 A thread is live if <code>java.lang.Thread.isAlive()</code> 1518 would return <code>true</code>, that is, the thread has 1519 been started and has not yet died. 1520 The universe of threads is determined by the context of the <jvmti/> 1521 environment, which typically is all threads attached to the VM. 1522 Note that this includes <jvmti/> agent threads 1523 (see <functionlink id="RunAgentThread"/>). 1524 </description> 1525 <origin>jvmdi</origin> 1526 <capabilities> 1527 </capabilities> 1528 <parameters> 1529 <param id="threads_count_ptr"> 1530 <outptr><jint/></outptr> 1531 <description> 1532 On return, points to the number of running threads. 1533 </description> 1534 </param> 1535 <param id="threads_ptr"> 1536 <allocbuf outcount="threads_count_ptr"><jthread/></allocbuf> 1537 <description> 1538 On return, points to an array of references, one 1539 for each running thread. 1540 </description> 1541 </param> 1542 </parameters> 1543 <errors> 1544 </errors> 1545 </function> 1546 1547 <function id="SuspendThread" num="5"> 1548 <synopsis>Suspend Thread</synopsis> 1549 <description> 1550 Suspend the specified thread. If the calling thread is specified, 1551 this function will not return until some other thread calls 1552 <functionlink id="ResumeThread"></functionlink>. 1553 If the thread is currently suspended, this function 1554 does nothing and returns an error. 1555 </description> 1556 <origin>jvmdi</origin> 1557 <capabilities> 1558 <required id="can_suspend"></required> 1559 </capabilities> 1560 <parameters> 1561 <param id="thread"> 1562 <jthread null="current"/> 1563 <description> 1564 The thread to suspend. 1565 </description> 1566 </param> 1567 </parameters> 1568 <errors> 1569 <error id="JVMTI_ERROR_THREAD_SUSPENDED"> 1570 Thread already suspended. 1571 </error> 1572 </errors> 1573 </function> 1574 1575 <elide> 1576 <function id="SuspendAllThreads" num="101"> 1577 <synopsis>Suspend All Threads</synopsis> 1578 <description> 1579 <issue> 1580 There has been no explicit call for this function, and it will 1581 thus be removed if there is no interest. 1582 </issue> 1583 Suspend all live threads except: 1584 <ul> 1585 <li>already suspended threads</li> 1586 <li>those listed in <paramlink id="except_list"></paramlink></li> 1587 <li>certain system (non application) threads, as determined 1588 by the VM implementation</li> 1589 </ul> 1590 The threads are Java programming language threads; 1591 native threads which are not attached to the VM are not 1592 Java programming language threads. 1593 A thread is live if <code>java.lang.Thread.isAlive()</code> 1594 would return <code>true</code>, that is, the thread has 1595 been started and has not yet died. 1596 The universe of threads is determined 1597 by the context of the <jvmti/> 1598 environment, which, typically, is all threads attached to the VM, 1599 except critical VM internal threads and <jvmti/> agent threads 1600 (see <functionlink id="RunAgentThread"/>). 1601 <p/> 1602 If the calling thread is specified, 1603 all other threads are suspended first then the caller thread is suspended - 1604 this function will not return until some other thread calls 1605 <functionlink id="ResumeThread"></functionlink>. 1606 <p/> 1607 The list of actually 1608 suspended threads is returned in 1609 <paramlink id="suspended_list_ptr"></paramlink>. 1610 Suspension is as defined in <functionlink id="SuspendThread"></functionlink>. 1611 <functionlink id="ResumeThreadList"></functionlink> 1612 can be used to resume the suspended threads. 1613 </description> 1614 <origin>new</origin> 1615 <capabilities> 1616 <required id="can_suspend"></required> 1617 </capabilities> 1618 <parameters> 1619 <param id="except_count"> 1620 <jint min="0"/> 1621 <description> 1622 The number of threads in the list of threads not to be suspended. 1623 </description> 1624 </param> 1625 <param id="except_list"> 1626 <inbuf incount="except_count"> 1627 <jthread/> 1628 <nullok>not an error if <code>except_count == 0</code></nullok> 1629 </inbuf> 1630 <description> 1631 The list of threads not to be suspended. 1632 </description> 1633 </param> 1634 <param id="suspended_count_ptr"> 1635 <outptr><jint/></outptr> 1636 <description> 1637 On return, points to the number of threads suspended by this call. 1638 </description> 1639 </param> 1640 <param id="suspended_list_ptr"> 1641 <allocbuf outcount="suspended_count_ptr"><jthread/></allocbuf> 1642 <description> 1643 On return, points to an array of references, one 1644 for each thread suspended. 1645 </description> 1646 </param> 1647 </parameters> 1648 <errors> 1649 <error id="JVMTI_ERROR_INVALID_THREAD"> 1650 A thread in <paramlink id="except_list"></paramlink> was invalid. 1651 </error> 1652 <error id="JVMTI_ERROR_NULL_POINTER"> 1653 Both <paramlink id="except_list"></paramlink> was <code>NULL</code> 1654 and <paramlink id="except_count"></paramlink> was non-zero. 1655 </error> 1656 </errors> 1657 </function> 1658 </elide> 1659 1660 <function id="SuspendThreadList" num="92"> 1661 <synopsis>Suspend Thread List</synopsis> 1662 <description> 1663 Suspend the <paramlink id="request_count"></paramlink> 1664 threads specified in the 1665 <paramlink id="request_list"></paramlink> array. 1666 Threads may be resumed with 1667 <functionlink id="ResumeThreadList"></functionlink> or 1668 <functionlink id="ResumeThread"></functionlink>. 1669 If the calling thread is specified in the 1670 <paramlink id="request_list"></paramlink> array, this function will 1671 not return until some other thread resumes it. 1672 Errors encountered in the suspension of a thread 1673 are returned in the <paramlink id="results"></paramlink> 1674 array, <b>not</b> in the return value of this function. 1675 Threads that are currently suspended do not change state. 1676 </description> 1677 <origin>jvmdi</origin> 1678 <capabilities> 1679 <required id="can_suspend"></required> 1680 </capabilities> 1681 <parameters> 1682 <param id="request_count"> 1683 <jint min="0"/> 1684 <description> 1685 The number of threads to suspend. 1686 </description> 1687 </param> 1688 <param id="request_list"> 1689 <inbuf incount="request_count"><jthread/></inbuf> 1690 <description> 1691 The list of threads to suspend. 1692 </description> 1693 </param> 1694 <param id="results"> 1695 <outbuf incount="request_count"><enum>jvmtiError</enum></outbuf> 1696 <description> 1697 An agent supplied array of 1698 <paramlink id="request_count"></paramlink> elements. 1699 On return, filled with the error code for 1700 the suspend of the corresponding thread. 1701 The error code will be 1702 <errorlink id="JVMTI_ERROR_NONE"></errorlink> 1703 if the thread was suspended by this call. 1704 Possible error codes are those specified 1705 for <functionlink id="SuspendThread"></functionlink>. 1706 </description> 1707 </param> 1708 </parameters> 1709 <errors> 1710 </errors> 1711 </function> 1712 1713 <function id="ResumeThread" num="6"> 1714 <synopsis>Resume Thread</synopsis> 1715 <description> 1716 Resume a suspended thread. 1717 Any threads currently suspended through 1718 a <jvmti/> suspend function (eg. 1719 <functionlink id="SuspendThread"></functionlink>) 1720 or <code>java.lang.Thread.suspend()</code> 1721 will resume execution; 1722 all other threads are unaffected. 1723 </description> 1724 <origin>jvmdi</origin> 1725 <capabilities> 1726 <required id="can_suspend"></required> 1727 </capabilities> 1728 <parameters> 1729 <param id="thread"> 1730 <jthread/> 1731 <description> 1732 The thread to resume. 1733 </description> 1734 </param> 1735 </parameters> 1736 <errors> 1737 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 1738 Thread was not suspended. 1739 </error> 1740 <error id="JVMTI_ERROR_INVALID_TYPESTATE"> 1741 The state of the thread has been modified, and is now inconsistent. 1742 </error> 1743 </errors> 1744 </function> 1745 1746 <function id="ResumeThreadList" num="93"> 1747 <synopsis>Resume Thread List</synopsis> 1748 <description> 1749 Resume the <paramlink id="request_count"></paramlink> 1750 threads specified in the 1751 <paramlink id="request_list"></paramlink> array. 1752 Any thread suspended through 1753 a <jvmti/> suspend function (eg. 1754 <functionlink id="SuspendThreadList"></functionlink>) 1755 or <code>java.lang.Thread.suspend()</code> 1756 will resume execution. 1757 </description> 1758 <origin>jvmdi</origin> 1759 <capabilities> 1760 <required id="can_suspend"></required> 1761 </capabilities> 1762 <parameters> 1763 <param id="request_count"> 1764 <jint min="0"/> 1765 <description> 1766 The number of threads to resume. 1767 </description> 1768 </param> 1769 <param id="request_list"> 1770 <inbuf incount="request_count"><jthread/></inbuf> 1771 <description> 1772 The threads to resume. 1773 </description> 1774 </param> 1775 <param id="results"> 1776 <outbuf incount="request_count"><enum>jvmtiError</enum></outbuf> 1777 <description> 1778 An agent supplied array of 1779 <paramlink id="request_count"></paramlink> elements. 1780 On return, filled with the error code for 1781 the resume of the corresponding thread. 1782 The error code will be 1783 <errorlink id="JVMTI_ERROR_NONE"></errorlink> 1784 if the thread was suspended by this call. 1785 Possible error codes are those specified 1786 for <functionlink id="ResumeThread"></functionlink>. 1787 </description> 1788 </param> 1789 </parameters> 1790 <errors> 1791 </errors> 1792 </function> 1793 1794 <function id="StopThread" num="7"> 1795 <synopsis>Stop Thread</synopsis> 1796 <description> 1797 Send the specified asynchronous exception to the specified thread 1798 (similar to <code>java.lang.Thread.stop</code>). 1799 Normally, this function is used to kill the specified thread with an 1800 instance of the exception <code>ThreadDeath</code>. 1801 </description> 1802 <origin>jvmdi</origin> 1803 <capabilities> 1804 <required id="can_signal_thread"></required> 1805 </capabilities> 1806 <parameters> 1807 <param id="thread"> 1808 <jthread/> 1809 <description> 1810 The thread to stop. 1811 </description> 1812 </param> 1813 <param id="exception"> 1814 <jobject/> 1815 <description> 1816 The asynchronous exception object. 1817 </description> 1818 </param> 1819 </parameters> 1820 <errors> 1821 </errors> 1822 </function> 1823 1824 <function id="InterruptThread" num="8"> 1825 <synopsis>Interrupt Thread</synopsis> 1826 <description> 1827 Interrupt the specified thread 1828 (similar to <code>java.lang.Thread.interrupt</code>). 1829 </description> 1830 <origin>jvmdi</origin> 1831 <capabilities> 1832 <required id="can_signal_thread"></required> 1833 </capabilities> 1834 <parameters> 1835 <param id="thread"> 1836 <jthread impl="noconvert"/> 1837 <description> 1838 The thread to interrupt. 1839 </description> 1840 </param> 1841 </parameters> 1842 <errors> 1843 </errors> 1844 </function> 1845 1846 <function id="GetThreadInfo" num="9"> 1847 <synopsis>Get Thread Info</synopsis> 1848 <typedef id="jvmtiThreadInfo" label="Thread information structure"> 1849 <field id="name"> 1850 <allocfieldbuf><char/></allocfieldbuf> 1851 <description> 1852 The thread name, encoded as a 1853 <internallink id="mUTF">modified UTF-8</internallink> string. 1854 </description> 1855 </field> 1856 <field id="priority"> 1857 <jint/> 1858 <description> 1859 The thread priority. See the thread priority constants: 1860 <datalink id="jvmtiThreadPriority"></datalink>. 1861 </description> 1862 </field> 1863 <field id="is_daemon"> 1864 <jboolean/> 1865 <description> 1866 Is this a daemon thread? 1867 </description> 1868 </field> 1869 <field id="thread_group"> 1870 <jthreadGroup/> 1871 <description> 1872 The thread group to which this thread belongs. 1873 <code>NULL</code> if the thread has died. 1874 </description> 1875 </field> 1876 <field id="context_class_loader"> 1877 <jobject/> 1878 <description> 1879 The context class loader associated with this thread. 1880 </description> 1881 </field> 1882 </typedef> 1883 <description> 1884 Get thread information. The fields of the <datalink id="jvmtiThreadInfo"/> structure 1885 are filled in with details of the specified thread. 1886 </description> 1887 <origin>jvmdi</origin> 1888 <capabilities> 1889 </capabilities> 1890 <parameters> 1891 <param id="thread"> 1892 <jthread null="current" impl="noconvert" started="maybe"/> 1893 <description> 1894 The thread to query. 1895 </description> 1896 </param> 1897 <param id="info_ptr"> 1898 <outptr><struct>jvmtiThreadInfo</struct></outptr> 1899 <description> 1900 On return, filled with information describing the specified thread. 1901 </description> 1902 </param> 1903 </parameters> 1904 <errors> 1905 </errors> 1906 </function> 1907 1908 <function id="GetOwnedMonitorInfo" num="10"> 1909 <synopsis>Get Owned Monitor Info</synopsis> 1910 <description> 1911 Get information about the monitors owned by the 1912 specified thread. 1913 </description> 1914 <origin>jvmdiClone</origin> 1915 <capabilities> 1916 <required id="can_get_owned_monitor_info"></required> 1917 </capabilities> 1918 <parameters> 1919 <param id="thread"> 1920 <jthread null="current"/> 1921 <description> 1922 The thread to query. 1923 </description> 1924 </param> 1925 <param id="owned_monitor_count_ptr"> 1926 <outptr><jint/></outptr> 1927 <description> 1928 The number of monitors returned. 1929 </description> 1930 </param> 1931 <param id="owned_monitors_ptr"> 1932 <allocbuf outcount="owned_monitor_count_ptr"><jobject/></allocbuf> 1933 <description> 1934 The array of owned monitors. 1935 </description> 1936 </param> 1937 </parameters> 1938 <errors> 1939 </errors> 1940 </function> 1941 1942 <function id="GetOwnedMonitorStackDepthInfo" num="153" since="1.1"> 1943 <synopsis>Get Owned Monitor Stack Depth Info</synopsis> 1944 <typedef id="jvmtiMonitorStackDepthInfo" 1945 label="Monitor stack depth information structure"> 1946 <field id="monitor"> 1947 <jobject/> 1948 <description> 1949 The owned monitor. 1950 </description> 1951 </field> 1952 <field id="stack_depth"> 1953 <jint/> 1954 <description> 1955 The stack depth. Corresponds to the stack depth used in the 1956 <internallink id="stack">Stack Frame functions</internallink>. 1957 That is, zero is the current frame, one is the frame which 1958 called the current frame. And it is negative one if the 1959 implementation cannot determine the stack depth (e.g., for 1960 monitors acquired by JNI <code>MonitorEnter</code>). 1961 </description> 1962 </field> 1963 </typedef> 1964 <description> 1965 Get information about the monitors owned by the 1966 specified thread and the depth of the stack frame which locked them. 1967 </description> 1968 <origin>new</origin> 1969 <capabilities> 1970 <required id="can_get_owned_monitor_stack_depth_info"></required> 1971 </capabilities> 1972 <parameters> 1973 <param id="thread"> 1974 <jthread null="current"/> 1975 <description> 1976 The thread to query. 1977 </description> 1978 </param> 1979 <param id="monitor_info_count_ptr"> 1980 <outptr><jint/></outptr> 1981 <description> 1982 The number of monitors returned. 1983 </description> 1984 </param> 1985 <param id="monitor_info_ptr"> 1986 <allocbuf outcount="monitor_info_count_ptr"> 1987 <struct>jvmtiMonitorStackDepthInfo</struct> 1988 </allocbuf> 1989 <description> 1990 The array of owned monitor depth information. 1991 </description> 1992 </param> 1993 </parameters> 1994 <errors> 1995 </errors> 1996 </function> 1997 1998 <function id="GetCurrentContendedMonitor" num="11"> 1999 <synopsis>Get Current Contended Monitor</synopsis> 2000 <description> 2001 Get the object, if any, whose monitor the specified thread is waiting to 2002 enter or waiting to regain through <code>java.lang.Object.wait</code>. 2003 </description> 2004 <origin>jvmdi</origin> 2005 <capabilities> 2006 <required id="can_get_current_contended_monitor"></required> 2007 </capabilities> 2008 <parameters> 2009 <param id="thread"> 2010 <jthread null="current"/> 2011 <description> 2012 The thread to query. 2013 </description> 2014 </param> 2015 <param id="monitor_ptr"> 2016 <outptr><jobject/></outptr> 2017 <description> 2018 On return, filled with the current contended monitor, or 2019 NULL if there is none. 2020 </description> 2021 </param> 2022 </parameters> 2023 <errors> 2024 </errors> 2025 </function> 2026 2027 <callback id="jvmtiStartFunction"> 2028 <void/> 2029 <synopsis>Agent Start Function</synopsis> 2030 <description> 2031 Agent supplied callback function. 2032 This function is the entry point for an agent thread 2033 started with 2034 <functionlink id="RunAgentThread"></functionlink>. 2035 </description> 2036 <parameters> 2037 <param id="jvmti_env"> 2038 <outptr> 2039 <struct>jvmtiEnv</struct> 2040 </outptr> 2041 <description> 2042 The <jvmti/> environment. 2043 </description> 2044 </param> 2045 <param id="jni_env"> 2046 <outptr> 2047 <struct>JNIEnv</struct> 2048 </outptr> 2049 <description> 2050 The JNI environment. 2051 </description> 2052 </param> 2053 <param id="arg"> 2054 <outptr> 2055 <void/> 2056 </outptr> 2057 <description> 2058 The <code>arg</code> parameter passed to 2059 <functionlink id="RunAgentThread"></functionlink>. 2060 </description> 2061 </param> 2062 </parameters> 2063 </callback> 2064 2065 <function id="RunAgentThread" num="12"> 2066 <synopsis>Run Agent Thread</synopsis> 2067 <description> 2068 Starts the execution of an agent thread. with the specified native function. 2069 The parameter <paramlink id="arg"></paramlink> is forwarded on to the 2070 <functionlink id="jvmtiStartFunction">start function</functionlink> 2071 (specified with <paramlink id="proc"></paramlink>) as its single argument. 2072 This function allows the creation of agent threads 2073 for handling communication with another process or for handling events 2074 without the need to load a special subclass of <code>java.lang.Thread</code> or 2075 implementer of <code>java.lang.Runnable</code>. 2076 Instead, the created thread can run entirely in native code. 2077 However, the created thread does require a newly created instance 2078 of <code>java.lang.Thread</code> (referenced by the argument <code>thread</code>) to 2079 which it will be associated. 2080 The thread object can be created with JNI calls. 2081 <p/> 2082 The following common thread priorities are provided for your convenience: 2083 <constants id="jvmtiThreadPriority" label="Thread Priority Constants" kind="const"> 2084 <constant id="JVMTI_THREAD_MIN_PRIORITY" num="1"> 2085 Minimum possible thread priority 2086 </constant> 2087 <constant id="JVMTI_THREAD_NORM_PRIORITY" num="5"> 2088 Normal thread priority 2089 </constant> 2090 <constant id="JVMTI_THREAD_MAX_PRIORITY" num="10"> 2091 Maximum possible thread priority 2092 </constant> 2093 </constants> 2094 <p/> 2095 The new thread is started as a daemon thread with the specified 2096 <paramlink id="priority"></paramlink>. 2097 If enabled, a <eventlink id="ThreadStart"/> event will be sent. 2098 <p/> 2099 Since the thread has been started, the thread will be live when this function 2100 returns, unless the thread has died immediately. 2101 <p/> 2102 The thread group of the thread is ignored -- specifically, the thread is not 2103 added to the thread group and the thread is not seen on queries of the thread 2104 group at either the Java programming language or <jvmti/> levels. 2105 <p/> 2106 The thread is not visible to Java programming language queries but is 2107 included in <jvmti/> queries (for example, 2108 <functionlink id="GetAllThreads"/> and 2109 <functionlink id="GetAllStackTraces"/>). 2110 <p/> 2111 Upon execution of <code>proc</code>, the new thread will be attached to the 2112 VM--see the JNI documentation on 2113 <externallink id="docs/technotes/guides/jni/spec/invocation.html#attaching_to_the_vm" 2114 >Attaching to the VM</externallink>. 2115 </description> 2116 <origin>jvmdiClone</origin> 2117 <capabilities> 2118 </capabilities> 2119 <parameters> 2120 <param id="thread"> 2121 <jthread impl="noconvert" started="no"/> 2122 <description> 2123 The thread to run. 2124 </description> 2125 </param> 2126 <param id="proc"> 2127 <ptrtype> 2128 <struct>jvmtiStartFunction</struct> 2129 </ptrtype> 2130 <description> 2131 The start function. 2132 </description> 2133 </param> 2134 <param id="arg"> 2135 <inbuf> 2136 <void/> 2137 <nullok><code>NULL</code> is passed to the start function</nullok> 2138 </inbuf> 2139 <description> 2140 The argument to the start function. 2141 </description> 2142 </param> 2143 <param id="priority"> 2144 <jint/> 2145 <description> 2146 The priority of the started thread. Any thread 2147 priority allowed by <code>java.lang.Thread.setPriority</code> can be used including 2148 those in <datalink id="jvmtiThreadPriority"></datalink>. 2149 </description> 2150 </param> 2151 </parameters> 2152 <errors> 2153 <error id="JVMTI_ERROR_INVALID_PRIORITY"> 2154 <paramlink id="priority"/> is less than 2155 <datalink id="JVMTI_THREAD_MIN_PRIORITY"/> 2156 or greater than 2157 <datalink id="JVMTI_THREAD_MAX_PRIORITY"/> 2158 </error> 2159 </errors> 2160 </function> 2161 2162 <function id="SetThreadLocalStorage" jkernel="yes" impl="notrace" phase="start" num="103"> 2163 <synopsis>Set Thread Local Storage</synopsis> 2164 <description> 2165 The VM stores a pointer value associated with each environment-thread 2166 pair. This pointer value is called <i>thread-local storage</i>. 2167 This value is <code>NULL</code> unless set with this function. 2168 Agents can allocate memory in which they store thread specific 2169 information. By setting thread-local storage it can then be 2170 accessed with 2171 <functionlink id="GetThreadLocalStorage"></functionlink>. 2172 <p/> 2173 This function is called by the agent to set the value of the <jvmti/> 2174 thread-local storage. <jvmti/> supplies to the agent a pointer-size 2175 thread-local storage that can be used to record per-thread 2176 information. 2177 </description> 2178 <origin>jvmpi</origin> 2179 <capabilities> 2180 </capabilities> 2181 <parameters> 2182 <param id="thread"> 2183 <jthread null="current"/> 2184 <description> 2185 Store to this thread. 2186 </description> 2187 </param> 2188 <param id="data"> 2189 <inbuf> 2190 <void/> 2191 <nullok>value is set to <code>NULL</code></nullok> 2192 </inbuf> 2193 <description> 2194 The value to be entered into the thread-local storage. 2195 </description> 2196 </param> 2197 </parameters> 2198 <errors> 2199 </errors> 2200 </function> 2201 2202 <function id="GetThreadLocalStorage" jkernel="yes" impl="innative notrace" phase="start" num="102"> 2203 <synopsis>Get Thread Local Storage</synopsis> 2204 <description> 2205 Called by the agent to get the value of the <jvmti/> thread-local 2206 storage. 2207 </description> 2208 <origin>jvmpi</origin> 2209 <capabilities> 2210 </capabilities> 2211 <parameters> 2212 <param id="thread"> 2213 <jthread null="current" impl="noconvert"/> 2214 <description> 2215 Retrieve from this thread. 2216 </description> 2217 </param> 2218 <param id="data_ptr"> 2219 <agentbuf><void/></agentbuf> 2220 <description> 2221 Pointer through which the value of the thread local 2222 storage is returned. 2223 If thread-local storage has not been set with 2224 <functionlink id="SetThreadLocalStorage"></functionlink> the returned 2225 pointer is <code>NULL</code>. 2226 </description> 2227 </param> 2228 </parameters> 2229 <errors> 2230 </errors> 2231 </function> 2232 2233 </category> 2234 2235 <category id="thread_groups" label="Thread Group"> 2236 <intro> 2237 </intro> 2238 2239 <function id="GetTopThreadGroups" num="13"> 2240 <synopsis>Get Top Thread Groups</synopsis> 2241 <description> 2242 Return all top-level (parentless) thread groups in the VM. 2243 </description> 2244 <origin>jvmdi</origin> 2245 <capabilities> 2246 </capabilities> 2247 <parameters> 2248 <param id="group_count_ptr"> 2249 <outptr><jint/></outptr> 2250 <description> 2251 On return, points to the number of top-level thread groups. 2252 </description> 2253 </param> 2254 <param id="groups_ptr"> 2255 <allocbuf outcount="group_count_ptr"><jthreadGroup/></allocbuf> 2256 <description> 2257 On return, refers to a pointer to the top-level thread group array. 2258 </description> 2259 </param> 2260 </parameters> 2261 <errors> 2262 </errors> 2263 </function> 2264 2265 <function id="GetThreadGroupInfo" num="14"> 2266 <synopsis>Get Thread Group Info</synopsis> 2267 <typedef id="jvmtiThreadGroupInfo" label="Thread group information structure"> 2268 <field id="parent"> 2269 <jthreadGroup/> 2270 <description> 2271 The parent thread group. 2272 </description> 2273 </field> 2274 <field id="name"> 2275 <allocfieldbuf><char/></allocfieldbuf> 2276 <description> 2277 The thread group's name, encoded as a 2278 <internallink id="mUTF">modified UTF-8</internallink> string. 2279 </description> 2280 </field> 2281 <field id="max_priority"> 2282 <jint/> 2283 <description> 2284 The maximum priority for this thread group. 2285 </description> 2286 </field> 2287 <field id="is_daemon"> 2288 <jboolean/> 2289 <description> 2290 Is this a daemon thread group? 2291 </description> 2292 </field> 2293 </typedef> 2294 <description> 2295 Get information about the thread group. The fields of the 2296 <functionlink id="jvmtiThreadGroupInfo"></functionlink> structure 2297 are filled in with details of the specified thread group. 2298 </description> 2299 <origin>jvmdi</origin> 2300 <capabilities> 2301 </capabilities> 2302 <parameters> 2303 <param id="group"> 2304 <jthreadGroup/> 2305 <description> 2306 The thread group to query. 2307 </description> 2308 </param> 2309 <param id="info_ptr"> 2310 <outptr><struct>jvmtiThreadGroupInfo</struct></outptr> 2311 <description> 2312 On return, filled with information describing the specified 2313 thread group. 2314 </description> 2315 </param> 2316 </parameters> 2317 <errors> 2318 </errors> 2319 </function> 2320 2321 <function id="GetThreadGroupChildren" num="15"> 2322 <synopsis>Get Thread Group Children</synopsis> 2323 <description> 2324 Get the live threads and active subgroups in this thread group. 2325 </description> 2326 <origin>jvmdi</origin> 2327 <capabilities> 2328 </capabilities> 2329 <parameters> 2330 <param id="group"> 2331 <jthreadGroup/> 2332 <description> 2333 The group to query. 2334 </description> 2335 </param> 2336 <param id="thread_count_ptr"> 2337 <outptr><jint/></outptr> 2338 <description> 2339 On return, points to the number of live threads in this thread group. 2340 </description> 2341 </param> 2342 <param id="threads_ptr"> 2343 <allocbuf outcount="thread_count_ptr"><jthread/></allocbuf> 2344 <description> 2345 On return, points to an array of the live threads in this thread group. 2346 </description> 2347 </param> 2348 <param id="group_count_ptr"> 2349 <outptr><jint/></outptr> 2350 <description> 2351 On return, points to the number of active child thread groups 2352 </description> 2353 </param> 2354 <param id="groups_ptr"> 2355 <allocbuf outcount="group_count_ptr"><jthreadGroup/></allocbuf> 2356 <description> 2357 On return, points to an array of the active child thread groups. 2358 </description> 2359 </param> 2360 </parameters> 2361 <errors> 2362 </errors> 2363 </function> 2364 </category> 2365 2366 <category id="stack" label="Stack Frame"> 2367 <intro> 2368 These functions provide information about the stack of a thread. 2369 Stack frames are referenced by depth. 2370 The frame at depth zero is the current frame. 2371 <p/> 2372 Stack frames are as described in 2373 <vmspec chapter="3.6"/>, 2374 That is, they correspond to method 2375 invocations (including native methods) but do not correspond to platform native or 2376 VM internal frames. 2377 <p/> 2378 A <jvmti/> implementation may use method invocations to launch a thread and 2379 the corresponding frames may be included in the stack as presented by these functions -- 2380 that is, there may be frames shown 2381 deeper than <code>main()</code> and <code>run()</code>. 2382 However this presentation must be consistent across all <jvmti/> functionality which 2383 uses stack frames or stack depth. 2384 </intro> 2385 2386 <typedef id="jvmtiFrameInfo" label="Stack frame information structure"> 2387 <description> 2388 Information about a stack frame is returned in this structure. 2389 </description> 2390 <field id="method"> 2391 <jmethodID/> 2392 <description> 2393 The method executing in this frame. 2394 </description> 2395 </field> 2396 <field id="location"> 2397 <jlocation/> 2398 <description> 2399 The index of the instruction executing in this frame. 2400 <code>-1</code> if the frame is executing a native method. 2401 </description> 2402 </field> 2403 </typedef> 2404 2405 <typedef id="jvmtiStackInfo" label="Stack information structure"> 2406 <description> 2407 Information about a set of stack frames is returned in this structure. 2408 </description> 2409 <field id="thread"> 2410 <jthread/> 2411 <description> 2412 On return, the thread traced. 2413 </description> 2414 </field> 2415 <field id="state"> 2416 <jint/> 2417 <description> 2418 On return, the thread state. See <functionlink id="GetThreadState"></functionlink>. 2419 </description> 2420 </field> 2421 <field id="frame_buffer"> 2422 <outbuf incount="max_frame_count"> 2423 <struct>jvmtiFrameInfo</struct> 2424 </outbuf> 2425 <description> 2426 On return, this agent allocated buffer is filled 2427 with stack frame information. 2428 </description> 2429 </field> 2430 <field id="frame_count"> 2431 <jint/> 2432 <description> 2433 On return, the number of records filled into 2434 <code>frame_buffer</code>. 2435 This will be 2436 min(<code>max_frame_count</code>, <i>stackDepth</i>). 2437 </description> 2438 </field> 2439 </typedef> 2440 2441 <function id="GetStackTrace" num="104"> 2442 <synopsis>Get Stack Trace</synopsis> 2443 <description> 2444 Get information about the stack of a thread. 2445 If <paramlink id="max_frame_count"></paramlink> is less than the depth of the stack, 2446 the <paramlink id="max_frame_count"></paramlink> topmost frames are returned, 2447 otherwise the entire stack is returned. 2448 The topmost frames, those most recently invoked, are at the beginning of the returned buffer. 2449 <p/> 2450 The following example causes up to five of the topmost frames 2451 to be returned and (if there are any frames) the currently 2452 executing method name to be printed. 2453 <example> 2454 jvmtiFrameInfo frames[5]; 2455 jint count; 2456 jvmtiError err; 2457 2458 err = (*jvmti)->GetStackTrace(jvmti, aThread, 0, 5, 2459 frames, &count); 2460 if (err == JVMTI_ERROR_NONE && count >= 1) { 2461 char *methodName; 2462 err = (*jvmti)->GetMethodName(jvmti, frames[0].method, 2463 &methodName, NULL, NULL); 2464 if (err == JVMTI_ERROR_NONE) { 2465 printf("Executing method: %s", methodName); 2466 } 2467 } 2468 </example> 2469 <todo> 2470 check example code. 2471 </todo> 2472 <p/> 2473 The <paramlink id="thread"></paramlink> need not be suspended 2474 to call this function. 2475 <p/> 2476 The <functionlink id="GetLineNumberTable"></functionlink> 2477 function can be used to map locations to line numbers. Note that 2478 this mapping can be done lazily. 2479 </description> 2480 <origin>jvmpi</origin> 2481 <capabilities> 2482 </capabilities> 2483 <parameters> 2484 <param id="thread"> 2485 <jthread null="current"/> 2486 <description> 2487 Fetch the stack trace of this thread. 2488 </description> 2489 </param> 2490 <param id="start_depth"> 2491 <jint/> 2492 <description> 2493 Begin retrieving frames at this depth. 2494 If non-negative, count from the current frame, 2495 the first frame retrieved is at depth <code>start_depth</code>. 2496 For example, if zero, start from the current frame; if one, start from the 2497 caller of the current frame; if two, start from the caller of the 2498 caller of the current frame; and so on. 2499 If negative, count from below the oldest frame, 2500 the first frame retrieved is at depth <i>stackDepth</i><code> + start_depth</code>, 2501 where <i>stackDepth</i> is the count of frames on the stack. 2502 For example, if negative one, only the oldest frame is retrieved; 2503 if negative two, start from the frame called by the oldest frame. 2504 </description> 2505 </param> 2506 <param id="max_frame_count"> 2507 <jint min="0"/> 2508 <description> 2509 The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve. 2510 </description> 2511 </param> 2512 <param id="frame_buffer"> 2513 <outbuf incount="max_frame_count" outcount="count_ptr"> 2514 <struct>jvmtiFrameInfo</struct> 2515 </outbuf> 2516 <description> 2517 On return, this agent allocated buffer is filled 2518 with stack frame information. 2519 </description> 2520 </param> 2521 <param id="count_ptr"> 2522 <outptr><jint/></outptr> 2523 <description> 2524 On return, points to the number of records filled in. 2525 For non-negative <code>start_depth</code>, this will be 2526 min(<code>max_frame_count</code>, <i>stackDepth</i><code> - start_depth</code>). 2527 For negative <code>start_depth</code>, this will be 2528 min(<code>max_frame_count</code>, <code>-start_depth</code>). 2529 </description> 2530 </param> 2531 </parameters> 2532 <errors> 2533 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 2534 <paramlink id="start_depth"/> is positive and greater than or equal to <i>stackDepth</i>. 2535 Or <paramlink id="start_depth"/> is negative and less than <i>-stackDepth</i>. 2536 </error> 2537 </errors> 2538 </function> 2539 2540 2541 <function id="GetAllStackTraces" num="100"> 2542 <synopsis>Get All Stack Traces</synopsis> 2543 <description> 2544 Get information about the stacks of all live threads 2545 (including <internallink id="RunAgentThread">agent threads</internallink>). 2546 If <paramlink id="max_frame_count"/> is less than the depth of a stack, 2547 the <paramlink id="max_frame_count"/> topmost frames are returned for that thread, 2548 otherwise the entire stack is returned. 2549 The topmost frames, those most recently invoked, are at the beginning of the returned buffer. 2550 <p/> 2551 All stacks are collected simultaneously, that is, no changes will occur to the 2552 thread state or stacks between the sampling of one thread and the next. 2553 The threads need not be suspended. 2554 2555 <example> 2556 jvmtiStackInfo *stack_info; 2557 jint thread_count; 2558 int ti; 2559 jvmtiError err; 2560 2561 err = (*jvmti)->GetAllStackTraces(jvmti, MAX_FRAMES, &stack_info, &thread_count); 2562 if (err != JVMTI_ERROR_NONE) { 2563 ... 2564 } 2565 for (ti = 0; ti < thread_count; ++ti) { 2566 jvmtiStackInfo *infop = &stack_info[ti]; 2567 jthread thread = infop->thread; 2568 jint state = infop->state; 2569 jvmtiFrameInfo *frames = infop->frame_buffer; 2570 int fi; 2571 2572 myThreadAndStatePrinter(thread, state); 2573 for (fi = 0; fi < infop->frame_count; fi++) { 2574 myFramePrinter(frames[fi].method, frames[fi].location); 2575 } 2576 } 2577 /* this one Deallocate call frees all data allocated by GetAllStackTraces */ 2578 err = (*jvmti)->Deallocate(jvmti, stack_info); 2579 </example> 2580 <todo> 2581 check example code. 2582 </todo> 2583 2584 </description> 2585 <origin>new</origin> 2586 <capabilities> 2587 </capabilities> 2588 <parameters> 2589 <param id="max_frame_count"> 2590 <jint min="0"/> 2591 <description> 2592 The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve per thread. 2593 </description> 2594 </param> 2595 <param id="stack_info_ptr"> 2596 <allocbuf> 2597 <struct>jvmtiStackInfo</struct> 2598 </allocbuf> 2599 <description> 2600 On return, this buffer is filled 2601 with stack information for each thread. 2602 The number of <datalink id="jvmtiStackInfo"/> records is determined 2603 by <paramlink id="thread_count_ptr"/>. 2604 <p/> 2605 Note that this buffer is allocated to include the <datalink id="jvmtiFrameInfo"/> 2606 buffers pointed to by <datalink id="jvmtiStackInfo.frame_buffer"/>. 2607 These buffers must not be separately deallocated. 2608 </description> 2609 </param> 2610 <param id="thread_count_ptr"> 2611 <outptr><jint/></outptr> 2612 <description> 2613 The number of threads traced. 2614 </description> 2615 </param> 2616 </parameters> 2617 <errors> 2618 </errors> 2619 </function> 2620 2621 <function id="GetThreadListStackTraces" num="101"> 2622 <synopsis>Get Thread List Stack Traces</synopsis> 2623 <description> 2624 Get information about the stacks of the supplied threads. 2625 If <paramlink id="max_frame_count"/> is less than the depth of a stack, 2626 the <paramlink id="max_frame_count"/> topmost frames are returned for that thread, 2627 otherwise the entire stack is returned. 2628 The topmost frames, those most recently invoked, are at the beginning of the returned buffer. 2629 <p/> 2630 All stacks are collected simultaneously, that is, no changes will occur to the 2631 thread state or stacks between the sampling one thread and the next. 2632 The threads need not be suspended. 2633 <p/> 2634 If a thread has not yet started or terminates before the stack information is collected, 2635 a zero length stack (<datalink id="jvmtiStackInfo.frame_count"/> will be zero) 2636 will be returned and the thread <datalink id="jvmtiStackInfo.state"/> can be checked. 2637 <p/> 2638 See the example for the similar function 2639 <functionlink id="GetAllStackTraces"/>. 2640 </description> 2641 <origin>new</origin> 2642 <capabilities> 2643 </capabilities> 2644 <parameters> 2645 <param id="thread_count"> 2646 <jint min="0"/> 2647 <description> 2648 The number of threads to trace. 2649 </description> 2650 </param> 2651 <param id="thread_list"> 2652 <inbuf incount="thread_count"><jthread/></inbuf> 2653 <description> 2654 The list of threads to trace. 2655 </description> 2656 </param> 2657 <param id="max_frame_count"> 2658 <jint min="0"/> 2659 <description> 2660 The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve per thread. 2661 </description> 2662 </param> 2663 <param id="stack_info_ptr"> 2664 <allocbuf outcount="thread_count"> 2665 <struct>jvmtiStackInfo</struct> 2666 </allocbuf> 2667 <description> 2668 On return, this buffer is filled 2669 with stack information for each thread. 2670 The number of <datalink id="jvmtiStackInfo"/> records is determined 2671 by <paramlink id="thread_count"/>. 2672 <p/> 2673 Note that this buffer is allocated to include the <datalink id="jvmtiFrameInfo"/> 2674 buffers pointed to by <datalink id="jvmtiStackInfo.frame_buffer"/>. 2675 These buffers must not be separately deallocated. 2676 </description> 2677 </param> 2678 </parameters> 2679 <errors> 2680 <error id="JVMTI_ERROR_INVALID_THREAD"> 2681 An element in <paramlink id="thread_list"/> is not a thread object. 2682 </error> 2683 </errors> 2684 </function> 2685 2686 <elide> 2687 <function id="AsyncGetStackTrace" num="1000"> 2688 <synopsis>Get Stack Trace--Asynchronous</synopsis> 2689 <description> 2690 Get information about the entire stack of a thread (or a sub-section of it). 2691 This is the asynchronous version of <functionlink id="GetStackTrace"></functionlink> 2692 and is reentrant and safe to call 2693 from asynchronous signal handlers. 2694 The stack trace is returned only for the calling thread. 2695 <p/> 2696 The <functionlink id="GetLineNumberTable"></functionlink> 2697 function can be used to map locations to line numbers. Note that 2698 this mapping can be done lazily. 2699 </description> 2700 <origin>jvmpi</origin> 2701 <capabilities> 2702 <required id="can_get_async_stack_trace"></required> 2703 <capability id="can_show_JVM_spec_async_frames"> 2704 If <code>false</code>, 2705 <paramlink id="use_java_stack"></paramlink> 2706 must be <code>false</code>. 2707 </capability> 2708 </capabilities> 2709 <parameters> 2710 <param id="use_java_stack"> 2711 <jboolean/> 2712 <description> 2713 Return the stack showing <vmspec/> 2714 model of the stack; 2715 otherwise, show the internal representation of the stack with 2716 inlined and optimized methods missing. If the virtual machine 2717 is using the <i>Java Virtual Machine Specification</i> stack model 2718 internally, this flag is ignored. 2719 </description> 2720 </param> 2721 <param id="max_count"> 2722 <jint min="0"/> 2723 <description> 2724 The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve. 2725 Retrieve this many unless the stack depth is less than <code>max_count</code>. 2726 </description> 2727 </param> 2728 <param id="frame_buffer"> 2729 <outbuf incount="max_count" outcount="count_ptr"> 2730 <struct>jvmtiFrameInfo</struct> 2731 <nullok>this information is not returned</nullok> 2732 </outbuf> 2733 <description> 2734 The agent passes in a buffer 2735 large enough to hold <code>max_count</code> records of 2736 <datalink id="jvmtiFrameInfo"></datalink>. This buffer must be 2737 pre-allocated by the agent. 2738 </description> 2739 </param> 2740 <param id="count_ptr"> 2741 <outptr><jint/></outptr> 2742 <description> 2743 On return, points to the number of records filled in.. 2744 </description> 2745 </param> 2746 </parameters> 2747 <errors> 2748 <error id="JVMTI_ERROR_UNATTACHED_THREAD"> 2749 The thread being used to call this function is not attached 2750 to the virtual machine. Calls must be made from attached threads. 2751 </error> 2752 </errors> 2753 </function> 2754 </elide> 2755 2756 <function id="GetFrameCount" num="16"> 2757 <synopsis>Get Frame Count</synopsis> 2758 <description> 2759 Get the number of frames currently in the specified thread's call stack. 2760 <p/> 2761 If this function is called for a thread actively executing bytecodes (for example, 2762 not the current thread and not suspended), the information returned is transient. 2763 </description> 2764 <origin>jvmdi</origin> 2765 <capabilities> 2766 </capabilities> 2767 <parameters> 2768 <param id="thread"> 2769 <jthread null="current"/> 2770 <description> 2771 The thread to query. 2772 </description> 2773 </param> 2774 <param id="count_ptr"> 2775 <outptr><jint/></outptr> 2776 <description> 2777 On return, points to the number of frames in the call stack. 2778 </description> 2779 </param> 2780 </parameters> 2781 <errors> 2782 </errors> 2783 </function> 2784 2785 <function id="PopFrame" num="80"> 2786 <synopsis>Pop Frame</synopsis> 2787 <description> 2788 Pop the current frame of <code>thread</code>'s stack. 2789 Popping a frame takes you to the previous frame. 2790 When the thread is resumed, the execution 2791 state of the thread is reset to the state 2792 immediately before the called method was invoked. 2793 That is (using <vmspec/> terminology): 2794 <ul> 2795 <li>the current frame is discarded as the previous frame becomes the current one</li> 2796 <li>the operand stack is restored--the argument values are added back 2797 and if the invoke was not <code>invokestatic</code>, 2798 <code>objectref</code> is added back as well</li> 2799 <li>the Java virtual machine PC is restored to the opcode 2800 of the invoke instruction</li> 2801 </ul> 2802 Note however, that any changes to the arguments, which 2803 occurred in the called method, remain; 2804 when execution continues, the first instruction to 2805 execute will be the invoke. 2806 <p/> 2807 Between calling <code>PopFrame</code> and resuming the 2808 thread the state of the stack is undefined. 2809 To pop frames beyond the first, 2810 these three steps must be repeated: 2811 <ul> 2812 <li>suspend the thread via an event (step, breakpoint, ...)</li> 2813 <li>call <code>PopFrame</code></li> 2814 <li>resume the thread</li> 2815 </ul> 2816 <p/> 2817 A lock acquired by calling the called method 2818 (if it is a <code>synchronized</code> method) 2819 and locks acquired by entering <code>synchronized</code> 2820 blocks within the called method are released. 2821 Note: this does not apply to native locks or 2822 <code>java.util.concurrent.locks</code> locks. 2823 <p/> 2824 Finally blocks are not executed. 2825 <p/> 2826 Changes to global state are not addressed and thus remain changed. 2827 <p/> 2828 The specified thread must be suspended (which implies it cannot be the current thread). 2829 <p/> 2830 Both the called method and calling method must be non-native Java programming 2831 language methods. 2832 <p/> 2833 No <jvmti/> events are generated by this function. 2834 </description> 2835 <origin>jvmdi</origin> 2836 <capabilities> 2837 <required id="can_pop_frame"></required> 2838 </capabilities> 2839 <parameters> 2840 <param id="thread"> 2841 <jthread/> 2842 <description> 2843 The thread whose current frame is to be popped. 2844 </description> 2845 </param> 2846 </parameters> 2847 <errors> 2848 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 2849 Called or calling method is a native method. 2850 The implementation is unable to pop this frame. 2851 </error> 2852 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 2853 Thread was not suspended. 2854 </error> 2855 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 2856 There are less than two stack frames on the call stack. 2857 </error> 2858 </errors> 2859 </function> 2860 2861 <function id="GetFrameLocation" num="19"> 2862 <synopsis>Get Frame Location</synopsis> 2863 <description> 2864 <p/> 2865 For a Java programming language frame, return the location of the instruction 2866 currently executing. 2867 </description> 2868 <origin>jvmdiClone</origin> 2869 <capabilities> 2870 </capabilities> 2871 <parameters> 2872 <param id="thread"> 2873 <jthread null="current" frame="frame"/> 2874 <description> 2875 The thread of the frame to query. 2876 </description> 2877 </param> 2878 <param id="depth"> 2879 <jframeID thread="thread"/> 2880 <description> 2881 The depth of the frame to query. 2882 </description> 2883 </param> 2884 <param id="method_ptr"> 2885 <outptr><jmethodID/></outptr> 2886 <description> 2887 On return, points to the method for the current location. 2888 </description> 2889 </param> 2890 <param id="location_ptr"> 2891 <outptr><jlocation/></outptr> 2892 <description> 2893 On return, points to the index of the currently 2894 executing instruction. 2895 Is set to <code>-1</code> if the frame is executing 2896 a native method. 2897 </description> 2898 </param> 2899 </parameters> 2900 <errors> 2901 </errors> 2902 </function> 2903 2904 <function id="NotifyFramePop" num="20"> 2905 <synopsis>Notify Frame Pop</synopsis> 2906 <description> 2907 When the frame that is currently at <paramlink id="depth"></paramlink> 2908 is popped from the stack, generate a 2909 <eventlink id="FramePop"></eventlink> event. See the 2910 <eventlink id="FramePop"></eventlink> event for details. 2911 Only frames corresponding to non-native Java programming language 2912 methods can receive notification. 2913 <p/> 2914 The specified thread must either be the current thread 2915 or the thread must be suspended. 2916 </description> 2917 <origin>jvmdi</origin> 2918 <capabilities> 2919 <required id="can_generate_frame_pop_events"></required> 2920 </capabilities> 2921 <parameters> 2922 <param id="thread"> 2923 <jthread null="current" frame="depth"/> 2924 <description> 2925 The thread of the frame for which the frame pop event will be generated. 2926 </description> 2927 </param> 2928 <param id="depth"> 2929 <jframeID thread="thread"/> 2930 <description> 2931 The depth of the frame for which the frame pop event will be generated. 2932 </description> 2933 </param> 2934 </parameters> 2935 <errors> 2936 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 2937 The frame at <code>depth</code> is executing a 2938 native method. 2939 </error> 2940 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 2941 Thread was not suspended and was not the current thread. 2942 </error> 2943 </errors> 2944 </function> 2945 2946 </category> 2947 2948 <category id="ForceEarlyReturn" label="Force Early Return"> 2949 <intro> 2950 These functions allow an agent to force a method 2951 to return at any point during its execution. 2952 The method which will return early is referred to as the <i>called method</i>. 2953 The called method is the current method 2954 (as defined by 2955 <vmspec chapter="3.6"/>) 2956 for the specified thread at 2957 the time the function is called. 2958 <p/> 2959 The specified thread must be suspended or must be the current thread. 2960 The return occurs when execution of Java programming 2961 language code is resumed on this thread. 2962 Between calling one of these functions and resumption 2963 of thread execution, the state of the stack is undefined. 2964 <p/> 2965 No further instructions are executed in the called method. 2966 Specifically, finally blocks are not executed. 2967 Note: this can cause inconsistent states in the application. 2968 <p/> 2969 A lock acquired by calling the called method 2970 (if it is a <code>synchronized</code> method) 2971 and locks acquired by entering <code>synchronized</code> 2972 blocks within the called method are released. 2973 Note: this does not apply to native locks or 2974 <code>java.util.concurrent.locks</code> locks. 2975 <p/> 2976 Events, such as <eventlink id="MethodExit"></eventlink>, 2977 are generated as they would be in a normal return. 2978 <p/> 2979 The called method must be a non-native Java programming 2980 language method. 2981 Forcing return on a thread with only one frame on the 2982 stack causes the thread to exit when resumed. 2983 </intro> 2984 2985 <function id="ForceEarlyReturnObject" num="81" since="1.1"> 2986 <synopsis>Force Early Return - Object</synopsis> 2987 <description> 2988 This function can be used to return from a method whose 2989 result type is <code>Object</code> 2990 or a subclass of <code>Object</code>. 2991 </description> 2992 <origin>new</origin> 2993 <capabilities> 2994 <required id="can_force_early_return"></required> 2995 </capabilities> 2996 <parameters> 2997 <param id="thread"> 2998 <jthread null="current"/> 2999 <description> 3000 The thread whose current frame is to return early. 3001 </description> 3002 </param> 3003 <param id="value"> 3004 <jobject/> 3005 <description> 3006 The return value for the called frame. 3007 An object or <code>NULL</code>. 3008 </description> 3009 </param> 3010 </parameters> 3011 <errors> 3012 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3013 Attempted to return early from a frame 3014 corresponding to a native method. 3015 Or the implementation is unable to provide 3016 this functionality on this frame. 3017 </error> 3018 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3019 The result type of the called method is not 3020 <code>Object</code> or a subclass of <code>Object</code>. 3021 </error> 3022 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3023 The supplied <paramlink id="value"/> is not compatible with the 3024 result type of the called method. 3025 </error> 3026 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3027 Thread was not the current thread and was not suspended. 3028 </error> 3029 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3030 There are no more frames on the call stack. 3031 </error> 3032 </errors> 3033 </function> 3034 3035 <function id="ForceEarlyReturnInt" num="82" since="1.1"> 3036 <synopsis>Force Early Return - Int</synopsis> 3037 <description> 3038 This function can be used to return from a method whose 3039 result type is <code>int</code>, <code>short</code>, 3040 <code>char</code>, <code>byte</code>, or 3041 <code>boolean</code>. 3042 </description> 3043 <origin>new</origin> 3044 <capabilities> 3045 <required id="can_force_early_return"></required> 3046 </capabilities> 3047 <parameters> 3048 <param id="thread"> 3049 <jthread null="current"/> 3050 <description> 3051 The thread whose current frame is to return early. 3052 </description> 3053 </param> 3054 <param id="value"> 3055 <jint/> 3056 <description> 3057 The return value for the called frame. 3058 </description> 3059 </param> 3060 </parameters> 3061 <errors> 3062 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3063 Attempted to return early from a frame 3064 corresponding to a native method. 3065 Or the implementation is unable to provide 3066 this functionality on this frame. 3067 </error> 3068 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3069 The result type of the called method is not 3070 <code>int</code>, <code>short</code>, 3071 <code>char</code>, <code>byte</code>, or 3072 <code>boolean</code>. 3073 </error> 3074 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3075 Thread was not the current thread and was not suspended. 3076 </error> 3077 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3078 There are no frames on the call stack. 3079 </error> 3080 </errors> 3081 </function> 3082 3083 <function id="ForceEarlyReturnLong" num="83" since="1.1"> 3084 <synopsis>Force Early Return - Long</synopsis> 3085 <description> 3086 This function can be used to return from a method whose 3087 result type is <code>long</code>. 3088 </description> 3089 <origin>new</origin> 3090 <capabilities> 3091 <required id="can_force_early_return"></required> 3092 </capabilities> 3093 <parameters> 3094 <param id="thread"> 3095 <jthread null="current"/> 3096 <description> 3097 The thread whose current frame is to return early. 3098 </description> 3099 </param> 3100 <param id="value"> 3101 <jlong/> 3102 <description> 3103 The return value for the called frame. 3104 </description> 3105 </param> 3106 </parameters> 3107 <errors> 3108 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3109 Attempted to return early from a frame 3110 corresponding to a native method. 3111 Or the implementation is unable to provide 3112 this functionality on this frame. 3113 </error> 3114 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3115 The result type of the called method is not <code>long</code>. 3116 </error> 3117 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3118 Thread was not the current thread and was not suspended. 3119 </error> 3120 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3121 There are no frames on the call stack. 3122 </error> 3123 </errors> 3124 </function> 3125 3126 <function id="ForceEarlyReturnFloat" num="84" since="1.1"> 3127 <synopsis>Force Early Return - Float</synopsis> 3128 <description> 3129 This function can be used to return from a method whose 3130 result type is <code>float</code>. 3131 </description> 3132 <origin>new</origin> 3133 <capabilities> 3134 <required id="can_force_early_return"></required> 3135 </capabilities> 3136 <parameters> 3137 <param id="thread"> 3138 <jthread null="current"/> 3139 <description> 3140 The thread whose current frame is to return early. 3141 </description> 3142 </param> 3143 <param id="value"> 3144 <jfloat/> 3145 <description> 3146 The return value for the called frame. 3147 </description> 3148 </param> 3149 </parameters> 3150 <errors> 3151 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3152 Attempted to return early from a frame 3153 corresponding to a native method. 3154 Or the implementation is unable to provide 3155 this functionality on this frame. 3156 </error> 3157 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3158 The result type of the called method is not <code>float</code>. 3159 </error> 3160 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3161 Thread was not the current thread and was not suspended. 3162 </error> 3163 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3164 There are no frames on the call stack. 3165 </error> 3166 </errors> 3167 </function> 3168 3169 <function id="ForceEarlyReturnDouble" num="85" since="1.1"> 3170 <synopsis>Force Early Return - Double</synopsis> 3171 <description> 3172 This function can be used to return from a method whose 3173 result type is <code>double</code>. 3174 </description> 3175 <origin>new</origin> 3176 <capabilities> 3177 <required id="can_force_early_return"></required> 3178 </capabilities> 3179 <parameters> 3180 <param id="thread"> 3181 <jthread null="current"/> 3182 <description> 3183 The thread whose current frame is to return early. 3184 </description> 3185 </param> 3186 <param id="value"> 3187 <jdouble/> 3188 <description> 3189 The return value for the called frame. 3190 </description> 3191 </param> 3192 </parameters> 3193 <errors> 3194 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3195 Attempted to return early from a frame corresponding to a native method. 3196 Or the implementation is unable to provide this functionality on this frame. 3197 </error> 3198 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3199 The result type of the called method is not <code>double</code>. 3200 </error> 3201 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3202 Thread was not the current thread and was not suspended. 3203 </error> 3204 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3205 There are no frames on the call stack. 3206 </error> 3207 </errors> 3208 </function> 3209 3210 <function id="ForceEarlyReturnVoid" num="86" since="1.1"> 3211 <synopsis>Force Early Return - Void</synopsis> 3212 <description> 3213 This function can be used to return from a method with no result type. 3214 That is, the called method must be declared <code>void</code>. 3215 </description> 3216 <origin>new</origin> 3217 <capabilities> 3218 <required id="can_force_early_return"></required> 3219 </capabilities> 3220 <parameters> 3221 <param id="thread"> 3222 <jthread null="current"/> 3223 <description> 3224 The thread whose current frame is to return early. 3225 </description> 3226 </param> 3227 </parameters> 3228 <errors> 3229 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3230 Attempted to return early from a frame 3231 corresponding to a native method. 3232 Or the implementation is unable to provide 3233 this functionality on this frame. 3234 </error> 3235 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3236 The called method has a result type. 3237 </error> 3238 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3239 Thread was not the current thread and was not suspended. 3240 </error> 3241 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3242 There are no frames on the call stack. 3243 </error> 3244 </errors> 3245 </function> 3246 3247 </category> 3248 3249 <category id="Heap" label="Heap"> 3250 <intro> 3251 These functions are used to analyze the heap. 3252 Functionality includes the ability to view the objects in the 3253 heap and to tag these objects. 3254 </intro> 3255 3256 <intro id="objectTags" label="Object Tags"> 3257 A <i>tag</i> is a value associated with an object. 3258 Tags are explicitly set by the agent using the 3259 <functionlink id="SetTag"></functionlink> function or by 3260 callback functions such as <functionlink id="jvmtiHeapIterationCallback"/>. 3261 <p/> 3262 Tags are local to the environment; that is, the tags of one 3263 environment are not visible in another. 3264 <p/> 3265 Tags are <code>jlong</code> values which can be used 3266 simply to mark an object or to store a pointer to more detailed 3267 information. Objects which have not been tagged have a 3268 tag of zero. 3269 Setting a tag to zero makes the object untagged. 3270 </intro> 3271 3272 <intro id="heapCallbacks" label="Heap Callback Functions"> 3273 Heap functions which iterate through the heap and recursively 3274 follow object references use agent supplied callback functions 3275 to deliver the information. 3276 <p/> 3277 These heap callback functions must adhere to the following restrictions -- 3278 These callbacks must not use JNI functions. 3279 These callbacks must not use <jvmti/> functions except 3280 <i>callback safe</i> functions which 3281 specifically allow such use (see the raw monitor, memory management, 3282 and environment local storage functions). 3283 <p/> 3284 An implementation may invoke a callback on an internal thread or 3285 the thread which called the iteration function. 3286 Heap callbacks are single threaded -- no more than one callback will 3287 be invoked at a time. 3288 <p/> 3289 The Heap Filter Flags can be used to prevent reporting 3290 based on the tag status of an object or its class. 3291 If no flags are set (the <code>jint</code> is zero), objects 3292 will not be filtered out. 3293 3294 <constants id="jvmtiHeapFilter" label="Heap Filter Flags" kind="bits"> 3295 <constant id="JVMTI_HEAP_FILTER_TAGGED" num="0x4"> 3296 Filter out tagged objects. Objects which are tagged are not included. 3297 </constant> 3298 <constant id="JVMTI_HEAP_FILTER_UNTAGGED" num="0x8"> 3299 Filter out untagged objects. Objects which are not tagged are not included. 3300 </constant> 3301 <constant id="JVMTI_HEAP_FILTER_CLASS_TAGGED" num="0x10"> 3302 Filter out objects with tagged classes. Objects whose class is tagged are not included. 3303 </constant> 3304 <constant id="JVMTI_HEAP_FILTER_CLASS_UNTAGGED" num="0x20"> 3305 Filter out objects with untagged classes. Objects whose class is not tagged are not included. 3306 </constant> 3307 </constants> 3308 3309 <p/> 3310 The Heap Visit Control Flags are returned by the heap callbacks 3311 and can be used to abort the iteration. For the 3312 <functionlink id="jvmtiHeapReferenceCallback">Heap 3313 Reference Callback</functionlink>, it can also be used 3314 to prune the graph of traversed references 3315 (<code>JVMTI_VISIT_OBJECTS</code> is not set). 3316 3317 <constants id="jvmtiHeapVisitControl" 3318 label="Heap Visit Control Flags" 3319 kind="bits" 3320 since="1.1"> 3321 <constant id="JVMTI_VISIT_OBJECTS" num="0x100"> 3322 If we are visiting an object and if this callback 3323 was initiated by <functionlink id="FollowReferences"/>, 3324 traverse the references of this object. 3325 Otherwise ignored. 3326 </constant> 3327 <constant id="JVMTI_VISIT_ABORT" num="0x8000"> 3328 Abort the iteration. Ignore all other bits. 3329 </constant> 3330 </constants> 3331 3332 <p/> 3333 The Heap Reference Enumeration is provided by the 3334 <functionlink id="jvmtiHeapReferenceCallback">Heap 3335 Reference Callback</functionlink> and 3336 <functionlink id="jvmtiPrimitiveFieldCallback">Primitive Field 3337 Callback</functionlink> to 3338 describe the kind of reference 3339 being reported. 3340 3341 <constants id="jvmtiHeapReferenceKind" 3342 label="Heap Reference Enumeration" 3343 kind="enum" 3344 since="1.1"> 3345 <constant id="JVMTI_HEAP_REFERENCE_CLASS" num="1"> 3346 Reference from an object to its class. 3347 </constant> 3348 <constant id="JVMTI_HEAP_REFERENCE_FIELD" num="2"> 3349 Reference from an object to the value of one of its instance fields. 3350 </constant> 3351 <constant id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT" num="3"> 3352 Reference from an array to one of its elements. 3353 </constant> 3354 <constant id="JVMTI_HEAP_REFERENCE_CLASS_LOADER" num="4"> 3355 Reference from a class to its class loader. 3356 </constant> 3357 <constant id="JVMTI_HEAP_REFERENCE_SIGNERS" num="5"> 3358 Reference from a class to its signers array. 3359 </constant> 3360 <constant id="JVMTI_HEAP_REFERENCE_PROTECTION_DOMAIN" num="6"> 3361 Reference from a class to its protection domain. 3362 </constant> 3363 <constant id="JVMTI_HEAP_REFERENCE_INTERFACE" num="7"> 3364 Reference from a class to one of its interfaces. 3365 Note: interfaces are defined via a constant pool reference, 3366 so the referenced interfaces may also be reported with a 3367 <code>JVMTI_HEAP_REFERENCE_CONSTANT_POOL</code> reference kind. 3368 </constant> 3369 <constant id="JVMTI_HEAP_REFERENCE_STATIC_FIELD" num="8"> 3370 Reference from a class to the value of one of its static fields. 3371 </constant> 3372 <constant id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL" num="9"> 3373 Reference from a class to a resolved entry in the constant pool. 3374 </constant> 3375 <constant id="JVMTI_HEAP_REFERENCE_SUPERCLASS" num="10"> 3376 Reference from a class to its superclass. 3377 A callback is bot sent if the superclass is <code>java.lang.Object</code>. 3378 Note: loaded classes define superclasses via a constant pool 3379 reference, so the referenced superclass may also be reported with 3380 a <code>JVMTI_HEAP_REFERENCE_CONSTANT_POOL</code> reference kind. 3381 </constant> 3382 <constant id="JVMTI_HEAP_REFERENCE_JNI_GLOBAL" num="21"> 3383 Heap root reference: JNI global reference. 3384 </constant> 3385 <constant id="JVMTI_HEAP_REFERENCE_SYSTEM_CLASS" num="22"> 3386 Heap root reference: System class. 3387 </constant> 3388 <constant id="JVMTI_HEAP_REFERENCE_MONITOR" num="23"> 3389 Heap root reference: monitor. 3390 </constant> 3391 <constant id="JVMTI_HEAP_REFERENCE_STACK_LOCAL" num="24"> 3392 Heap root reference: local variable on the stack. 3393 </constant> 3394 <constant id="JVMTI_HEAP_REFERENCE_JNI_LOCAL" num="25"> 3395 Heap root reference: JNI local reference. 3396 </constant> 3397 <constant id="JVMTI_HEAP_REFERENCE_THREAD" num="26"> 3398 Heap root reference: Thread. 3399 </constant> 3400 <constant id="JVMTI_HEAP_REFERENCE_OTHER" num="27"> 3401 Heap root reference: other heap root reference. 3402 </constant> 3403 </constants> 3404 3405 <p/> 3406 Definitions for the single character type descriptors of 3407 primitive types. 3408 3409 <constants id="jvmtiPrimitiveType" 3410 label="Primitive Type Enumeration" 3411 kind="enum" 3412 since="1.1"> 3413 <constant id="JVMTI_PRIMITIVE_TYPE_BOOLEAN" num="90"> 3414 'Z' - Java programming language <code>boolean</code> - JNI <code>jboolean</code> 3415 </constant> 3416 <constant id="JVMTI_PRIMITIVE_TYPE_BYTE" num="66"> 3417 'B' - Java programming language <code>byte</code> - JNI <code>jbyte</code> 3418 </constant> 3419 <constant id="JVMTI_PRIMITIVE_TYPE_CHAR" num="67"> 3420 'C' - Java programming language <code>char</code> - JNI <code>jchar</code> 3421 </constant> 3422 <constant id="JVMTI_PRIMITIVE_TYPE_SHORT" num="83"> 3423 'S' - Java programming language <code>short</code> - JNI <code>jshort</code> 3424 </constant> 3425 <constant id="JVMTI_PRIMITIVE_TYPE_INT" num="73"> 3426 'I' - Java programming language <code>int</code> - JNI <code>jint</code> 3427 </constant> 3428 <constant id="JVMTI_PRIMITIVE_TYPE_LONG" num="74"> 3429 'J' - Java programming language <code>long</code> - JNI <code>jlong</code> 3430 </constant> 3431 <constant id="JVMTI_PRIMITIVE_TYPE_FLOAT" num="70"> 3432 'F' - Java programming language <code>float</code> - JNI <code>jfloat</code> 3433 </constant> 3434 <constant id="JVMTI_PRIMITIVE_TYPE_DOUBLE" num="68"> 3435 'D' - Java programming language <code>double</code> - JNI <code>jdouble</code> 3436 </constant> 3437 </constants> 3438 </intro> 3439 3440 <typedef id="jvmtiHeapReferenceInfoField" 3441 label="Reference information structure for Field references" 3442 since="1.1"> 3443 <description> 3444 Reference information returned for 3445 <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/> and 3446 <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/> references. 3447 </description> 3448 <field id="index"> 3449 <jint/> 3450 <description> 3451 For <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/>, the 3452 referrer object is not a class or an inteface. 3453 In this case, <code>index</code> is the index of the field 3454 in the class of the referrer object. 3455 This class is referred to below as <i>C</i>. 3456 <p/> 3457 For <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/>, 3458 the referrer object is a class (referred to below as <i>C</i>) 3459 or an interface (referred to below as <i>I</i>). 3460 In this case, <code>index</code> is the index of the field in 3461 that class or interface. 3462 <p/> 3463 If the referrer object is not an interface, then the field 3464 indices are determined as follows: 3465 <ul> 3466 <li>make a list of all the fields in <i>C</i> and its 3467 superclasses, starting with all the fields in 3468 <code>java.lang.Object</code> and ending with all the 3469 fields in <i>C</i>.</li> 3470 <li>Within this list, put 3471 the fields for a given class in the order returned by 3472 <functionlink id="GetClassFields"/>.</li> 3473 <li>Assign the fields in this list indices 3474 <i>n</i>, <i>n</i>+1, ..., in order, where <i>n</i> 3475 is the count of the fields in all the interfaces 3476 implemented by <i>C</i>. 3477 Note that <i>C</i> implements all interfaces 3478 directly implemented by its superclasses; as well 3479 as all superinterfaces of these interfaces.</li> 3480 </ul> 3481 If the referrer object is an interface, then the field 3482 indices are determined as follows: 3483 <ul> 3484 <li>make a list of the fields directly declared in 3485 <i>I</i>.</li> 3486 <li>Within this list, put 3487 the fields in the order returned by 3488 <functionlink id="GetClassFields"/>.</li> 3489 <li>Assign the fields in this list indices 3490 <i>n</i>, <i>n</i>+1, ..., in order, where <i>n</i> 3491 is the count of the fields in all the superinterfaces 3492 of <i>I</i>.</li> 3493 </ul> 3494 All fields are included in this computation, regardless of 3495 field modifier (static, public, private, etc). 3496 <p/> 3497 For example, given the following classes and interfaces: 3498 <example> 3499 interface I0 { 3500 int p = 0; 3501 } 3502 3503 interface I1 extends I0 { 3504 int x = 1; 3505 } 3506 3507 interface I2 extends I0 { 3508 int y = 2; 3509 } 3510 3511 class C1 implements I1 { 3512 public static int a = 3; 3513 private int b = 4; 3514 } 3515 3516 class C2 extends C1 implements I2 { 3517 static int q = 5; 3518 final int r = 6; 3519 } 3520 </example> 3521 Assume that <functionlink id="GetClassFields"/> called on 3522 <code>C1</code> returns the fields of <code>C1</code> in the 3523 order: a, b; and that the fields of <code>C2</code> are 3524 returned in the order: q, r. 3525 An instance of class <code>C1</code> will have the 3526 following field indices: 3527 <dl><dd><table> 3528 <tr> 3529 <td> 3530 a 3531 </td> 3532 <td> 3533 2 3534 </td> 3535 <td align="left"> 3536 The count of the fields in the interfaces 3537 implemented by <code>C1</code> is two (<i>n</i>=2): 3538 <code>p</code> of <code>I0</code> 3539 and <code>x</code> of <code>I1</code>. 3540 </td> 3541 </tr> 3542 <tr> 3543 <td> 3544 b 3545 </td> 3546 <td> 3547 3 3548 </td> 3549 <td align="left"> 3550 the subsequent index. 3551 </td> 3552 </tr> 3553 </table></dd></dl> 3554 The class <code>C1</code> will have the same field indices. 3555 <p/> 3556 An instance of class <code>C2</code> will have the 3557 following field indices: 3558 <dl><dd><table> 3559 <tr> 3560 <td> 3561 a 3562 </td> 3563 <td> 3564 3 3565 </td> 3566 <td align="left"> 3567 The count of the fields in the interfaces 3568 implemented by <code>C2</code> is three (<i>n</i>=3): 3569 <code>p</code> of <code>I0</code>, 3570 <code>x</code> of <code>I1</code> and <code>y</code> of <code>I2</code> 3571 (an interface of <code>C2</code>). Note that the field <code>p</code> 3572 of <code>I0</code> is only included once. 3573 </td> 3574 </tr> 3575 <tr> 3576 <td> 3577 b 3578 </td> 3579 <td> 3580 4 3581 </td> 3582 <td align="left"> 3583 the subsequent index to "a". 3584 </td> 3585 </tr> 3586 <tr> 3587 <td> 3588 q 3589 </td> 3590 <td> 3591 5 3592 </td> 3593 <td align="left"> 3594 the subsequent index to "b". 3595 </td> 3596 </tr> 3597 <tr> 3598 <td> 3599 r 3600 </td> 3601 <td> 3602 6 3603 </td> 3604 <td align="left"> 3605 the subsequent index to "q". 3606 </td> 3607 </tr> 3608 </table></dd></dl> 3609 The class <code>C2</code> will have the same field indices. 3610 Note that a field may have a different index depending on the 3611 object that is viewing it -- for example field "a" above. 3612 Note also: not all field indices may be visible from the 3613 callbacks, but all indices are shown for illustrative purposes. 3614 <p/> 3615 The interface <code>I1</code> will have the 3616 following field indices: 3617 <dl><dd><table> 3618 <tr> 3619 <td> 3620 x 3621 </td> 3622 <td> 3623 1 3624 </td> 3625 <td align="left"> 3626 The count of the fields in the superinterfaces 3627 of <code>I1</code> is one (<i>n</i>=1): 3628 <code>p</code> of <code>I0</code>. 3629 </td> 3630 </tr> 3631 </table></dd></dl> 3632 </description> 3633 </field> 3634 </typedef> 3635 3636 <typedef id="jvmtiHeapReferenceInfoArray" 3637 label="Reference information structure for Array references" 3638 since="1.1"> 3639 <description> 3640 Reference information returned for 3641 <datalink id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT"/> references. 3642 </description> 3643 <field id="index"> 3644 <jint/> 3645 <description> 3646 The array index. 3647 </description> 3648 </field> 3649 </typedef> 3650 3651 <typedef id="jvmtiHeapReferenceInfoConstantPool" 3652 label="Reference information structure for Constant Pool references" 3653 since="1.1"> 3654 <description> 3655 Reference information returned for 3656 <datalink id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL"/> references. 3657 </description> 3658 <field id="index"> 3659 <jint/> 3660 <description> 3661 The index into the constant pool of the class. See the description in 3662 <vmspec chapter="4.4"/>. 3663 </description> 3664 </field> 3665 </typedef> 3666 3667 <typedef id="jvmtiHeapReferenceInfoStackLocal" 3668 label="Reference information structure for Local Variable references" 3669 since="1.1"> 3670 <description> 3671 Reference information returned for 3672 <datalink id="JVMTI_HEAP_REFERENCE_STACK_LOCAL"/> references. 3673 </description> 3674 <field id="thread_tag"> 3675 <jlong/> 3676 <description> 3677 The tag of the thread corresponding to this stack, zero if not tagged. 3678 </description> 3679 </field> 3680 <field id="thread_id"> 3681 <jlong/> 3682 <description> 3683 The unique thread ID of the thread corresponding to this stack. 3684 </description> 3685 </field> 3686 <field id="depth"> 3687 <jint/> 3688 <description> 3689 The depth of the frame. 3690 </description> 3691 </field> 3692 <field id="method"> 3693 <jmethodID/> 3694 <description> 3695 The method executing in this frame. 3696 </description> 3697 </field> 3698 <field id="location"> 3699 <jlocation/> 3700 <description> 3701 The currently executing location in this frame. 3702 </description> 3703 </field> 3704 <field id="slot"> 3705 <jint/> 3706 <description> 3707 The slot number of the local variable. 3708 </description> 3709 </field> 3710 </typedef> 3711 3712 <typedef id="jvmtiHeapReferenceInfoJniLocal" 3713 label="Reference information structure for JNI local references" 3714 since="1.1"> 3715 <description> 3716 Reference information returned for 3717 <datalink id="JVMTI_HEAP_REFERENCE_JNI_LOCAL"/> references. 3718 </description> 3719 <field id="thread_tag"> 3720 <jlong/> 3721 <description> 3722 The tag of the thread corresponding to this stack, zero if not tagged. 3723 </description> 3724 </field> 3725 <field id="thread_id"> 3726 <jlong/> 3727 <description> 3728 The unique thread ID of the thread corresponding to this stack. 3729 </description> 3730 </field> 3731 <field id="depth"> 3732 <jint/> 3733 <description> 3734 The depth of the frame. 3735 </description> 3736 </field> 3737 <field id="method"> 3738 <jmethodID/> 3739 <description> 3740 The method executing in this frame. 3741 </description> 3742 </field> 3743 </typedef> 3744 3745 <typedef id="jvmtiHeapReferenceInfoReserved" 3746 label="Reference information structure for Other references" 3747 since="1.1"> 3748 <description> 3749 Reference information returned for other references. 3750 </description> 3751 <field id="reserved1"> 3752 <jlong/> 3753 <description> 3754 reserved for future use. 3755 </description> 3756 </field> 3757 <field id="reserved2"> 3758 <jlong/> 3759 <description> 3760 reserved for future use. 3761 </description> 3762 </field> 3763 <field id="reserved3"> 3764 <jlong/> 3765 <description> 3766 reserved for future use. 3767 </description> 3768 </field> 3769 <field id="reserved4"> 3770 <jlong/> 3771 <description> 3772 reserved for future use. 3773 </description> 3774 </field> 3775 <field id="reserved5"> 3776 <jlong/> 3777 <description> 3778 reserved for future use. 3779 </description> 3780 </field> 3781 <field id="reserved6"> 3782 <jlong/> 3783 <description> 3784 reserved for future use. 3785 </description> 3786 </field> 3787 <field id="reserved7"> 3788 <jlong/> 3789 <description> 3790 reserved for future use. 3791 </description> 3792 </field> 3793 <field id="reserved8"> 3794 <jlong/> 3795 <description> 3796 reserved for future use. 3797 </description> 3798 </field> 3799 </typedef> 3800 3801 <uniontypedef id="jvmtiHeapReferenceInfo" 3802 label="Reference information structure" 3803 since="1.1"> 3804 <description> 3805 The information returned about referrers. 3806 Represented as a union of the various kinds of reference information. 3807 </description> 3808 <field id="field"> 3809 <struct>jvmtiHeapReferenceInfoField</struct> 3810 <description> 3811 The referrer information for 3812 <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/> 3813 and <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/> references. 3814 </description> 3815 </field> 3816 <field id="array"> 3817 <struct>jvmtiHeapReferenceInfoArray</struct> 3818 <description> 3819 The referrer information for 3820 For <datalink id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT"/> references. 3821 </description> 3822 </field> 3823 <field id="constant_pool"> 3824 <struct>jvmtiHeapReferenceInfoConstantPool</struct> 3825 <description> 3826 The referrer information for 3827 For <datalink id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL"/> references. 3828 </description> 3829 </field> 3830 <field id="stack_local"> 3831 <struct>jvmtiHeapReferenceInfoStackLocal</struct> 3832 <description> 3833 The referrer information for 3834 For <datalink id="JVMTI_HEAP_REFERENCE_STACK_LOCAL"/> references. 3835 </description> 3836 </field> 3837 <field id="jni_local"> 3838 <struct>jvmtiHeapReferenceInfoJniLocal</struct> 3839 <description> 3840 The referrer information for 3841 For <datalink id="JVMTI_HEAP_REFERENCE_JNI_LOCAL"/> references. 3842 </description> 3843 </field> 3844 <field id="other"> 3845 <struct>jvmtiHeapReferenceInfoReserved</struct> 3846 <description> 3847 reserved for future use. 3848 </description> 3849 </field> 3850 </uniontypedef> 3851 3852 <typedef id="jvmtiHeapCallbacks" 3853 label="Heap callback function structure" 3854 since="1.1"> 3855 <field id="heap_iteration_callback"> 3856 <ptrtype> 3857 <struct>jvmtiHeapIterationCallback</struct> 3858 </ptrtype> 3859 <description> 3860 The callback to be called to describe an 3861 object in the heap. Used by the 3862 <functionlink id="IterateThroughHeap"/> function, ignored by the 3863 <functionlink id="FollowReferences"/> function. 3864 </description> 3865 </field> 3866 <field id="heap_reference_callback"> 3867 <ptrtype> 3868 <struct>jvmtiHeapReferenceCallback</struct> 3869 </ptrtype> 3870 <description> 3871 The callback to be called to describe an 3872 object reference. Used by the 3873 <functionlink id="FollowReferences"/> function, ignored by the 3874 <functionlink id="IterateThroughHeap"/> function. 3875 </description> 3876 </field> 3877 <field id="primitive_field_callback"> 3878 <ptrtype> 3879 <struct>jvmtiPrimitiveFieldCallback</struct> 3880 </ptrtype> 3881 <description> 3882 The callback to be called to describe a 3883 primitive field. 3884 </description> 3885 </field> 3886 <field id="array_primitive_value_callback"> 3887 <ptrtype> 3888 <struct>jvmtiArrayPrimitiveValueCallback</struct> 3889 </ptrtype> 3890 <description> 3891 The callback to be called to describe an 3892 array of primitive values. 3893 </description> 3894 </field> 3895 <field id="string_primitive_value_callback"> 3896 <ptrtype> 3897 <struct>jvmtiStringPrimitiveValueCallback</struct> 3898 </ptrtype> 3899 <description> 3900 The callback to be called to describe a String value. 3901 </description> 3902 </field> 3903 <field id="reserved5"> 3904 <ptrtype> 3905 <struct>jvmtiReservedCallback</struct> 3906 </ptrtype> 3907 <description> 3908 Reserved for future use.. 3909 </description> 3910 </field> 3911 <field id="reserved6"> 3912 <ptrtype> 3913 <struct>jvmtiReservedCallback</struct> 3914 </ptrtype> 3915 <description> 3916 Reserved for future use.. 3917 </description> 3918 </field> 3919 <field id="reserved7"> 3920 <ptrtype> 3921 <struct>jvmtiReservedCallback</struct> 3922 </ptrtype> 3923 <description> 3924 Reserved for future use.. 3925 </description> 3926 </field> 3927 <field id="reserved8"> 3928 <ptrtype> 3929 <struct>jvmtiReservedCallback</struct> 3930 </ptrtype> 3931 <description> 3932 Reserved for future use.. 3933 </description> 3934 </field> 3935 <field id="reserved9"> 3936 <ptrtype> 3937 <struct>jvmtiReservedCallback</struct> 3938 </ptrtype> 3939 <description> 3940 Reserved for future use.. 3941 </description> 3942 </field> 3943 <field id="reserved10"> 3944 <ptrtype> 3945 <struct>jvmtiReservedCallback</struct> 3946 </ptrtype> 3947 <description> 3948 Reserved for future use.. 3949 </description> 3950 </field> 3951 <field id="reserved11"> 3952 <ptrtype> 3953 <struct>jvmtiReservedCallback</struct> 3954 </ptrtype> 3955 <description> 3956 Reserved for future use.. 3957 </description> 3958 </field> 3959 <field id="reserved12"> 3960 <ptrtype> 3961 <struct>jvmtiReservedCallback</struct> 3962 </ptrtype> 3963 <description> 3964 Reserved for future use.. 3965 </description> 3966 </field> 3967 <field id="reserved13"> 3968 <ptrtype> 3969 <struct>jvmtiReservedCallback</struct> 3970 </ptrtype> 3971 <description> 3972 Reserved for future use.. 3973 </description> 3974 </field> 3975 <field id="reserved14"> 3976 <ptrtype> 3977 <struct>jvmtiReservedCallback</struct> 3978 </ptrtype> 3979 <description> 3980 Reserved for future use.. 3981 </description> 3982 </field> 3983 <field id="reserved15"> 3984 <ptrtype> 3985 <struct>jvmtiReservedCallback</struct> 3986 </ptrtype> 3987 <description> 3988 Reserved for future use.. 3989 </description> 3990 </field> 3991 </typedef> 3992 3993 3994 <intro> 3995 <rationale> 3996 The heap dumping functionality (below) uses a callback 3997 for each object. While it would seem that a buffered approach 3998 would provide better throughput, tests do 3999 not show this to be the case--possibly due to locality of 4000 memory reference or array access overhead. 4001 </rationale> 4002 4003 <issue> 4004 Still under investigation as to if java.lang.ref references 4005 are reported as a different type of reference. 4006 </issue> 4007 4008 <issue> 4009 Should or can an indication of the cost or relative cost of 4010 these operations be included? 4011 </issue> 4012 4013 </intro> 4014 4015 <callback id="jvmtiHeapIterationCallback" since="1.1"> 4016 <jint/> 4017 <synopsis>Heap Iteration Callback</synopsis> 4018 <description> 4019 Agent supplied callback function. 4020 Describes (but does not pass in) an object in the heap. 4021 <p/> 4022 This function should return a bit vector of the desired 4023 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>. 4024 This will determine if the entire iteration should be aborted 4025 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored). 4026 <p/> 4027 See the <internallink id="heapCallbacks">heap callback 4028 function restrictions</internallink>. 4029 </description> 4030 <parameters> 4031 <param id="class_tag"> 4032 <jlong/> 4033 <description> 4034 The tag of the class of object (zero if the class is not tagged). 4035 If the object represents a runtime class, 4036 the <code>class_tag</code> is the tag 4037 associated with <code>java.lang.Class</code> 4038 (zero if <code>java.lang.Class</code> is not tagged). 4039 </description> 4040 </param> 4041 <param id="size"> 4042 <jlong/> 4043 <description> 4044 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 4045 </description> 4046 </param> 4047 <param id="tag_ptr"> 4048 <outptr><jlong/></outptr> 4049 <description> 4050 The object tag value, or zero if the object is not tagged. 4051 To set the tag value to be associated with the object 4052 the agent sets the <code>jlong</code> pointed to by the parameter. 4053 </description> 4054 </param> 4055 <param id="length"> 4056 <jint/> 4057 <description> 4058 If this object is an array, the length of the array. Otherwise negative one (-1). 4059 </description> 4060 </param> 4061 <param id="user_data"> 4062 <outptr><void/></outptr> 4063 <description> 4064 The user supplied data that was passed into the iteration function. 4065 </description> 4066 </param> 4067 </parameters> 4068 </callback> 4069 4070 <callback id="jvmtiHeapReferenceCallback" since="1.1"> 4071 <jint/> 4072 <synopsis>Heap Reference Callback</synopsis> 4073 <description> 4074 Agent supplied callback function. 4075 Describes a reference from an object or the VM (the referrer) to another object 4076 (the referree) or a heap root to a referree. 4077 <p/> 4078 This function should return a bit vector of the desired 4079 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>. 4080 This will determine if the objects referenced by the referree 4081 should be visited or if the entire iteration should be aborted. 4082 <p/> 4083 See the <internallink id="heapCallbacks">heap callback 4084 function restrictions</internallink>. 4085 </description> 4086 <parameters> 4087 <param id="reference_kind"> 4088 <enum>jvmtiHeapReferenceKind</enum> 4089 <description> 4090 The kind of reference. 4091 </description> 4092 </param> 4093 <param id="reference_info"> 4094 <inptr> 4095 <struct>jvmtiHeapReferenceInfo</struct> 4096 </inptr> 4097 <description> 4098 Details about the reference. 4099 Set when the <datalink id="jvmtiHeapReferenceCallback.reference_kind">reference_kind</datalink> is 4100 <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/>, 4101 <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/>, 4102 <datalink id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT"/>, 4103 <datalink id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL"/>, 4104 <datalink id="JVMTI_HEAP_REFERENCE_STACK_LOCAL"/>, 4105 or <datalink id="JVMTI_HEAP_REFERENCE_JNI_LOCAL"/>. 4106 Otherwise <code>NULL</code>. 4107 </description> 4108 </param> 4109 <param id="class_tag"> 4110 <jlong/> 4111 <description> 4112 The tag of the class of referree object (zero if the class is not tagged). 4113 If the referree object represents a runtime class, 4114 the <code>class_tag</code> is the tag 4115 associated with <code>java.lang.Class</code> 4116 (zero if <code>java.lang.Class</code> is not tagged). 4117 </description> 4118 </param> 4119 <param id="referrer_class_tag"> 4120 <jlong/> 4121 <description> 4122 The tag of the class of the referrer object (zero if the class is not tagged 4123 or the referree is a heap root). If the referrer object represents a runtime 4124 class, the <code>referrer_class_tag</code> is the tag associated with 4125 the <code>java.lang.Class</code> 4126 (zero if <code>java.lang.Class</code> is not tagged). 4127 </description> 4128 </param> 4129 <param id="size"> 4130 <jlong/> 4131 <description> 4132 Size of the referree object (in bytes). 4133 See <functionlink id="GetObjectSize"/>. 4134 </description> 4135 </param> 4136 <param id="tag_ptr"> 4137 <outptr><jlong/></outptr> 4138 <description> 4139 Points to the referree object tag value, or zero if the object is not 4140 tagged. 4141 To set the tag value to be associated with the object 4142 the agent sets the <code>jlong</code> pointed to by the parameter. 4143 </description> 4144 </param> 4145 <param id="referrer_tag_ptr"> 4146 <outptr><jlong/></outptr> 4147 <description> 4148 Points to the tag of the referrer object, or 4149 points to the zero if the referrer 4150 object is not tagged. 4151 <code>NULL</code> if the referrer in not an object (that is, 4152 this callback is reporting a heap root). 4153 To set the tag value to be associated with the referrer object 4154 the agent sets the <code>jlong</code> pointed to by the parameter. 4155 If this callback is reporting a reference from an object to itself, 4156 <code>referrer_tag_ptr == tag_ptr</code>. 4157 </description> 4158 </param> 4159 <param id="length"> 4160 <jint/> 4161 <description> 4162 If this object is an array, the length of the array. Otherwise negative one (-1). 4163 </description> 4164 </param> 4165 <param id="user_data"> 4166 <outptr><void/></outptr> 4167 <description> 4168 The user supplied data that was passed into the iteration function. 4169 </description> 4170 </param> 4171 </parameters> 4172 </callback> 4173 4174 <callback id="jvmtiPrimitiveFieldCallback" since="1.1"> 4175 <jint/> 4176 <synopsis>Primitive Field Callback</synopsis> 4177 <description> 4178 Agent supplied callback function which 4179 describes a primitive field of an object (<i>the object</i>). 4180 A primitive field is a field whose type is a primitive type. 4181 This callback will describe a static field if the object is a class, 4182 and otherwise will describe an instance field. 4183 <p/> 4184 This function should return a bit vector of the desired 4185 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>. 4186 This will determine if the entire iteration should be aborted 4187 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored). 4188 <p/> 4189 See the <internallink id="heapCallbacks">heap callback 4190 function restrictions</internallink>. 4191 </description> 4192 <parameters> 4193 <param id="kind"> 4194 <enum>jvmtiHeapReferenceKind</enum> 4195 <description> 4196 The kind of field -- instance or static (<datalink id="JVMTI_HEAP_REFERENCE_FIELD"/> or 4197 <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/>). 4198 </description> 4199 </param> 4200 <param id="info"> 4201 <inptr> 4202 <struct>jvmtiHeapReferenceInfo</struct> 4203 </inptr> 4204 <description> 4205 Which field (the field index). 4206 </description> 4207 </param> 4208 <param id="object_class_tag"> 4209 <jlong/> 4210 <description> 4211 The tag of the class of the object (zero if the class is not tagged). 4212 If the object represents a runtime class, the 4213 <code>object_class_tag</code> is the tag 4214 associated with <code>java.lang.Class</code> 4215 (zero if <code>java.lang.Class</code> is not tagged). 4216 </description> 4217 </param> 4218 <param id="object_tag_ptr"> 4219 <outptr><jlong/></outptr> 4220 <description> 4221 Points to the tag of the object, or zero if the object is not 4222 tagged. 4223 To set the tag value to be associated with the object 4224 the agent sets the <code>jlong</code> pointed to by the parameter. 4225 </description> 4226 </param> 4227 <param id="value"> 4228 <jvalue/> 4229 <description> 4230 The value of the field. 4231 </description> 4232 </param> 4233 <param id="value_type"> 4234 <enum>jvmtiPrimitiveType</enum> 4235 <description> 4236 The type of the field. 4237 </description> 4238 </param> 4239 <param id="user_data"> 4240 <outptr><void/></outptr> 4241 <description> 4242 The user supplied data that was passed into the iteration function. 4243 </description> 4244 </param> 4245 </parameters> 4246 </callback> 4247 4248 <callback id="jvmtiArrayPrimitiveValueCallback" since="1.1"> 4249 <jint/> 4250 <synopsis>Array Primitive Value Callback</synopsis> 4251 <description> 4252 Agent supplied callback function. 4253 Describes the values in an array of a primitive type. 4254 <p/> 4255 This function should return a bit vector of the desired 4256 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>. 4257 This will determine if the entire iteration should be aborted 4258 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored). 4259 <p/> 4260 See the <internallink id="heapCallbacks">heap callback 4261 function restrictions</internallink>. 4262 </description> 4263 <parameters> 4264 <param id="class_tag"> 4265 <jlong/> 4266 <description> 4267 The tag of the class of the array object (zero if the class is not tagged). 4268 </description> 4269 </param> 4270 <param id="size"> 4271 <jlong/> 4272 <description> 4273 Size of the array (in bytes). 4274 See <functionlink id="GetObjectSize"/>. 4275 </description> 4276 </param> 4277 <param id="tag_ptr"> 4278 <outptr><jlong/></outptr> 4279 <description> 4280 Points to the tag of the array object, or zero if the object is not 4281 tagged. 4282 To set the tag value to be associated with the object 4283 the agent sets the <code>jlong</code> pointed to by the parameter. 4284 </description> 4285 </param> 4286 <param id="element_count"> 4287 <jint/> 4288 <description> 4289 The length of the primitive array. 4290 </description> 4291 </param> 4292 <param id="element_type"> 4293 <enum>jvmtiPrimitiveType</enum> 4294 <description> 4295 The type of the elements of the array. 4296 </description> 4297 </param> 4298 <param id="elements"> 4299 <vmbuf><void/></vmbuf> 4300 <description> 4301 The elements of the array in a packed array of <code>element_count</code> 4302 items of <code>element_type</code> size each. 4303 </description> 4304 </param> 4305 <param id="user_data"> 4306 <outptr><void/></outptr> 4307 <description> 4308 The user supplied data that was passed into the iteration function. 4309 </description> 4310 </param> 4311 </parameters> 4312 </callback> 4313 4314 <callback id="jvmtiStringPrimitiveValueCallback" since="1.1"> 4315 <jint/> 4316 <synopsis>String Primitive Value Callback</synopsis> 4317 <description> 4318 Agent supplied callback function. 4319 Describes the value of a java.lang.String. 4320 <p/> 4321 This function should return a bit vector of the desired 4322 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>. 4323 This will determine if the entire iteration should be aborted 4324 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored). 4325 <p/> 4326 See the <internallink id="heapCallbacks">heap callback 4327 function restrictions</internallink>. 4328 </description> 4329 <parameters> 4330 <param id="class_tag"> 4331 <jlong/> 4332 <description> 4333 The tag of the class of the String class (zero if the class is not tagged). 4334 <issue>Is this needed?</issue> 4335 </description> 4336 </param> 4337 <param id="size"> 4338 <jlong/> 4339 <description> 4340 Size of the string (in bytes). 4341 See <functionlink id="GetObjectSize"/>. 4342 </description> 4343 </param> 4344 <param id="tag_ptr"> 4345 <outptr><jlong/></outptr> 4346 <description> 4347 Points to the tag of the String object, or zero if the object is not 4348 tagged. 4349 To set the tag value to be associated with the object 4350 the agent sets the <code>jlong</code> pointed to by the parameter. 4351 </description> 4352 </param> 4353 <param id="value"> 4354 <vmbuf><jchar/></vmbuf> 4355 <description> 4356 The value of the String, encoded as a Unicode string. 4357 </description> 4358 </param> 4359 <param id="value_length"> 4360 <jint/> 4361 <description> 4362 The length of the string. 4363 The length is equal to the number of 16-bit Unicode 4364 characters in the string. 4365 </description> 4366 </param> 4367 <param id="user_data"> 4368 <outptr><void/></outptr> 4369 <description> 4370 The user supplied data that was passed into the iteration function. 4371 </description> 4372 </param> 4373 </parameters> 4374 </callback> 4375 4376 4377 <callback id="jvmtiReservedCallback" since="1.1"> 4378 <jint/> 4379 <synopsis>reserved for future use Callback</synopsis> 4380 <description> 4381 Placeholder -- reserved for future use. 4382 </description> 4383 <parameters> 4384 </parameters> 4385 </callback> 4386 4387 <function id="FollowReferences" num="115" since="1.1"> 4388 <synopsis>Follow References</synopsis> 4389 <description> 4390 This function initiates a traversal over the objects that are 4391 directly and indirectly reachable from the specified object or, 4392 if <code>initial_object</code> is not specified, all objects 4393 reachable from the heap roots. 4394 The heap root are the set of system classes, 4395 JNI globals, references from thread stacks, and other objects used as roots 4396 for the purposes of garbage collection. 4397 <p/> 4398 This function operates by traversing the reference graph. 4399 Let <i>A</i>, <i>B</i>, ... represent objects. 4400 When a reference from <i>A</i> to <i>B</i> is traversed, 4401 when a reference from a heap root to <i>B</i> is traversed, 4402 or when <i>B</i> is specified as the <paramlink id="initial_object"/>, 4403 then <i>B</i> is said to be <i>visited</i>. 4404 A reference from <i>A</i> to <i>B</i> is not traversed until <i>A</i> 4405 is visited. 4406 References are reported in the same order that the references are traversed. 4407 Object references are reported by invoking the agent supplied 4408 callback function <functionlink id="jvmtiHeapReferenceCallback"/>. 4409 In a reference from <i>A</i> to <i>B</i>, <i>A</i> is known 4410 as the <i>referrer</i> and <i>B</i> as the <i>referree</i>. 4411 The callback is invoked exactly once for each reference from a referrer; 4412 this is true even if there are reference cycles or multiple paths to 4413 the referrer. 4414 There may be more than one reference between a referrer and a referree, 4415 each reference is reported. 4416 These references may be distinguished by examining the 4417 <datalink 4418 id="jvmtiHeapReferenceCallback.reference_kind"><code>reference_kind</code></datalink> 4419 and 4420 <datalink 4421 id="jvmtiHeapReferenceCallback.reference_info"><code>reference_info</code></datalink> 4422 parameters of the <functionlink id="jvmtiHeapReferenceCallback"/> callback. 4423 <p/> 4424 This function reports a Java programming language view of object references, 4425 not a virtual machine implementation view. The following object references 4426 are reported when they are non-null: 4427 <ul> 4428 <li>Instance objects report references to each non-primitive instance fields 4429 (including inherited fields).</li> 4430 <li>Instance objects report a reference to the object type (class).</li> 4431 <li>Classes report a reference to the superclass and directly 4432 implemented/extended interfaces.</li> 4433 <li>Classes report a reference to the class loader, protection domain, 4434 signers, and resolved entries in the constant pool.</li> 4435 <li>Classes report a reference to each directly declared non-primitive 4436 static field.</li> 4437 <li>Arrays report a reference to the array type (class) and each 4438 array element.</li> 4439 <li>Primitive arrays report a reference to the array type.</li> 4440 </ul> 4441 <p/> 4442 This function can also be used to examine primitive (non-object) values. 4443 The primitive value of an array or String 4444 is reported after the object has been visited; 4445 it is reported by invoking the agent supplied callback function 4446 <functionlink id="jvmtiArrayPrimitiveValueCallback"/> or 4447 <functionlink id="jvmtiStringPrimitiveValueCallback"/>. 4448 A primitive field 4449 is reported after the object with that field is visited; 4450 it is reported by invoking the agent supplied callback function 4451 <functionlink id="jvmtiPrimitiveFieldCallback"/>. 4452 <p/> 4453 Whether a callback is provided or is <code>NULL</code> only determines 4454 whether the callback will be invoked, it does not influence 4455 which objects are visited nor does it influence whether other callbacks 4456 will be invoked. 4457 However, the 4458 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink> 4459 returned by <functionlink id="jvmtiHeapReferenceCallback"/> 4460 do determine if the objects referenced by the 4461 current object as visited. 4462 The <datalink id="jvmtiHeapFilter">heap filter flags</datalink> 4463 and <paramlink id="klass"/> provided as parameters to this function 4464 do not control which objects are visited but they do control which 4465 objects and primitive values are reported by the callbacks. 4466 For example, if the only callback that was set is 4467 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> and <code>klass</code> 4468 is set to the array of bytes class, then only arrays of byte will be 4469 reported. 4470 The table below summarizes this: 4471 <p/> 4472 <table> 4473 <tr> 4474 <th/> 4475 <th> 4476 Controls objects visited 4477 </th> 4478 <th> 4479 Controls objects reported 4480 </th> 4481 <th> 4482 Controls primitives reported 4483 </th> 4484 </tr> 4485 <tr> 4486 <th align="left"> 4487 the 4488 <datalink id="jvmtiHeapVisitControl">Heap Visit Control Flags</datalink> 4489 returned by <functionlink id="jvmtiHeapReferenceCallback"/> 4490 </th> 4491 <td> 4492 <b>Yes</b> 4493 </td> 4494 <td> 4495 <b>Yes</b>, since visits are controlled 4496 </td> 4497 <td> 4498 <b>Yes</b>, since visits are controlled 4499 </td> 4500 </tr> 4501 <tr> 4502 <th align="left"> 4503 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> 4504 in <paramlink id="callbacks"/> set 4505 </th> 4506 <td> 4507 No 4508 </td> 4509 <td> 4510 <b>Yes</b> 4511 </td> 4512 <td> 4513 No 4514 </td> 4515 </tr> 4516 <tr> 4517 <th align="left"> 4518 <paramlink id="heap_filter"/> 4519 </th> 4520 <td> 4521 No 4522 </td> 4523 <td> 4524 <b>Yes</b> 4525 </td> 4526 <td> 4527 <b>Yes</b> 4528 </td> 4529 </tr> 4530 <tr> 4531 <th align="left"> 4532 <paramlink id="klass"/> 4533 </th> 4534 <td> 4535 No 4536 </td> 4537 <td> 4538 <b>Yes</b> 4539 </td> 4540 <td> 4541 <b>Yes</b> 4542 </td> 4543 </tr> 4544 </table> 4545 <p/> 4546 During the execution of this function the state of the heap 4547 does not change: no objects are allocated, no objects are 4548 garbage collected, and the state of objects (including 4549 held values) does not change. 4550 As a result, threads executing Java 4551 programming language code, threads attempting to resume the 4552 execution of Java programming language code, and threads 4553 attempting to execute JNI functions are typically stalled. 4554 </description> 4555 <origin>new</origin> 4556 <capabilities> 4557 <required id="can_tag_objects"></required> 4558 </capabilities> 4559 <parameters> 4560 <param id="heap_filter"> 4561 <jint/> 4562 <description> 4563 This bit vector of 4564 <datalink id="jvmtiHeapFilter">heap filter flags</datalink>. 4565 restricts the objects for which the callback function is called. 4566 This applies to both the object and primitive callbacks. 4567 </description> 4568 </param> 4569 <param id="klass"> 4570 <ptrtype> 4571 <jclass/> 4572 <nullok>callbacks are not limited to instances of a particular 4573 class</nullok> 4574 </ptrtype> 4575 <description> 4576 Callbacks are only reported when the object is an instance of 4577 this class. 4578 Objects which are instances of a subclass of <code>klass</code> 4579 are not reported. 4580 If <code>klass</code> is an interface, no objects are reported. 4581 This applies to both the object and primitive callbacks. 4582 </description> 4583 </param> 4584 <param id="initial_object"> 4585 <ptrtype> 4586 <jobject/> 4587 <nullok>references are followed from the heap roots</nullok> 4588 </ptrtype> 4589 <description> 4590 The object to follow 4591 </description> 4592 </param> 4593 <param id="callbacks"> 4594 <inptr> 4595 <struct>jvmtiHeapCallbacks</struct> 4596 </inptr> 4597 <description> 4598 Structure defining the set of callback functions. 4599 </description> 4600 </param> 4601 <param id="user_data"> 4602 <inbuf> 4603 <void/> 4604 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 4605 </inbuf> 4606 <description> 4607 User supplied data to be passed to the callback. 4608 </description> 4609 </param> 4610 </parameters> 4611 <errors> 4612 <error id="JVMTI_ERROR_INVALID_CLASS"> 4613 <paramlink id="klass"/> is not a valid class. 4614 </error> 4615 <error id="JVMTI_ERROR_INVALID_OBJECT"> 4616 <paramlink id="initial_object"/> is not a valid object. 4617 </error> 4618 </errors> 4619 </function> 4620 4621 4622 <function id="IterateThroughHeap" num="116" since="1.1"> 4623 <synopsis>Iterate Through Heap</synopsis> 4624 <description> 4625 Initiate an iteration over all objects in the heap. 4626 This includes both reachable and 4627 unreachable objects. Objects are visited in no particular order. 4628 <p/> 4629 Heap objects are reported by invoking the agent supplied 4630 callback function <functionlink id="jvmtiHeapIterationCallback"/>. 4631 References between objects are not reported. 4632 If only reachable objects are desired, or if object reference information 4633 is needed, use <functionlink id="FollowReferences"/>. 4634 <p/> 4635 This function can also be used to examine primitive (non-object) values. 4636 The primitive value of an array or String 4637 is reported after the object has been visited; 4638 it is reported by invoking the agent supplied callback function 4639 <functionlink id="jvmtiArrayPrimitiveValueCallback"/> or 4640 <functionlink id="jvmtiStringPrimitiveValueCallback"/>. 4641 A primitive field 4642 is reported after the object with that field is visited; 4643 it is reported by invoking the agent supplied 4644 callback function 4645 <functionlink id="jvmtiPrimitiveFieldCallback"/>. 4646 <p/> 4647 Unless the iteration is aborted by the 4648 <datalink id="jvmtiHeapVisitControl">Heap Visit Control Flags</datalink> 4649 returned by a callback, all objects in the heap are visited. 4650 Whether a callback is provided or is <code>NULL</code> only determines 4651 whether the callback will be invoked, it does not influence 4652 which objects are visited nor does it influence whether other callbacks 4653 will be invoked. 4654 The <datalink id="jvmtiHeapFilter">heap filter flags</datalink> 4655 and <paramlink id="klass"/> provided as parameters to this function 4656 do not control which objects are visited but they do control which 4657 objects and primitive values are reported by the callbacks. 4658 For example, if the only callback that was set is 4659 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> and <code>klass</code> 4660 is set to the array of bytes class, then only arrays of byte will be 4661 reported. The table below summarizes this (contrast this with 4662 <functionlink id="FollowReferences"/>): 4663 <p/> 4664 <table> 4665 <tr> 4666 <th/> 4667 <th> 4668 Controls objects visited 4669 </th> 4670 <th> 4671 Controls objects reported 4672 </th> 4673 <th> 4674 Controls primitives reported 4675 </th> 4676 </tr> 4677 <tr> 4678 <th align="left"> 4679 the 4680 <datalink id="jvmtiHeapVisitControl">Heap Visit Control Flags</datalink> 4681 returned by <functionlink id="jvmtiHeapIterationCallback"/> 4682 </th> 4683 <td> 4684 No<br/>(unless they abort the iteration) 4685 </td> 4686 <td> 4687 No<br/>(unless they abort the iteration) 4688 </td> 4689 <td> 4690 No<br/>(unless they abort the iteration) 4691 </td> 4692 </tr> 4693 <tr> 4694 <th align="left"> 4695 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> 4696 in <paramlink id="callbacks"/> set 4697 </th> 4698 <td> 4699 No 4700 </td> 4701 <td> 4702 <b>Yes</b> 4703 </td> 4704 <td> 4705 No 4706 </td> 4707 </tr> 4708 <tr> 4709 <th align="left"> 4710 <paramlink id="heap_filter"/> 4711 </th> 4712 <td> 4713 No 4714 </td> 4715 <td> 4716 <b>Yes</b> 4717 </td> 4718 <td> 4719 <b>Yes</b> 4720 </td> 4721 </tr> 4722 <tr> 4723 <th align="left"> 4724 <paramlink id="klass"/> 4725 </th> 4726 <td> 4727 No 4728 </td> 4729 <td> 4730 <b>Yes</b> 4731 </td> 4732 <td> 4733 <b>Yes</b> 4734 </td> 4735 </tr> 4736 </table> 4737 <p/> 4738 During the execution of this function the state of the heap 4739 does not change: no objects are allocated, no objects are 4740 garbage collected, and the state of objects (including 4741 held values) does not change. 4742 As a result, threads executing Java 4743 programming language code, threads attempting to resume the 4744 execution of Java programming language code, and threads 4745 attempting to execute JNI functions are typically stalled. 4746 </description> 4747 <origin>new</origin> 4748 <capabilities> 4749 <required id="can_tag_objects"></required> 4750 </capabilities> 4751 <parameters> 4752 <param id="heap_filter"> 4753 <jint/> 4754 <description> 4755 This bit vector of 4756 <datalink id="jvmtiHeapFilter">heap filter flags</datalink>. 4757 restricts the objects for which the callback function is called. 4758 This applies to both the object and primitive callbacks. 4759 </description> 4760 </param> 4761 <param id="klass"> 4762 <ptrtype> 4763 <jclass/> 4764 <nullok>callbacks are not limited to instances of a particular class</nullok> 4765 </ptrtype> 4766 <description> 4767 Callbacks are only reported when the object is an instance of 4768 this class. 4769 Objects which are instances of a subclass of <code>klass</code> 4770 are not reported. 4771 If <code>klass</code> is an interface, no objects are reported. 4772 This applies to both the object and primitive callbacks. 4773 </description> 4774 </param> 4775 <param id="callbacks"> 4776 <inptr> 4777 <struct>jvmtiHeapCallbacks</struct> 4778 </inptr> 4779 <description> 4780 Structure defining the set callback functions. 4781 </description> 4782 </param> 4783 <param id="user_data"> 4784 <inbuf> 4785 <void/> 4786 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 4787 </inbuf> 4788 <description> 4789 User supplied data to be passed to the callback. 4790 </description> 4791 </param> 4792 </parameters> 4793 <errors> 4794 <error id="JVMTI_ERROR_INVALID_CLASS"> 4795 <paramlink id="klass"/> is not a valid class. 4796 </error> 4797 </errors> 4798 </function> 4799 4800 <function id="GetTag" phase="start" num="106"> 4801 <synopsis>Get Tag</synopsis> 4802 <description> 4803 Retrieve the tag associated with an object. 4804 The tag is a long value typically used to store a 4805 unique identifier or pointer to object information. 4806 The tag is set with 4807 <functionlink id="SetTag"></functionlink>. 4808 Objects for which no tags have been set return a 4809 tag value of zero. 4810 </description> 4811 <origin>new</origin> 4812 <capabilities> 4813 <required id="can_tag_objects"></required> 4814 </capabilities> 4815 <parameters> 4816 <param id="object"> 4817 <jobject/> 4818 <description> 4819 The object whose tag is to be retrieved. 4820 </description> 4821 </param> 4822 <param id="tag_ptr"> 4823 <outptr><jlong/></outptr> 4824 <description> 4825 On return, the referenced long is set to the value 4826 of the tag. 4827 </description> 4828 </param> 4829 </parameters> 4830 <errors> 4831 </errors> 4832 </function> 4833 4834 <function id="SetTag" phase="start" num="107"> 4835 <synopsis>Set Tag</synopsis> 4836 <description> 4837 Set the tag associated with an object. 4838 The tag is a long value typically used to store a 4839 unique identifier or pointer to object information. 4840 The tag is visible with 4841 <functionlink id="GetTag"></functionlink>. 4842 </description> 4843 <origin>new</origin> 4844 <capabilities> 4845 <required id="can_tag_objects"></required> 4846 </capabilities> 4847 <parameters> 4848 <param id="object"> 4849 <jobject/> 4850 <description> 4851 The object whose tag is to be set. 4852 </description> 4853 </param> 4854 <param id="tag"> 4855 <jlong/> 4856 <description> 4857 The new value of the tag. 4858 </description> 4859 </param> 4860 </parameters> 4861 <errors> 4862 </errors> 4863 </function> 4864 4865 <function id="GetObjectsWithTags" num="114"> 4866 <synopsis>Get Objects With Tags</synopsis> 4867 <description> 4868 Return objects in the heap with the specified tags. 4869 The format is parallel arrays of objects and tags. 4870 </description> 4871 <origin>new</origin> 4872 <capabilities> 4873 <required id="can_tag_objects"></required> 4874 </capabilities> 4875 <parameters> 4876 <param id="tag_count"> 4877 <jint min="0"/> 4878 <description> 4879 Number of tags to scan for. 4880 </description> 4881 </param> 4882 <param id="tags"> 4883 <inbuf incount="tag_count"> 4884 <jlong/> 4885 </inbuf> 4886 <description> 4887 Scan for objects with these tags. 4888 Zero is not permitted in this array. 4889 </description> 4890 </param> 4891 <param id="count_ptr"> 4892 <outptr> 4893 <jint/> 4894 </outptr> 4895 <description> 4896 Return the number of objects with any of the tags 4897 in <paramlink id="tags"/>. 4898 </description> 4899 </param> 4900 <param id="object_result_ptr"> 4901 <allocbuf outcount="count_ptr"> 4902 <jobject/> 4903 <nullok>this information is not returned</nullok> 4904 </allocbuf> 4905 <description> 4906 Returns the array of objects with any of the tags 4907 in <paramlink id="tags"/>. 4908 </description> 4909 </param> 4910 <param id="tag_result_ptr"> 4911 <allocbuf outcount="count_ptr"> 4912 <jlong/> 4913 <nullok>this information is not returned</nullok> 4914 </allocbuf> 4915 <description> 4916 For each object in <paramlink id="object_result_ptr"/>, 4917 return the tag at the corresponding index. 4918 </description> 4919 </param> 4920 </parameters> 4921 <errors> 4922 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 4923 Zero is present in <paramlink id="tags"></paramlink>. 4924 </error> 4925 </errors> 4926 </function> 4927 4928 <function id="ForceGarbageCollection" num="108"> 4929 <synopsis>Force Garbage Collection</synopsis> 4930 <description> 4931 Force the VM to perform a garbage collection. 4932 The garbage collection is as complete as possible. 4933 This function does not cause finalizers to be run. 4934 This function does not return until the garbage collection 4935 is finished. 4936 <p/> 4937 Although garbage collection is as complete 4938 as possible there is no guarantee that all 4939 <eventlink id="ObjectFree"/> 4940 events will have been 4941 sent by the time that this function 4942 returns. In particular, an object may be 4943 prevented from being freed because it 4944 is awaiting finalization. 4945 </description> 4946 <origin>new</origin> 4947 <capabilities> 4948 </capabilities> 4949 <parameters> 4950 </parameters> 4951 <errors> 4952 </errors> 4953 </function> 4954 4955 4956 </category> 4957 4958 <category id="Heap_1_0" label="Heap (1.0)"> 4959 <intro> 4960 <b> 4961 These functions and data types were introduced in the original 4962 <jvmti/> version 1.0 and have been superseded by more 4963 </b> 4964 <internallink id="Heap"><b>powerful and flexible versions</b></internallink> 4965 <b> 4966 which: 4967 </b> 4968 <ul> 4969 <li> 4970 <b> 4971 Allow access to primitive values (the value of Strings, arrays, 4972 and primitive fields) 4973 </b> 4974 </li> 4975 <li> 4976 <b> 4977 Allow the tag of the referrer to be set, thus enabling more 4978 efficient localized reference graph building 4979 </b> 4980 </li> 4981 <li> 4982 <b> 4983 Provide more extensive filtering abilities 4984 </b> 4985 </li> 4986 <li> 4987 <b> 4988 Are extensible, allowing their abilities to grow in future versions of <jvmti/> 4989 </b> 4990 </li> 4991 </ul> 4992 <p/> 4993 <b>Please use the </b> 4994 <internallink id="Heap"><b>current Heap functions</b></internallink>. 4995 <p/> 4996 <constants id="jvmtiHeapObjectFilter" label="Heap Object Filter Enumeration" kind="enum"> 4997 <constant id="JVMTI_HEAP_OBJECT_TAGGED" num="1"> 4998 Tagged objects only. 4999 </constant> 5000 <constant id="JVMTI_HEAP_OBJECT_UNTAGGED" num="2"> 5001 Untagged objects only. 5002 </constant> 5003 <constant id="JVMTI_HEAP_OBJECT_EITHER" num="3"> 5004 Either tagged or untagged objects. 5005 </constant> 5006 </constants> 5007 5008 <constants id="jvmtiHeapRootKind" label="Heap Root Kind Enumeration" kind="enum"> 5009 <constant id="JVMTI_HEAP_ROOT_JNI_GLOBAL" num="1"> 5010 JNI global reference. 5011 </constant> 5012 <constant id="JVMTI_HEAP_ROOT_SYSTEM_CLASS" num="2"> 5013 System class. 5014 </constant> 5015 <constant id="JVMTI_HEAP_ROOT_MONITOR" num="3"> 5016 Monitor. 5017 </constant> 5018 <constant id="JVMTI_HEAP_ROOT_STACK_LOCAL" num="4"> 5019 Stack local. 5020 </constant> 5021 <constant id="JVMTI_HEAP_ROOT_JNI_LOCAL" num="5"> 5022 JNI local reference. 5023 </constant> 5024 <constant id="JVMTI_HEAP_ROOT_THREAD" num="6"> 5025 Thread. 5026 </constant> 5027 <constant id="JVMTI_HEAP_ROOT_OTHER" num="7"> 5028 Other. 5029 </constant> 5030 </constants> 5031 5032 <constants id="jvmtiObjectReferenceKind" label="Object Reference Enumeration" kind="enum"> 5033 <constant id="JVMTI_REFERENCE_CLASS" num="1"> 5034 Reference from an object to its class. 5035 </constant> 5036 <constant id="JVMTI_REFERENCE_FIELD" num="2"> 5037 Reference from an object to the value of one of its instance fields. 5038 For references of this kind the <code>referrer_index</code> 5039 parameter to the <internallink id="jvmtiObjectReferenceCallback"> 5040 jvmtiObjectReferenceCallback</internallink> is the index of the 5041 the instance field. The index is based on the order of all the 5042 object's fields. This includes all fields of the directly declared 5043 static and instance fields in the class, and includes all fields (both 5044 public and private) fields declared in superclasses and superinterfaces. 5045 The index is thus calculated by summing the index of the field in the directly 5046 declared class (see <functionlink id="GetClassFields"/>), with the total 5047 number of fields (both public and private) declared in all superclasses 5048 and superinterfaces. The index starts at zero. 5049 </constant> 5050 <constant id="JVMTI_REFERENCE_ARRAY_ELEMENT" num="3"> 5051 Reference from an array to one of its elements. 5052 For references of this kind the <code>referrer_index</code> 5053 parameter to the <internallink id="jvmtiObjectReferenceCallback"> 5054 jvmtiObjectReferenceCallback</internallink> is the array index. 5055 </constant> 5056 <constant id="JVMTI_REFERENCE_CLASS_LOADER" num="4"> 5057 Reference from a class to its class loader. 5058 </constant> 5059 <constant id="JVMTI_REFERENCE_SIGNERS" num="5"> 5060 Reference from a class to its signers array. 5061 </constant> 5062 <constant id="JVMTI_REFERENCE_PROTECTION_DOMAIN" num="6"> 5063 Reference from a class to its protection domain. 5064 </constant> 5065 <constant id="JVMTI_REFERENCE_INTERFACE" num="7"> 5066 Reference from a class to one of its interfaces. 5067 </constant> 5068 <constant id="JVMTI_REFERENCE_STATIC_FIELD" num="8"> 5069 Reference from a class to the value of one of its static fields. 5070 For references of this kind the <code>referrer_index</code> 5071 parameter to the <internallink id="jvmtiObjectReferenceCallback"> 5072 jvmtiObjectReferenceCallback</internallink> is the index of the 5073 the static field. The index is based on the order of all the 5074 object's fields. This includes all fields of the directly declared 5075 static and instance fields in the class, and includes all fields (both 5076 public and private) fields declared in superclasses and superinterfaces. 5077 The index is thus calculated by summing the index of the field in the directly 5078 declared class (see <functionlink id="GetClassFields"/>), with the total 5079 number of fields (both public and private) declared in all superclasses 5080 and superinterfaces. The index starts at zero. 5081 Note: this definition differs from that in the <jvmti/> 1.0 Specification. 5082 <rationale>No known implementations used the 1.0 definition.</rationale> 5083 </constant> 5084 <constant id="JVMTI_REFERENCE_CONSTANT_POOL" num="9"> 5085 Reference from a class to a resolved entry in the constant pool. 5086 For references of this kind the <code>referrer_index</code> 5087 parameter to the <internallink id="jvmtiObjectReferenceCallback"> 5088 jvmtiObjectReferenceCallback</internallink> is the index into 5089 constant pool table of the class, starting at 1. See 5090 <vmspec chapter="4.4"/>. 5091 </constant> 5092 </constants> 5093 5094 <constants id="jvmtiIterationControl" label="Iteration Control Enumeration" kind="enum"> 5095 <constant id="JVMTI_ITERATION_CONTINUE" num="1"> 5096 Continue the iteration. 5097 If this is a reference iteration, follow the references of this object. 5098 </constant> 5099 <constant id="JVMTI_ITERATION_IGNORE" num="2"> 5100 Continue the iteration. 5101 If this is a reference iteration, ignore the references of this object. 5102 </constant> 5103 <constant id="JVMTI_ITERATION_ABORT" num="0"> 5104 Abort the iteration. 5105 </constant> 5106 </constants> 5107 </intro> 5108 5109 <callback id="jvmtiHeapObjectCallback"> 5110 <enum>jvmtiIterationControl</enum> 5111 <synopsis>Heap Object Callback</synopsis> 5112 <description> 5113 Agent supplied callback function. 5114 Describes (but does not pass in) an object in the heap. 5115 <p/> 5116 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration, 5117 or <code>JVMTI_ITERATION_ABORT</code> to stop iteration. 5118 <p/> 5119 See the <internallink id="heapCallbacks">heap callback 5120 function restrictions</internallink>. 5121 </description> 5122 <parameters> 5123 <param id="class_tag"> 5124 <jlong/> 5125 <description> 5126 The tag of the class of object (zero if the class is not tagged). 5127 If the object represents a runtime class, 5128 the <code>class_tag</code> is the tag 5129 associated with <code>java.lang.Class</code> 5130 (zero if <code>java.lang.Class</code> is not tagged). 5131 </description> 5132 </param> 5133 <param id="size"> 5134 <jlong/> 5135 <description> 5136 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 5137 </description> 5138 </param> 5139 <param id="tag_ptr"> 5140 <outptr><jlong/></outptr> 5141 <description> 5142 The object tag value, or zero if the object is not tagged. 5143 To set the tag value to be associated with the object 5144 the agent sets the <code>jlong</code> pointed to by the parameter. 5145 </description> 5146 </param> 5147 <param id="user_data"> 5148 <outptr><void/></outptr> 5149 <description> 5150 The user supplied data that was passed into the iteration function. 5151 </description> 5152 </param> 5153 </parameters> 5154 </callback> 5155 5156 <callback id="jvmtiHeapRootCallback"> 5157 <enum>jvmtiIterationControl</enum> 5158 <synopsis>Heap Root Object Callback</synopsis> 5159 <description> 5160 Agent supplied callback function. 5161 Describes (but does not pass in) an object that is a root for the purposes 5162 of garbage collection. 5163 <p/> 5164 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration, 5165 <code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing 5166 references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration. 5167 <p/> 5168 See the <internallink id="heapCallbacks">heap callback 5169 function restrictions</internallink>. 5170 </description> 5171 <parameters> 5172 <param id="root_kind"> 5173 <enum>jvmtiHeapRootKind</enum> 5174 <description> 5175 The kind of heap root. 5176 </description> 5177 </param> 5178 <param id="class_tag"> 5179 <jlong/> 5180 <description> 5181 The tag of the class of object (zero if the class is not tagged). 5182 If the object represents a runtime class, the <code>class_tag</code> is the tag 5183 associated with <code>java.lang.Class</code> 5184 (zero if <code>java.lang.Class</code> is not tagged). 5185 </description> 5186 </param> 5187 <param id="size"> 5188 <jlong/> 5189 <description> 5190 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 5191 </description> 5192 </param> 5193 <param id="tag_ptr"> 5194 <outptr><jlong/></outptr> 5195 <description> 5196 The object tag value, or zero if the object is not tagged. 5197 To set the tag value to be associated with the object 5198 the agent sets the <code>jlong</code> pointed to by the parameter. 5199 </description> 5200 </param> 5201 <param id="user_data"> 5202 <outptr><void/></outptr> 5203 <description> 5204 The user supplied data that was passed into the iteration function. 5205 </description> 5206 </param> 5207 </parameters> 5208 </callback> 5209 5210 <callback id="jvmtiStackReferenceCallback"> 5211 <enum>jvmtiIterationControl</enum> 5212 <synopsis>Stack Reference Object Callback</synopsis> 5213 <description> 5214 Agent supplied callback function. 5215 Describes (but does not pass in) an object on the stack that is a root for 5216 the purposes of garbage collection. 5217 <p/> 5218 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration, 5219 <code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing 5220 references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration. 5221 <p/> 5222 See the <internallink id="heapCallbacks">heap callback 5223 function restrictions</internallink>. 5224 </description> 5225 <parameters> 5226 <param id="root_kind"> 5227 <enum>jvmtiHeapRootKind</enum> 5228 <description> 5229 The kind of root (either <code>JVMTI_HEAP_ROOT_STACK_LOCAL</code> or 5230 <code>JVMTI_HEAP_ROOT_JNI_LOCAL</code>). 5231 </description> 5232 </param> 5233 <param id="class_tag"> 5234 <jlong/> 5235 <description> 5236 The tag of the class of object (zero if the class is not tagged). 5237 If the object represents a runtime class, the <code>class_tag</code> is the tag 5238 associated with <code>java.lang.Class</code> 5239 (zero if <code>java.lang.Class</code> is not tagged). 5240 </description> 5241 </param> 5242 <param id="size"> 5243 <jlong/> 5244 <description> 5245 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 5246 </description> 5247 </param> 5248 <param id="tag_ptr"> 5249 <outptr><jlong/></outptr> 5250 <description> 5251 The object tag value, or zero if the object is not tagged. 5252 To set the tag value to be associated with the object 5253 the agent sets the <code>jlong</code> pointed to by the parameter. 5254 </description> 5255 </param> 5256 <param id="thread_tag"> 5257 <jlong/> 5258 <description> 5259 The tag of the thread corresponding to this stack, zero if not tagged. 5260 </description> 5261 </param> 5262 <param id="depth"> 5263 <jint/> 5264 <description> 5265 The depth of the frame. 5266 </description> 5267 </param> 5268 <param id="method"> 5269 <jmethodID/> 5270 <description> 5271 The method executing in this frame. 5272 </description> 5273 </param> 5274 <param id="slot"> 5275 <jint/> 5276 <description> 5277 The slot number. 5278 </description> 5279 </param> 5280 <param id="user_data"> 5281 <outptr><void/></outptr> 5282 <description> 5283 The user supplied data that was passed into the iteration function. 5284 </description> 5285 </param> 5286 </parameters> 5287 </callback> 5288 5289 <callback id="jvmtiObjectReferenceCallback"> 5290 <enum>jvmtiIterationControl</enum> 5291 <synopsis>Object Reference Callback</synopsis> 5292 <description> 5293 Agent supplied callback function. 5294 Describes a reference from an object (the referrer) to another object 5295 (the referree). 5296 <p/> 5297 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration, 5298 <code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing 5299 references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration. 5300 <p/> 5301 See the <internallink id="heapCallbacks">heap callback 5302 function restrictions</internallink>. 5303 </description> 5304 <parameters> 5305 <param id="reference_kind"> 5306 <enum>jvmtiObjectReferenceKind</enum> 5307 <description> 5308 The type of reference. 5309 </description> 5310 </param> 5311 <param id="class_tag"> 5312 <jlong/> 5313 <description> 5314 The tag of the class of referree object (zero if the class is not tagged). 5315 If the referree object represents a runtime class, 5316 the <code>class_tag</code> is the tag 5317 associated with <code>java.lang.Class</code> 5318 (zero if <code>java.lang.Class</code> is not tagged). 5319 </description> 5320 </param> 5321 <param id="size"> 5322 <jlong/> 5323 <description> 5324 Size of the referree object (in bytes). 5325 See <functionlink id="GetObjectSize"/>. 5326 </description> 5327 </param> 5328 <param id="tag_ptr"> 5329 <outptr><jlong/></outptr> 5330 <description> 5331 The referree object tag value, or zero if the object is not 5332 tagged. 5333 To set the tag value to be associated with the object 5334 the agent sets the <code>jlong</code> pointed to by the parameter. 5335 </description> 5336 </param> 5337 <param id="referrer_tag"> 5338 <jlong/> 5339 <description> 5340 The tag of the referrer object, or zero if the referrer 5341 object is not tagged. 5342 </description> 5343 </param> 5344 <param id="referrer_index"> 5345 <jint/> 5346 <description> 5347 For references of type <code>JVMTI_REFERENCE_FIELD</code> or 5348 <code>JVMTI_REFERENCE_STATIC_FIELD</code> the index 5349 of the field in the referrer object. The index is based on the 5350 order of all the object's fields - see <internallink 5351 id="JVMTI_REFERENCE_FIELD">JVMTI_REFERENCE_FIELD</internallink> 5352 or <internallink 5353 id="JVMTI_REFERENCE_STATIC_FIELD">JVMTI_REFERENCE_STATIC_FIELD 5354 </internallink> for further description. 5355 <p/> 5356 For references of type <code>JVMTI_REFERENCE_ARRAY_ELEMENT</code> 5357 the array index - see <internallink id="JVMTI_REFERENCE_ARRAY_ELEMENT"> 5358 JVMTI_REFERENCE_ARRAY_ELEMENT</internallink> for further description. 5359 <p/> 5360 For references of type <code>JVMTI_REFERENCE_CONSTANT_POOL</code> 5361 the index into the constant pool of the class - see 5362 <internallink id="JVMTI_REFERENCE_CONSTANT_POOL"> 5363 JVMTI_REFERENCE_CONSTANT_POOL</internallink> for further 5364 description. 5365 <p/> 5366 For references of other kinds the <code>referrer_index</code> is 5367 <code>-1</code>. 5368 </description> 5369 </param> 5370 <param id="user_data"> 5371 <outptr><void/></outptr> 5372 <description> 5373 The user supplied data that was passed into the iteration function. 5374 </description> 5375 </param> 5376 </parameters> 5377 </callback> 5378 5379 <function id="IterateOverObjectsReachableFromObject" num="109"> 5380 <synopsis>Iterate Over Objects Reachable From Object</synopsis> 5381 <description> 5382 This function iterates over all objects that are directly 5383 and indirectly reachable from the specified object. 5384 For each object <i>A</i> (known 5385 as the referrer) with a reference to object <i>B</i> the specified 5386 callback function is called to describe the object reference. 5387 The callback is called exactly once for each reference from a referrer; 5388 this is true even if there are reference cycles or multiple paths to 5389 the referrer. 5390 There may be more than one reference between a referrer and a referree, 5391 These may be distinguished by the 5392 <datalink id="jvmtiObjectReferenceCallback.reference_kind"></datalink> and 5393 <datalink id="jvmtiObjectReferenceCallback.referrer_index"></datalink>. 5394 The callback for an object will always occur after the callback for 5395 its referrer. 5396 <p/> 5397 See <functionlink id="FollowReferences"/> for the object 5398 references which are reported. 5399 <p/> 5400 During the execution of this function the state of the heap 5401 does not change: no objects are allocated, no objects are 5402 garbage collected, and the state of objects (including 5403 held values) does not change. 5404 As a result, threads executing Java 5405 programming language code, threads attempting to resume the 5406 execution of Java programming language code, and threads 5407 attempting to execute JNI functions are typically stalled. 5408 </description> 5409 <origin>new</origin> 5410 <capabilities> 5411 <required id="can_tag_objects"></required> 5412 </capabilities> 5413 <parameters> 5414 <param id="object"> 5415 <jobject/> 5416 <description> 5417 The object 5418 </description> 5419 </param> 5420 <param id="object_reference_callback"> 5421 <ptrtype> 5422 <struct>jvmtiObjectReferenceCallback</struct> 5423 </ptrtype> 5424 <description> 5425 The callback to be called to describe each 5426 object reference. 5427 </description> 5428 </param> 5429 <param id="user_data"> 5430 <inbuf> 5431 <void/> 5432 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 5433 </inbuf> 5434 <description> 5435 User supplied data to be passed to the callback. 5436 </description> 5437 </param> 5438 </parameters> 5439 <errors> 5440 </errors> 5441 </function> 5442 5443 <function id="IterateOverReachableObjects" num="110"> 5444 <synopsis>Iterate Over Reachable Objects</synopsis> 5445 <description> 5446 This function iterates over the root objects and all objects that 5447 are directly and indirectly reachable from the root objects. 5448 The root objects comprise the set of system classes, 5449 JNI globals, references from thread stacks, and other objects used as roots 5450 for the purposes of garbage collection. 5451 <p/> 5452 For each root the <paramlink id="heap_root_callback"></paramlink> 5453 or <paramlink id="stack_ref_callback"></paramlink> callback is called. 5454 An object can be a root object for more than one reason and in that case 5455 the appropriate callback is called for each reason. 5456 <p/> 5457 For each object reference the <paramlink id="object_ref_callback"></paramlink> 5458 callback function is called to describe the object reference. 5459 The callback is called exactly once for each reference from a referrer; 5460 this is true even if there are reference cycles or multiple paths to 5461 the referrer. 5462 There may be more than one reference between a referrer and a referree, 5463 These may be distinguished by the 5464 <datalink id="jvmtiObjectReferenceCallback.reference_kind"></datalink> and 5465 <datalink id="jvmtiObjectReferenceCallback.referrer_index"></datalink>. 5466 The callback for an object will always occur after the callback for 5467 its referrer. 5468 <p/> 5469 See <functionlink id="FollowReferences"/> for the object 5470 references which are reported. 5471 <p/> 5472 Roots are always reported to the profiler before any object references 5473 are reported. In other words, the <paramlink id="object_ref_callback"></paramlink> 5474 callback will not be called until the appropriate callback has been called 5475 for all roots. If the <paramlink id="object_ref_callback"></paramlink> callback is 5476 specified as <code>NULL</code> then this function returns after 5477 reporting the root objects to the profiler. 5478 <p/> 5479 During the execution of this function the state of the heap 5480 does not change: no objects are allocated, no objects are 5481 garbage collected, and the state of objects (including 5482 held values) does not change. 5483 As a result, threads executing Java 5484 programming language code, threads attempting to resume the 5485 execution of Java programming language code, and threads 5486 attempting to execute JNI functions are typically stalled. 5487 </description> 5488 <origin>new</origin> 5489 <capabilities> 5490 <required id="can_tag_objects"></required> 5491 </capabilities> 5492 <parameters> 5493 <param id="heap_root_callback"> 5494 <ptrtype> 5495 <struct>jvmtiHeapRootCallback</struct> 5496 <nullok>do not report heap roots</nullok> 5497 </ptrtype> 5498 <description> 5499 The callback function to be called for each heap root of type 5500 <code>JVMTI_HEAP_ROOT_JNI_GLOBAL</code>, 5501 <code>JVMTI_HEAP_ROOT_SYSTEM_CLASS</code>, 5502 <code>JVMTI_HEAP_ROOT_MONITOR</code>, 5503 <code>JVMTI_HEAP_ROOT_THREAD</code>, or 5504 <code>JVMTI_HEAP_ROOT_OTHER</code>. 5505 </description> 5506 </param> 5507 <param id="stack_ref_callback"> 5508 <ptrtype> 5509 <struct>jvmtiStackReferenceCallback</struct> 5510 <nullok>do not report stack references</nullok> 5511 </ptrtype> 5512 <description> 5513 The callback function to be called for each heap root of 5514 <code>JVMTI_HEAP_ROOT_STACK_LOCAL</code> or 5515 <code>JVMTI_HEAP_ROOT_JNI_LOCAL</code>. 5516 </description> 5517 </param> 5518 <param id="object_ref_callback"> 5519 <ptrtype> 5520 <struct>jvmtiObjectReferenceCallback</struct> 5521 <nullok>do not follow references from the root objects</nullok> 5522 </ptrtype> 5523 <description> 5524 The callback function to be called for each object reference. 5525 </description> 5526 </param> 5527 <param id="user_data"> 5528 <inbuf> 5529 <void/> 5530 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 5531 </inbuf> 5532 <description> 5533 User supplied data to be passed to the callback. 5534 </description> 5535 </param> 5536 </parameters> 5537 <errors> 5538 </errors> 5539 </function> 5540 5541 <function id="IterateOverHeap" num="111"> 5542 <synopsis>Iterate Over Heap</synopsis> 5543 <description> 5544 Iterate over all objects in the heap. This includes both reachable and 5545 unreachable objects. 5546 <p/> 5547 The <paramlink id="object_filter"></paramlink> parameter indicates the 5548 objects for which the callback function is called. If this parameter 5549 is <code>JVMTI_HEAP_OBJECT_TAGGED</code> then the callback will only be 5550 called for every object that is tagged. If the parameter is 5551 <code>JVMTI_HEAP_OBJECT_UNTAGGED</code> then the callback will only be 5552 for objects that are not tagged. If the parameter 5553 is <code>JVMTI_HEAP_OBJECT_EITHER</code> then the callback will be 5554 called for every object in the heap, irrespective of whether it is 5555 tagged or not. 5556 <p/> 5557 During the execution of this function the state of the heap 5558 does not change: no objects are allocated, no objects are 5559 garbage collected, and the state of objects (including 5560 held values) does not change. 5561 As a result, threads executing Java 5562 programming language code, threads attempting to resume the 5563 execution of Java programming language code, and threads 5564 attempting to execute JNI functions are typically stalled. 5565 </description> 5566 <origin>new</origin> 5567 <capabilities> 5568 <required id="can_tag_objects"></required> 5569 </capabilities> 5570 <parameters> 5571 <param id="object_filter"> 5572 <enum>jvmtiHeapObjectFilter</enum> 5573 <description> 5574 Indicates the objects for which the callback function is called. 5575 </description> 5576 </param> 5577 <param id="heap_object_callback"> 5578 <ptrtype> 5579 <struct>jvmtiHeapObjectCallback</struct> 5580 </ptrtype> 5581 <description> 5582 The iterator function to be called for each 5583 object matching the <paramlink id="object_filter"/>. 5584 </description> 5585 </param> 5586 <param id="user_data"> 5587 <inbuf> 5588 <void/> 5589 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 5590 </inbuf> 5591 <description> 5592 User supplied data to be passed to the callback. 5593 </description> 5594 </param> 5595 </parameters> 5596 <errors> 5597 </errors> 5598 </function> 5599 5600 <function id="IterateOverInstancesOfClass" num="112"> 5601 <synopsis>Iterate Over Instances Of Class</synopsis> 5602 <description> 5603 Iterate over all objects in the heap that are instances of the specified class. 5604 This includes direct instances of the specified class and 5605 instances of all subclasses of the specified class. 5606 This includes both reachable and unreachable objects. 5607 <p/> 5608 The <paramlink id="object_filter"></paramlink> parameter indicates the 5609 objects for which the callback function is called. If this parameter 5610 is <code>JVMTI_HEAP_OBJECT_TAGGED</code> then the callback will only be 5611 called for every object that is tagged. If the parameter is 5612 <code>JVMTI_HEAP_OBJECT_UNTAGGED</code> then the callback will only be 5613 called for objects that are not tagged. If the parameter 5614 is <code>JVMTI_HEAP_OBJECT_EITHER</code> then the callback will be 5615 called for every object in the heap, irrespective of whether it is 5616 tagged or not. 5617 <p/> 5618 During the execution of this function the state of the heap 5619 does not change: no objects are allocated, no objects are 5620 garbage collected, and the state of objects (including 5621 held values) does not change. 5622 As a result, threads executing Java 5623 programming language code, threads attempting to resume the 5624 execution of Java programming language code, and threads 5625 attempting to execute JNI functions are typically stalled. 5626 </description> 5627 <origin>new</origin> 5628 <capabilities> 5629 <required id="can_tag_objects"></required> 5630 </capabilities> 5631 <parameters> 5632 <param id="klass"> 5633 <jclass/> 5634 <description> 5635 Iterate over objects of this class only. 5636 </description> 5637 </param> 5638 <param id="object_filter"> 5639 <enum>jvmtiHeapObjectFilter</enum> 5640 <description> 5641 Indicates the objects for which the callback function is called. 5642 </description> 5643 </param> 5644 <param id="heap_object_callback"> 5645 <ptrtype> 5646 <struct>jvmtiHeapObjectCallback</struct> 5647 </ptrtype> 5648 <description> 5649 The iterator function to be called for each 5650 <paramlink id="klass"/> instance matching 5651 the <paramlink id="object_filter"/>. 5652 </description> 5653 </param> 5654 <param id="user_data"> 5655 <inbuf> 5656 <void/> 5657 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 5658 </inbuf> 5659 <description> 5660 User supplied data to be passed to the callback. 5661 </description> 5662 </param> 5663 </parameters> 5664 <errors> 5665 </errors> 5666 </function> 5667 5668 </category> 5669 5670 <category id="local" label="Local Variable"> 5671 5672 <intro> 5673 These functions are used to retrieve or set the value of a local variable. 5674 The variable is identified by the depth of the frame containing its 5675 value and the variable's slot number within that frame. 5676 The mapping of variables to 5677 slot numbers can be obtained with the function 5678 <functionlink id="GetLocalVariableTable"></functionlink>. 5679 </intro> 5680 5681 <function id="GetLocalObject" num="21"> 5682 <synopsis>Get Local Variable - Object</synopsis> 5683 <description> 5684 This function can be used to retrieve the value of a local 5685 variable whose type is <code>Object</code> or a subclass of <code>Object</code>. 5686 </description> 5687 <origin>jvmdi</origin> 5688 <capabilities> 5689 <required id="can_access_local_variables"></required> 5690 </capabilities> 5691 <parameters> 5692 <param id="thread"> 5693 <jthread null="current" frame="frame"/> 5694 <description> 5695 The thread of the frame containing the variable's value. 5696 </description> 5697 </param> 5698 <param id="depth"> 5699 <jframeID thread="thread"/> 5700 <description> 5701 The depth of the frame containing the variable's value. 5702 </description> 5703 </param> 5704 <param id="slot"> 5705 <jint/> 5706 <description> 5707 The variable's slot number. 5708 </description> 5709 </param> 5710 <param id="value_ptr"> 5711 <outptr><jobject/></outptr> 5712 <description> 5713 On return, points to the variable's value. 5714 </description> 5715 </param> 5716 </parameters> 5717 <errors> 5718 <error id="JVMTI_ERROR_INVALID_SLOT"> 5719 Invalid <code>slot</code>. 5720 </error> 5721 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 5722 The variable type is not 5723 <code>Object</code> or a subclass of <code>Object</code>. 5724 </error> 5725 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 5726 Not a visible frame 5727 </error> 5728 </errors> 5729 </function> 5730 5731 <function id="GetLocalInstance" num="155" since="1.2"> 5732 <synopsis>Get Local Instance</synopsis> 5733 <description> 5734 This function can be used to retrieve the value of the local object 5735 variable at slot 0 (the "<code>this</code>" object) from non-static 5736 frames. This function can retrieve the "<code>this</code>" object from 5737 native method frames, whereas <code>GetLocalObject()</code> would 5738 return <code>JVMTI_ERROR_OPAQUE_FRAME</code> in those cases. 5739 </description> 5740 <origin>new</origin> 5741 <capabilities> 5742 <required id="can_access_local_variables"></required> 5743 </capabilities> 5744 <parameters> 5745 <param id="thread"> 5746 <jthread null="current" frame="frame"/> 5747 <description> 5748 The thread of the frame containing the variable's value. 5749 </description> 5750 </param> 5751 <param id="depth"> 5752 <jframeID thread="thread"/> 5753 <description> 5754 The depth of the frame containing the variable's value. 5755 </description> 5756 </param> 5757 <param id="value_ptr"> 5758 <outptr><jobject/></outptr> 5759 <description> 5760 On return, points to the variable's value. 5761 </description> 5762 </param> 5763 </parameters> 5764 <errors> 5765 <error id="JVMTI_ERROR_INVALID_SLOT"> 5766 If the specified frame is a static method frame. 5767 </error> 5768 </errors> 5769 </function> 5770 <function id="GetLocalInt" num="22"> 5771 <synopsis>Get Local Variable - Int</synopsis> 5772 <description> 5773 This function can be used to retrieve the value of a local 5774 variable whose type is <code>int</code>, 5775 <code>short</code>, <code>char</code>, <code>byte</code>, or 5776 <code>boolean</code>. 5777 </description> 5778 <origin>jvmdi</origin> 5779 <capabilities> 5780 <required id="can_access_local_variables"></required> 5781 </capabilities> 5782 <parameters> 5783 <param id="thread"> 5784 <jthread null="current" frame="frame"/> 5785 <description> 5786 The thread of the frame containing the variable's value. 5787 </description> 5788 </param> 5789 <param id="depth"> 5790 <jframeID thread="thread"/> 5791 <description> 5792 The depth of the frame containing the variable's value. 5793 </description> 5794 </param> 5795 <param id="slot"> 5796 <jint/> 5797 <description> 5798 The variable's slot number. 5799 </description> 5800 </param> 5801 <param id="value_ptr"> 5802 <outptr><jint/></outptr> 5803 <description> 5804 On return, points to the variable's value. 5805 </description> 5806 </param> 5807 </parameters> 5808 <errors> 5809 <error id="JVMTI_ERROR_INVALID_SLOT"> 5810 Invalid <code>slot</code>. 5811 </error> 5812 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 5813 The variable type is not 5814 <code>int</code>, <code>short</code>, 5815 <code>char</code>, <code>byte</code>, or 5816 <code>boolean</code>. 5817 </error> 5818 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 5819 Not a visible frame 5820 </error> 5821 </errors> 5822 </function> 5823 5824 <function id="GetLocalLong" num="23"> 5825 <synopsis>Get Local Variable - Long</synopsis> 5826 <description> 5827 This function can be used to retrieve the value of a local 5828 variable whose type is <code>long</code>. 5829 </description> 5830 <origin>jvmdi</origin> 5831 <capabilities> 5832 <required id="can_access_local_variables"></required> 5833 </capabilities> 5834 <parameters> 5835 <param id="thread"> 5836 <jthread null="current" frame="frame"/> 5837 <description> 5838 The thread of the frame containing the variable's value. 5839 </description> 5840 </param> 5841 <param id="depth"> 5842 <jframeID thread="thread"/> 5843 <description> 5844 The depth of the frame containing the variable's value. 5845 </description> 5846 </param> 5847 <param id="slot"> 5848 <jint/> 5849 <description> 5850 The variable's slot number. 5851 </description> 5852 </param> 5853 <param id="value_ptr"> 5854 <outptr><jlong/></outptr> 5855 <description> 5856 On return, points to the variable's value. 5857 </description> 5858 </param> 5859 </parameters> 5860 <errors> 5861 <error id="JVMTI_ERROR_INVALID_SLOT"> 5862 Invalid <code>slot</code>. 5863 </error> 5864 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 5865 The variable type is not <code>long</code>. 5866 </error> 5867 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 5868 Not a visible frame 5869 </error> 5870 </errors> 5871 </function> 5872 5873 <function id="GetLocalFloat" num="24"> 5874 <synopsis>Get Local Variable - Float</synopsis> 5875 <description> 5876 This function can be used to retrieve the value of a local 5877 variable whose type is <code>float</code>. 5878 </description> 5879 <origin>jvmdi</origin> 5880 <capabilities> 5881 <required id="can_access_local_variables"></required> 5882 </capabilities> 5883 <parameters> 5884 <param id="thread"> 5885 <jthread null="current" frame="frame"/> 5886 <description> 5887 The thread of the frame containing the variable's value. 5888 </description> 5889 </param> 5890 <param id="depth"> 5891 <jframeID thread="thread"/> 5892 <description> 5893 The depth of the frame containing the variable's value. 5894 </description> 5895 </param> 5896 <param id="slot"> 5897 <jint/> 5898 <description> 5899 The variable's slot number. 5900 </description> 5901 </param> 5902 <param id="value_ptr"> 5903 <outptr><jfloat/></outptr> 5904 <description> 5905 On return, points to the variable's value. 5906 </description> 5907 </param> 5908 </parameters> 5909 <errors> 5910 <error id="JVMTI_ERROR_INVALID_SLOT"> 5911 Invalid <code>slot</code>. 5912 </error> 5913 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 5914 The variable type is not <code>float</code>. 5915 </error> 5916 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 5917 Not a visible frame 5918 </error> 5919 </errors> 5920 </function> 5921 5922 <function id="GetLocalDouble" num="25"> 5923 <synopsis>Get Local Variable - Double</synopsis> 5924 <description> 5925 This function can be used to retrieve the value of a local 5926 variable whose type is <code>long</code>. 5927 </description> 5928 <origin>jvmdi</origin> 5929 <capabilities> 5930 <required id="can_access_local_variables"></required> 5931 </capabilities> 5932 <parameters> 5933 <param id="thread"> 5934 <jthread null="current" frame="frame"/> 5935 <description> 5936 The thread of the frame containing the variable's value. 5937 </description> 5938 </param> 5939 <param id="depth"> 5940 <jframeID thread="thread"/> 5941 <description> 5942 The depth of the frame containing the variable's value. 5943 </description> 5944 </param> 5945 <param id="slot"> 5946 <jint/> 5947 <description> 5948 The variable's slot number. 5949 </description> 5950 </param> 5951 <param id="value_ptr"> 5952 <outptr><jdouble/></outptr> 5953 <description> 5954 On return, points to the variable's value. 5955 </description> 5956 </param> 5957 </parameters> 5958 <errors> 5959 <error id="JVMTI_ERROR_INVALID_SLOT"> 5960 Invalid <code>slot</code>. 5961 </error> 5962 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 5963 The variable type is not <code>double</code>. 5964 </error> 5965 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 5966 Not a visible frame 5967 </error> 5968 </errors> 5969 </function> 5970 5971 <function id="SetLocalObject" num="26"> 5972 <synopsis>Set Local Variable - Object</synopsis> 5973 <description> 5974 This function can be used to set the value of a local 5975 variable whose type is <code>Object</code> or a subclass of <code>Object</code>. 5976 </description> 5977 <origin>jvmdi</origin> 5978 <capabilities> 5979 <required id="can_access_local_variables"></required> 5980 </capabilities> 5981 <parameters> 5982 <param id="thread"> 5983 <jthread null="current" frame="frame"/> 5984 <description> 5985 The thread of the frame containing the variable's value. 5986 </description> 5987 </param> 5988 <param id="depth"> 5989 <jframeID thread="thread"/> 5990 <description> 5991 The depth of the frame containing the variable's value. 5992 </description> 5993 </param> 5994 <param id="slot"> 5995 <jint/> 5996 <description> 5997 The variable's slot number. 5998 </description> 5999 </param> 6000 <param id="value"> 6001 <jobject/> 6002 <description> 6003 The new value for the variable. 6004 </description> 6005 </param> 6006 </parameters> 6007 <errors> 6008 <error id="JVMTI_ERROR_INVALID_SLOT"> 6009 Invalid <code>slot</code>. 6010 </error> 6011 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6012 The variable type is not 6013 <code>Object</code> or a subclass of <code>Object</code>. 6014 </error> 6015 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6016 The supplied <paramlink id="value"/> is not compatible 6017 with the variable type. 6018 </error> 6019 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6020 Not a visible frame 6021 </error> 6022 </errors> 6023 </function> 6024 6025 <function id="SetLocalInt" num="27"> 6026 <synopsis>Set Local Variable - Int</synopsis> 6027 <description> 6028 This function can be used to set the value of a local 6029 variable whose type is <code>int</code>, 6030 <code>short</code>, <code>char</code>, <code>byte</code>, or 6031 <code>boolean</code>. 6032 </description> 6033 <origin>jvmdi</origin> 6034 <capabilities> 6035 <required id="can_access_local_variables"></required> 6036 </capabilities> 6037 <parameters> 6038 <param id="thread"> 6039 <jthread null="current" frame="frame"/> 6040 <description> 6041 The thread of the frame containing the variable's value. 6042 </description> 6043 </param> 6044 <param id="depth"> 6045 <jframeID thread="thread"/> 6046 <description> 6047 The depth of the frame containing the variable's value. 6048 </description> 6049 </param> 6050 <param id="slot"> 6051 <jint/> 6052 <description> 6053 The variable's slot number. 6054 </description> 6055 </param> 6056 <param id="value"> 6057 <jint/> 6058 <description> 6059 The new value for the variable. 6060 </description> 6061 </param> 6062 </parameters> 6063 <errors> 6064 <error id="JVMTI_ERROR_INVALID_SLOT"> 6065 Invalid <code>slot</code>. 6066 </error> 6067 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6068 The variable type is not 6069 <code>int</code>, <code>short</code>, 6070 <code>char</code>, <code>byte</code>, or 6071 <code>boolean</code>. 6072 </error> 6073 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6074 Not a visible frame 6075 </error> 6076 </errors> 6077 </function> 6078 6079 <function id="SetLocalLong" num="28"> 6080 <synopsis>Set Local Variable - Long</synopsis> 6081 <description> 6082 This function can be used to set the value of a local 6083 variable whose type is <code>long</code>. 6084 </description> 6085 <origin>jvmdi</origin> 6086 <capabilities> 6087 <required id="can_access_local_variables"></required> 6088 </capabilities> 6089 <parameters> 6090 <param id="thread"> 6091 <jthread null="current" frame="frame"/> 6092 <description> 6093 The thread of the frame containing the variable's value. 6094 </description> 6095 </param> 6096 <param id="depth"> 6097 <jframeID thread="thread"/> 6098 <description> 6099 The depth of the frame containing the variable's value. 6100 </description> 6101 </param> 6102 <param id="slot"> 6103 <jint/> 6104 <description> 6105 The variable's slot number. 6106 </description> 6107 </param> 6108 <param id="value"> 6109 <jlong/> 6110 <description> 6111 The new value for the variable. 6112 </description> 6113 </param> 6114 </parameters> 6115 <errors> 6116 <error id="JVMTI_ERROR_INVALID_SLOT"> 6117 Invalid <code>slot</code>. 6118 </error> 6119 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6120 The variable type is not <code>long</code>. 6121 </error> 6122 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6123 Not a visible frame 6124 </error> 6125 </errors> 6126 </function> 6127 6128 <function id="SetLocalFloat" num="29"> 6129 <synopsis>Set Local Variable - Float</synopsis> 6130 <description> 6131 This function can be used to set the value of a local 6132 variable whose type is <code>float</code>. 6133 </description> 6134 <origin>jvmdi</origin> 6135 <capabilities> 6136 <required id="can_access_local_variables"></required> 6137 </capabilities> 6138 <parameters> 6139 <param id="thread"> 6140 <jthread null="current" frame="frame"/> 6141 <description> 6142 The thread of the frame containing the variable's value. 6143 </description> 6144 </param> 6145 <param id="depth"> 6146 <jframeID thread="thread"/> 6147 <description> 6148 The depth of the frame containing the variable's value. 6149 </description> 6150 </param> 6151 <param id="slot"> 6152 <jint/> 6153 <description> 6154 The variable's slot number. 6155 </description> 6156 </param> 6157 <param id="value"> 6158 <jfloat/> 6159 <description> 6160 The new value for the variable. 6161 </description> 6162 </param> 6163 </parameters> 6164 <errors> 6165 <error id="JVMTI_ERROR_INVALID_SLOT"> 6166 Invalid <code>slot</code>. 6167 </error> 6168 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6169 The variable type is not <code>float</code>. 6170 </error> 6171 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6172 Not a visible frame 6173 </error> 6174 </errors> 6175 </function> 6176 6177 <function id="SetLocalDouble" num="30"> 6178 <synopsis>Set Local Variable - Double</synopsis> 6179 <description> 6180 This function can be used to set the value of a local 6181 variable whose type is <code>double</code>. 6182 </description> 6183 <origin>jvmdi</origin> 6184 <capabilities> 6185 <required id="can_access_local_variables"></required> 6186 </capabilities> 6187 <parameters> 6188 <param id="thread"> 6189 <jthread null="current" frame="frame"/> 6190 <description> 6191 The thread of the frame containing the variable's value. 6192 </description> 6193 </param> 6194 <param id="depth"> 6195 <jframeID thread="thread"/> 6196 <description> 6197 The depth of the frame containing the variable's value. 6198 </description> 6199 </param> 6200 <param id="slot"> 6201 <jint/> 6202 <description> 6203 The variable's slot number. 6204 </description> 6205 </param> 6206 <param id="value"> 6207 <jdouble/> 6208 <description> 6209 The new value for the variable. 6210 </description> 6211 </param> 6212 </parameters> 6213 <errors> 6214 <error id="JVMTI_ERROR_INVALID_SLOT"> 6215 Invalid <code>slot</code>. 6216 </error> 6217 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6218 The variable type is not <code>double</code>. 6219 </error> 6220 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6221 Not a visible frame 6222 </error> 6223 </errors> 6224 </function> 6225 </category> 6226 6227 <category id="breakpointCategory" label="Breakpoint"> 6228 6229 <intro> 6230 </intro> 6231 6232 <function id="SetBreakpoint" num="38"> 6233 <synopsis>Set Breakpoint</synopsis> 6234 <description> 6235 Set a breakpoint at the instruction indicated by 6236 <code>method</code> and <code>location</code>. 6237 An instruction can only have one breakpoint. 6238 <p/> 6239 Whenever the designated instruction is about to be executed, a 6240 <eventlink id="Breakpoint"></eventlink> event is generated. 6241 </description> 6242 <origin>jvmdi</origin> 6243 <capabilities> 6244 <required id="can_generate_breakpoint_events"></required> 6245 </capabilities> 6246 <parameters> 6247 <param id="klass"> 6248 <jclass method="method"/> 6249 <description> 6250 The class in which to set the breakpoint 6251 </description> 6252 </param> 6253 <param id="method"> 6254 <jmethodID class="klass"/> 6255 <description> 6256 The method in which to set the breakpoint 6257 </description> 6258 </param> 6259 <param id="location"> 6260 <jlocation/> 6261 <description> 6262 the index of the instruction at which to set the breakpoint 6263 6264 </description> 6265 </param> 6266 </parameters> 6267 <errors> 6268 <error id="JVMTI_ERROR_DUPLICATE"> 6269 The designated bytecode already has a breakpoint. 6270 </error> 6271 </errors> 6272 </function> 6273 6274 <function id="ClearBreakpoint" num="39"> 6275 <synopsis>Clear Breakpoint</synopsis> 6276 <description> 6277 Clear the breakpoint at the bytecode indicated by 6278 <code>method</code> and <code>location</code>. 6279 </description> 6280 <origin>jvmdi</origin> 6281 <capabilities> 6282 <required id="can_generate_breakpoint_events"></required> 6283 </capabilities> 6284 <parameters> 6285 <param id="klass"> 6286 <jclass method="method"/> 6287 <description> 6288 The class in which to clear the breakpoint 6289 </description> 6290 </param> 6291 <param id="method"> 6292 <jmethodID class="klass"/> 6293 <description> 6294 The method in which to clear the breakpoint 6295 </description> 6296 </param> 6297 <param id="location"> 6298 <jlocation/> 6299 <description> 6300 the index of the instruction at which to clear the breakpoint 6301 </description> 6302 </param> 6303 </parameters> 6304 <errors> 6305 <error id="JVMTI_ERROR_NOT_FOUND"> 6306 There's no breakpoint at the designated bytecode. 6307 </error> 6308 </errors> 6309 </function> 6310 6311 </category> 6312 6313 <category id="fieldWatch" label="Watched Field"> 6314 6315 <intro> 6316 </intro> 6317 6318 <function id="SetFieldAccessWatch" num="41"> 6319 <synopsis>Set Field Access Watch</synopsis> 6320 <description> 6321 Generate a <eventlink id="FieldAccess"></eventlink> event 6322 when the field specified 6323 by <code>klass</code> and 6324 <code>field</code> is about to be accessed. 6325 An event will be generated for each access of the field 6326 until it is canceled with 6327 <functionlink id="ClearFieldAccessWatch"></functionlink>. 6328 Field accesses from Java programming language code or from JNI code are watched, 6329 fields modified by other means are not watched. 6330 Note that <jvmti/> users should be aware that their own field accesses 6331 will trigger the watch. 6332 A field can only have one field access watch set. 6333 Modification of a field is not considered an access--use 6334 <functionlink id="SetFieldModificationWatch"></functionlink> 6335 to monitor modifications. 6336 </description> 6337 <origin>jvmdi</origin> 6338 <capabilities> 6339 <required id="can_generate_field_access_events"></required> 6340 </capabilities> 6341 <parameters> 6342 <param id="klass"> 6343 <jclass field="field"/> 6344 <description> 6345 The class containing the field to watch 6346 </description> 6347 </param> 6348 <param id="field"> 6349 <jfieldID class="klass"/> 6350 <description> 6351 The field to watch 6352 6353 </description> 6354 </param> 6355 </parameters> 6356 <errors> 6357 <error id="JVMTI_ERROR_DUPLICATE"> 6358 The designated field is already being watched for accesses. 6359 </error> 6360 </errors> 6361 </function> 6362 6363 <function id="ClearFieldAccessWatch" num="42"> 6364 <synopsis>Clear Field Access Watch</synopsis> 6365 <description> 6366 Cancel a field access watch previously set by 6367 <functionlink id="SetFieldAccessWatch"></functionlink>, on the 6368 field specified 6369 by <code>klass</code> and 6370 <code>field</code>. 6371 </description> 6372 <origin>jvmdi</origin> 6373 <capabilities> 6374 <required id="can_generate_field_access_events"></required> 6375 </capabilities> 6376 <parameters> 6377 <param id="klass"> 6378 <jclass field="field"/> 6379 <description> 6380 The class containing the field to watch 6381 </description> 6382 </param> 6383 <param id="field"> 6384 <jfieldID class="klass"/> 6385 <description> 6386 The field to watch 6387 6388 </description> 6389 </param> 6390 </parameters> 6391 <errors> 6392 <error id="JVMTI_ERROR_NOT_FOUND"> 6393 The designated field is not being watched for accesses. 6394 </error> 6395 </errors> 6396 </function> 6397 6398 <function id="SetFieldModificationWatch" num="43"> 6399 <synopsis>Set Field Modification Watch</synopsis> 6400 <description> 6401 Generate a <eventlink id="FieldModification"></eventlink> event 6402 when the field specified 6403 by <code>klass</code> and 6404 <code>field</code> is about to be modified. 6405 An event will be generated for each modification of the field 6406 until it is canceled with 6407 <functionlink id="ClearFieldModificationWatch"></functionlink>. 6408 Field modifications from Java programming language code or from JNI code are watched, 6409 fields modified by other means are not watched. 6410 Note that <jvmti/> users should be aware that their own field modifications 6411 will trigger the watch. 6412 A field can only have one field modification watch set. 6413 </description> 6414 <origin>jvmdi</origin> 6415 <capabilities> 6416 <required id="can_generate_field_modification_events"></required> 6417 </capabilities> 6418 <parameters> 6419 <param id="klass"> 6420 <jclass field="field"/> 6421 <description> 6422 The class containing the field to watch 6423 </description> 6424 </param> 6425 <param id="field"> 6426 <jfieldID class="klass"/> 6427 <description> 6428 The field to watch 6429 6430 </description> 6431 </param> 6432 </parameters> 6433 <errors> 6434 <error id="JVMTI_ERROR_DUPLICATE"> 6435 The designated field is already being watched for modifications. 6436 </error> 6437 </errors> 6438 </function> 6439 6440 <function id="ClearFieldModificationWatch" num="44"> 6441 <synopsis>Clear Field Modification Watch</synopsis> 6442 <description> 6443 6444 Cancel a field modification watch previously set by 6445 <functionlink id="SetFieldModificationWatch"></functionlink>, on the 6446 field specified 6447 by <code>klass</code> and 6448 <code>field</code>. 6449 </description> 6450 <origin>jvmdi</origin> 6451 <capabilities> 6452 <required id="can_generate_field_modification_events"></required> 6453 </capabilities> 6454 <parameters> 6455 <param id="klass"> 6456 <jclass field="field"/> 6457 <description> 6458 The class containing the field to watch 6459 </description> 6460 </param> 6461 <param id="field"> 6462 <jfieldID class="klass"/> 6463 <description> 6464 The field to watch 6465 6466 </description> 6467 </param> 6468 </parameters> 6469 <errors> 6470 <error id="JVMTI_ERROR_NOT_FOUND"> 6471 The designated field is not being watched for modifications. 6472 </error> 6473 </errors> 6474 </function> 6475 </category> 6476 6477 <category id="module" label="Module"> 6478 6479 <intro> 6480 </intro> 6481 6482 <function id="GetAllModules" num="3" since="9"> 6483 <synopsis>Get All Modules</synopsis> 6484 <description> 6485 Return an array of all modules loaded in the virtual machine. 6486 The array includes the unnamed module for each class loader. 6487 The number of modules in the array is returned via 6488 <code>module_count_ptr</code>, and the array itself via 6489 <code>modules_ptr</code>. 6490 <p/> 6491 </description> 6492 <origin>new</origin> 6493 <capabilities> 6494 </capabilities> 6495 <parameters> 6496 <param id="module_count_ptr"> 6497 <outptr><jint/></outptr> 6498 <description> 6499 On return, points to the number of returned modules. 6500 </description> 6501 </param> 6502 <param id="modules_ptr"> 6503 <allocbuf outcount="module_count_ptr"><jobject/></allocbuf> 6504 <description> 6505 On return, points to an array of references, one 6506 for each module. 6507 </description> 6508 </param> 6509 </parameters> 6510 <errors> 6511 </errors> 6512 </function> 6513 6514 <function id="GetNamedModule" num="40" since="9"> 6515 <synopsis>Get Named Module</synopsis> 6516 <description> 6517 Return the <code>java.lang.reflect.Module</code> object for a named 6518 module defined to a class loader that contains a given package. 6519 The module is returned via <code>module_ptr</code>. 6520 <p/> 6521 If a named module is defined to the class loader and it 6522 contains the package then that named module is returned, 6523 otherwise <code>NULL</code> is returned. 6524 <p/> 6525 </description> 6526 <origin>new</origin> 6527 <capabilities> 6528 </capabilities> 6529 <parameters> 6530 <param id="class_loader"> 6531 <ptrtype> 6532 <jobject/> 6533 <nullok>the bootstrap loader is assumed</nullok> 6534 </ptrtype> 6535 <description> 6536 A class loader. 6537 If the <code>class_loader</code> is not <code>NULL</code> 6538 or a subclass of <code>java.lang.ClassLoader</code> 6539 this function returns 6540 <errorlink id="JVMTI_ERROR_ILLEGAL_ARGUMENT"></errorlink>. 6541 </description> 6542 </param> 6543 <param id="package_name"> 6544 <inbuf><char/></inbuf> 6545 <description> 6546 The name of the package, encoded as a 6547 <internallink id="mUTF">modified UTF-8</internallink> string. 6548 The package name is in internal form (JVMS 4.2.1); 6549 identifiers are separated by forward slashes rather than periods. 6550 </description> 6551 </param> 6552 <param id="module_ptr"> 6553 <outptr><jobject/></outptr> 6554 <description> 6555 On return, points to a <code>java.lang.reflect.Module</code> object 6556 or points to <code>NULL</code>. 6557 </description> 6558 </param> 6559 </parameters> 6560 <errors> 6561 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 6562 If class loader is not <code>NULL</code> and is not a class loader object. 6563 </error> 6564 </errors> 6565 </function> 6566 </category> 6567 6568 <category id="class" label="Class"> 6569 6570 <intro> 6571 </intro> 6572 6573 <function id="GetLoadedClasses" jkernel="yes" num="78"> 6574 <synopsis>Get Loaded Classes</synopsis> 6575 <description> 6576 Return an array of all classes loaded in the virtual machine. 6577 The number of classes in the array is returned via 6578 <code>class_count_ptr</code>, and the array itself via 6579 <code>classes_ptr</code>. 6580 <p/> 6581 Array classes of all types (including arrays of primitive types) are 6582 included in the returned list. Primitive classes (for example, 6583 <code>java.lang.Integer.TYPE</code>) are <i>not</i> included in this list. 6584 </description> 6585 <origin>jvmdi</origin> 6586 <capabilities> 6587 </capabilities> 6588 <parameters> 6589 <param id="class_count_ptr"> 6590 <outptr><jint/></outptr> 6591 <description> 6592 On return, points to the number of classes. 6593 </description> 6594 </param> 6595 <param id="classes_ptr"> 6596 <allocbuf outcount="class_count_ptr"><jclass/></allocbuf> 6597 <description> 6598 On return, points to an array of references, one 6599 for each class. 6600 </description> 6601 </param> 6602 </parameters> 6603 <errors> 6604 </errors> 6605 </function> 6606 6607 <function id="GetClassLoaderClasses" jkernel="yes" num="79"> 6608 <synopsis>Get Classloader Classes</synopsis> 6609 <description> 6610 Returns an array of those classes for which this class loader has 6611 been recorded as an initiating loader. Each 6612 class in the returned array was created by this class loader, 6613 either by defining it directly or by delegation to another class loader. 6614 See <vmspec chapter="5.3"/>. 6615 <p/> 6616 The number of classes in the array is returned via 6617 <code>class_count_ptr</code>, and the array itself via 6618 <code>classes_ptr</code>. 6619 </description> 6620 <origin>jvmdi</origin> 6621 <capabilities> 6622 </capabilities> 6623 <parameters> 6624 <param id="initiating_loader"> 6625 <ptrtype> 6626 <jobject/> 6627 <nullok>the classes initiated by the bootstrap loader will be returned</nullok> 6628 </ptrtype> 6629 <description> 6630 An initiating class loader. 6631 </description> 6632 </param> 6633 <param id="class_count_ptr"> 6634 <outptr><jint/></outptr> 6635 <description> 6636 On return, points to the number of classes. 6637 </description> 6638 </param> 6639 <param id="classes_ptr"> 6640 <allocbuf outcount="class_count_ptr"><jclass/></allocbuf> 6641 <description> 6642 On return, points to an array of references, one 6643 for each class. 6644 </description> 6645 </param> 6646 </parameters> 6647 <errors> 6648 </errors> 6649 </function> 6650 6651 <function id="GetClassSignature" phase="start" num="48"> 6652 <synopsis>Get Class Signature</synopsis> 6653 <description> 6654 For the class indicated by <code>klass</code>, return the 6655 <externallink id="docs/technotes/guides/jni/spec/types.html#type_signatures">JNI 6656 type signature</externallink> 6657 and the generic signature of the class. 6658 For example, <code>java.util.List</code> is <code>"Ljava/util/List;"</code> 6659 and <code>int[]</code> is <code>"[I"</code> 6660 The returned name for primitive classes 6661 is the type signature character of the corresponding primitive type. 6662 For example, <code>java.lang.Integer.TYPE</code> is <code>"I"</code>. 6663 </description> 6664 <origin>jvmdiClone</origin> 6665 <capabilities> 6666 </capabilities> 6667 <parameters> 6668 <param id="klass"> 6669 <jclass/> 6670 <description> 6671 The class to query. 6672 </description> 6673 </param> 6674 <param id="signature_ptr"> 6675 <allocbuf> 6676 <char/> 6677 <nullok>the signature is not returned</nullok> 6678 </allocbuf> 6679 <description> 6680 On return, points to the JNI type signature of the class, encoded as a 6681 <internallink id="mUTF">modified UTF-8</internallink> string. 6682 </description> 6683 </param> 6684 <param id="generic_ptr"> 6685 <allocbuf> 6686 <char/> 6687 <nullok>the generic signature is not returned</nullok> 6688 </allocbuf> 6689 <description> 6690 On return, points to the generic signature of the class, encoded as a 6691 <internallink id="mUTF">modified UTF-8</internallink> string. 6692 If there is no generic signature attribute for the class, then, 6693 on return, points to <code>NULL</code>. 6694 </description> 6695 </param> 6696 </parameters> 6697 <errors> 6698 </errors> 6699 </function> 6700 6701 <function id="GetClassStatus" phase="start" num="49"> 6702 <synopsis>Get Class Status</synopsis> 6703 <description> 6704 Get the status of the class. Zero or more of the following bits can be 6705 set. 6706 <constants id="jvmtiClassStatus" label="Class Status Flags" kind="bits"> 6707 <constant id="JVMTI_CLASS_STATUS_VERIFIED" num="1"> 6708 Class bytecodes have been verified 6709 </constant> 6710 <constant id="JVMTI_CLASS_STATUS_PREPARED" num="2"> 6711 Class preparation is complete 6712 </constant> 6713 <constant id="JVMTI_CLASS_STATUS_INITIALIZED" num="4"> 6714 Class initialization is complete. Static initializer has been run. 6715 </constant> 6716 <constant id="JVMTI_CLASS_STATUS_ERROR" num="8"> 6717 Error during initialization makes class unusable 6718 </constant> 6719 <constant id="JVMTI_CLASS_STATUS_ARRAY" num="16"> 6720 Class is an array. If set, all other bits are zero. 6721 </constant> 6722 <constant id="JVMTI_CLASS_STATUS_PRIMITIVE" num="32"> 6723 Class is a primitive class (for example, <code>java.lang.Integer.TYPE</code>). 6724 If set, all other bits are zero. 6725 </constant> 6726 </constants> 6727 </description> 6728 <origin>jvmdi</origin> 6729 <capabilities> 6730 </capabilities> 6731 <parameters> 6732 <param id="klass"> 6733 <jclass/> 6734 <description> 6735 The class to query. 6736 </description> 6737 </param> 6738 <param id="status_ptr"> 6739 <outptr><jint/></outptr> 6740 <description> 6741 On return, points to the current state of this class as one or 6742 more of the <internallink id="jvmtiClassStatus">class status flags</internallink>. 6743 </description> 6744 </param> 6745 </parameters> 6746 <errors> 6747 </errors> 6748 </function> 6749 6750 <function id="GetSourceFileName" phase="start" num="50"> 6751 <synopsis>Get Source File Name</synopsis> 6752 <description> 6753 For the class indicated by <code>klass</code>, return the source file 6754 name via <code>source_name_ptr</code>. The returned string 6755 is a file name only and never contains a directory name. 6756 <p/> 6757 For primitive classes (for example, <code>java.lang.Integer.TYPE</code>) 6758 and for arrays this function returns 6759 <errorlink id="JVMTI_ERROR_ABSENT_INFORMATION"></errorlink>. 6760 </description> 6761 <origin>jvmdi</origin> 6762 <capabilities> 6763 <required id="can_get_source_file_name"></required> 6764 </capabilities> 6765 <parameters> 6766 <param id="klass"> 6767 <jclass/> 6768 <description> 6769 The class to query. 6770 </description> 6771 </param> 6772 <param id="source_name_ptr"> 6773 <allocbuf><char/></allocbuf> 6774 <description> 6775 On return, points to the class's source file name, encoded as a 6776 <internallink id="mUTF">modified UTF-8</internallink> string. 6777 </description> 6778 </param> 6779 </parameters> 6780 <errors> 6781 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 6782 Class information does not include a source file name. This includes 6783 cases where the class is an array class or primitive class. 6784 </error> 6785 </errors> 6786 </function> 6787 6788 <function id="GetClassModifiers" phase="start" num="51"> 6789 <synopsis>Get Class Modifiers</synopsis> 6790 <description> 6791 For the class indicated by <code>klass</code>, return the access 6792 flags 6793 via <code>modifiers_ptr</code>. 6794 Access flags are defined in <vmspec chapter="4"/>. 6795 <p/> 6796 If the class is an array class, then its public, private, and protected 6797 modifiers are the same as those of its component type. For arrays of 6798 primitives, this component type is represented by one of the primitive 6799 classes (for example, <code>java.lang.Integer.TYPE</code>). 6800 <p/> 6801 If the class is a primitive class, its public modifier is always true, 6802 and its protected and private modifiers are always false. 6803 <p/> 6804 If the class is an array class or a primitive class then its final 6805 modifier is always true and its interface modifier is always false. 6806 The values of its other modifiers are not determined by this specification. 6807 6808 </description> 6809 <origin>jvmdi</origin> 6810 <capabilities> 6811 </capabilities> 6812 <parameters> 6813 <param id="klass"> 6814 <jclass/> 6815 <description> 6816 The class to query. 6817 </description> 6818 </param> 6819 <param id="modifiers_ptr"> 6820 <outptr><jint/></outptr> 6821 <description> 6822 On return, points to the current access flags of this class. 6823 6824 </description> 6825 </param> 6826 </parameters> 6827 <errors> 6828 </errors> 6829 </function> 6830 6831 <function id="GetClassMethods" phase="start" num="52"> 6832 <synopsis>Get Class Methods</synopsis> 6833 <description> 6834 For the class indicated by <code>klass</code>, return a count of 6835 methods via <code>method_count_ptr</code> and a list of 6836 method IDs via <code>methods_ptr</code>. The method list contains 6837 constructors and static initializers as well as true methods. 6838 Only directly declared methods are returned (not inherited methods). 6839 An empty method list is returned for array classes and primitive classes 6840 (for example, <code>java.lang.Integer.TYPE</code>). 6841 </description> 6842 <origin>jvmdi</origin> 6843 <capabilities> 6844 <capability id="can_maintain_original_method_order"/> 6845 </capabilities> 6846 <parameters> 6847 <param id="klass"> 6848 <jclass/> 6849 <description> 6850 The class to query. 6851 </description> 6852 </param> 6853 <param id="method_count_ptr"> 6854 <outptr><jint/></outptr> 6855 <description> 6856 On return, points to the number of methods declared in this class. 6857 </description> 6858 </param> 6859 <param id="methods_ptr"> 6860 <allocbuf outcount="method_count_ptr"><jmethodID class="klass"/></allocbuf> 6861 <description> 6862 On return, points to the method ID array. 6863 </description> 6864 </param> 6865 </parameters> 6866 <errors> 6867 <error id="JVMTI_ERROR_CLASS_NOT_PREPARED"> 6868 <paramlink id="klass"></paramlink> is not prepared. 6869 </error> 6870 </errors> 6871 </function> 6872 6873 <function id="GetClassFields" phase="start" num="53"> 6874 <synopsis>Get Class Fields</synopsis> 6875 <description> 6876 For the class indicated by <code>klass</code>, return a count of fields 6877 via <code>field_count_ptr</code> and a list of field IDs via 6878 <code>fields_ptr</code>. 6879 Only directly declared fields are returned (not inherited fields). 6880 Fields are returned in the order they occur in the class file. 6881 An empty field list is returned for array classes and primitive classes 6882 (for example, <code>java.lang.Integer.TYPE</code>). 6883 Use JNI to determine the length of an array. 6884 </description> 6885 <origin>jvmdi</origin> 6886 <capabilities> 6887 </capabilities> 6888 <parameters> 6889 <param id="klass"> 6890 <jclass/> 6891 <description> 6892 The class to query. 6893 </description> 6894 </param> 6895 <param id="field_count_ptr"> 6896 <outptr><jint/></outptr> 6897 <description> 6898 On return, points to the number of fields declared in this class. 6899 </description> 6900 </param> 6901 <param id="fields_ptr"> 6902 <allocbuf outcount="field_count_ptr"><jfieldID/></allocbuf> 6903 <description> 6904 On return, points to the field ID array. 6905 </description> 6906 </param> 6907 </parameters> 6908 <errors> 6909 <error id="JVMTI_ERROR_CLASS_NOT_PREPARED"> 6910 <paramlink id="klass"></paramlink> is not prepared. 6911 </error> 6912 </errors> 6913 </function> 6914 6915 <function id="GetImplementedInterfaces" phase="start" num="54"> 6916 <synopsis>Get Implemented Interfaces</synopsis> 6917 <description> 6918 Return the direct super-interfaces of this class. For a class, this 6919 function returns the interfaces declared in its <code>implements</code> 6920 clause. For an interface, this function returns the interfaces declared in 6921 its <code>extends</code> clause. 6922 An empty interface list is returned for array classes and primitive classes 6923 (for example, <code>java.lang.Integer.TYPE</code>). 6924 </description> 6925 <origin>jvmdi</origin> 6926 <capabilities> 6927 </capabilities> 6928 <parameters> 6929 <param id="klass"> 6930 <jclass/> 6931 <description> 6932 The class to query. 6933 </description> 6934 </param> 6935 <param id="interface_count_ptr"> 6936 <outptr><jint/></outptr> 6937 <description> 6938 On return, points to the number of interfaces. 6939 </description> 6940 </param> 6941 <param id="interfaces_ptr"> 6942 <allocbuf outcount="interface_count_ptr"><jclass/></allocbuf> 6943 <description> 6944 On return, points to the interface array. 6945 </description> 6946 </param> 6947 </parameters> 6948 <errors> 6949 <error id="JVMTI_ERROR_CLASS_NOT_PREPARED"> 6950 <paramlink id="klass"></paramlink> is not prepared. 6951 </error> 6952 </errors> 6953 </function> 6954 6955 <function id="GetClassVersionNumbers" phase="start" num="145" since="1.1"> 6956 <synopsis>Get Class Version Numbers</synopsis> 6957 <description> 6958 For the class indicated by <code>klass</code>, 6959 return the minor and major version numbers, 6960 as defined in 6961 <vmspec chapter="4"/>. 6962 </description> 6963 <origin>new</origin> 6964 <capabilities> 6965 </capabilities> 6966 <parameters> 6967 <param id="klass"> 6968 <jclass/> 6969 <description> 6970 The class to query. 6971 </description> 6972 </param> 6973 <param id="minor_version_ptr"> 6974 <outptr><jint/></outptr> 6975 <description> 6976 On return, points to the value of the 6977 <code>minor_version</code> item of the 6978 Class File Format. 6979 Note: to be consistent with the Class File Format, 6980 the minor version number is the first parameter. 6981 </description> 6982 </param> 6983 <param id="major_version_ptr"> 6984 <outptr><jint/></outptr> 6985 <description> 6986 On return, points to the value of the 6987 <code>major_version</code> item of the 6988 Class File Format. 6989 </description> 6990 </param> 6991 </parameters> 6992 <errors> 6993 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 6994 The class is a primitive or array class. 6995 </error> 6996 </errors> 6997 </function> 6998 6999 <function id="GetConstantPool" phase="start" num="146" since="1.1"> 7000 <synopsis>Get Constant Pool</synopsis> 7001 <description> 7002 For the class indicated by <code>klass</code>, 7003 return the raw bytes of the constant pool in the format of the 7004 <code>constant_pool</code> item of 7005 <vmspec chapter="4"/>. 7006 The format of the constant pool may differ between versions 7007 of the Class File Format, so, the 7008 <functionlink id="GetClassVersionNumbers">minor and major 7009 class version numbers</functionlink> should be checked for 7010 compatibility. 7011 <p/> 7012 The returned constant pool might not have the same layout or 7013 contents as the constant pool in the defining class file. 7014 The constant pool returned by GetConstantPool() may have 7015 more or fewer entries than the defining constant pool. 7016 Entries may be in a different order. 7017 The constant pool returned by GetConstantPool() will match the 7018 constant pool used by 7019 <functionlink id="GetBytecodes">GetBytecodes()</functionlink>. 7020 That is, the bytecodes returned by GetBytecodes() will have 7021 constant pool indices which refer to constant pool entries returned 7022 by GetConstantPool(). 7023 Note that since <functionlink id="RetransformClasses"/> 7024 and <functionlink id="RedefineClasses"/> can change 7025 the constant pool, the constant pool returned by this function 7026 can change accordingly. Thus, the correspondence between 7027 GetConstantPool() and GetBytecodes() does not hold if there 7028 is an intervening class retransformation or redefinition. 7029 The value of a constant pool entry used by a given bytecode will 7030 match that of the defining class file (even if the indices don't match). 7031 Constant pool entries which are not used directly or indirectly by 7032 bytecodes (for example, UTF-8 strings associated with annotations) are 7033 not required to exist in the returned constant pool. 7034 </description> 7035 <origin>new</origin> 7036 <capabilities> 7037 <required id="can_get_constant_pool"></required> 7038 </capabilities> 7039 <parameters> 7040 <param id="klass"> 7041 <jclass/> 7042 <description> 7043 The class to query. 7044 </description> 7045 </param> 7046 <param id="constant_pool_count_ptr"> 7047 <outptr><jint/></outptr> 7048 <description> 7049 On return, points to the number of entries 7050 in the constant pool table plus one. 7051 This corresponds to the <code>constant_pool_count</code> 7052 item of the Class File Format. 7053 </description> 7054 </param> 7055 <param id="constant_pool_byte_count_ptr"> 7056 <outptr><jint/></outptr> 7057 <description> 7058 On return, points to the number of bytes 7059 in the returned raw constant pool. 7060 </description> 7061 </param> 7062 <param id="constant_pool_bytes_ptr"> 7063 <allocbuf outcount="constant_pool_byte_count_ptr"><uchar/></allocbuf> 7064 <description> 7065 On return, points to the raw constant pool, that is the bytes 7066 defined by the <code>constant_pool</code> item of the 7067 Class File Format 7068 </description> 7069 </param> 7070 </parameters> 7071 <errors> 7072 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 7073 The class is a primitive or array class. 7074 </error> 7075 </errors> 7076 </function> 7077 7078 <function id="IsInterface" phase="start" num="55"> 7079 <synopsis>Is Interface</synopsis> 7080 <description> 7081 Determines whether a class object reference represents an interface. 7082 The <code>jboolean</code> result is 7083 <code>JNI_TRUE</code> if the "class" is actually an interface, 7084 <code>JNI_FALSE</code> otherwise. 7085 </description> 7086 <origin>jvmdi</origin> 7087 <capabilities> 7088 </capabilities> 7089 <parameters> 7090 <param id="klass"> 7091 <jclass/> 7092 <description> 7093 The class to query. 7094 </description> 7095 </param> 7096 <param id="is_interface_ptr"> 7097 <outptr><jboolean/></outptr> 7098 <description> 7099 On return, points to the boolean result of this function. 7100 7101 </description> 7102 </param> 7103 </parameters> 7104 <errors> 7105 </errors> 7106 </function> 7107 7108 <function id="IsArrayClass" phase="start" num="56"> 7109 <synopsis>Is Array Class</synopsis> 7110 <description> 7111 Determines whether a class object reference represents an array. 7112 The <code>jboolean</code> result is 7113 <code>JNI_TRUE</code> if the class is an array, 7114 <code>JNI_FALSE</code> otherwise. 7115 </description> 7116 <origin>jvmdi</origin> 7117 <capabilities> 7118 </capabilities> 7119 <parameters> 7120 <param id="klass"> 7121 <jclass/> 7122 <description> 7123 The class to query. 7124 </description> 7125 </param> 7126 <param id="is_array_class_ptr"> 7127 <outptr><jboolean/></outptr> 7128 <description> 7129 On return, points to the boolean result of this function. 7130 7131 </description> 7132 </param> 7133 </parameters> 7134 <errors> 7135 </errors> 7136 </function> 7137 7138 <function id="IsModifiableClass" jkernel="yes" phase="start" num="45" since="1.1"> 7139 <synopsis>Is Modifiable Class</synopsis> 7140 <description> 7141 Determines whether a class is modifiable. 7142 If a class is modifiable (<paramlink id="is_modifiable_class_ptr"/> 7143 returns <code>JNI_TRUE</code>) the class can be 7144 redefined with <functionlink id="RedefineClasses"/> (assuming 7145 the agent possesses the 7146 <fieldlink id="can_redefine_classes" struct="jvmtiCapabilities"/> 7147 capability) or 7148 retransformed with <functionlink id="RetransformClasses"/> (assuming 7149 the agent possesses the 7150 <fieldlink id="can_retransform_classes" struct="jvmtiCapabilities"/> 7151 capability). 7152 If a class is not modifiable (<paramlink id="is_modifiable_class_ptr"/> 7153 returns <code>JNI_FALSE</code>) the class can be neither 7154 redefined nor retransformed. 7155 <p/> 7156 Primitive classes (for example, <code>java.lang.Integer.TYPE</code>), 7157 array classes, and some implementation defined classes are never modifiable. 7158 <p/> 7159 </description> 7160 <origin>new</origin> 7161 <capabilities> 7162 <capability id="can_redefine_any_class"> 7163 If possessed then all classes (except primitive, array, and some implementation defined 7164 classes) are modifiable (redefine or retransform). 7165 </capability> 7166 <capability id="can_retransform_any_class"> 7167 If possessed then all classes (except primitive, array, and some implementation defined 7168 classes) are modifiable with <functionlink id="RetransformClasses"/>. 7169 </capability> 7170 <capability id="can_redefine_classes"> 7171 No effect on the result of the function. 7172 But must additionally be possessed to modify the class with 7173 <functionlink id="RedefineClasses"/>. 7174 </capability> 7175 <capability id="can_retransform_classes"> 7176 No effect on the result of the function. 7177 But must additionally be possessed to modify the class with 7178 <functionlink id="RetransformClasses"/>. 7179 </capability> 7180 </capabilities> 7181 <parameters> 7182 <param id="klass"> 7183 <jclass/> 7184 <description> 7185 The class to query. 7186 </description> 7187 </param> 7188 <param id="is_modifiable_class_ptr"> 7189 <outptr><jboolean/></outptr> 7190 <description> 7191 On return, points to the boolean result of this function. 7192 </description> 7193 </param> 7194 </parameters> 7195 <errors> 7196 </errors> 7197 </function> 7198 7199 <function id="GetClassLoader" phase="start" num="57"> 7200 <synopsis>Get Class Loader</synopsis> 7201 <description> 7202 For the class indicated by <code>klass</code>, return via 7203 <code>classloader_ptr</code> a reference to the class loader for the 7204 class. 7205 </description> 7206 <origin>jvmdi</origin> 7207 <capabilities> 7208 </capabilities> 7209 <parameters> 7210 <param id="klass"> 7211 <jclass/> 7212 <description> 7213 The class to query. 7214 </description> 7215 </param> 7216 <param id="classloader_ptr"> 7217 <outptr><jobject/></outptr> 7218 <description> 7219 On return, points to the class loader that loaded 7220 this class. 7221 If the class was not created by a class loader 7222 or if the class loader is the bootstrap class loader, 7223 points to <code>NULL</code>. 7224 </description> 7225 </param> 7226 </parameters> 7227 <errors> 7228 </errors> 7229 7230 </function> 7231 7232 <function id="GetSourceDebugExtension" phase="start" num="90"> 7233 <synopsis>Get Source Debug Extension</synopsis> 7234 <description> 7235 For the class indicated by <code>klass</code>, return the debug 7236 extension via <code>source_debug_extension_ptr</code>. 7237 The returned string 7238 contains exactly the debug extension information present in the 7239 class file of <code>klass</code>. 7240 </description> 7241 <origin>jvmdi</origin> 7242 <capabilities> 7243 <required id="can_get_source_debug_extension"></required> 7244 </capabilities> 7245 <parameters> 7246 <param id="klass"> 7247 <jclass/> 7248 <description> 7249 The class to query. 7250 </description> 7251 </param> 7252 <param id="source_debug_extension_ptr"> 7253 <allocbuf><char/></allocbuf> 7254 <description> 7255 On return, points to the class's debug extension, encoded as a 7256 <internallink id="mUTF">modified UTF-8</internallink> string. 7257 </description> 7258 </param> 7259 </parameters> 7260 <errors> 7261 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 7262 Class information does not include a debug extension. 7263 </error> 7264 </errors> 7265 </function> 7266 7267 <function id="RetransformClasses" jkernel="yes" num="152" since="1.1"> 7268 <synopsis>Retransform Classes</synopsis> 7269 <description> 7270 This function facilitates the 7271 <internallink id="bci">bytecode instrumentation</internallink> 7272 of already loaded classes. 7273 To replace the class definition without reference to the existing 7274 bytecodes, as one might do when recompiling from source for 7275 fix-and-continue debugging, <functionlink id="RedefineClasses"/> 7276 function should be used instead. 7277 <p/> 7278 When classes are initially loaded or when they are 7279 <functionlink id="RedefineClasses">redefined</functionlink>, 7280 the initial class file bytes can be transformed with the 7281 <eventlink id="ClassFileLoadHook"/> event. 7282 This function reruns the transformation process 7283 (whether or not a transformation has previously occurred). 7284 This retransformation follows these steps: 7285 <ul> 7286 <li>starting from the initial class file bytes 7287 </li> 7288 <li>for each <fieldlink id="can_retransform_classes" 7289 struct="jvmtiCapabilities">retransformation 7290 incapable</fieldlink> 7291 agent which received a 7292 <code>ClassFileLoadHook</code> event during the previous 7293 load or redefine, the bytes it returned 7294 (via the <code>new_class_data</code> parameter) 7295 are reused as the output of the transformation; 7296 note that this is equivalent to reapplying 7297 the previous transformation, unaltered. except that 7298 the <code>ClassFileLoadHook</code> event 7299 is <b>not</b> sent to these agents 7300 </li> 7301 <li>for each <fieldlink id="can_retransform_classes" 7302 struct="jvmtiCapabilities">retransformation 7303 capable</fieldlink> 7304 agent, the <code>ClassFileLoadHook</code> event is sent, 7305 allowing a new transformation to be applied 7306 </li> 7307 <li>the transformed class file bytes are installed as the new 7308 definition of the class 7309 </li> 7310 </ul> 7311 See the <eventlink id="ClassFileLoadHook"/> event for more details. 7312 <p/> 7313 The initial class file bytes represent the bytes passed to 7314 <code>ClassLoader.defineClass</code> 7315 or <code>RedefineClasses</code> (before any transformations 7316 were applied), however they may not exactly match them. 7317 The constant pool may differ in ways described in 7318 <functionlink id="GetConstantPool"/>. 7319 Constant pool indices in the bytecodes of methods will correspond. 7320 Some attributes may not be present. 7321 Where order is not meaningful, for example the order of methods, 7322 order may not be preserved. 7323 <p/> 7324 Retransformation can cause new versions of methods to be installed. 7325 Old method versions may become 7326 <internallink id="obsoleteMethods">obsolete</internallink> 7327 The new method version will be used on new invokes. 7328 If a method has active stack frames, those active frames continue to 7329 run the bytecodes of the original method version. 7330 <p/> 7331 This function does not cause any initialization except that which 7332 would occur under the customary JVM semantics. 7333 In other words, retransforming a class does not cause its initializers to be 7334 run. The values of static fields will remain as they were 7335 prior to the call. 7336 <p/> 7337 Threads need not be suspended. 7338 <p/> 7339 All breakpoints in the class are cleared. 7340 <p/> 7341 All attributes are updated. 7342 <p/> 7343 Instances of the retransformed class are not affected -- fields retain their 7344 previous values. 7345 <functionlink id="GetTag">Tags</functionlink> on the instances are 7346 also unaffected. 7347 <p/> 7348 In response to this call, no events other than the 7349 <eventlink id="ClassFileLoadHook"/> event 7350 will be sent. 7351 <p/> 7352 The retransformation may change method bodies, the constant pool and attributes. 7353 The retransformation must not add, remove or rename fields or methods, change the 7354 signatures of methods, change modifiers, or change inheritance. 7355 These restrictions may be lifted in future versions. 7356 See the error return description below for information on error codes 7357 returned if an unsupported retransformation is attempted. 7358 The class file bytes are not verified or installed until they have passed 7359 through the chain of <eventlink id="ClassFileLoadHook"/> events, thus the 7360 returned error code reflects the result of the transformations. 7361 If any error code is returned other than <code>JVMTI_ERROR_NONE</code>, 7362 none of the classes to be retransformed will have a new definition installed. 7363 When this function returns (with the error code of <code>JVMTI_ERROR_NONE</code>) 7364 all of the classes to be retransformed will have their new definitions installed. 7365 </description> 7366 <origin>new</origin> 7367 <capabilities> 7368 <required id="can_retransform_classes"></required> 7369 <capability id="can_retransform_any_class"></capability> 7370 </capabilities> 7371 <parameters> 7372 <param id="class_count"> 7373 <jint min="0"/> 7374 <description> 7375 The number of classes to be retransformed. 7376 </description> 7377 </param> 7378 <param id="classes"> 7379 <inbuf incount="class_count"><jclass/></inbuf> 7380 <description> 7381 The array of classes to be retransformed. 7382 </description> 7383 </param> 7384 </parameters> 7385 <errors> 7386 <error id="JVMTI_ERROR_UNMODIFIABLE_CLASS"> 7387 One of the <paramlink id="classes"/> cannot be modified. 7388 See <functionlink id="IsModifiableClass"/>. 7389 </error> 7390 <error id="JVMTI_ERROR_INVALID_CLASS"> 7391 One of the <paramlink id="classes"/> is not a valid class. 7392 </error> 7393 <error id="JVMTI_ERROR_UNSUPPORTED_VERSION"> 7394 A retransformed class file has a version number not supported by this VM. 7395 </error> 7396 <error id="JVMTI_ERROR_INVALID_CLASS_FORMAT"> 7397 A retransformed class file is malformed (The VM would return a <code>ClassFormatError</code>). 7398 </error> 7399 <error id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION"> 7400 The retransformed class file definitions would lead to a circular definition 7401 (the VM would return a <code>ClassCircularityError</code>). 7402 </error> 7403 <error id="JVMTI_ERROR_FAILS_VERIFICATION"> 7404 The retransformed class file bytes fail verification. 7405 </error> 7406 <error id="JVMTI_ERROR_NAMES_DONT_MATCH"> 7407 The class name defined in a retransformed class file is 7408 different from the name in the old class object. 7409 </error> 7410 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED"> 7411 A retransformed class file would require adding a method. 7412 </error> 7413 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED"> 7414 A retransformed class file changes a field. 7415 </error> 7416 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED"> 7417 A direct superclass is different for a retransformed class file, 7418 or the set of directly implemented 7419 interfaces is different. 7420 </error> 7421 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED"> 7422 A retransformed class file does not declare a method 7423 declared in the old class version. 7424 </error> 7425 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED"> 7426 A retransformed class file has different class modifiers. 7427 </error> 7428 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED"> 7429 A method in the retransformed class file has different modifiers 7430 than its counterpart in the old class version. 7431 </error> 7432 </errors> 7433 </function> 7434 7435 <function id="RedefineClasses" jkernel="yes" num="87"> 7436 <synopsis>Redefine Classes</synopsis> 7437 <typedef id="jvmtiClassDefinition" label="Class redefinition description"> 7438 <field id="klass"> 7439 <jclass/> 7440 <description> 7441 Class object for this class 7442 </description> 7443 </field> 7444 <field id="class_byte_count"> 7445 <jint/> 7446 <description> 7447 Number of bytes defining class (below) 7448 </description> 7449 </field> 7450 <field id="class_bytes"> 7451 <inbuf incount="class_byte_count"><uchar/></inbuf> 7452 <description> 7453 Bytes defining class (in <vmspec chapter="4"/>) 7454 </description> 7455 </field> 7456 </typedef> 7457 <description> 7458 All classes given are redefined according to the definitions 7459 supplied. 7460 This function is used to replace the definition of a class 7461 with a new definition, as might be needed in fix-and-continue 7462 debugging. 7463 Where the existing class file bytes are to be transformed, for 7464 example in 7465 <internallink id="bci">bytecode instrumentation</internallink>, 7466 <functionlink id="RetransformClasses"/> should be used. 7467 <p/> 7468 Redefinition can cause new versions of methods to be installed. 7469 Old method versions may become 7470 <internallink id="obsoleteMethods">obsolete</internallink> 7471 The new method version will be used on new invokes. 7472 If a method has active stack frames, those active frames continue to 7473 run the bytecodes of the original method version. 7474 If resetting of stack frames is desired, use 7475 <functionlink id="PopFrame"></functionlink> 7476 to pop frames with obsolete method versions. 7477 <p/> 7478 This function does not cause any initialization except that which 7479 would occur under the customary JVM semantics. 7480 In other words, redefining a class does not cause its initializers to be 7481 run. The values of static fields will remain as they were 7482 prior to the call. 7483 <p/> 7484 Threads need not be suspended. 7485 <p/> 7486 All breakpoints in the class are cleared. 7487 <p/> 7488 All attributes are updated. 7489 <p/> 7490 Instances of the redefined class are not affected -- fields retain their 7491 previous values. 7492 <functionlink id="GetTag">Tags</functionlink> on the instances are 7493 also unaffected. 7494 <p/> 7495 In response to this call, the <jvmti/> event 7496 <eventlink id="ClassFileLoadHook">Class File Load Hook</eventlink> 7497 will be sent (if enabled), but no other <jvmti/> events will be sent. 7498 <p/> 7499 The redefinition may change method bodies, the constant pool and attributes. 7500 The redefinition must not add, remove or rename fields or methods, change the 7501 signatures of methods, change modifiers, or change inheritance. 7502 These restrictions may be lifted in future versions. 7503 See the error return description below for information on error codes 7504 returned if an unsupported redefinition is attempted. 7505 The class file bytes are not verified or installed until they have passed 7506 through the chain of <eventlink id="ClassFileLoadHook"/> events, thus the 7507 returned error code reflects the result of the transformations applied 7508 to the bytes passed into <paramlink id="class_definitions"/>. 7509 If any error code is returned other than <code>JVMTI_ERROR_NONE</code>, 7510 none of the classes to be redefined will have a new definition installed. 7511 When this function returns (with the error code of <code>JVMTI_ERROR_NONE</code>) 7512 all of the classes to be redefined will have their new definitions installed. 7513 </description> 7514 <origin>jvmdi</origin> 7515 <capabilities> 7516 <required id="can_redefine_classes"></required> 7517 <capability id="can_redefine_any_class"></capability> 7518 </capabilities> 7519 <parameters> 7520 <param id="class_count"> 7521 <jint min="0"/> 7522 <description> 7523 The number of classes specified in <code>class_definitions</code> 7524 </description> 7525 </param> 7526 <param id="class_definitions"> 7527 <inbuf incount="class_count"><struct>jvmtiClassDefinition</struct></inbuf> 7528 <description> 7529 The array of new class definitions 7530 </description> 7531 </param> 7532 </parameters> 7533 <errors> 7534 <error id="JVMTI_ERROR_NULL_POINTER"> 7535 One of <code>class_bytes</code> is <code>NULL</code>. 7536 </error> 7537 <error id="JVMTI_ERROR_UNMODIFIABLE_CLASS"> 7538 An element of <code>class_definitions</code> cannot be modified. 7539 See <functionlink id="IsModifiableClass"/>. 7540 </error> 7541 <error id="JVMTI_ERROR_INVALID_CLASS"> 7542 An element of <code>class_definitions</code> is not a valid class. 7543 </error> 7544 <error id="JVMTI_ERROR_UNSUPPORTED_VERSION"> 7545 A new class file has a version number not supported by this VM. 7546 </error> 7547 <error id="JVMTI_ERROR_INVALID_CLASS_FORMAT"> 7548 A new class file is malformed (The VM would return a <code>ClassFormatError</code>). 7549 </error> 7550 <error id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION"> 7551 The new class file definitions would lead to a circular definition 7552 (the VM would return a <code>ClassCircularityError</code>). 7553 </error> 7554 <error id="JVMTI_ERROR_FAILS_VERIFICATION"> 7555 The class bytes fail verification. 7556 </error> 7557 <error id="JVMTI_ERROR_NAMES_DONT_MATCH"> 7558 The class name defined in a new class file is 7559 different from the name in the old class object. 7560 </error> 7561 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED"> 7562 A new class file would require adding a method. 7563 </error> 7564 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED"> 7565 A new class version changes a field. 7566 </error> 7567 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED"> 7568 A direct superclass is different for a new class 7569 version, or the set of directly implemented 7570 interfaces is different. 7571 </error> 7572 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED"> 7573 A new class version does not declare a method 7574 declared in the old class version. 7575 </error> 7576 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED"> 7577 A new class version has different modifiers. 7578 </error> 7579 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED"> 7580 A method in the new class version has different modifiers 7581 than its counterpart in the old class version. 7582 </error> 7583 </errors> 7584 </function> 7585 7586 </category> 7587 7588 <category id="object" label="Object"> 7589 7590 <function id="GetObjectSize" jkernel="yes" phase="start" num="154"> 7591 <synopsis>Get Object Size</synopsis> 7592 <description> 7593 For the object indicated by <code>object</code>, 7594 return via <code>size_ptr</code> the size of the object. 7595 This size is an implementation-specific approximation of 7596 the amount of storage consumed by this object. 7597 It may include some or all of the object's overhead, and thus 7598 is useful for comparison within an implementation but not 7599 between implementations. 7600 The estimate may change during a single invocation of the JVM. 7601 </description> 7602 <origin>new</origin> 7603 <capabilities> 7604 </capabilities> 7605 <parameters> 7606 <param id="object"> 7607 <jobject/> 7608 <description> 7609 The object to query. 7610 </description> 7611 </param> 7612 <param id="size_ptr"> 7613 <outptr><jlong/></outptr> 7614 <description> 7615 On return, points to the object's size in bytes. 7616 </description> 7617 </param> 7618 </parameters> 7619 <errors> 7620 </errors> 7621 </function> 7622 7623 <function id="GetObjectHashCode" phase="start" num="58"> 7624 <synopsis>Get Object Hash Code</synopsis> 7625 <description> 7626 For the object indicated by <code>object</code>, 7627 return via <code>hash_code_ptr</code> a hash code. 7628 This hash code could be used to maintain a hash table of object references, 7629 however, on some implementations this can cause significant performance 7630 impacts--in most cases 7631 <internallink id="Heap">tags</internallink> 7632 will be a more efficient means of associating information with objects. 7633 This function guarantees 7634 the same hash code value for a particular object throughout its life 7635 </description> 7636 <origin>jvmdi</origin> 7637 <capabilities> 7638 </capabilities> 7639 <parameters> 7640 <param id="object"> 7641 <jobject/> 7642 <description> 7643 The object to query. 7644 </description> 7645 </param> 7646 <param id="hash_code_ptr"> 7647 <outptr><jint/></outptr> 7648 <description> 7649 On return, points to the object's hash code. 7650 </description> 7651 </param> 7652 </parameters> 7653 <errors> 7654 </errors> 7655 </function> 7656 7657 <function id="GetObjectMonitorUsage" num="59"> 7658 <synopsis>Get Object Monitor Usage</synopsis> 7659 <typedef id="jvmtiMonitorUsage" label="Object monitor usage information"> 7660 <field id="owner"> 7661 <jthread/> 7662 <description> 7663 The thread owning this monitor, or <code>NULL</code> if unused 7664 </description> 7665 </field> 7666 <field id="entry_count"> 7667 <jint/> 7668 <description> 7669 The number of times the owning thread has entered the monitor 7670 </description> 7671 </field> 7672 <field id="waiter_count"> 7673 <jint/> 7674 <description> 7675 The number of threads waiting to own this monitor 7676 </description> 7677 </field> 7678 <field id="waiters"> 7679 <allocfieldbuf><jthread/></allocfieldbuf> 7680 <description> 7681 The <code>waiter_count</code> waiting threads 7682 </description> 7683 </field> 7684 <field id="notify_waiter_count"> 7685 <jint/> 7686 <description> 7687 The number of threads waiting to be notified by this monitor 7688 </description> 7689 </field> 7690 <field id="notify_waiters"> 7691 <allocfieldbuf><jthread/></allocfieldbuf> 7692 <description> 7693 The <code>notify_waiter_count</code> threads waiting to be notified 7694 </description> 7695 </field> 7696 </typedef> 7697 <description> 7698 Get information about the object's monitor. 7699 The fields of the <functionlink id="jvmtiMonitorUsage"></functionlink> structure 7700 are filled in with information about usage of the monitor. 7701 <todo> 7702 Decide and then clarify suspend requirements. 7703 </todo> 7704 </description> 7705 <origin>jvmdi</origin> 7706 <capabilities> 7707 <required id="can_get_monitor_info"></required> 7708 </capabilities> 7709 <parameters> 7710 <param id="object"> 7711 <jobject/> 7712 <description> 7713 The object to query. 7714 </description> 7715 </param> 7716 <param id="info_ptr"> 7717 <outptr><struct>jvmtiMonitorUsage</struct></outptr> 7718 <description> 7719 On return, filled with monitor information for the 7720 specified object. 7721 </description> 7722 </param> 7723 </parameters> 7724 <errors> 7725 </errors> 7726 </function> 7727 7728 <elide> 7729 <function id="GetObjectMonitors" num="116"> 7730 <synopsis>Get Object Monitors</synopsis> 7731 <description> 7732 Return the list of object monitors. 7733 <p/> 7734 Note: details about each monitor can be examined with 7735 <functionlink id="GetObjectMonitorUsage"></functionlink>. 7736 </description> 7737 <origin>new</origin> 7738 <capabilities> 7739 <required id="can_get_monitor_info"></required> 7740 </capabilities> 7741 <parameters> 7742 <param id="monitorCnt"> 7743 <outptr><jint/></outptr> 7744 <description> 7745 On return, pointer to the number 7746 of monitors returned in <code>monitors_ptr</code>. 7747 </description> 7748 </param> 7749 <param id="monitors_ptr"> 7750 <allocbuf outcount="monitorCnt"><jobject/></allocbuf> 7751 <description> 7752 On return, pointer to the monitor list. 7753 </description> 7754 </param> 7755 </parameters> 7756 <errors> 7757 </errors> 7758 </function> 7759 </elide> 7760 7761 </category> 7762 7763 <category id="fieldCategory" label="Field"> 7764 7765 <intro> 7766 </intro> 7767 7768 <function id="GetFieldName" phase="start" num="60"> 7769 <synopsis>Get Field Name (and Signature)</synopsis> 7770 <description> 7771 For the field indicated by <paramlink id="klass"/> and <paramlink id="field"/>, 7772 return the field name via <paramlink id="name_ptr"/> and field signature via 7773 <paramlink id="signature_ptr"/>. 7774 <p/> 7775 Field signatures are defined in the JNI Specification and 7776 are referred to as <code>field descriptors</code> in 7777 <vmspec chapter="4.3.2"/>. 7778 </description> 7779 <origin>jvmdiClone</origin> 7780 <capabilities> 7781 </capabilities> 7782 <parameters> 7783 <param id="klass"> 7784 <jclass field="field"/> 7785 <description> 7786 The class of the field to query. 7787 </description> 7788 </param> 7789 <param id="field"> 7790 <jfieldID class="klass"/> 7791 <description> 7792 The field to query. 7793 </description> 7794 </param> 7795 <param id="name_ptr"> 7796 <allocbuf> 7797 <char/> 7798 <nullok>the name is not returned</nullok> 7799 </allocbuf> 7800 <description> 7801 On return, points to the field name, encoded as a 7802 <internallink id="mUTF">modified UTF-8</internallink> string. 7803 </description> 7804 </param> 7805 <param id="signature_ptr"> 7806 <allocbuf> 7807 <char/> 7808 <nullok>the signature is not returned</nullok> 7809 </allocbuf> 7810 <description> 7811 On return, points to the field signature, encoded as a 7812 <internallink id="mUTF">modified UTF-8</internallink> string. 7813 </description> 7814 </param> 7815 <param id="generic_ptr"> 7816 <allocbuf> 7817 <char/> 7818 <nullok>the generic signature is not returned</nullok> 7819 </allocbuf> 7820 <description> 7821 On return, points to the generic signature of the field, encoded as a 7822 <internallink id="mUTF">modified UTF-8</internallink> string. 7823 If there is no generic signature attribute for the field, then, 7824 on return, points to <code>NULL</code>. 7825 </description> 7826 </param> 7827 </parameters> 7828 <errors> 7829 </errors> 7830 </function> 7831 7832 <function id="GetFieldDeclaringClass" phase="start" num="61"> 7833 <synopsis>Get Field Declaring Class</synopsis> 7834 <description> 7835 For the field indicated by <code>klass</code> and <code>field</code> 7836 return the class that defined it via <code>declaring_class_ptr</code>. 7837 The declaring class will either be <code>klass</code>, a superclass, or 7838 an implemented interface. 7839 </description> 7840 <origin>jvmdi</origin> 7841 <capabilities> 7842 </capabilities> 7843 <parameters> 7844 <param id="klass"> 7845 <jclass field="field"/> 7846 <description> 7847 The class to query. 7848 </description> 7849 </param> 7850 <param id="field"> 7851 <jfieldID class="klass"/> 7852 <description> 7853 The field to query. 7854 </description> 7855 </param> 7856 <param id="declaring_class_ptr"> 7857 <outptr><jclass/></outptr> 7858 <description> 7859 On return, points to the declaring class 7860 </description> 7861 </param> 7862 </parameters> 7863 <errors> 7864 </errors> 7865 </function> 7866 7867 <function id="GetFieldModifiers" phase="start" num="62"> 7868 <synopsis>Get Field Modifiers</synopsis> 7869 <description> 7870 For the field indicated by <code>klass</code> and <code>field</code> 7871 return the access flags via <code>modifiers_ptr</code>. 7872 Access flags are defined in <vmspec chapter="4"/>. 7873 </description> 7874 <origin>jvmdi</origin> 7875 <capabilities> 7876 </capabilities> 7877 <parameters> 7878 <param id="klass"> 7879 <jclass field="field"/> 7880 <description> 7881 The class to query. 7882 </description> 7883 </param> 7884 <param id="field"> 7885 <jfieldID class="klass"/> 7886 <description> 7887 The field to query. 7888 </description> 7889 </param> 7890 <param id="modifiers_ptr"> 7891 <outptr><jint/></outptr> 7892 <description> 7893 On return, points to the access flags. 7894 </description> 7895 </param> 7896 </parameters> 7897 <errors> 7898 </errors> 7899 </function> 7900 7901 <function id="IsFieldSynthetic" phase="start" num="63"> 7902 <synopsis>Is Field Synthetic</synopsis> 7903 <description> 7904 For the field indicated by <code>klass</code> and <code>field</code>, return a 7905 value indicating whether the field is synthetic via <code>is_synthetic_ptr</code>. 7906 Synthetic fields are generated by the compiler but not present in the 7907 original source code. 7908 </description> 7909 <origin>jvmdi</origin> 7910 <capabilities> 7911 <required id="can_get_synthetic_attribute"></required> 7912 </capabilities> 7913 <parameters> 7914 <param id="klass"> 7915 <jclass field="field"/> 7916 <description> 7917 The class of the field to query. 7918 </description> 7919 </param> 7920 <param id="field"> 7921 <jfieldID class="klass"/> 7922 <description> 7923 The field to query. 7924 </description> 7925 </param> 7926 <param id="is_synthetic_ptr"> 7927 <outptr><jboolean/></outptr> 7928 <description> 7929 On return, points to the boolean result of this function. 7930 </description> 7931 </param> 7932 </parameters> 7933 <errors> 7934 </errors> 7935 </function> 7936 7937 </category> 7938 7939 <category id="method" label="Method"> 7940 7941 <intro> 7942 These functions provide information about a method (represented as a 7943 <typelink id="jmethodID"/>) and set how methods are processed. 7944 </intro> 7945 7946 <intro id="obsoleteMethods" label="Obsolete Methods"> 7947 The functions <functionlink id="RetransformClasses"/> and 7948 <functionlink id="RedefineClasses"/> can cause new versions 7949 of methods to be installed. 7950 An original version of a method is considered equivalent 7951 to the new version if: 7952 <ul> 7953 <li>their bytecodes are the same except for indices into the 7954 constant pool and </li> 7955 <li>the referenced constants are equal.</li> 7956 </ul> 7957 An original method version which is not equivalent to the 7958 new method version is called obsolete and is assigned a new method ID; 7959 the original method ID now refers to the new method version. 7960 A method ID can be tested for obsolescence with 7961 <functionlink id="IsMethodObsolete"/>. 7962 </intro> 7963 7964 <function id="GetMethodName" phase="start" num="64"> 7965 <synopsis>Get Method Name (and Signature)</synopsis> 7966 <description> 7967 For the method indicated by <code>method</code>, 7968 return the method name via <code>name_ptr</code> and method signature via 7969 <code>signature_ptr</code>. 7970 <p/> 7971 Method signatures are defined in the JNI Specification and are 7972 referred to as <code>method descriptors</code> in 7973 <vmspec chapter="4.3.3"/>. 7974 Note this is different 7975 than method signatures as defined in the <i>Java Language Specification</i>. 7976 </description> 7977 <origin>jvmdiClone</origin> 7978 <capabilities> 7979 </capabilities> 7980 <parameters> 7981 <param id="method"> 7982 <jmethodID/> 7983 <description> 7984 The method to query. 7985 </description> 7986 </param> 7987 <param id="name_ptr"> 7988 <allocbuf> 7989 <char/> 7990 <nullok>the name is not returned</nullok> 7991 </allocbuf> 7992 <description> 7993 On return, points to the method name, encoded as a 7994 <internallink id="mUTF">modified UTF-8</internallink> string. 7995 </description> 7996 </param> 7997 <param id="signature_ptr"> 7998 <allocbuf> 7999 <char/> 8000 <nullok>the signature is not returned</nullok> 8001 </allocbuf> 8002 <description> 8003 On return, points to the method signature, encoded as a 8004 <internallink id="mUTF">modified UTF-8</internallink> string. 8005 </description> 8006 </param> 8007 <param id="generic_ptr"> 8008 <allocbuf> 8009 <char/> 8010 <nullok>the generic signature is not returned</nullok> 8011 </allocbuf> 8012 <description> 8013 On return, points to the generic signature of the method, encoded as a 8014 <internallink id="mUTF">modified UTF-8</internallink> string. 8015 If there is no generic signature attribute for the method, then, 8016 on return, points to <code>NULL</code>. 8017 </description> 8018 </param> 8019 </parameters> 8020 <errors> 8021 </errors> 8022 </function> 8023 8024 <function id="GetMethodDeclaringClass" phase="start" num="65"> 8025 <synopsis>Get Method Declaring Class</synopsis> 8026 <description> 8027 For the method indicated by <code>method</code>, 8028 return the class that defined it via <code>declaring_class_ptr</code>. 8029 </description> 8030 <origin>jvmdi</origin> 8031 <capabilities> 8032 </capabilities> 8033 <parameters> 8034 <param id="klass"> 8035 <jclass method="method"/> 8036 <description> 8037 The class to query. 8038 </description> 8039 </param> 8040 <param id="method"> 8041 <jmethodID class="klass"/> 8042 <description> 8043 The method to query. 8044 </description> 8045 </param> 8046 <param id="declaring_class_ptr"> 8047 <outptr><jclass/></outptr> 8048 <description> 8049 On return, points to the declaring class 8050 </description> 8051 </param> 8052 </parameters> 8053 <errors> 8054 </errors> 8055 </function> 8056 8057 <function id="GetMethodModifiers" phase="start" num="66"> 8058 <synopsis>Get Method Modifiers</synopsis> 8059 <description> 8060 For the method indicated by <code>method</code>, 8061 return the access flags via <code>modifiers_ptr</code>. 8062 Access flags are defined in <vmspec chapter="4"/>. 8063 </description> 8064 <origin>jvmdi</origin> 8065 <capabilities> 8066 </capabilities> 8067 <parameters> 8068 <param id="klass"> 8069 <jclass method="method"/> 8070 <description> 8071 The class to query. 8072 </description> 8073 </param> 8074 <param id="method"> 8075 <jmethodID class="klass"/> 8076 <description> 8077 The method to query. 8078 </description> 8079 </param> 8080 <param id="modifiers_ptr"> 8081 <outptr><jint/></outptr> 8082 <description> 8083 On return, points to the access flags. 8084 </description> 8085 </param> 8086 </parameters> 8087 <errors> 8088 </errors> 8089 </function> 8090 8091 <function id="GetMaxLocals" phase="start" num="68"> 8092 <synopsis>Get Max Locals</synopsis> 8093 <description> 8094 For the method indicated by <code>method</code>, 8095 return the number of local variable slots used by the method, 8096 including the local variables used to pass parameters to the 8097 method on its invocation. 8098 <p/> 8099 See <code>max_locals</code> in <vmspec chapter="4.7.3"/>. 8100 </description> 8101 <origin>jvmdi</origin> 8102 <capabilities> 8103 </capabilities> 8104 <parameters> 8105 <param id="klass"> 8106 <jclass method="method"/> 8107 <description> 8108 The class to query. 8109 </description> 8110 </param> 8111 <param id="method"> 8112 <jmethodID class="klass" native="error"/> 8113 <description> 8114 The method to query. 8115 </description> 8116 </param> 8117 <param id="max_ptr"> 8118 <outptr><jint/></outptr> 8119 <description> 8120 On return, points to the maximum number of local slots 8121 </description> 8122 </param> 8123 </parameters> 8124 <errors> 8125 </errors> 8126 </function> 8127 8128 <function id="GetArgumentsSize" phase="start" num="69"> 8129 <synopsis>Get Arguments Size</synopsis> 8130 <description> 8131 For the method indicated by <code>method</code>, 8132 return via <code>max_ptr</code> the number of local variable slots used 8133 by the method's arguments. 8134 Note that two-word arguments use two slots. 8135 </description> 8136 <origin>jvmdi</origin> 8137 <capabilities> 8138 </capabilities> 8139 <parameters> 8140 <param id="klass"> 8141 <jclass method="method"/> 8142 <description> 8143 The class to query. 8144 </description> 8145 </param> 8146 <param id="method"> 8147 <jmethodID class="klass" native="error"/> 8148 <description> 8149 The method to query. 8150 </description> 8151 </param> 8152 <param id="size_ptr"> 8153 <outptr><jint/></outptr> 8154 <description> 8155 On return, points to the number of argument slots 8156 </description> 8157 </param> 8158 </parameters> 8159 <errors> 8160 </errors> 8161 </function> 8162 8163 <function id="GetLineNumberTable" phase="start" num="70"> 8164 <synopsis>Get Line Number Table</synopsis> 8165 <typedef id="jvmtiLineNumberEntry" label="Line number table entry"> 8166 <field id="start_location"> 8167 <jlocation/> 8168 <description> 8169 the <datalink id="jlocation"></datalink> where the line begins 8170 </description> 8171 </field> 8172 <field id="line_number"> 8173 <jint/> 8174 <description> 8175 the line number 8176 </description> 8177 </field> 8178 </typedef> 8179 <description> 8180 For the method indicated by <code>method</code>, 8181 return a table of source line number entries. The size of the table is 8182 returned via <code>entry_count_ptr</code> and the table itself is 8183 returned via <code>table_ptr</code>. 8184 </description> 8185 <origin>jvmdi</origin> 8186 <capabilities> 8187 <required id="can_get_line_numbers"></required> 8188 </capabilities> 8189 <parameters> 8190 <param id="klass"> 8191 <jclass method="method"/> 8192 <description> 8193 The class to query. 8194 </description> 8195 </param> 8196 <param id="method"> 8197 <jmethodID class="klass" native="error"/> 8198 <description> 8199 The method to query. 8200 </description> 8201 </param> 8202 <param id="entry_count_ptr"> 8203 <outptr><jint/></outptr> 8204 <description> 8205 On return, points to the number of entries in the table 8206 </description> 8207 </param> 8208 <param id="table_ptr"> 8209 <allocbuf outcount="entry_count_ptr"><struct>jvmtiLineNumberEntry</struct></allocbuf> 8210 <description> 8211 On return, points to the line number table pointer. 8212 </description> 8213 </param> 8214 </parameters> 8215 <errors> 8216 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 8217 Class information does not include line numbers. 8218 </error> 8219 </errors> 8220 </function> 8221 8222 <function id="GetMethodLocation" phase="start" num="71"> 8223 <synopsis>Get Method Location</synopsis> 8224 <description> 8225 For the method indicated by <code>method</code>, 8226 return the beginning and ending addresses through 8227 <code>start_location_ptr</code> and <code>end_location_ptr</code>. In a 8228 conventional byte code indexing scheme, 8229 <code>start_location_ptr</code> will always point to zero 8230 and <code>end_location_ptr</code> 8231 will always point to the byte code count minus one. 8232 </description> 8233 <origin>jvmdi</origin> 8234 <capabilities> 8235 </capabilities> 8236 <parameters> 8237 <param id="klass"> 8238 <jclass method="method"/> 8239 <description> 8240 The class to query. 8241 </description> 8242 </param> 8243 <param id="method"> 8244 <jmethodID class="klass" native="error"/> 8245 <description> 8246 The method to query. 8247 </description> 8248 </param> 8249 <param id="start_location_ptr"> 8250 <outptr><jlocation/></outptr> 8251 <description> 8252 On return, points to the first location, or 8253 <code>-1</code> if location information is not available. 8254 If the information is available and 8255 <functionlink id="GetJLocationFormat"></functionlink> 8256 returns <datalink id="JVMTI_JLOCATION_JVMBCI"></datalink> 8257 then this will always be zero. 8258 </description> 8259 </param> 8260 <param id="end_location_ptr"> 8261 <outptr><jlocation/></outptr> 8262 <description> 8263 On return, points to the last location, 8264 or <code>-1</code> if location information is not available. 8265 </description> 8266 </param> 8267 </parameters> 8268 <errors> 8269 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 8270 Class information does not include method sizes. 8271 </error> 8272 </errors> 8273 </function> 8274 8275 <function id="GetLocalVariableTable" num="72"> 8276 <synopsis>Get Local Variable Table</synopsis> 8277 <typedef id="jvmtiLocalVariableEntry" label="Local variable table entry"> 8278 <field id="start_location"> 8279 <jlocation/> 8280 <description> 8281 The code array index where the local variable is first valid 8282 (that is, where it must have a value). 8283 </description> 8284 </field> 8285 <field id="length"> 8286 <jint/> 8287 <description> 8288 The length of the valid section for this local variable. 8289 The last code array index where the local variable is valid 8290 is <code>start_location + length</code>. 8291 </description> 8292 </field> 8293 <field id="name"> 8294 <allocfieldbuf><char/></allocfieldbuf> 8295 <description> 8296 The local variable name, encoded as a 8297 <internallink id="mUTF">modified UTF-8</internallink> string. 8298 </description> 8299 </field> 8300 <field id="signature"> 8301 <allocfieldbuf><char/></allocfieldbuf> 8302 <description> 8303 The local variable's type signature, encoded as a 8304 <internallink id="mUTF">modified UTF-8</internallink> string. 8305 The signature format is the same as that defined in 8306 <vmspec chapter="4.3.2"/>. 8307 </description> 8308 </field> 8309 <field id="generic_signature"> 8310 <allocfieldbuf><char/></allocfieldbuf> 8311 <description> 8312 The local variable's generic signature, encoded as a 8313 <internallink id="mUTF">modified UTF-8</internallink> string. 8314 The value of this field will be <code>NULL</code> for any local 8315 variable which does not have a generic type. 8316 </description> 8317 </field> 8318 <field id="slot"> 8319 <jint/> 8320 <description> 8321 The local variable's slot. See <internallink id="local">Local Variables</internallink>. 8322 </description> 8323 </field> 8324 </typedef> 8325 <description> 8326 Return local variable information. 8327 </description> 8328 <origin>jvmdiClone</origin> 8329 <capabilities> 8330 <required id="can_access_local_variables"></required> 8331 </capabilities> 8332 <parameters> 8333 <param id="method"> 8334 <jmethodID native="error"/> 8335 <description> 8336 The method to query. 8337 </description> 8338 </param> 8339 <param id="entry_count_ptr"> 8340 <outptr><jint/></outptr> 8341 <description> 8342 On return, points to the number of entries in the table 8343 </description> 8344 </param> 8345 <param id="table_ptr"> 8346 <allocbuf outcount="entry_count_ptr"><struct>jvmtiLocalVariableEntry</struct></allocbuf> 8347 <description> 8348 On return, points to an array of local variable table entries. 8349 </description> 8350 </param> 8351 </parameters> 8352 <errors> 8353 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 8354 Class information does not include local variable 8355 information. 8356 </error> 8357 </errors> 8358 </function> 8359 8360 <function id="GetBytecodes" phase="start" num="75"> 8361 <synopsis>Get Bytecodes</synopsis> 8362 <description> 8363 For the method indicated by <code>method</code>, 8364 return the byte codes that implement the method. The number of 8365 bytecodes is returned via <code>bytecode_count_ptr</code>. The byte codes 8366 themselves are returned via <code>bytecodes_ptr</code>. 8367 </description> 8368 <origin>jvmdi</origin> 8369 <capabilities> 8370 <required id="can_get_bytecodes"></required> 8371 </capabilities> 8372 <parameters> 8373 <param id="klass"> 8374 <jclass method="method"/> 8375 <description> 8376 The class to query. 8377 </description> 8378 </param> 8379 <param id="method"> 8380 <jmethodID class="klass" native="error"/> 8381 <description> 8382 The method to query. 8383 </description> 8384 </param> 8385 <param id="bytecode_count_ptr"> 8386 <outptr><jint/></outptr> 8387 <description> 8388 On return, points to the length of the byte code array 8389 </description> 8390 </param> 8391 <param id="bytecodes_ptr"> 8392 <allocbuf outcount="bytecode_count_ptr"><uchar/></allocbuf> 8393 <description> 8394 On return, points to the pointer to the byte code array 8395 </description> 8396 </param> 8397 </parameters> 8398 <errors> 8399 </errors> 8400 </function> 8401 8402 <function id="IsMethodNative" phase="start" num="76"> 8403 <synopsis>Is Method Native</synopsis> 8404 <description> 8405 For the method indicated by <code>method</code>, return a 8406 value indicating whether the method is native via <code>is_native_ptr</code> 8407 </description> 8408 <origin>jvmdi</origin> 8409 <capabilities> 8410 </capabilities> 8411 <parameters> 8412 <param id="klass"> 8413 <jclass method="method"/> 8414 <description> 8415 The class to query. 8416 </description> 8417 </param> 8418 <param id="method"> 8419 <jmethodID class="klass"/> 8420 <description> 8421 The method to query. 8422 </description> 8423 </param> 8424 <param id="is_native_ptr"> 8425 <outptr><jboolean/></outptr> 8426 <description> 8427 On return, points to the boolean result of this function. 8428 </description> 8429 </param> 8430 </parameters> 8431 <errors> 8432 </errors> 8433 </function> 8434 8435 <function id="IsMethodSynthetic" phase="start" num="77"> 8436 <synopsis>Is Method Synthetic</synopsis> 8437 <description> 8438 For the method indicated by <code>method</code>, return a 8439 value indicating whether the method is synthetic via <code>is_synthetic_ptr</code>. 8440 Synthetic methods are generated by the compiler but not present in the 8441 original source code. 8442 </description> 8443 <origin>jvmdi</origin> 8444 <capabilities> 8445 <required id="can_get_synthetic_attribute"></required> 8446 </capabilities> 8447 <parameters> 8448 <param id="klass"> 8449 <jclass method="method"/> 8450 <description> 8451 The class to query. 8452 </description> 8453 </param> 8454 <param id="method"> 8455 <jmethodID class="klass"/> 8456 <description> 8457 The method to query. 8458 </description> 8459 </param> 8460 <param id="is_synthetic_ptr"> 8461 <outptr><jboolean/></outptr> 8462 <description> 8463 On return, points to the boolean result of this function. 8464 </description> 8465 </param> 8466 </parameters> 8467 <errors> 8468 </errors> 8469 </function> 8470 8471 <function id="IsMethodObsolete" phase="start" num="91"> 8472 <synopsis>Is Method Obsolete</synopsis> 8473 <description> 8474 Determine if a method ID refers to an 8475 <internallink id="obsoleteMethods">obsolete</internallink> 8476 method version. 8477 </description> 8478 <origin>jvmdi</origin> 8479 <capabilities> 8480 </capabilities> 8481 <parameters> 8482 <param id="klass"> 8483 <jclass method="method"/> 8484 <description> 8485 The class to query. 8486 </description> 8487 </param> 8488 <param id="method"> 8489 <jmethodID class="klass"/> 8490 <description> 8491 The method ID to query. 8492 </description> 8493 </param> 8494 <param id="is_obsolete_ptr"> 8495 <outptr><jboolean/></outptr> 8496 <description> 8497 On return, points to the boolean result of this function. 8498 </description> 8499 </param> 8500 </parameters> 8501 <errors> 8502 </errors> 8503 </function> 8504 8505 <function id="SetNativeMethodPrefix" jkernel="yes" phase="any" num="73" since="1.1"> 8506 <synopsis>Set Native Method Prefix</synopsis> 8507 <description> 8508 This function modifies the failure handling of 8509 native method resolution by allowing retry 8510 with a prefix applied to the name. 8511 When used with the 8512 <eventlink id="ClassFileLoadHook">ClassFileLoadHook 8513 event</eventlink>, it enables native methods to be 8514 <internallink id="bci">instrumented</internallink>. 8515 <p/> 8516 Since native methods cannot be directly instrumented 8517 (they have no bytecodes), they must be wrapped with 8518 a non-native method which can be instrumented. 8519 For example, if we had: 8520 <example> 8521 native boolean foo(int x);</example> 8522 <p/> 8523 We could transform the class file (with the 8524 ClassFileLoadHook event) so that this becomes: 8525 <example> 8526 boolean foo(int x) { 8527 <i>... record entry to foo ...</i> 8528 return wrapped_foo(x); 8529 } 8530 8531 native boolean wrapped_foo(int x);</example> 8532 <p/> 8533 Where foo becomes a wrapper for the actual native method 8534 with the appended prefix "wrapped_". Note that 8535 "wrapped_" would be a poor choice of prefix since it 8536 might conceivably form the name of an existing method 8537 thus something like "$$$MyAgentWrapped$$$_" would be 8538 better but would make these examples less readable. 8539 <p/> 8540 The wrapper will allow data to be collected on the native 8541 method call, but now the problem becomes linking up the 8542 wrapped method with the native implementation. 8543 That is, the method <code>wrapped_foo</code> needs to be 8544 resolved to the native implementation of <code>foo</code>, 8545 which might be: 8546 <example> 8547 Java_somePackage_someClass_foo(JNIEnv* env, jint x)</example> 8548 <p/> 8549 This function allows the prefix to be specified and the 8550 proper resolution to occur. 8551 Specifically, when the standard resolution fails, the 8552 resolution is retried taking the prefix into consideration. 8553 There are two ways that resolution occurs, explicit 8554 resolution with the JNI function <code>RegisterNatives</code> 8555 and the normal automatic resolution. For 8556 <code>RegisterNatives</code>, the VM will attempt this 8557 association: 8558 <example> 8559 method(foo) -> nativeImplementation(foo)</example> 8560 <p/> 8561 When this fails, the resolution will be retried with 8562 the specified prefix prepended to the method name, 8563 yielding the correct resolution: 8564 <example> 8565 method(wrapped_foo) -> nativeImplementation(foo)</example> 8566 <p/> 8567 For automatic resolution, the VM will attempt: 8568 <example> 8569 method(wrapped_foo) -> nativeImplementation(wrapped_foo)</example> 8570 <p/> 8571 When this fails, the resolution will be retried with 8572 the specified prefix deleted from the implementation name, 8573 yielding the correct resolution: 8574 <example> 8575 method(wrapped_foo) -> nativeImplementation(foo)</example> 8576 <p/> 8577 Note that since the prefix is only used when standard 8578 resolution fails, native methods can be wrapped selectively. 8579 <p/> 8580 Since each <jvmti/> environment is independent and 8581 can do its own transformation of the bytecodes, more 8582 than one layer of wrappers may be applied. Thus each 8583 environment needs its own prefix. Since transformations 8584 are applied in order, the prefixes, if applied, will 8585 be applied in the same order. 8586 The order of transformation application is described in 8587 the <eventlink id="ClassFileLoadHook"/> event. 8588 Thus if three environments applied 8589 wrappers, <code>foo</code> might become 8590 <code>$env3_$env2_$env1_foo</code>. But if, say, 8591 the second environment did not apply a wrapper to 8592 <code>foo</code> it would be just 8593 <code>$env3_$env1_foo</code>. To be able to 8594 efficiently determine the sequence of prefixes, 8595 an intermediate prefix is only applied if its non-native 8596 wrapper exists. Thus, in the last example, even though 8597 <code>$env1_foo</code> is not a native method, the 8598 <code>$env1_</code> prefix is applied since 8599 <code>$env1_foo</code> exists. 8600 <p/> 8601 Since the prefixes are used at resolution time 8602 and since resolution may be arbitrarily delayed, a 8603 native method prefix must remain set as long as there 8604 are corresponding prefixed native methods. 8605 </description> 8606 <origin>new</origin> 8607 <capabilities> 8608 <required id="can_set_native_method_prefix"></required> 8609 </capabilities> 8610 <parameters> 8611 <param id="prefix"> 8612 <inbuf> 8613 <char/> 8614 <nullok> 8615 any existing prefix in this environment is cancelled 8616 </nullok> 8617 </inbuf> 8618 <description> 8619 The prefix to apply, encoded as a 8620 <internallink id="mUTF">modified UTF-8</internallink> string. 8621 </description> 8622 </param> 8623 </parameters> 8624 <errors> 8625 </errors> 8626 </function> 8627 8628 <function id="SetNativeMethodPrefixes" jkernel="yes" phase="any" num="74" since="1.1"> 8629 <synopsis>Set Native Method Prefixes</synopsis> 8630 <description> 8631 For a normal agent, <functionlink id="SetNativeMethodPrefix"/> 8632 will provide all needed native method prefixing. 8633 For a meta-agent that performs multiple independent class 8634 file transformations (for example as a proxy for another 8635 layer of agents) this function allows each transformation 8636 to have its own prefix. 8637 The prefixes are applied in the order supplied and are 8638 processed in the same manor as described for the 8639 application of prefixes from multiple <jvmti/> environments 8640 in <functionlink id="SetNativeMethodPrefix"/>. 8641 <p/> 8642 Any previous prefixes are replaced. Thus, calling this 8643 function with a <paramlink id="prefix_count"/> of <code>0</code> 8644 disables prefixing in this environment. 8645 <p/> 8646 <functionlink id="SetNativeMethodPrefix"/> and this function 8647 are the two ways to set the prefixes. 8648 Calling <code>SetNativeMethodPrefix</code> with 8649 a prefix is the same as calling this function with 8650 <paramlink id="prefix_count"/> of <code>1</code>. 8651 Calling <code>SetNativeMethodPrefix</code> with 8652 <code>NULL</code> is the same as calling this function with 8653 <paramlink id="prefix_count"/> of <code>0</code>. 8654 </description> 8655 <origin>new</origin> 8656 <capabilities> 8657 <required id="can_set_native_method_prefix"></required> 8658 </capabilities> 8659 <parameters> 8660 <param id="prefix_count"> 8661 <jint min="0"/> 8662 <description> 8663 The number of prefixes to apply. 8664 </description> 8665 </param> 8666 <param id="prefixes"> 8667 <agentbuf> 8668 <char/> 8669 </agentbuf> 8670 <description> 8671 The prefixes to apply for this environment, each encoded as a 8672 <internallink id="mUTF">modified UTF-8</internallink> string. 8673 </description> 8674 </param> 8675 </parameters> 8676 <errors> 8677 </errors> 8678 </function> 8679 8680 </category> 8681 8682 <category id="RawMonitors" label="Raw Monitor"> 8683 8684 <function id="CreateRawMonitor" phase="onload" callbacksafe="safe" num="31"> 8685 <synopsis>Create Raw Monitor</synopsis> 8686 <description> 8687 Create a raw monitor. 8688 </description> 8689 <origin>jvmdi</origin> 8690 <capabilities> 8691 </capabilities> 8692 <parameters> 8693 <param id="name"> 8694 <inbuf><char/></inbuf> 8695 <description> 8696 A name to identify the monitor, encoded as a 8697 <internallink id="mUTF">modified UTF-8</internallink> string. 8698 </description> 8699 </param> 8700 <param id="monitor_ptr"> 8701 <outptr><jrawMonitorID/></outptr> 8702 <description> 8703 On return, points to the created monitor. 8704 </description> 8705 </param> 8706 </parameters> 8707 <errors> 8708 </errors> 8709 </function> 8710 8711 <function id="DestroyRawMonitor" phase="onload" callbacksafe="safe" num="32"> 8712 <synopsis>Destroy Raw Monitor</synopsis> 8713 <description> 8714 Destroy the raw monitor. 8715 If the monitor being destroyed has been entered by this thread, it will be 8716 exited before it is destroyed. 8717 If the monitor being destroyed has been entered by another thread, 8718 an error will be returned and the monitor will not be destroyed. 8719 </description> 8720 <origin>jvmdi</origin> 8721 <capabilities> 8722 </capabilities> 8723 <parameters> 8724 <param id="monitor"> 8725 <jrawMonitorID/> 8726 <description> 8727 The monitor 8728 </description> 8729 </param> 8730 </parameters> 8731 <errors> 8732 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 8733 Not monitor owner 8734 </error> 8735 </errors> 8736 </function> 8737 8738 <function id="RawMonitorEnter" phase="any" callbacksafe="safe" impl="innative notrace" num="33"> 8739 <synopsis>Raw Monitor Enter</synopsis> 8740 <description> 8741 Gain exclusive ownership of a raw monitor. 8742 The same thread may enter a monitor more then once. 8743 The thread must 8744 <functionlink id="RawMonitorExit">exit</functionlink> 8745 the monitor the same number of times as it is entered. 8746 If a monitor is entered during <code>OnLoad</code> (before attached threads exist) 8747 and has not exited when attached threads come into existence, the enter 8748 is considered to have occurred on the main thread. 8749 </description> 8750 <origin>jvmdi</origin> 8751 <capabilities> 8752 </capabilities> 8753 <parameters> 8754 <param id="monitor"> 8755 <jrawMonitorID/> 8756 <description> 8757 The monitor 8758 </description> 8759 </param> 8760 </parameters> 8761 <errors> 8762 </errors> 8763 </function> 8764 8765 <function id="RawMonitorExit" phase="any" callbacksafe="safe" impl="innative notrace" num="34"> 8766 <synopsis>Raw Monitor Exit</synopsis> 8767 <description> 8768 Release exclusive ownership of a raw monitor. 8769 </description> 8770 <origin>jvmdi</origin> 8771 <capabilities> 8772 </capabilities> 8773 <parameters> 8774 <param id="monitor"> 8775 <jrawMonitorID/> 8776 <description> 8777 The monitor 8778 </description> 8779 </param> 8780 </parameters> 8781 <errors> 8782 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 8783 Not monitor owner 8784 </error> 8785 </errors> 8786 </function> 8787 8788 <function id="RawMonitorWait" phase="any" callbacksafe="safe" impl="innative notrace" num="35"> 8789 <synopsis>Raw Monitor Wait</synopsis> 8790 <description> 8791 Wait for notification of the raw monitor. 8792 <p/> 8793 Causes the current thread to wait until either another thread calls 8794 <functionlink id="RawMonitorNotify"/> or 8795 <functionlink id="RawMonitorNotifyAll"/> 8796 for the specified raw monitor, or the specified 8797 <paramlink id="millis">timeout</paramlink> 8798 has elapsed. 8799 </description> 8800 <origin>jvmdi</origin> 8801 <capabilities> 8802 </capabilities> 8803 <parameters> 8804 <param id="monitor"> 8805 <jrawMonitorID/> 8806 <description> 8807 The monitor 8808 </description> 8809 </param> 8810 <param id="millis"> 8811 <jlong/> 8812 <description> 8813 The timeout, in milliseconds. If the timeout is 8814 zero, then real time is not taken into consideration 8815 and the thread simply waits until notified. 8816 </description> 8817 </param> 8818 </parameters> 8819 <errors> 8820 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 8821 Not monitor owner 8822 </error> 8823 <error id="JVMTI_ERROR_INTERRUPT"> 8824 Wait was interrupted, try again 8825 </error> 8826 </errors> 8827 </function> 8828 8829 <function id="RawMonitorNotify" phase="any" callbacksafe="safe" impl="notrace" num="36"> 8830 <synopsis>Raw Monitor Notify</synopsis> 8831 <description> 8832 Notify a single thread waiting on the raw monitor. 8833 </description> 8834 <origin>jvmdi</origin> 8835 <capabilities> 8836 </capabilities> 8837 <parameters> 8838 <param id="monitor"> 8839 <jrawMonitorID/> 8840 <description> 8841 The monitor 8842 </description> 8843 </param> 8844 </parameters> 8845 <errors> 8846 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 8847 Not monitor owner 8848 </error> 8849 </errors> 8850 </function> 8851 8852 <function id="RawMonitorNotifyAll" phase="any" callbacksafe="safe" impl="notrace" num="37"> 8853 <synopsis>Raw Monitor Notify All</synopsis> 8854 <description> 8855 Notify all threads waiting on the raw monitor. 8856 </description> 8857 <origin>jvmdi</origin> 8858 <capabilities> 8859 </capabilities> 8860 <parameters> 8861 <param id="monitor"> 8862 <jrawMonitorID/> 8863 <description> 8864 The monitor 8865 </description> 8866 </param> 8867 </parameters> 8868 <errors> 8869 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 8870 Not monitor owner 8871 </error> 8872 </errors> 8873 </function> 8874 8875 <elide> 8876 <function id="GetRawMonitorUse" num="118"> 8877 <synopsis>Get Raw Monitor Use</synopsis> 8878 <description> 8879 The fields of the <functionlink id="jvmtiMonitorUsage"></functionlink> structure 8880 are filled in with information about usage of the raw monitor. 8881 </description> 8882 <origin>new</origin> 8883 <capabilities> 8884 <required id="can_get_raw_monitor_usage"></required> 8885 </capabilities> 8886 <parameters> 8887 <param id="monitor"> 8888 <jrawMonitorID/> 8889 <description> 8890 the raw monitor to query. 8891 </description> 8892 </param> 8893 <param id="info_ptr"> 8894 <outptr><struct>jvmtiMonitorUsage</struct></outptr> 8895 <description> 8896 On return, filled with monitor information for the 8897 specified raw monitor. 8898 </description> 8899 </param> 8900 </parameters> 8901 <errors> 8902 </errors> 8903 </function> 8904 8905 <function id="GetRawMonitors" num="119"> 8906 <synopsis>Get Raw Monitors</synopsis> 8907 <description> 8908 Return the list of raw monitors. 8909 <p/> 8910 Note: details about each monitor can be examined with 8911 <functionlink id="GetRawMonitorUse"></functionlink>. 8912 </description> 8913 <origin>new</origin> 8914 <capabilities> 8915 <required id="can_get_raw_monitor_usage"></required> 8916 </capabilities> 8917 <parameters> 8918 <param id="monitorCnt"> 8919 <outptr><jint/></outptr> 8920 <description> 8921 On return, pointer to the number 8922 of monitors returned in <code>monitors_ptr</code>. 8923 </description> 8924 </param> 8925 <param id="monitors_ptr"> 8926 <allocbuf outcount="monitorCnt"><jrawMonitorID/></allocbuf> 8927 <description> 8928 On return, pointer to the monitor list. 8929 </description> 8930 </param> 8931 </parameters> 8932 <errors> 8933 </errors> 8934 </function> 8935 </elide> 8936 </category> 8937 8938 <category id="jniIntercept" label="JNI Function Interception"> 8939 8940 <intro> 8941 Provides the ability to intercept and resend 8942 Java Native Interface (JNI) function calls 8943 by manipulating the JNI function table. 8944 See <externallink id="docs/technotes/guides/jni/spec/functions.html">JNI 8945 Functions</externallink> in the <i>Java Native Interface Specification</i>. 8946 <p/> 8947 The following example illustrates intercepting the 8948 <code>NewGlobalRef</code> JNI call in order to count reference 8949 creation. 8950 <example> 8951 JNIEnv original_jni_Functions; 8952 JNIEnv redirected_jni_Functions; 8953 int my_global_ref_count = 0; 8954 8955 jobject 8956 MyNewGlobalRef(JNIEnv *jni_env, jobject lobj) { 8957 ++my_global_ref_count; 8958 return originalJNIFunctions->NewGlobalRef(env, lobj); 8959 } 8960 8961 void 8962 myInit() { 8963 jvmtiError err; 8964 8965 err = (*jvmti_env)->GetJNIFunctionTable(jvmti_env, &original_jni_Functions); 8966 if (err != JVMTI_ERROR_NONE) { 8967 die(); 8968 } 8969 err = (*jvmti_env)->GetJNIFunctionTable(jvmti_env, &redirected_jni_Functions); 8970 if (err != JVMTI_ERROR_NONE) { 8971 die(); 8972 } 8973 redirectedJNIFunctions->NewGlobalRef = MyNewGlobalRef; 8974 err = (*jvmti_env)->SetJNIFunctionTable(jvmti_env, redirected_jni_Functions); 8975 if (err != JVMTI_ERROR_NONE) { 8976 die(); 8977 } 8978 } 8979 </example> 8980 Sometime after <code>myInit</code> is called the user's JNI 8981 code is executed which makes the call to create a new global 8982 reference. Instead of going to the normal JNI implementation 8983 the call goes to <code>myNewGlobalRef</code>. Note that a 8984 copy of the original function table is kept so that the normal 8985 JNI function can be called after the data is collected. 8986 Note also that any JNI functions which are not overwritten 8987 will behave normally. 8988 <todo> 8989 check that the example compiles and executes. 8990 </todo> 8991 </intro> 8992 8993 <function id="SetJNIFunctionTable" phase="start" num="120"> 8994 <synopsis>Set JNI Function Table</synopsis> 8995 <description> 8996 Set the JNI function table 8997 in all current and future JNI environments. 8998 As a result, all future JNI calls are directed to the specified functions. 8999 Use <functionlink id="GetJNIFunctionTable"></functionlink> to get the 9000 function table to pass to this function. 9001 For this function to take effect the the updated table entries must be 9002 used by the JNI clients. 9003 Since the table is defined <code>const</code> some compilers may optimize 9004 away the access to the table, thus preventing this function from taking 9005 effect. 9006 The table is copied--changes to the local copy of the 9007 table have no effect. 9008 This function affects only the function table, all other aspects of the environment are 9009 unaffected. 9010 See the examples <internallink id="jniIntercept">above</internallink>. 9011 </description> 9012 <origin>new</origin> 9013 <capabilities> 9014 </capabilities> 9015 <parameters> 9016 <param id="function_table"> 9017 <inptr> 9018 <struct>jniNativeInterface</struct> 9019 </inptr> 9020 <description> 9021 Points to the new JNI function table. 9022 </description> 9023 </param> 9024 </parameters> 9025 <errors> 9026 </errors> 9027 </function> 9028 9029 <function id="GetJNIFunctionTable" phase="start" num="121"> 9030 <synopsis>Get JNI Function Table</synopsis> 9031 <description> 9032 Get the JNI function table. 9033 The JNI function table is copied into allocated memory. 9034 If <functionlink id="SetJNIFunctionTable"></functionlink> 9035 has been called, the modified (not the original) function 9036 table is returned. 9037 Only the function table is copied, no other aspects of the environment 9038 are copied. 9039 See the examples <internallink id="jniIntercept">above</internallink>. 9040 </description> 9041 <origin>new</origin> 9042 <capabilities> 9043 </capabilities> 9044 <parameters> 9045 <param id="function_table"> 9046 <allocbuf> 9047 <struct>jniNativeInterface</struct> 9048 </allocbuf> 9049 <description> 9050 On return, <code>*function_table</code> 9051 points a newly allocated copy of the JNI function table. 9052 </description> 9053 </param> 9054 </parameters> 9055 <errors> 9056 </errors> 9057 </function> 9058 9059 </category> 9060 9061 <category id="eventManagement" label="Event Management"> 9062 9063 <function id="SetEventCallbacks" jkernel="yes" phase="onload" num="122"> 9064 <synopsis>Set Event Callbacks</synopsis> 9065 <description> 9066 Set the functions to be called for each event. 9067 The callbacks are specified by supplying a replacement function table. 9068 The function table is copied--changes to the local copy of the 9069 table have no effect. 9070 This is an atomic action, all callbacks are set at once. 9071 No events are sent before this function is called. 9072 When an entry is <code>NULL</code> or when the event is beyond 9073 <paramlink id="size_of_callbacks"></paramlink> no event is sent. 9074 Details on events are 9075 described <internallink id="EventSection">later</internallink> in this document. 9076 An event must be enabled and have a callback in order to be 9077 sent--the order in which this function and 9078 <functionlink id="SetEventNotificationMode"></functionlink> 9079 are called does not affect the result. 9080 </description> 9081 <origin>new</origin> 9082 <capabilities> 9083 </capabilities> 9084 <parameters> 9085 <param id="callbacks"> 9086 <inptr> 9087 <struct>jvmtiEventCallbacks</struct> 9088 <nullok>remove the existing callbacks</nullok> 9089 </inptr> 9090 <description> 9091 The new event callbacks. 9092 </description> 9093 </param> 9094 <param id="size_of_callbacks"> 9095 <jint min="0"/> 9096 <description> 9097 <code>sizeof(jvmtiEventCallbacks)</code>--for version 9098 compatibility. 9099 </description> 9100 </param> 9101 </parameters> 9102 <errors> 9103 </errors> 9104 </function> 9105 9106 <function id="SetEventNotificationMode" jkernel="yes" phase="onload" num="2"> 9107 <synopsis>Set Event Notification Mode</synopsis> 9108 <description> 9109 Control the generation of events. 9110 <constants id="jvmtiEventMode" label="Event Enable/Disable" kind="enum"> 9111 <constant id="JVMTI_ENABLE" num="1"> 9112 If <paramlink id="mode"></paramlink> is <code>JVMTI_ENABLE</code>, 9113 the event <paramlink id="event_type"></paramlink> will be enabled 9114 </constant> 9115 <constant id="JVMTI_DISABLE" num="0"> 9116 If <paramlink id="mode"></paramlink> is <code>JVMTI_DISABLE</code>, 9117 the event <paramlink id="event_type"></paramlink> will be disabled 9118 </constant> 9119 </constants> 9120 If <code>thread</code> is <code>NULL</code>, 9121 the event is enabled or disabled globally; otherwise, it is 9122 enabled or disabled for a particular thread. 9123 An event is generated for 9124 a particular thread if it is enabled either at the thread or global 9125 levels. 9126 <p/> 9127 See <internallink id="EventIndex">below</internallink> for information on specific events. 9128 <p/> 9129 The following events cannot be controlled at the thread 9130 level through this function. 9131 <ul> 9132 <li><eventlink id="VMInit"></eventlink></li> 9133 <li><eventlink id="VMStart"></eventlink></li> 9134 <li><eventlink id="VMDeath"></eventlink></li> 9135 <li><eventlink id="ThreadStart"></eventlink></li> 9136 <li><eventlink id="CompiledMethodLoad"></eventlink></li> 9137 <li><eventlink id="CompiledMethodUnload"></eventlink></li> 9138 <li><eventlink id="DynamicCodeGenerated"></eventlink></li> 9139 <li><eventlink id="DataDumpRequest"></eventlink></li> 9140 </ul> 9141 <p/> 9142 Initially, no events are enabled at either the thread level 9143 or the global level. 9144 <p/> 9145 Any needed capabilities (see Event Enabling Capabilities below) must be possessed 9146 before calling this function. 9147 <p/> 9148 Details on events are 9149 described <internallink id="EventSection">below</internallink>. 9150 </description> 9151 <origin>jvmdiClone</origin> 9152 <eventcapabilities></eventcapabilities> 9153 <parameters> 9154 <param id="mode"> 9155 <enum>jvmtiEventMode</enum> 9156 <description> 9157 <code>JVMTI_ENABLE</code> or <code>JVMTI_DISABLE</code> 9158 </description> 9159 </param> 9160 <param id="event_type"> 9161 <enum>jvmtiEvent</enum> 9162 <description> 9163 the event to control 9164 </description> 9165 </param> 9166 <param id="event_thread"> 9167 <ptrtype> 9168 <jthread impl="noconvert"/> 9169 <nullok>event is controlled at the global level</nullok> 9170 </ptrtype> 9171 <description> 9172 The thread to control 9173 </description> 9174 </param> 9175 <param id="..."> 9176 <varargs/> 9177 <description> 9178 for future expansion 9179 </description> 9180 </param> 9181 </parameters> 9182 <errors> 9183 <error id="JVMTI_ERROR_INVALID_THREAD"> 9184 <paramlink id="event_thread"/> is non-<code>NULL</code> and is not a valid thread. 9185 </error> 9186 <error id="JVMTI_ERROR_THREAD_NOT_ALIVE"> 9187 <paramlink id="event_thread"/> is non-<code>NULL</code> and is not live (has not been started or is now dead). 9188 </error> 9189 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 9190 thread level control was attempted on events which do not 9191 permit thread level control. 9192 </error> 9193 <error id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY"> 9194 The Required Event Enabling Capability is not possessed. 9195 </error> 9196 </errors> 9197 </function> 9198 9199 <function id="GenerateEvents" num="123"> 9200 <synopsis>Generate Events</synopsis> 9201 <description> 9202 Generate events to represent the current state of the VM. 9203 For example, if <paramlink id="event_type"/> is 9204 <code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code>, 9205 a <eventlink id="CompiledMethodLoad"></eventlink> event will be 9206 sent for each currently compiled method. 9207 Methods that were loaded and now have been unloaded are not sent. 9208 The history of what events have previously been sent does not 9209 effect what events are sent by this function--for example, 9210 all currently compiled methods 9211 will be sent each time this function is called. 9212 <p/> 9213 This function is useful when 9214 events may have been missed due to the agent attaching after program 9215 execution begins; this function generates the missed events. 9216 <p/> 9217 Attempts to execute Java programming language code or 9218 JNI functions may be paused until this function returns - 9219 so neither should be called from the thread sending the event. 9220 This function returns only after the missed events have been 9221 sent, processed and have returned. 9222 The event may be sent on a different thread than the thread 9223 on which the event occurred. 9224 The callback for the event must be set with 9225 <functionlink id="SetEventCallbacks"></functionlink> 9226 and the event must be enabled with 9227 <functionlink id="SetEventNotificationMode"></functionlink> 9228 or the events will not occur. 9229 If the VM no longer has the information to generate some or 9230 all of the requested events, the events are simply not sent - 9231 no error is returned. 9232 <p/> 9233 Only the following events are supported: 9234 <ul> 9235 <li><eventlink id="CompiledMethodLoad"></eventlink></li> 9236 <li><eventlink id="DynamicCodeGenerated"></eventlink></li> 9237 </ul> 9238 </description> 9239 <origin>new</origin> 9240 <capabilities> 9241 <capability id="can_generate_compiled_method_load_events"></capability> 9242 </capabilities> 9243 <parameters> 9244 <param id="event_type"> 9245 <enum>jvmtiEvent</enum> 9246 <description> 9247 The type of event to generate. Must be one of these: 9248 <ul> 9249 <li><eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink></li> 9250 <li><eventlink id="DynamicCodeGenerated"><code>JVMTI_EVENT_DYNAMIC_CODE_GENERATED</code></eventlink></li> 9251 </ul> 9252 </description> 9253 </param> 9254 </parameters> 9255 <errors> 9256 <error id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY"> 9257 <paramlink id="event_type"/> is 9258 <eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink> 9259 and <fieldlink id="can_generate_compiled_method_load_events" struct="jvmtiCapabilities"></fieldlink> 9260 is <code>false</code>. 9261 </error> 9262 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 9263 <paramlink id="event_type"/> is other than 9264 <eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink> 9265 or <eventlink id="DynamicCodeGenerated"><code>JVMTI_EVENT_DYNAMIC_CODE_GENERATED</code></eventlink>. 9266 </error> 9267 </errors> 9268 </function> 9269 9270 </category> 9271 9272 <category id="extension" label="Extension Mechanism"> 9273 9274 <intro> 9275 These functions 9276 allow a <jvmti/> implementation to provide functions and events 9277 beyond those defined in this specification. 9278 <p/> 9279 Both extension functions and extension events have parameters 9280 each of which has a 'type' and 'kind' chosen from the following tables: 9281 9282 <constants id="jvmtiParamTypes" label="Extension Function/Event Parameter Types" kind="enum"> 9283 <constant id="JVMTI_TYPE_JBYTE" num="101"> 9284 Java programming language primitive type - <code>byte</code>. 9285 JNI type <code>jbyte</code>. 9286 </constant> 9287 <constant id="JVMTI_TYPE_JCHAR" num="102"> 9288 Java programming language primitive type - <code>char</code>. 9289 JNI type <code>jchar</code>. 9290 </constant> 9291 <constant id="JVMTI_TYPE_JSHORT" num="103"> 9292 Java programming language primitive type - <code>short</code>. 9293 JNI type <code>jshort</code>. 9294 </constant> 9295 <constant id="JVMTI_TYPE_JINT" num="104"> 9296 Java programming language primitive type - <code>int</code>. 9297 JNI type <datalink id="jint"></datalink>. 9298 </constant> 9299 <constant id="JVMTI_TYPE_JLONG" num="105"> 9300 Java programming language primitive type - <code>long</code>. 9301 JNI type <datalink id="jlong"></datalink>. 9302 </constant> 9303 <constant id="JVMTI_TYPE_JFLOAT" num="106"> 9304 Java programming language primitive type - <code>float</code>. 9305 JNI type <datalink id="jfloat"></datalink>. 9306 </constant> 9307 <constant id="JVMTI_TYPE_JDOUBLE" num="107"> 9308 Java programming language primitive type - <code>double</code>. 9309 JNI type <datalink id="jdouble"></datalink>. 9310 </constant> 9311 <constant id="JVMTI_TYPE_JBOOLEAN" num="108"> 9312 Java programming language primitive type - <code>boolean</code>. 9313 JNI type <datalink id="jboolean"></datalink>. 9314 </constant> 9315 <constant id="JVMTI_TYPE_JOBJECT" num="109"> 9316 Java programming language object type - <code>java.lang.Object</code>. 9317 JNI type <datalink id="jobject"></datalink>. 9318 Returned values are JNI local references and must be managed. 9319 </constant> 9320 <constant id="JVMTI_TYPE_JTHREAD" num="110"> 9321 Java programming language object type - <code>java.lang.Thread</code>. 9322 <jvmti/> type <datalink id="jthread"></datalink>. 9323 Returned values are JNI local references and must be managed. 9324 </constant> 9325 <constant id="JVMTI_TYPE_JCLASS" num="111"> 9326 Java programming language object type - <code>java.lang.Class</code>. 9327 JNI type <datalink id="jclass"></datalink>. 9328 Returned values are JNI local references and must be managed. 9329 </constant> 9330 <constant id="JVMTI_TYPE_JVALUE" num="112"> 9331 Union of all Java programming language primitive and object types - 9332 JNI type <datalink id="jvalue"></datalink>. 9333 Returned values which represent object types are JNI local references and must be managed. 9334 </constant> 9335 <constant id="JVMTI_TYPE_JFIELDID" num="113"> 9336 Java programming language field identifier - 9337 JNI type <datalink id="jfieldID"></datalink>. 9338 </constant> 9339 <constant id="JVMTI_TYPE_JMETHODID" num="114"> 9340 Java programming language method identifier - 9341 JNI type <datalink id="jmethodID"></datalink>. 9342 </constant> 9343 <constant id="JVMTI_TYPE_CCHAR" num="115"> 9344 C programming language type - <code>char</code>. 9345 </constant> 9346 <constant id="JVMTI_TYPE_CVOID" num="116"> 9347 C programming language type - <code>void</code>. 9348 </constant> 9349 <constant id="JVMTI_TYPE_JNIENV" num="117"> 9350 JNI environment - <code>JNIEnv</code>. 9351 Should be used with the correct <datalink id="jvmtiParamKind"/> to make it a pointer type. 9352 </constant> 9353 </constants> 9354 9355 <constants id="jvmtiParamKind" label="Extension Function/Event Parameter Kinds" kind="enum"> 9356 <constant id="JVMTI_KIND_IN" num="91"> 9357 Ingoing argument - <code>foo</code>. 9358 </constant> 9359 <constant id="JVMTI_KIND_IN_PTR" num="92"> 9360 Ingoing pointer argument - <code>const foo*</code>. 9361 </constant> 9362 <constant id="JVMTI_KIND_IN_BUF" num="93"> 9363 Ingoing array argument - <code>const foo*</code>. 9364 </constant> 9365 <constant id="JVMTI_KIND_ALLOC_BUF" num="94"> 9366 Outgoing allocated array argument - <code>foo**</code>. 9367 Free with <code>Deallocate</code>. 9368 </constant> 9369 <constant id="JVMTI_KIND_ALLOC_ALLOC_BUF" num="95"> 9370 Outgoing allocated array of allocated arrays argument - <code>foo***</code>. 9371 Free with <code>Deallocate</code>. 9372 </constant> 9373 <constant id="JVMTI_KIND_OUT" num="96"> 9374 Outgoing argument - <code>foo*</code>. 9375 </constant> 9376 <constant id="JVMTI_KIND_OUT_BUF" num="97"> 9377 Outgoing array argument (pre-allocated by agent) - <code>foo*</code>. 9378 Do not <code>Deallocate</code>. 9379 </constant> 9380 </constants> 9381 9382 </intro> 9383 9384 <typedef id="jvmtiParamInfo" label="Extension Function/Event Parameter Info"> 9385 <field id="name"> 9386 <allocfieldbuf><char/></allocfieldbuf> 9387 <description> 9388 The parameter name, encoded as a 9389 <internallink id="mUTF">modified UTF-8</internallink> string 9390 </description> 9391 </field> 9392 <field id="kind"> 9393 <enum>jvmtiParamKind</enum> 9394 <description> 9395 The kind of the parameter - type modifiers 9396 </description> 9397 </field> 9398 <field id="base_type"> 9399 <enum>jvmtiParamTypes</enum> 9400 <description> 9401 The base type of the parameter - modified by <code>kind</code> 9402 </description> 9403 </field> 9404 <field id="null_ok"> 9405 <jboolean/> 9406 <description> 9407 Is a <code>NULL</code> argument permitted? Applies only to pointer and object types. 9408 </description> 9409 </field> 9410 </typedef> 9411 9412 <callback id="jvmtiExtensionFunction"> 9413 <enum>jvmtiError</enum> 9414 <synopsis>Extension Function</synopsis> 9415 <description> 9416 This is the implementation-specific extension function. 9417 </description> 9418 <parameters> 9419 <param id="jvmti_env"> 9420 <outptr> 9421 <struct>jvmtiEnv</struct> 9422 </outptr> 9423 <description> 9424 The <jvmti/> environment is the only fixed parameter for extension functions. 9425 </description> 9426 </param> 9427 <param id="..."> 9428 <varargs/> 9429 <description> 9430 The extension function-specific parameters 9431 </description> 9432 </param> 9433 </parameters> 9434 </callback> 9435 9436 <function id="GetExtensionFunctions" phase="onload" num="124"> 9437 <synopsis>Get Extension Functions</synopsis> 9438 9439 <typedef id="jvmtiExtensionFunctionInfo" label="Extension Function Info"> 9440 <field id="func"> 9441 <ptrtype> 9442 <struct>jvmtiExtensionFunction</struct> 9443 </ptrtype> 9444 <description> 9445 The actual function to call 9446 </description> 9447 </field> 9448 <field id="id"> 9449 <allocfieldbuf><char/></allocfieldbuf> 9450 <description> 9451 The identifier for the extension function, encoded as a 9452 <internallink id="mUTF">modified UTF-8</internallink> string. 9453 Uses package name conventions. 9454 For example, <code>com.sun.hotspot.bar</code> 9455 </description> 9456 </field> 9457 <field id="short_description"> 9458 <allocfieldbuf><char/></allocfieldbuf> 9459 <description> 9460 A one sentence description of the function, encoded as a 9461 <internallink id="mUTF">modified UTF-8</internallink> string. 9462 </description> 9463 </field> 9464 <field id="param_count"> 9465 <jint/> 9466 <description> 9467 The number of parameters excluding <code>jvmtiEnv *jvmti_env</code> 9468 </description> 9469 </field> 9470 <field id="params"> 9471 <allocfieldbuf outcount="param_count"> 9472 <struct>jvmtiParamInfo</struct> 9473 </allocfieldbuf> 9474 <description> 9475 Array of 9476 <fieldlink id="param_count" struct="jvmtiExtensionFunctionInfo"></fieldlink> 9477 parameters (<code>jvmtiEnv *jvmti_env</code> excluded) 9478 </description> 9479 </field> 9480 <field id="error_count"> 9481 <jint/> 9482 <description> 9483 The number of possible error returns (excluding universal errors) 9484 </description> 9485 </field> 9486 <field id="errors"> 9487 <allocfieldbuf outcount="error_count"> 9488 <enum>jvmtiError</enum> 9489 </allocfieldbuf> 9490 <description> 9491 Array of <fieldlink id="error_count" struct="jvmtiExtensionFunctionInfo"></fieldlink> 9492 possible errors 9493 </description> 9494 </field> 9495 </typedef> 9496 9497 <description> 9498 Returns the set of extension functions. 9499 </description> 9500 <origin>new</origin> 9501 <capabilities> 9502 </capabilities> 9503 <parameters> 9504 <param id="extension_count_ptr"> 9505 <outptr><jint/></outptr> 9506 <description> 9507 On return, points to the number of extension functions 9508 </description> 9509 </param> 9510 <param id="extensions"> 9511 <allocbuf outcount="extension_count_ptr"><struct>jvmtiExtensionFunctionInfo</struct></allocbuf> 9512 <description> 9513 Returns an array of extension function info, one per function 9514 </description> 9515 </param> 9516 </parameters> 9517 <errors> 9518 </errors> 9519 </function> 9520 9521 <function id="GetExtensionEvents" phase="onload" num="125"> 9522 <synopsis>Get Extension Events</synopsis> 9523 9524 <typedef id="jvmtiExtensionEventInfo" label="Extension Event Info"> 9525 <field id="extension_event_index"> 9526 <jint/> 9527 <description> 9528 The identifying index of the event 9529 </description> 9530 </field> 9531 <field id="id"> 9532 <allocfieldbuf><char/></allocfieldbuf> 9533 <description> 9534 The identifier for the extension event, encoded as a 9535 <internallink id="mUTF">modified UTF-8</internallink> string. 9536 Uses package name conventions. 9537 For example, <code>com.sun.hotspot.bar</code> 9538 </description> 9539 </field> 9540 <field id="short_description"> 9541 <allocfieldbuf><char/></allocfieldbuf> 9542 <description> 9543 A one sentence description of the event, encoded as a 9544 <internallink id="mUTF">modified UTF-8</internallink> string. 9545 </description> 9546 </field> 9547 <field id="param_count"> 9548 <jint/> 9549 <description> 9550 The number of parameters excluding <code>jvmtiEnv *jvmti_env</code> 9551 </description> 9552 </field> 9553 <field id="params"> 9554 <allocfieldbuf outcount="param_count"> 9555 <struct>jvmtiParamInfo</struct> 9556 </allocfieldbuf> 9557 <description> 9558 Array of 9559 <fieldlink id="param_count" struct="jvmtiExtensionEventInfo"></fieldlink> 9560 parameters (<code>jvmtiEnv *jvmti_env</code> excluded) 9561 </description> 9562 </field> 9563 </typedef> 9564 9565 <description> 9566 Returns the set of extension events. 9567 </description> 9568 <origin>new</origin> 9569 <capabilities> 9570 </capabilities> 9571 <parameters> 9572 <param id="extension_count_ptr"> 9573 <outptr><jint/></outptr> 9574 <description> 9575 On return, points to the number of extension events 9576 </description> 9577 </param> 9578 <param id="extensions"> 9579 <allocbuf outcount="extension_count_ptr"><struct>jvmtiExtensionEventInfo</struct></allocbuf> 9580 <description> 9581 Returns an array of extension event info, one per event 9582 </description> 9583 </param> 9584 </parameters> 9585 <errors> 9586 </errors> 9587 </function> 9588 9589 <callback id="jvmtiExtensionEvent"> 9590 <void/> 9591 <synopsis>Extension Event</synopsis> 9592 <description> 9593 This is the implementation-specific event. 9594 The event handler is set with 9595 <functionlink id="SetExtensionEventCallback"/>. 9596 <p/> 9597 Event handlers for extension events must be declared varargs to match this definition. 9598 Failure to do so could result in calling convention mismatch and undefined behavior 9599 on some platforms. 9600 <p/> 9601 For example, if the <code>jvmtiParamInfo</code> 9602 returned by <functionlink id="GetExtensionEvents"/> indicates that 9603 there is a <code>jint</code> parameter, the event handler should be 9604 declared: 9605 <example> 9606 void JNICALL myHandler(jvmtiEnv* jvmti_env, jint myInt, ...) 9607 </example> 9608 Note the terminal "<code>...</code>" which indicates varargs. 9609 </description> 9610 <parameters> 9611 <param id="jvmti_env"> 9612 <outptr> 9613 <struct>jvmtiEnv</struct> 9614 </outptr> 9615 <description> 9616 The <jvmti/> environment is the only fixed parameter for extension events. 9617 </description> 9618 </param> 9619 <param id="..."> 9620 <varargs/> 9621 <description> 9622 The extension event-specific parameters 9623 </description> 9624 </param> 9625 </parameters> 9626 </callback> 9627 9628 <function id="SetExtensionEventCallback" phase="onload" num="126"> 9629 <synopsis>Set Extension Event Callback</synopsis> 9630 9631 <description> 9632 Sets the callback function for an extension event and 9633 enables the event. Or, if the callback is <code>NULL</code>, disables 9634 the event. Note that unlike standard events, setting 9635 the callback and enabling the event are a single operation. 9636 </description> 9637 <origin>new</origin> 9638 <capabilities> 9639 </capabilities> 9640 <parameters> 9641 <param id="extension_event_index"> 9642 <jint/> 9643 <description> 9644 Identifies which callback to set. 9645 This index is the 9646 <fieldlink id="extension_event_index" struct="jvmtiExtensionEventInfo"></fieldlink> 9647 field of 9648 <datalink id="jvmtiExtensionEventInfo"/>. 9649 </description> 9650 </param> 9651 <param id="callback"> 9652 <ptrtype> 9653 <struct>jvmtiExtensionEvent</struct> 9654 <nullok>disable the event</nullok> 9655 </ptrtype> 9656 <description> 9657 If <code>callback</code> is non-<code>NULL</code>, 9658 set <code>callback</code> to be the event callback function 9659 and enable the event. 9660 </description> 9661 </param> 9662 </parameters> 9663 <errors> 9664 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 9665 <paramlink id="extension_event_index"/> is not an 9666 <fieldlink id="extension_event_index" 9667 struct="jvmtiExtensionEventInfo"/> 9668 returned by 9669 <functionlink id="GetExtensionEvents"/> 9670 </error> 9671 </errors> 9672 </function> 9673 9674 </category> 9675 9676 <category id="capability" label="Capability"> 9677 9678 <intro> 9679 The capabilities functions allow you to change the 9680 functionality available to <jvmti/>--that is, 9681 which <jvmti/> 9682 functions can be called, what events can be generated, 9683 and what functionality these events and functions can 9684 provide. 9685 <p/> 9686 The "Capabilities" section of each function and event describe which 9687 capabilities, if any, they are associated with. "Required Functionality" 9688 means it is available for use and no capabilities must be added to use it. 9689 "Optional Functionality" means the agent must possess the capability 9690 before it can be used. 9691 To possess a capability, the agent must 9692 <functionlink id="AddCapabilities">add the capability</functionlink>. 9693 "Optional Features" describe capabilities which, 9694 if added, extend the feature set. 9695 <p/> 9696 The potentially available capabilities of each <jvmti/> implementation are different. 9697 Depending on the implementation, a capability: 9698 <ul> 9699 <li>may never be added</li> 9700 <li>may be added in either the <code>OnLoad</code> or live phase in any environment</li> 9701 <li>may be added only during the <code>OnLoad</code> phase</li> 9702 <li>may be possessed by only one environment at a time</li> 9703 <li>may be possessed by only one environment at a time, 9704 and only during the <code>OnLoad</code> phase</li> 9705 <li>and so on ...</li> 9706 </ul> 9707 Frequently, the addition of a capability may incur a cost in execution speed, start up 9708 time, and/or memory footprint. Note that the overhead of using a capability 9709 is completely different than the overhead of possessing a capability. 9710 Take single stepping as an example. When single stepping is on (that 9711 is, when the event is enabled and thus actively sending events) 9712 the overhead of sending and processing an event 9713 on each instruction is huge in any implementation. 9714 However, the overhead of possessing the capability may be small or large, 9715 depending on the implementation. Also, when and if a capability is potentially 9716 available depends on the implementation. Some examples: 9717 <ul> 9718 <li>One VM might perform all execution by compiling bytecodes into 9719 native code and be unable to generate single step instructions. 9720 In this implementation the capability can not be added.</li> 9721 <li>Another VM may be able to switch execution to a single stepping 9722 interpreter at any time. In this implementation, having the capability has no 9723 overhead and could be added at any time.</li> 9724 <li>Yet another VM might be able to choose a bytecode compiling or single stepping capable interpreted 9725 execution engine at start up, but be unable to switch between them. 9726 In this implementation the capability would need to be added 9727 during the <code>OnLoad</code> phase (before bytecode 9728 execution begins) and would have a large impact on execution speed 9729 even if single stepping was never used.</li> 9730 <li>Still another VM might be able to add an "is single stepping on" check 9731 into compiled bytecodes or a generated interpreter. Again in this implementation 9732 the capability would need to be added during the <code>OnLoad</code> phase but the overhead (a test 9733 and branch on each instruction) would be considerably less.</li> 9734 </ul> 9735 <p/> 9736 Each <jvmti/> <internallink id="environments">environment</internallink> 9737 has its own set of capabilities. 9738 Initially, that set is empty. 9739 Any desired capability must be added. 9740 If possible, capabilities should be added during the <code>OnLoad</code> phase. For most 9741 virtual machines certain capabilities require special set up for 9742 the virtual machine and this set up must happen 9743 during the <code>OnLoad</code> phase, before the virtual machine begins execution. 9744 Once a capability is added, it can 9745 only be removed if explicitly relinquished by the environment. 9746 <p/> 9747 The agent can, 9748 <functionlink id="GetPotentialCapabilities">determine what 9749 capabilities this VM can potentially provide</functionlink>, 9750 <functionlink id="AddCapabilities">add the capabilities 9751 to be used</functionlink>, 9752 <functionlink id="RelinquishCapabilities">release capabilities 9753 which are no longer needed</functionlink>, and 9754 <functionlink id="GetCapabilities">examine the currently available 9755 capabilities</functionlink>. 9756 </intro> 9757 9758 <intro id="capabilityExamples" label="Capability Examples"> 9759 For example, a freshly started agent (in the <code>OnLoad</code> function) 9760 wants to enable all possible capabilities. 9761 Note that, in general, this is not advisable as the agent may suffer 9762 a performance penalty for functionality it is not using. 9763 The code might look like this in C: 9764 <example> 9765 jvmtiCapabilities capa; 9766 jvmtiError err; 9767 9768 err = (*jvmti)->GetPotentialCapabilities(jvmti, &capa); 9769 if (err == JVMTI_ERROR_NONE) { 9770 err = (*jvmti)->AddCapabilities(jvmti, &capa); 9771 </example> 9772 For example, if an agent wants to check if it can get 9773 the bytecodes of a method (that is, it wants to check 9774 if it previously added this capability and has not 9775 relinquished it), the code might 9776 look like this in C: 9777 <example> 9778 jvmtiCapabilities capa; 9779 jvmtiError err; 9780 9781 err = (*jvmti)->GetCapabilities(jvmti, &capa); 9782 if (err == JVMTI_ERROR_NONE) { 9783 if (capa.can_get_bytecodes) { ... } } 9784 </example> 9785 </intro> 9786 9787 <capabilitiestypedef id="jvmtiCapabilities" label="The Capabilities Structure"> 9788 <description> 9789 The functions in this category use this capabilities structure 9790 which contains boolean flags corresponding to each capability: 9791 </description> 9792 <capabilityfield id="can_tag_objects"> 9793 <description> 9794 Can set and get tags, as described in the 9795 <internallink id="Heap">Heap category</internallink>. 9796 </description> 9797 </capabilityfield> 9798 <capabilityfield id="can_generate_field_modification_events"> 9799 <description> 9800 Can set watchpoints on field modification - 9801 <functionlink id="SetFieldModificationWatch"></functionlink> 9802 </description> 9803 </capabilityfield> 9804 <capabilityfield id="can_generate_field_access_events"> 9805 <description> 9806 Can set watchpoints on field access - 9807 <functionlink id="SetFieldAccessWatch"></functionlink> 9808 </description> 9809 </capabilityfield> 9810 <capabilityfield id="can_get_bytecodes"> 9811 <description> 9812 Can get bytecodes of a method <functionlink id="GetBytecodes"></functionlink> 9813 </description> 9814 </capabilityfield> 9815 <capabilityfield id="can_get_synthetic_attribute"> 9816 <description> 9817 Can test if a field or method is synthetic - 9818 <functionlink id="IsFieldSynthetic"></functionlink> and 9819 <functionlink id="IsMethodSynthetic"></functionlink> 9820 </description> 9821 </capabilityfield> 9822 <capabilityfield id="can_get_owned_monitor_info"> 9823 <description> 9824 Can get information about ownership of monitors - 9825 <functionlink id="GetOwnedMonitorInfo"></functionlink> 9826 </description> 9827 </capabilityfield> 9828 <capabilityfield id="can_get_current_contended_monitor"> 9829 <description> 9830 Can <functionlink id="GetCurrentContendedMonitor"></functionlink> 9831 </description> 9832 </capabilityfield> 9833 <capabilityfield id="can_get_monitor_info"> 9834 <description> 9835 Can <functionlink id="GetObjectMonitorUsage"></functionlink> 9836 </description> 9837 </capabilityfield> 9838 <capabilityfield id="can_pop_frame"> 9839 <description> 9840 Can pop frames off the stack - <functionlink id="PopFrame"></functionlink> 9841 </description> 9842 </capabilityfield> 9843 <capabilityfield id="can_redefine_classes"> 9844 <description> 9845 Can redefine classes with <functionlink id="RedefineClasses"/>. 9846 </description> 9847 </capabilityfield> 9848 <capabilityfield id="can_signal_thread"> 9849 <description> 9850 Can send stop or interrupt to threads 9851 </description> 9852 </capabilityfield> 9853 <capabilityfield id="can_get_source_file_name"> 9854 <description> 9855 Can get the source file name of a class 9856 </description> 9857 </capabilityfield> 9858 <capabilityfield id="can_get_line_numbers"> 9859 <description> 9860 Can get the line number table of a method 9861 </description> 9862 </capabilityfield> 9863 <capabilityfield id="can_get_source_debug_extension"> 9864 <description> 9865 Can get the source debug extension of a class 9866 </description> 9867 </capabilityfield> 9868 <capabilityfield id="can_access_local_variables"> 9869 <description> 9870 Can set and get local variables 9871 </description> 9872 </capabilityfield> 9873 <capabilityfield id="can_maintain_original_method_order"> 9874 <description> 9875 Can return methods in the order they occur in the class file 9876 </description> 9877 </capabilityfield> 9878 <capabilityfield id="can_generate_single_step_events"> 9879 <description> 9880 Can get <eventlink id="SingleStep">single step</eventlink> events 9881 </description> 9882 </capabilityfield> 9883 <capabilityfield id="can_generate_exception_events"> 9884 <description> 9885 Can get <eventlink id="Exception">exception thrown</eventlink> and 9886 <eventlink id="ExceptionCatch">exception catch</eventlink> events 9887 </description> 9888 </capabilityfield> 9889 <capabilityfield id="can_generate_frame_pop_events"> 9890 <description> 9891 Can <functionlink id="NotifyFramePop">set</functionlink> and thus get 9892 <eventlink id="FramePop"></eventlink> events 9893 </description> 9894 </capabilityfield> 9895 <capabilityfield id="can_generate_breakpoint_events"> 9896 <description> 9897 Can <functionlink id="SetBreakpoint">set</functionlink> and thus get 9898 <eventlink id="Breakpoint"></eventlink> events 9899 </description> 9900 </capabilityfield> 9901 <capabilityfield id="can_suspend"> 9902 <description> 9903 Can suspend and resume threads 9904 </description> 9905 </capabilityfield> 9906 <capabilityfield id="can_redefine_any_class"> 9907 <description> 9908 Can modify (retransform or redefine) any modifiable class. 9909 See <functionlink id="IsModifiableClass"/>. 9910 </description> 9911 </capabilityfield> 9912 <capabilityfield id="can_get_current_thread_cpu_time"> 9913 <description> 9914 Can <functionlink id="GetCurrentThreadCpuTime">get</functionlink> 9915 current thread CPU time 9916 </description> 9917 </capabilityfield> 9918 <capabilityfield id="can_get_thread_cpu_time"> 9919 <description> 9920 Can <functionlink id="GetThreadCpuTime">get</functionlink> 9921 thread CPU time 9922 </description> 9923 </capabilityfield> 9924 <capabilityfield id="can_generate_method_entry_events" 9925 disp1="can_generate" disp2="_method_entry_events" 9926 > 9927 <description> 9928 Can generate method entry events on entering a method 9929 </description> 9930 </capabilityfield> 9931 <capabilityfield id="can_generate_method_exit_events" 9932 disp1="can_generate" disp2="_method_exit_events" 9933 > 9934 <description> 9935 Can generate method exit events on leaving a method 9936 </description> 9937 </capabilityfield> 9938 <capabilityfield id="can_generate_all_class_hook_events" 9939 disp1="can_generate" disp2="_all_class_hook_events" 9940 > 9941 <description> 9942 Can generate ClassFileLoadHook events for every loaded class. 9943 </description> 9944 </capabilityfield> 9945 <capabilityfield id="can_generate_compiled_method_load_events" 9946 disp1="can_generate" disp2="_compiled_method_load_events" 9947 > 9948 <description> 9949 Can generate events when a method is compiled or unloaded 9950 </description> 9951 </capabilityfield> 9952 <capabilityfield id="can_generate_monitor_events" 9953 disp1="can_generate" disp2="_monitor_events" 9954 > 9955 <description> 9956 Can generate events on monitor activity 9957 </description> 9958 </capabilityfield> 9959 <capabilityfield id="can_generate_vm_object_alloc_events" 9960 disp1="can_generate" disp2="_vm_object_alloc_events" 9961 > 9962 <description> 9963 Can generate events on VM allocation of an object 9964 </description> 9965 </capabilityfield> 9966 <capabilityfield id="can_generate_native_method_bind_events" 9967 disp1="can_generate" disp2="_native_method_bind_events" 9968 > 9969 <description> 9970 Can generate events when a native method is bound to its 9971 implementation 9972 </description> 9973 </capabilityfield> 9974 <capabilityfield id="can_generate_garbage_collection_events" 9975 disp1="can_generate" disp2="_garbage_collection_events" 9976 > 9977 <description> 9978 Can generate events when garbage collection begins or ends 9979 </description> 9980 </capabilityfield> 9981 <capabilityfield id="can_generate_object_free_events" 9982 disp1="can_generate" disp2="_object_free_events" 9983 > 9984 <description> 9985 Can generate events when the garbage collector frees an object 9986 </description> 9987 </capabilityfield> 9988 <capabilityfield id="can_force_early_return" since="1.1"> 9989 <description> 9990 Can return early from a method, as described in the 9991 <internallink id="ForceEarlyReturn">Force Early Return category</internallink>. 9992 </description> 9993 </capabilityfield> 9994 <capabilityfield id="can_get_owned_monitor_stack_depth_info" since="1.1"> 9995 <description> 9996 Can get information about owned monitors with stack depth - 9997 <functionlink id="GetOwnedMonitorStackDepthInfo"></functionlink> 9998 </description> 9999 </capabilityfield> 10000 <capabilityfield id="can_get_constant_pool" since="1.1"> 10001 <description> 10002 Can get the constant pool of a class - 10003 <functionlink id="GetConstantPool"></functionlink> 10004 </description> 10005 </capabilityfield> 10006 <capabilityfield id="can_set_native_method_prefix" since="1.1"> 10007 <description> 10008 Can set prefix to be applied when native method cannot be resolved - 10009 <functionlink id="SetNativeMethodPrefix"/> and 10010 <functionlink id="SetNativeMethodPrefixes"/> 10011 </description> 10012 </capabilityfield> 10013 <capabilityfield id="can_retransform_classes" since="1.1"> 10014 <description> 10015 Can retransform classes with <functionlink id="RetransformClasses"/>. 10016 In addition to the restrictions imposed by the specific 10017 implementation on this capability (see the 10018 <internallink id="capability">Capability</internallink> section), 10019 this capability must be set before the 10020 <eventlink id="ClassFileLoadHook"/> event is enabled for the 10021 first time in this environment. 10022 An environment that possesses this capability at the time that 10023 <code>ClassFileLoadHook</code> is enabled for the first time is 10024 said to be <i>retransformation capable</i>. 10025 An environment that does not possess this capability at the time that 10026 <code>ClassFileLoadHook</code> is enabled for the first time is 10027 said to be <i>retransformation incapable</i>. 10028 </description> 10029 </capabilityfield> 10030 <capabilityfield id="can_retransform_any_class" since="1.1"> 10031 <description> 10032 <functionlink id="RetransformClasses"/> can be called on any modifiable class. 10033 See <functionlink id="IsModifiableClass"/>. 10034 (<fieldlink id="can_retransform_classes" struct="jvmtiCapabilities"/> 10035 must also be set) 10036 </description> 10037 </capabilityfield> 10038 <capabilityfield id="can_generate_resource_exhaustion_heap_events" since="1.1"> 10039 <description> 10040 Can generate events when the VM is unable to allocate memory from 10041 the <tm>Java</tm> platform heap. 10042 See <eventlink id="ResourceExhausted"/>. 10043 </description> 10044 </capabilityfield> 10045 <capabilityfield id="can_generate_resource_exhaustion_threads_events" since="1.1"> 10046 <description> 10047 Can generate events when the VM is unable to create a thread. 10048 See <eventlink id="ResourceExhausted"/>. 10049 </description> 10050 </capabilityfield> 10051 <capabilityfield id="can_generate_early_vmstart" since="9"> 10052 <description> 10053 Can generate the <code>VMStart</code> event early. 10054 See <eventlink id="VMStart"/>. 10055 </description> 10056 </capabilityfield> 10057 <capabilityfield id="can_generate_early_class_hook_events" since="9"> 10058 <description> 10059 Can generate the <eventlink id="ClassFileLoadHook"/> events 10060 in the primordial phase. If this capability and 10061 <internallink id="jvmtiCapabilities.can_generate_all_class_hook_events"> 10062 <code>can_generate_all_class_hook_events</code></internallink> 10063 are enabled then the <eventlink id="ClassFileLoadHook"/> events 10064 can be posted for classes loaded in the primordial phase. 10065 See <eventlink id="ClassFileLoadHook"/>. 10066 </description> 10067 </capabilityfield> 10068 </capabilitiestypedef> 10069 10070 <function id="GetPotentialCapabilities" jkernel="yes" phase="onload" num="140"> 10071 <synopsis>Get Potential Capabilities</synopsis> 10072 <description> 10073 Returns via <paramlink id="capabilities_ptr"></paramlink> the <jvmti/> 10074 features that can potentially be possessed by this environment 10075 at this time. 10076 The returned capabilities differ from the complete set of capabilities 10077 implemented by the VM in two cases: another environment possesses 10078 capabilities that can only be possessed by one environment, or the 10079 current <functionlink id="GetPhase">phase</functionlink> is live, 10080 and certain capabilities can only be added during the <code>OnLoad</code> phase. 10081 The <functionlink id="AddCapabilities"></functionlink> function 10082 may be used to set any or all or these capabilities. 10083 Currently possessed capabilities are included. 10084 <p/> 10085 Typically this function is used in the <code>OnLoad</code> function. 10086 Some virtual machines may allow a limited set of capabilities to be 10087 added in the live phase. 10088 In this case, the set of potentially available capabilities 10089 will likely differ from the <code>OnLoad</code> phase set. 10090 <p/> 10091 See the 10092 <internallink id="capabilityExamples">Capability Examples</internallink>. 10093 </description> 10094 <origin>new</origin> 10095 <capabilities> 10096 </capabilities> 10097 <parameters> 10098 <param id="capabilities_ptr"> 10099 <outptr><struct>jvmtiCapabilities</struct></outptr> 10100 <description> 10101 On return, points to the <jvmti/> capabilities that may be added. 10102 </description> 10103 </param> 10104 </parameters> 10105 <errors> 10106 </errors> 10107 </function> 10108 10109 <elide> 10110 <function id="EstimateCostOfCapabilities" phase="onload" num="141"> 10111 <synopsis>Estimate Cost Of Capabilities</synopsis> 10112 <description> 10113 <issue>There is strong opposition to this function. The concern is 10114 that it would be difficult or impossible to provide meaningful 10115 numbers, as the amount of impact is conditional on many factors 10116 that a single number could not represent. There is doubt that 10117 conditional implementations would be used or are even a good idea. 10118 The thought is that release documentation for the implementation 10119 would be the best means of exposing this information. 10120 Unless new arguments are presented, I intend to remove this 10121 function in the next revision. 10122 </issue> 10123 <p/> 10124 Return via the <paramlink id="time_impact_ptr"></paramlink> and 10125 <paramlink id="space_impact_ptr"></paramlink> an estimate of the impact 10126 of adding the capabilities pointed to by 10127 <paramlink id="capabilities_ptr"></paramlink>. 10128 The returned estimates are in percentage of additional overhead, thus 10129 a time impact of 100 mean the application might run 10130 at half the speed. 10131 The estimates are very rough approximations and are not guaranteed. 10132 Note also, that the estimates are of the impact of having the 10133 capability available--when and if it is used the impact may be 10134 much greater. 10135 Estimates can be for a single capability or for a set of 10136 capabilities. Note that the costs are not necessarily additive, 10137 adding support for one capability might make another available 10138 for free or conversely having two capabilities at once may 10139 have multiplicative impact. 10140 Estimates are relative to the current set of capabilities - 10141 that is, how much more impact given the currently possessed capabilities. 10142 <p/> 10143 Typically this function is used in the OnLoad function, 10144 some virtual machines may allow a limited set of capabilities to be 10145 added in the live phase. 10146 In this case, the set of potentially available capabilities 10147 will likely differ from the OnLoad phase set. 10148 <p/> 10149 See the 10150 <internallink id="capabilityExamples">Capability Examples</internallink>. 10151 </description> 10152 <origin>new</origin> 10153 <capabilities> 10154 </capabilities> 10155 <parameters> 10156 <param id="capabilities_ptr"> 10157 <inptr><struct>jvmtiCapabilities</struct></inptr> 10158 <description> 10159 points to the <jvmti/> capabilities to evaluate. 10160 </description> 10161 </param> 10162 <param id="time_impact_ptr"> 10163 <outptr><jint/></outptr> 10164 <description> 10165 On return, points to the estimated percentage increase in 10166 run time if this capability was added. 10167 </description> 10168 </param> 10169 <param id="space_impact_ptr"> 10170 <outptr><jint/></outptr> 10171 <description> 10172 On return, points to the estimated percentage increase in 10173 memory space used if this capability was added. 10174 </description> 10175 </param> 10176 </parameters> 10177 <errors> 10178 <error id="JVMTI_ERROR_NOT_AVAILABLE"> 10179 The desired capabilities are not even potentially available. 10180 </error> 10181 </errors> 10182 </function> 10183 </elide> 10184 10185 <function id="AddCapabilities" jkernel="yes" phase="onload" num="142"> 10186 <synopsis>Add Capabilities</synopsis> 10187 <description> 10188 Set new capabilities by adding the capabilities 10189 whose values are set to one (<code>1</code>) in 10190 <code>*</code><paramlink id="capabilities_ptr"></paramlink>. 10191 All previous capabilities are retained. 10192 Typically this function is used in the <code>OnLoad</code> function. 10193 Some virtual machines may allow a limited set of capabilities to be 10194 added in the live phase. 10195 <p/> 10196 See the 10197 <internallink id="capabilityExamples">Capability Examples</internallink>. 10198 </description> 10199 <origin>new</origin> 10200 <capabilities> 10201 </capabilities> 10202 <parameters> 10203 <param id="capabilities_ptr"> 10204 <inptr><struct>jvmtiCapabilities</struct></inptr> 10205 <description> 10206 Points to the <jvmti/> capabilities to add. 10207 </description> 10208 </param> 10209 </parameters> 10210 <errors> 10211 <error id="JVMTI_ERROR_NOT_AVAILABLE"> 10212 The desired capabilities are not even potentially available. 10213 </error> 10214 </errors> 10215 </function> 10216 10217 10218 <function id="RelinquishCapabilities" phase="onload" num="143"> 10219 <synopsis>Relinquish Capabilities</synopsis> 10220 <description> 10221 Relinquish the capabilities 10222 whose values are set to one (<code>1</code>) in 10223 <code>*</code><paramlink id="capabilities_ptr"></paramlink>. 10224 Some implementations may allow only one environment to have a capability 10225 (see the <internallink id="capability">capability introduction</internallink>). 10226 This function releases capabilities 10227 so that they may be used by other agents. 10228 All other capabilities are retained. 10229 The capability will no longer be present in <functionlink id="GetCapabilities"></functionlink>. 10230 Attempting to relinquish a capability that the agent does not possess is not an error. 10231 <issue> 10232 It is possible for the agent to be actively using capabilities 10233 which are being relinquished. For example, a thread is currently 10234 suspended and can_suspend is being relinquished or an event is currently 10235 enabled and can_generate_whatever is being relinquished. 10236 There are three possible ways we could spec this: 10237 <ul> 10238 <li>relinquish automatically releases them</li> 10239 <li>relinquish checks and returns some error code if held</li> 10240 <li>it is the agent's responsibility and it is not checked</li> 10241 </ul> 10242 One of these should be chosen. 10243 </issue> 10244 </description> 10245 <origin>new</origin> 10246 <capabilities> 10247 </capabilities> 10248 <parameters> 10249 <param id="capabilities_ptr"> 10250 <inptr><struct>jvmtiCapabilities</struct></inptr> 10251 <description> 10252 Points to the <jvmti/> capabilities to relinquish. 10253 </description> 10254 </param> 10255 </parameters> 10256 <errors> 10257 </errors> 10258 </function> 10259 10260 10261 10262 <function id="GetCapabilities" jkernel="yes" phase="any" num="89"> 10263 <synopsis>Get Capabilities</synopsis> 10264 <description> 10265 Returns via <paramlink id="capabilities_ptr"></paramlink> the optional <jvmti/> 10266 features which this environment currently possesses. 10267 Each possessed capability is indicated by a one (<code>1</code>) in the 10268 corresponding field of the <internallink id="jvmtiCapabilities">capabilities 10269 structure</internallink>. 10270 An environment does not possess a capability unless it has been successfully added with 10271 <functionlink id="AddCapabilities"/>. 10272 An environment only loses possession of a capability if it has been relinquished with 10273 <functionlink id="RelinquishCapabilities"/>. Thus, this function returns the net result 10274 of the <code>AddCapabilities</code> and <code>RelinquishCapabilities</code> calls which 10275 have been made. 10276 <p/> 10277 See the 10278 <internallink id="capabilityExamples">Capability Examples</internallink>. 10279 </description> 10280 <origin>jvmdiClone</origin> 10281 <capabilities> 10282 </capabilities> 10283 <parameters> 10284 <param id="capabilities_ptr"> 10285 <outptr><struct>jvmtiCapabilities</struct></outptr> 10286 <description> 10287 On return, points to the <jvmti/> capabilities. 10288 </description> 10289 </param> 10290 </parameters> 10291 <errors> 10292 </errors> 10293 </function> 10294 10295 </category> 10296 10297 10298 <category id="timers" label="Timers"> 10299 10300 <intro> 10301 These functions provide timing information. 10302 The resolution at which the time is updated is not specified. 10303 They provides nanosecond precision, but not necessarily nanosecond accuracy. 10304 Details about the timers, such as their maximum values, can be accessed with 10305 the timer information functions. 10306 </intro> 10307 10308 <typedef id="jvmtiTimerInfo" label="Timer Info"> 10309 <description> 10310 The information function for each timer returns this data structure. 10311 </description> 10312 <field id="max_value"> 10313 <jlong/> 10314 <description> 10315 The maximum value the timer can reach. 10316 After this value is reached the timer wraps back to zero. 10317 This is an unsigned value. If tested or printed as a jlong (signed value) 10318 it may appear to be a negative number. 10319 </description> 10320 </field> 10321 <field id="may_skip_forward"> 10322 <jboolean/> 10323 <description> 10324 If true, the timer can be externally adjusted and as a result skip forward. 10325 If false, the timer value will never increase faster than real time. 10326 </description> 10327 </field> 10328 <field id="may_skip_backward"> 10329 <jboolean/> 10330 <description> 10331 If true, the timer can be externally adjusted and as a result skip backward. 10332 If false, the timer value will be monotonically increasing. 10333 </description> 10334 </field> 10335 <field id="kind"> 10336 <enum>jvmtiTimerKind</enum> 10337 <description> 10338 The kind of timer. 10339 On a platform that does not distinguish between user and system time, <datalink 10340 id="JVMTI_TIMER_TOTAL_CPU"><code>JVMTI_TIMER_TOTAL_CPU</code></datalink> 10341 is returned. 10342 </description> 10343 </field> 10344 <field id="reserved1"> 10345 <jlong/> 10346 <description> 10347 Reserved for future use. 10348 </description> 10349 </field> 10350 <field id="reserved2"> 10351 <jlong/> 10352 <description> 10353 Reserved for future use. 10354 </description> 10355 </field> 10356 </typedef> 10357 10358 <intro> 10359 Where the timer kind is -- 10360 10361 <constants id="jvmtiTimerKind" label="Timer Kinds" kind="enum"> 10362 <constant id="JVMTI_TIMER_USER_CPU" num="30"> 10363 CPU time that a thread is in user mode. 10364 </constant> 10365 <constant id="JVMTI_TIMER_TOTAL_CPU" num="31"> 10366 CPU time that a thread is in user or system mode. 10367 </constant> 10368 <constant id="JVMTI_TIMER_ELAPSED" num="32"> 10369 Elapsed time. 10370 </constant> 10371 </constants> 10372 </intro> 10373 10374 <function id="GetCurrentThreadCpuTimerInfo" callbacksafe="safe" impl="innative notrace" phase="start" num="134"> 10375 <synopsis>Get Current Thread CPU Timer Information</synopsis> 10376 <description> 10377 Get information about the 10378 <functionlink id="GetCurrentThreadCpuTime"/> timer. 10379 The fields of the <datalink id="jvmtiTimerInfo"/> structure 10380 are filled in with details about the timer. 10381 This information is specific to the platform and the implementation of 10382 <functionlink id="GetCurrentThreadCpuTime"/> and thus 10383 does not vary by thread nor does it vary 10384 during a particular invocation of the VM. 10385 <p/> 10386 Note that the implementations of <functionlink id="GetCurrentThreadCpuTime"/> 10387 and <functionlink id="GetThreadCpuTime"/> may differ, and thus the values 10388 returned by <code>GetCurrentThreadCpuTimerInfo</code> 10389 and <functionlink id="GetThreadCpuTimerInfo"/> 10390 may differ -- see <functionlink id="GetCurrentThreadCpuTime"/> for more information. 10391 </description> 10392 <origin>new</origin> 10393 <capabilities> 10394 <required id="can_get_current_thread_cpu_time"> 10395 Can get current thread CPU time. 10396 </required> 10397 </capabilities> 10398 <parameters> 10399 <param id="info_ptr"> 10400 <outptr><struct>jvmtiTimerInfo</struct></outptr> 10401 <description> 10402 On return, filled with information describing the time 10403 returned by <functionlink id="GetCurrentThreadCpuTime"/>. 10404 </description> 10405 </param> 10406 </parameters> 10407 <errors> 10408 </errors> 10409 </function> 10410 10411 <function id="GetCurrentThreadCpuTime" callbacksafe="safe" impl="innative notrace" phase="start" num="135"> 10412 <synopsis>Get Current Thread CPU Time</synopsis> 10413 <description> 10414 Return the CPU time utilized by the current thread. 10415 <p/> 10416 Note that the <functionlink id="GetThreadCpuTime"/> 10417 function provides CPU time for any thread, including 10418 the current thread. <code>GetCurrentThreadCpuTime</code> 10419 exists to support platforms which cannot 10420 supply CPU time for threads other than the current 10421 thread or which have more accurate information for 10422 the current thread (see 10423 <functionlink id="GetCurrentThreadCpuTimerInfo"/> vs 10424 <functionlink id="GetThreadCpuTimerInfo"/>). 10425 On many platforms this call will be equivalent to: 10426 <example> 10427 GetThreadCpuTime(env, NULL, nanos_ptr) 10428 </example> 10429 </description> 10430 <origin>new</origin> 10431 <capabilities> 10432 <required id="can_get_current_thread_cpu_time"> 10433 Can get current thread CPU time. 10434 <p/> 10435 If this capability is enabled after threads have started, 10436 the implementation may choose any time up 10437 to and including the time that the capability is enabled 10438 as the point where CPU time collection starts. 10439 <p/> 10440 This capability must be potentially available on any 10441 platform where 10442 <internallink id="jvmtiCapabilities.can_get_thread_cpu_time"><code>can_get_thread_cpu_time</code></internallink> 10443 is potentially available. 10444 </required> 10445 </capabilities> 10446 <parameters> 10447 <param id="nanos_ptr"> 10448 <outptr><jlong/></outptr> 10449 <description> 10450 On return, points to the CPU time used by this thread 10451 in nanoseconds. 10452 This is an unsigned value. If tested or printed as a jlong (signed value) 10453 it may appear to be a negative number. 10454 </description> 10455 </param> 10456 </parameters> 10457 <errors> 10458 </errors> 10459 </function> 10460 10461 <function id="GetThreadCpuTimerInfo" num="136"> 10462 <synopsis>Get Thread CPU Timer Information</synopsis> 10463 <description> 10464 Get information about the 10465 <functionlink id="GetThreadCpuTime"/> timer. 10466 The fields of the <datalink id="jvmtiTimerInfo"/> structure 10467 are filled in with details about the timer. 10468 This information is specific to the platform and the implementation of 10469 <functionlink id="GetThreadCpuTime"/> and thus 10470 does not vary by thread nor does it vary 10471 during a particular invocation of the VM. 10472 <p/> 10473 Note that the implementations of <functionlink id="GetCurrentThreadCpuTime"/> 10474 and <functionlink id="GetThreadCpuTime"/> may differ, and thus the values 10475 returned by <functionlink id="GetCurrentThreadCpuTimerInfo"/> 10476 and <code>GetThreadCpuTimerInfo</code> 10477 may differ -- see <functionlink id="GetCurrentThreadCpuTime"/> for more information. 10478 </description> 10479 <origin>new</origin> 10480 <capabilities> 10481 <required id="can_get_thread_cpu_time"> 10482 Can get thread CPU time. 10483 </required> 10484 </capabilities> 10485 <parameters> 10486 <param id="info_ptr"> 10487 <outptr><struct>jvmtiTimerInfo</struct></outptr> 10488 <description> 10489 On return, filled with information describing the time 10490 returned by <functionlink id="GetThreadCpuTime"/>. 10491 </description> 10492 </param> 10493 </parameters> 10494 <errors> 10495 </errors> 10496 </function> 10497 10498 <function id="GetThreadCpuTime" num="137"> 10499 <synopsis>Get Thread CPU Time</synopsis> 10500 <description> 10501 Return the CPU time utilized by the specified thread. 10502 <p/> 10503 Get information about this timer with 10504 <functionlink id="GetThreadCpuTimerInfo"/>. 10505 </description> 10506 <origin>new</origin> 10507 <capabilities> 10508 <required id="can_get_thread_cpu_time"> 10509 Can get thread CPU time. 10510 <p/> 10511 If this capability is enabled after threads have started, 10512 the implementation may choose any time up 10513 to and including the time that the capability is enabled 10514 as the point where CPU time collection starts. 10515 </required> 10516 </capabilities> 10517 <parameters> 10518 <param id="thread"> 10519 <jthread null="current"/> 10520 <description> 10521 The thread to query. 10522 </description> 10523 </param> 10524 <param id="nanos_ptr"> 10525 <outptr><jlong/></outptr> 10526 <description> 10527 On return, points to the CPU time used by the specified thread 10528 in nanoseconds. 10529 This is an unsigned value. If tested or printed as a jlong (signed value) 10530 it may appear to be a negative number. 10531 </description> 10532 </param> 10533 </parameters> 10534 <errors> 10535 </errors> 10536 </function> 10537 10538 <function id="GetTimerInfo" phase="any" callbacksafe="safe" num="138"> 10539 <synopsis>Get Timer Information</synopsis> 10540 <description> 10541 Get information about the 10542 <functionlink id="GetTime"/> timer. 10543 The fields of the <datalink id="jvmtiTimerInfo"/> structure 10544 are filled in with details about the timer. 10545 This information will not change during a particular invocation of the VM. 10546 </description> 10547 <origin>new</origin> 10548 <capabilities> 10549 </capabilities> 10550 <parameters> 10551 <param id="info_ptr"> 10552 <outptr><struct>jvmtiTimerInfo</struct></outptr> 10553 <description> 10554 On return, filled with information describing the time 10555 returned by <functionlink id="GetTime"/>. 10556 </description> 10557 </param> 10558 </parameters> 10559 <errors> 10560 </errors> 10561 </function> 10562 10563 <function id="GetTime" phase="any" callbacksafe="safe" num="139"> 10564 <synopsis>Get Time</synopsis> 10565 <description> 10566 Return the current value of the system timer, in nanoseconds. 10567 <p/> 10568 The value returned represents nanoseconds since some fixed but 10569 arbitrary time (perhaps in the future, so values may be 10570 negative). This function provides nanosecond precision, but not 10571 necessarily nanosecond accuracy. No guarantees are made about 10572 how frequently values change. 10573 <p/> 10574 Get information about this timer with 10575 <functionlink id="GetTimerInfo"/>. 10576 </description> 10577 <origin>new</origin> 10578 <capabilities> 10579 </capabilities> 10580 <parameters> 10581 <param id="nanos_ptr"> 10582 <outptr><jlong/></outptr> 10583 <description> 10584 On return, points to the time in nanoseconds. 10585 This is an unsigned value. If tested or printed as a jlong (signed value) 10586 it may appear to be a negative number. 10587 </description> 10588 </param> 10589 </parameters> 10590 <errors> 10591 </errors> 10592 </function> 10593 10594 <function id="GetAvailableProcessors" phase="any" num="144"> 10595 <synopsis>Get Available Processors</synopsis> 10596 <description> 10597 Returns the number of processors available to the Java virtual machine. 10598 <p/> 10599 This value may change during a particular invocation of the virtual machine. 10600 Applications that are sensitive to the number of available processors should 10601 therefore occasionally poll this property. 10602 </description> 10603 <origin>new</origin> 10604 <capabilities> 10605 </capabilities> 10606 <parameters> 10607 <param id="processor_count_ptr"> 10608 <outptr><jint/></outptr> 10609 <description> 10610 On return, points to the maximum number of processors available to the 10611 virtual machine; never smaller than one. 10612 </description> 10613 </param> 10614 </parameters> 10615 <errors> 10616 </errors> 10617 </function> 10618 10619 </category> 10620 10621 10622 <category id="classLoaderSearch" label="Class Loader Search"> 10623 10624 <intro> 10625 These functions allow the agent to add to the locations that a class loader searches for a class. 10626 This is useful for installing instrumentation under the correct class loader. 10627 </intro> 10628 10629 <function id="AddToBootstrapClassLoaderSearch" jkernel="yes" phase="onload" num="149"> 10630 <synopsis>Add To Bootstrap Class Loader Search</synopsis> 10631 <description> 10632 This function can be used to cause instrumentation classes to be defined by the 10633 bootstrap class loader. See <vmspec chapter="5.3.1"/>. 10634 After the bootstrap 10635 class loader unsuccessfully searches for a class, the specified platform-dependent 10636 search path <paramlink id="segment"/> will be searched as well. Only one segment may be specified in 10637 the <paramlink id="segment"/>. This function may be called multiple times to add multiple segments, 10638 the segments will be searched in the order that this function was called. 10639 <p/> 10640 In the <code>OnLoad</code> phase the function may be used to specify any platform-dependent 10641 search path segment to be searched after the bootstrap class loader unsuccessfully searches 10642 for a class. The segment is typically a directory or JAR file. 10643 <p/> 10644 In the live phase the <paramlink id="segment"/> may be used to specify any platform-dependent 10645 path to a <externallink id="docs/technotes/guides/jar/jar.html"> 10646 JAR file</externallink>. The agent should take care that the JAR file does not 10647 contain any classes or resources other than those to be defined by the bootstrap 10648 class loader for the purposes of instrumentation. 10649 <p/> 10650 <vmspec/> specifies that a subsequent attempt to resolve a symbolic 10651 reference that the Java virtual machine has previously unsuccessfully attempted 10652 to resolve always fails with the same error that was thrown as a result of the 10653 initial resolution attempt. Consequently, if the JAR file contains an entry 10654 that corresponds to a class for which the Java virtual machine has 10655 unsuccessfully attempted to resolve a reference, then subsequent attempts to 10656 resolve that reference will fail with the same error as the initial attempt. 10657 </description> 10658 <origin>new</origin> 10659 <capabilities> 10660 </capabilities> 10661 <parameters> 10662 <param id="segment"> 10663 <inbuf><char/></inbuf> 10664 <description> 10665 The platform-dependent search path segment, encoded as a 10666 <internallink id="mUTF">modified UTF-8</internallink> string. 10667 </description> 10668 </param> 10669 </parameters> 10670 <errors> 10671 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 10672 <paramlink id="segment"/> is an invalid path. In the live phase, anything other than an 10673 existing JAR file is an invalid path. 10674 </error> 10675 </errors> 10676 </function> 10677 10678 <function id="AddToSystemClassLoaderSearch" jkernel="yes" phase="onload" num="151" since="1.1"> 10679 <synopsis>Add To System Class Loader Search</synopsis> 10680 <description> 10681 This function can be used to cause instrumentation classes to be 10682 defined by the system class loader. See <vmspec chapter="5.3.2"/>. 10683 After the class loader unsuccessfully searches for a class, the specified platform-dependent search 10684 path <paramlink id="segment"/> will be searched as well. Only one segment may be specified in the 10685 <paramlink id="segment"/>. This function may be called multiple times to add multiple segments, the 10686 segments will be searched in the order that this function was called. 10687 <p/> 10688 In the <code>OnLoad</code> phase the function may be used to specify any platform-dependent 10689 search path segment to be searched after the system class loader unsuccessfully searches 10690 for a class. The segment is typically a directory or JAR file. 10691 <p/> 10692 In the live phase the <paramlink id="segment"/> is a platform-dependent path to a 10693 <externallink id="docs/technotes/guides/jar/jar.html">JAR file</externallink> to be 10694 searched after the system class loader unsuccessfully searches for a class. The agent should 10695 take care that the JAR file does not contain any classes or resources other than those to be 10696 defined by the system class loader for the purposes of instrumentation. 10697 <p/> 10698 In the live phase the system class loader supports adding a JAR file to be searched if 10699 the system class loader implements a method name <code>appendToClassPathForInstrumentation</code> 10700 which takes a single parameter of type <code>java.lang.String</code>. The method is not required 10701 to have <code>public</code> access. 10702 <p/> 10703 <vmspec/> specifies that a subsequent attempt to resolve a symbolic 10704 reference that the Java virtual machine has previously unsuccessfully attempted 10705 to resolve always fails with the same error that was thrown as a result of the 10706 initial resolution attempt. Consequently, if the JAR file contains an entry 10707 that corresponds to a class for which the Java virtual machine has 10708 unsuccessfully attempted to resolve a reference, then subsequent attempts to 10709 resolve that reference will fail with the same error as the initial attempt. 10710 </description> 10711 <origin>new</origin> 10712 <capabilities> 10713 </capabilities> 10714 <parameters> 10715 <param id="segment"> 10716 <inbuf><char/></inbuf> 10717 <description> 10718 The platform-dependent search path segment, encoded as a 10719 <internallink id="mUTF">modified UTF-8</internallink> string. 10720 </description> 10721 </param> 10722 </parameters> 10723 <errors> 10724 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 10725 <paramlink id="segment"/> is an invalid path. In the live phase, anything other than an 10726 existing JAR file is an invalid path. 10727 </error> 10728 <error id="JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED"> 10729 Operation not supported by the system class loader. 10730 </error> 10731 </errors> 10732 </function> 10733 10734 </category> 10735 10736 10737 <category id="props" label="System Properties"> 10738 10739 <intro> 10740 These functions get and set system properties. 10741 </intro> 10742 10743 <function id="GetSystemProperties" phase="onload" num="130"> 10744 <synopsis>Get System Properties</synopsis> 10745 <description> 10746 The list of VM system property keys which may be used with 10747 <functionlink id="GetSystemProperty"/> is returned. 10748 It is strongly recommended that virtual machines provide the 10749 following property keys: 10750 <ul> 10751 <li><code>java.vm.vendor</code></li> 10752 <li><code>java.vm.version</code></li> 10753 <li><code>java.vm.name</code></li> 10754 <li><code>java.vm.info</code></li> 10755 <li><code>java.library.path</code></li> 10756 <li><code>java.class.path</code></li> 10757 </ul> 10758 Provides access to system properties defined by and used 10759 by the VM. 10760 Properties set on the command-line are included. 10761 This allows getting and setting of these properties 10762 before the VM even begins executing bytecodes. 10763 Since this is a VM view of system properties, the set of available 10764 properties will usually be different than that 10765 in <code>java.lang.System.getProperties</code>. 10766 JNI method invocation may be used to access 10767 <code>java.lang.System.getProperties</code>. 10768 <p/> 10769 The set of properties may grow during execution. 10770 </description> 10771 <origin>new</origin> 10772 <capabilities> 10773 </capabilities> 10774 <parameters> 10775 <param id="count_ptr"> 10776 <outptr><jint/></outptr> 10777 <description> 10778 On return, points to the number of property keys returned. 10779 </description> 10780 </param> 10781 <param id="property_ptr"> 10782 <allocallocbuf outcount="count_ptr"><char/></allocallocbuf> 10783 <description> 10784 On return, points to an array of property keys, encoded as 10785 <internallink id="mUTF">modified UTF-8</internallink> strings. 10786 </description> 10787 </param> 10788 </parameters> 10789 <errors> 10790 </errors> 10791 </function> 10792 10793 <function id="GetSystemProperty" phase="onload" num="131"> 10794 <synopsis>Get System Property</synopsis> 10795 <description> 10796 Return a VM system property value given the property key. 10797 <p/> 10798 The function <functionlink id="GetSystemProperties"/> 10799 returns the set of property keys which may be used. 10800 The properties which can be retrieved may grow during 10801 execution. 10802 <p/> 10803 Since this is a VM view of system properties, the values 10804 of properties may differ from that returned by 10805 <code>java.lang.System.getProperty(String)</code>. 10806 A typical VM might copy the values of the VM system 10807 properties into the <code>Properties</code> held by 10808 <code>java.lang.System</code> during the initialization 10809 of that class. Thereafter any changes to the VM system 10810 properties (with <functionlink id="SetSystemProperty"/>) 10811 or the <code>java.lang.System</code> system properties 10812 (with <code>java.lang.System.setProperty(String,String)</code>) 10813 would cause the values to diverge. 10814 JNI method invocation may be used to access 10815 <code>java.lang.System.getProperty(String)</code>. 10816 </description> 10817 <origin>new</origin> 10818 <capabilities> 10819 </capabilities> 10820 <parameters> 10821 <param id="property"> 10822 <inbuf><char/></inbuf> 10823 <description> 10824 The key of the property to retrieve, encoded as a 10825 <internallink id="mUTF">modified UTF-8</internallink> string. 10826 </description> 10827 </param> 10828 <param id="value_ptr"> 10829 <allocbuf><char/></allocbuf> 10830 <description> 10831 On return, points to the property value, encoded as a 10832 <internallink id="mUTF">modified UTF-8</internallink> string. 10833 </description> 10834 </param> 10835 </parameters> 10836 <errors> 10837 <error id="JVMTI_ERROR_NOT_AVAILABLE"> 10838 This property is not available. 10839 Use <functionlink id="GetSystemProperties"/> to find available properties. 10840 </error> 10841 </errors> 10842 </function> 10843 10844 <function id="SetSystemProperty" phase="onloadOnly" num="132"> 10845 <synopsis>Set System Property</synopsis> 10846 <description> 10847 Set a VM system property value. 10848 <p/> 10849 The function <functionlink id="GetSystemProperties"/> 10850 returns the set of property keys, some of these may be settable. 10851 See <functionlink id="GetSystemProperty"/>. 10852 </description> 10853 <origin>new</origin> 10854 <capabilities> 10855 </capabilities> 10856 <parameters> 10857 <param id="property"> 10858 <inbuf><char/></inbuf> 10859 <description> 10860 The key of the property, encoded as a 10861 <internallink id="mUTF">modified UTF-8</internallink> string. 10862 </description> 10863 </param> 10864 <param id="value_ptr"> 10865 <inbuf> 10866 <char/> 10867 <nullok> 10868 do not set the value, but return <errorlink id="JVMTI_ERROR_NOT_AVAILABLE"/> 10869 if the property is not writeable 10870 </nullok> 10871 </inbuf> 10872 <description> 10873 The property value to set, encoded as a 10874 <internallink id="mUTF">modified UTF-8</internallink> string. 10875 </description> 10876 </param> 10877 </parameters> 10878 <errors> 10879 <error id="JVMTI_ERROR_NOT_AVAILABLE"> 10880 This property is not available or is not writeable. 10881 </error> 10882 </errors> 10883 </function> 10884 10885 </category> 10886 10887 <category id="general" label="General"> 10888 10889 <intro> 10890 </intro> 10891 10892 <function id="GetPhase" jkernel="yes" phase="any" num="133"> 10893 <synopsis>Get Phase</synopsis> 10894 <description> 10895 Return the current phase of VM execution. 10896 The phases proceed in sequence: 10897 <constants id="jvmtiPhase" label="Phases of execution" kind="enum"> 10898 <constant id="JVMTI_PHASE_ONLOAD" num="1"> 10899 <code>OnLoad</code> phase: while in the 10900 <internallink id="onload"><code>Agent_OnLoad</code></internallink> 10901 or, for statically linked agents, the <internallink id="onload"> 10902 <code>Agent_OnLoad_<agent-lib-name> 10903 </code></internallink> function. 10904 </constant> 10905 <constant id="JVMTI_PHASE_PRIMORDIAL" num="2"> 10906 Primordial phase: between return from <code>Agent_OnLoad</code> 10907 or <code>Agent_OnLoad_<agent-lib-name></code> and the 10908 <code>VMStart</code> event. 10909 </constant> 10910 <constant id="JVMTI_PHASE_START" num="6"> 10911 Start phase: when the <eventlink id="VMStart"><code>VMStart</code></eventlink> event 10912 is sent and until the <code>VMInit</code> event is sent. 10913 </constant> 10914 <constant id="JVMTI_PHASE_LIVE" num="4"> 10915 Live phase: when the <eventlink id="VMInit"><code>VMInit</code></eventlink> event is sent 10916 and until the <eventlink id="VMDeath"></eventlink> event returns. 10917 </constant> 10918 <constant id="JVMTI_PHASE_DEAD" num="8"> 10919 Dead phase: after the <eventlink id="VMDeath"></eventlink> event returns or after 10920 start-up failure. 10921 </constant> 10922 </constants> 10923 In the case of start-up failure the VM will proceed directly to the dead 10924 phase skipping intermediate phases and neither a <code>VMInit</code> nor 10925 <code>VMDeath</code> event will be sent. 10926 <p/> 10927 Most <jvmti/> functions operate only in the live phase. 10928 The following functions operate in either the <code>OnLoad</code> or live phases: 10929 <functionphaselist phase="onload"/> 10930 The following functions operate in only the <code>OnLoad</code> phase: 10931 <functionphaselist phase="onloadOnly"/> 10932 The following functions operate in the start or live phases: 10933 <functionphaselist phase="start"/> 10934 The following functions operate in any phase: 10935 <functionphaselist phase="any"/> 10936 JNI functions (except the Invocation API) must only be used in the start or live phases. 10937 <p/> 10938 Most <jvmti/> events are sent only in the live phase. 10939 The following events operate in others phases: 10940 <eventphaselist phase="start"/> 10941 <eventphaselist phase="any"/> 10942 </description> 10943 <origin>new</origin> 10944 <capabilities> 10945 </capabilities> 10946 <parameters> 10947 <param id="phase_ptr"> 10948 <outptr><enum>jvmtiPhase</enum></outptr> 10949 <description> 10950 On return, points to the phase. 10951 </description> 10952 </param> 10953 </parameters> 10954 <errors> 10955 </errors> 10956 </function> 10957 10958 <function id="DisposeEnvironment" jkernel="yes" phase="any" num="127"> 10959 <synopsis>Dispose Environment</synopsis> 10960 <description> 10961 Shutdown a <jvmti/> connection created with JNI <code>GetEnv</code> 10962 (see <internallink id="environments"><jvmti/> Environments</internallink>). 10963 Dispose of any resources held by the environment. 10964 <issue> 10965 What resources are reclaimed? What is undone? 10966 Breakpoints,watchpoints removed? 10967 </issue> 10968 Threads suspended by this environment are not resumed by this call, 10969 this must be done explicitly by the agent. 10970 Memory allocated by this environment via calls to <jvmti/> functions 10971 is not released, this can be done explicitly by the agent 10972 by calling <functionlink id="Deallocate"/>. 10973 Raw monitors created by this environment are not destroyed, 10974 this can be done explicitly by the agent 10975 by calling <functionlink id="DestroyRawMonitor"/>. 10976 The state of threads waiting on raw monitors created by this environment 10977 are not affected. 10978 <p/> 10979 Any <functionlink id="SetNativeMethodPrefix">native method 10980 prefixes</functionlink> for this environment will be unset; 10981 the agent must remove any prefixed native methods before 10982 dispose is called. 10983 <p/> 10984 Any <internallink id="capability">capabilities</internallink> 10985 held by this environment are relinquished. 10986 <p/> 10987 Events enabled by this environment will no longer be sent, however 10988 event handlers currently running will continue to run. Caution must 10989 be exercised in the design of event handlers whose environment may 10990 be disposed and thus become invalid during their execution. 10991 <p/> 10992 This environment may not be used after this call. 10993 This call returns to the caller. 10994 </description> 10995 <origin>new</origin> 10996 <capabilities> 10997 </capabilities> 10998 <parameters> 10999 </parameters> 11000 <errors> 11001 </errors> 11002 </function> 11003 11004 <function id="SetEnvironmentLocalStorage" jkernel="yes" phase="any" callbacksafe="safe" impl="innative notrace" num="148"> 11005 <synopsis>Set Environment Local Storage</synopsis> 11006 <description> 11007 The VM stores a pointer value associated with each environment. 11008 This pointer value is called <i>environment-local storage</i>. 11009 This value is <code>NULL</code> unless set with this function. 11010 Agents can allocate memory in which they store environment specific 11011 information. By setting environment-local storage it can then be 11012 accessed with 11013 <functionlink id="GetEnvironmentLocalStorage"></functionlink>. 11014 <p/> 11015 Called by the agent to set the value of the <jvmti/> 11016 environment-local storage. <jvmti/> supplies to the agent a pointer-size 11017 environment-local storage that can be used to record per-environment 11018 information. 11019 </description> 11020 <origin>new</origin> 11021 <capabilities> 11022 </capabilities> 11023 <parameters> 11024 <param id="data"> 11025 <inbuf> 11026 <void/> 11027 <nullok>value is set to <code>NULL</code></nullok> 11028 </inbuf> 11029 <description> 11030 The value to be entered into the environment-local storage. 11031 </description> 11032 </param> 11033 </parameters> 11034 <errors> 11035 </errors> 11036 </function> 11037 11038 <function id="GetEnvironmentLocalStorage" jkernel="yes" phase="any" callbacksafe="safe" impl="innative notrace" num="147"> 11039 <synopsis>Get Environment Local Storage</synopsis> 11040 <description> 11041 Called by the agent to get the value of the <jvmti/> environment-local 11042 storage. 11043 </description> 11044 <origin>new</origin> 11045 <capabilities> 11046 </capabilities> 11047 <parameters> 11048 <param id="data_ptr"> 11049 <agentbuf><void/></agentbuf> 11050 <description> 11051 Pointer through which the value of the environment local 11052 storage is returned. 11053 If environment-local storage has not been set with 11054 <functionlink id="SetEnvironmentLocalStorage"></functionlink> returned 11055 pointer is <code>NULL</code>. 11056 </description> 11057 </param> 11058 </parameters> 11059 <errors> 11060 </errors> 11061 </function> 11062 11063 <function id="GetVersionNumber" jkernel="yes" phase="any" num="88"> 11064 <synopsis>Get Version Number</synopsis> 11065 <description> 11066 Return the <jvmti/> version via <code>version_ptr</code>. 11067 The return value is the version identifier. 11068 The version identifier includes major, minor and micro 11069 version as well as the interface type. 11070 <constants id="jvmtiVersionInterfaceTypes" label="Version Interface Types" kind="bits"> 11071 <constant id="JVMTI_VERSION_INTERFACE_JNI" num="0x00000000"> 11072 Value of <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> for JNI. 11073 </constant> 11074 <constant id="JVMTI_VERSION_INTERFACE_JVMTI" num="0x30000000"> 11075 Value of <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> for <jvmti/>. 11076 </constant> 11077 </constants> 11078 <constants id="jvmtiVersionMasks" label="Version Masks" kind="bits"> 11079 <constant id="JVMTI_VERSION_MASK_INTERFACE_TYPE" num="0x70000000"> 11080 Mask to extract interface type. 11081 The value of the version returned by this function masked with 11082 <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> is always 11083 <code>JVMTI_VERSION_INTERFACE_JVMTI</code> 11084 since this is a <jvmti/> function. 11085 </constant> 11086 <constant id="JVMTI_VERSION_MASK_MAJOR" num="0x0FFF0000"> 11087 Mask to extract major version number. 11088 </constant> 11089 <constant id="JVMTI_VERSION_MASK_MINOR" num="0x0000FF00"> 11090 Mask to extract minor version number. 11091 </constant> 11092 <constant id="JVMTI_VERSION_MASK_MICRO" num="0x000000FF"> 11093 Mask to extract micro version number. 11094 </constant> 11095 </constants> 11096 <constants id="jvmtiVersionShifts" label="Version Shifts" kind="bits"> 11097 <constant id="JVMTI_VERSION_SHIFT_MAJOR" num="16"> 11098 Shift to extract major version number. 11099 </constant> 11100 <constant id="JVMTI_VERSION_SHIFT_MINOR" num="8"> 11101 Shift to extract minor version number. 11102 </constant> 11103 <constant id="JVMTI_VERSION_SHIFT_MICRO" num="0"> 11104 Shift to extract micro version number. 11105 </constant> 11106 </constants> 11107 </description> 11108 <origin>jvmdi</origin> 11109 <capabilities> 11110 </capabilities> 11111 <parameters> 11112 <param id="version_ptr"> 11113 <outptr><jint/></outptr> 11114 <description> 11115 On return, points to the <jvmti/> version. 11116 </description> 11117 </param> 11118 </parameters> 11119 <errors> 11120 </errors> 11121 </function> 11122 11123 11124 <function id="GetErrorName" phase="any" num="128"> 11125 <synopsis>Get Error Name</synopsis> 11126 <description> 11127 Return the symbolic name for an 11128 <internallink id="ErrorSection">error code</internallink>. 11129 <p/> 11130 For example 11131 <code>GetErrorName(env, JVMTI_ERROR_NONE, &err_name)</code> 11132 would return in <code>err_name</code> the string 11133 <code>"JVMTI_ERROR_NONE"</code>. 11134 </description> 11135 <origin>new</origin> 11136 <capabilities> 11137 </capabilities> 11138 <parameters> 11139 <param id="error"> 11140 <enum>jvmtiError</enum> 11141 <description> 11142 The error code. 11143 </description> 11144 </param> 11145 <param id="name_ptr"> 11146 <allocbuf><char/></allocbuf> 11147 <description> 11148 On return, points to the error name. 11149 The name is encoded as a 11150 <internallink id="mUTF">modified UTF-8</internallink> string, 11151 but is restricted to the ASCII subset. 11152 </description> 11153 </param> 11154 </parameters> 11155 <errors> 11156 </errors> 11157 </function> 11158 11159 <function id="SetVerboseFlag" phase="any" num="150"> 11160 <synopsis>Set Verbose Flag</synopsis> 11161 <description> 11162 <constants id="jvmtiVerboseFlag" label="Verbose Flag Enumeration" kind="enum"> 11163 <constant id="JVMTI_VERBOSE_OTHER" num="0"> 11164 Verbose output other than the below. 11165 </constant> 11166 <constant id="JVMTI_VERBOSE_GC" num="1"> 11167 Verbose garbage collector output, like that specified with <code>-verbose:gc</code>. 11168 </constant> 11169 <constant id="JVMTI_VERBOSE_CLASS" num="2"> 11170 Verbose class loading output, like that specified with <code>-verbose:class</code>. 11171 </constant> 11172 <constant id="JVMTI_VERBOSE_JNI" num="4"> 11173 Verbose JNI output, like that specified with <code>-verbose:jni</code>. 11174 </constant> 11175 </constants> 11176 Control verbose output. 11177 This is the output which typically is sent to <code>stderr</code>. 11178 </description> 11179 <origin>new</origin> 11180 <capabilities> 11181 </capabilities> 11182 <parameters> 11183 <param id="flag"> 11184 <enum>jvmtiVerboseFlag</enum> 11185 <description> 11186 Which verbose flag to set. 11187 </description> 11188 </param> 11189 <param id="value"> 11190 <jboolean/> 11191 <description> 11192 New value of the flag. 11193 </description> 11194 </param> 11195 </parameters> 11196 <errors> 11197 </errors> 11198 </function> 11199 11200 11201 <function id="GetJLocationFormat" phase="any" num="129"> 11202 <synopsis>Get JLocation Format</synopsis> 11203 <description> 11204 Although the greatest functionality is achieved with location information 11205 referencing the virtual machine bytecode index, the definition of 11206 <code>jlocation</code> has intentionally been left unconstrained to allow VM 11207 implementations that do not have this information. 11208 <p/> 11209 This function describes the representation of <code>jlocation</code> used in this VM. 11210 If the returned format is <datalink id="JVMTI_JLOCATION_JVMBCI"></datalink>, 11211 <code>jlocation</code>s can 11212 be used as in indices into the array returned by 11213 <functionlink id="GetBytecodes"></functionlink>. 11214 <constants id="jvmtiJlocationFormat" label="JLocation Format Enumeration" kind="enum"> 11215 <constant id="JVMTI_JLOCATION_JVMBCI" num="1"> 11216 <code>jlocation</code> values represent virtual machine 11217 bytecode indices--that is, offsets into the 11218 virtual machine code for a method. 11219 </constant> 11220 <constant id="JVMTI_JLOCATION_MACHINEPC" num="2"> 11221 <code>jlocation</code> values represent native machine 11222 program counter values. 11223 </constant> 11224 <constant id="JVMTI_JLOCATION_OTHER" num="0"> 11225 <code>jlocation</code> values have some other representation. 11226 </constant> 11227 </constants> 11228 </description> 11229 <origin>new</origin> 11230 <capabilities> 11231 </capabilities> 11232 <parameters> 11233 <param id="format_ptr"> 11234 <outptr><enum>jvmtiJlocationFormat</enum></outptr> 11235 <description> 11236 On return, points to the format identifier for <code>jlocation</code> values. 11237 </description> 11238 </param> 11239 </parameters> 11240 <errors> 11241 </errors> 11242 </function> 11243 11244 </category> 11245 11246 </functionsection> 11247 11248 <errorsection label="Error Reference"> 11249 <intro> 11250 Every <jvmti/> function returns a <b><code>jvmtiError</code></b> error code. 11251 <p/> 11252 It is the responsibility of the agent to call <jvmti/> functions with 11253 valid parameters and in the proper context (calling thread is attached, 11254 phase is correct, etc.). 11255 Detecting some error conditions may be difficult, inefficient, or 11256 impossible for an implementation. 11257 The errors listed in 11258 <internallink id="reqerrors">Function Specific Required Errors</internallink> 11259 must be detected by the implementation. 11260 All other errors represent the recommended response to the error 11261 condition. 11262 </intro> 11263 11264 <errorcategory id="universal-error" label="Universal Errors"> 11265 <intro> 11266 The following errors may be returned by any function 11267 </intro> 11268 11269 <errorid id="JVMTI_ERROR_NONE" num="0"> 11270 No error has occurred. This is the error code that is returned 11271 on successful completion of the function. 11272 </errorid> 11273 <errorid id="JVMTI_ERROR_NULL_POINTER" num="100"> 11274 Pointer is unexpectedly <code>NULL</code>. 11275 </errorid> 11276 <errorid id="JVMTI_ERROR_OUT_OF_MEMORY" num="110"> 11277 The function attempted to allocate memory and no more memory was 11278 available for allocation. 11279 </errorid> 11280 <errorid id="JVMTI_ERROR_ACCESS_DENIED" num="111"> 11281 The desired functionality has not been enabled in this virtual machine. 11282 </errorid> 11283 <errorid id="JVMTI_ERROR_UNATTACHED_THREAD" num="115"> 11284 The thread being used to call this function is not attached 11285 to the virtual machine. Calls must be made from attached threads. 11286 See <code>AttachCurrentThread</code> in the JNI invocation API. 11287 </errorid> 11288 <errorid id="JVMTI_ERROR_INVALID_ENVIRONMENT" num="116"> 11289 The <jvmti/> environment provided is no longer connected or is 11290 not an environment. 11291 </errorid> 11292 <errorid id="JVMTI_ERROR_WRONG_PHASE" num="112"> 11293 The desired functionality is not available in the current 11294 <functionlink id="GetPhase">phase</functionlink>. 11295 Always returned if the virtual machine has completed running. 11296 </errorid> 11297 <errorid id="JVMTI_ERROR_INTERNAL" num="113"> 11298 An unexpected internal error has occurred. 11299 </errorid> 11300 </errorcategory> 11301 11302 <errorcategory id="reqerrors" label="Function Specific Required Errors"> 11303 <intro> 11304 The following errors are returned by some <jvmti/> functions and must 11305 be returned by the implementation when the condition occurs. 11306 </intro> 11307 11308 <errorid id="JVMTI_ERROR_INVALID_PRIORITY" num="12"> 11309 Invalid priority. 11310 </errorid> 11311 <errorid id="JVMTI_ERROR_THREAD_NOT_SUSPENDED" num="13"> 11312 Thread was not suspended. 11313 </errorid> 11314 <errorid id="JVMTI_ERROR_THREAD_SUSPENDED" num="14"> 11315 Thread already suspended. 11316 </errorid> 11317 <errorid id="JVMTI_ERROR_THREAD_NOT_ALIVE" num="15"> 11318 This operation requires the thread to be alive--that is, 11319 it must be started and not yet have died. 11320 </errorid> 11321 <errorid id="JVMTI_ERROR_CLASS_NOT_PREPARED" num="22"> 11322 The class has been loaded but not yet prepared. 11323 </errorid> 11324 <errorid id="JVMTI_ERROR_NO_MORE_FRAMES" num="31"> 11325 There are no Java programming language or JNI stack frames at the specified depth. 11326 </errorid> 11327 <errorid id="JVMTI_ERROR_OPAQUE_FRAME" num="32"> 11328 Information about the frame is not available (e.g. for native frames). 11329 </errorid> 11330 <errorid id="JVMTI_ERROR_DUPLICATE" num="40"> 11331 Item already set. 11332 </errorid> 11333 <errorid id="JVMTI_ERROR_NOT_FOUND" num="41"> 11334 Desired element (e.g. field or breakpoint) not found 11335 </errorid> 11336 <errorid id="JVMTI_ERROR_NOT_MONITOR_OWNER" num="51"> 11337 This thread doesn't own the raw monitor. 11338 </errorid> 11339 <errorid id="JVMTI_ERROR_INTERRUPT" num="52"> 11340 The call has been interrupted before completion. 11341 </errorid> 11342 <errorid id="JVMTI_ERROR_UNMODIFIABLE_CLASS" num="79"> 11343 The class cannot be modified. 11344 </errorid> 11345 <errorid id="JVMTI_ERROR_NOT_AVAILABLE" num="98"> 11346 The functionality is not available in this virtual machine. 11347 </errorid> 11348 <errorid id="JVMTI_ERROR_ABSENT_INFORMATION" num="101"> 11349 The requested information is not available. 11350 </errorid> 11351 <errorid id="JVMTI_ERROR_INVALID_EVENT_TYPE" num="102"> 11352 The specified event type ID is not recognized. 11353 </errorid> 11354 <errorid id="JVMTI_ERROR_NATIVE_METHOD" num="104"> 11355 The requested information is not available for native method. 11356 </errorid> 11357 <errorid id="JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED" num="106"> 11358 The class loader does not support this operation. 11359 </errorid> 11360 </errorcategory> 11361 11362 <errorcategory id="function-specific-errors" label="Function Specific Agent Errors"> 11363 <intro> 11364 The following errors are returned by some <jvmti/> functions. 11365 They are returned in the event of invalid parameters passed by the 11366 agent or usage in an invalid context. 11367 An implementation is not required to detect these errors. 11368 </intro> 11369 11370 <errorid id="JVMTI_ERROR_INVALID_THREAD" num="10"> 11371 The passed thread is not a valid thread. 11372 </errorid> 11373 <errorid id="JVMTI_ERROR_INVALID_FIELDID" num="25"> 11374 Invalid field. 11375 </errorid> 11376 <errorid id="JVMTI_ERROR_INVALID_METHODID" num="23"> 11377 Invalid method. 11378 </errorid> 11379 <errorid id="JVMTI_ERROR_INVALID_LOCATION" num="24"> 11380 Invalid location. 11381 </errorid> 11382 <errorid id="JVMTI_ERROR_INVALID_OBJECT" num="20"> 11383 Invalid object. 11384 </errorid> 11385 <errorid id="JVMTI_ERROR_INVALID_CLASS" num="21"> 11386 Invalid class. 11387 </errorid> 11388 <errorid id="JVMTI_ERROR_TYPE_MISMATCH" num="34"> 11389 The variable is not an appropriate type for the function used. 11390 </errorid> 11391 <errorid id="JVMTI_ERROR_INVALID_SLOT" num="35"> 11392 Invalid slot. 11393 </errorid> 11394 <errorid id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY" num="99"> 11395 The capability being used is false in this environment. 11396 </errorid> 11397 <errorid id="JVMTI_ERROR_INVALID_THREAD_GROUP" num="11"> 11398 Thread group invalid. 11399 </errorid> 11400 <errorid id="JVMTI_ERROR_INVALID_MONITOR" num="50"> 11401 Invalid raw monitor. 11402 </errorid> 11403 <errorid id="JVMTI_ERROR_ILLEGAL_ARGUMENT" num="103"> 11404 Illegal argument. 11405 </errorid> 11406 <errorid id="JVMTI_ERROR_INVALID_TYPESTATE" num="65"> 11407 The state of the thread has been modified, and is now inconsistent. 11408 </errorid> 11409 <errorid id="JVMTI_ERROR_UNSUPPORTED_VERSION" num="68"> 11410 A new class file has a version number not supported by this VM. 11411 </errorid> 11412 <errorid id="JVMTI_ERROR_INVALID_CLASS_FORMAT" num="60"> 11413 A new class file is malformed (the VM would return a <code>ClassFormatError</code>). 11414 </errorid> 11415 <errorid id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION" num="61"> 11416 The new class file definitions would lead to a circular 11417 definition (the VM would return a <code>ClassCircularityError</code>). 11418 </errorid> 11419 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED" num="63"> 11420 A new class file would require adding a method. 11421 </errorid> 11422 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED" num="64"> 11423 A new class version changes a field. 11424 </errorid> 11425 <errorid id="JVMTI_ERROR_FAILS_VERIFICATION" num="62"> 11426 The class bytes fail verification. 11427 </errorid> 11428 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED" num="66"> 11429 A direct superclass is different for the new class 11430 version, or the set of directly implemented 11431 interfaces is different. 11432 </errorid> 11433 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED" num="67"> 11434 A new class version does not declare a method 11435 declared in the old class version. 11436 </errorid> 11437 <errorid id="JVMTI_ERROR_NAMES_DONT_MATCH" num="69"> 11438 The class name defined in the new class file is 11439 different from the name in the old class object. 11440 </errorid> 11441 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED" num="70"> 11442 A new class version has different modifiers. 11443 </errorid> 11444 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED" num="71"> 11445 A method in the new class version has different modifiers 11446 than its counterpart in the old class version. 11447 </errorid> 11448 </errorcategory> 11449 </errorsection> 11450 11451 <eventsection label="Events"> 11452 <intro label="Handling Events" id="eventIntro"> 11453 Agents can be informed of many events that occur in application 11454 programs. 11455 <p/> 11456 To handle events, designate a set of callback functions with 11457 <functionlink id="SetEventCallbacks"></functionlink>. 11458 For each event the corresponding callback function will be 11459 called. 11460 Arguments to the callback function provide additional 11461 information about the event. 11462 <p/> 11463 The callback function is usually called from within an application 11464 thread. The <jvmti/> implementation does not 11465 queue events in any way. This means 11466 that event callback functions must be written 11467 carefully. Here are some general guidelines. See 11468 the individual event descriptions for further 11469 suggestions. 11470 <p/> 11471 <ul> 11472 <li>Any exception thrown during the execution of an event callback can 11473 overwrite any current pending exception in the current application thread. 11474 Care must be taken to preserve a pending exception 11475 when an event callback makes a JNI call that might generate an exception. 11476 </li> 11477 <li>Event callback functions must be re-entrant. The <jvmti/> implementation does 11478 not queue events. If an agent needs to process events one at a time, it 11479 can use a raw monitor inside the 11480 event callback functions to serialize event processing. 11481 </li> 11482 <li>Event callback functions that execute JNI's FindClass function to load 11483 classes need to note that FindClass locates the class loader associated 11484 with the current native method. For the purposes of class loading, an 11485 event callback that includes a JNI environment as a parameter to the 11486 callback will treated as if it is a native call, where the native method 11487 is in the class of the event thread's current frame. 11488 </li> 11489 </ul> 11490 <p/> 11491 Some <jvmti/> events identify objects with JNI references. 11492 All references 11493 in <jvmti/> events are JNI local references and will become invalid 11494 after the event callback returns. 11495 Unless stated otherwise, memory referenced by pointers sent in event 11496 callbacks may not be referenced after the event callback returns. 11497 <p/> 11498 Except where stated otherwise, events are delivered on the thread 11499 that caused the event. 11500 Events are sent at the time they occur. 11501 The specification for each event includes the set of 11502 <functionlink id="GetPhase">phases</functionlink> in which it can be sent; 11503 if an event triggering activity occurs during another phase, no event 11504 is sent. 11505 <p/> 11506 A thread that generates an event does not change its execution status 11507 (for example, the event does not cause the thread to be suspended). 11508 If an agent wishes the event to result in suspension, then the agent 11509 is responsible for explicitly suspending the thread with 11510 <functionlink id="SuspendThread"></functionlink>. 11511 <p/> 11512 If an event is enabled in multiple environments, the event will be sent 11513 to each agent in the order that the environments were created. 11514 </intro> 11515 11516 <intro label="Enabling Events" id="enablingevents"> 11517 All events are initially disabled. In order to receive any 11518 event: 11519 <ul> 11520 <li> 11521 If the event requires a capability, that capability must 11522 be added with 11523 <functionlink id="AddCapabilities"></functionlink>. 11524 </li> 11525 <li> 11526 A callback for the event must be set with 11527 <functionlink id="SetEventCallbacks"></functionlink>. 11528 </li> 11529 <li> 11530 The event must be enabled with 11531 <functionlink id="SetEventNotificationMode"></functionlink>. 11532 </li> 11533 </ul> 11534 </intro> 11535 11536 <intro label="Multiple Co-located Events" id="eventorder"> 11537 In many situations it is possible for multiple events to occur 11538 at the same location in one thread. When this happens, all the events 11539 are reported through the event callbacks in the order specified in this section. 11540 <p/> 11541 If the current location is at the entry point of a method, the 11542 <eventlink id="MethodEntry"></eventlink> event is reported before 11543 any other event at the current location in the same thread. 11544 <p/> 11545 If an exception catch has been detected at the current location, 11546 either because it is the beginning of a catch clause or a native method 11547 that cleared a pending exception has returned, the 11548 <code>exceptionCatch</code> event is reported before 11549 any other event at the current location in the same thread. 11550 <p/> 11551 If a <code>singleStep</code> event or 11552 <code>breakpoint</code> event is triggered at the 11553 current location, the event is defined to occur 11554 immediately before the code at the current location is executed. 11555 These events are reported before any events which are triggered 11556 by the execution of code at the current location in the same 11557 thread (specifically: 11558 <code>exception</code>, 11559 <code>fieldAccess</code>, and 11560 <code>fieldModification</code>). 11561 If both a step and breakpoint event are triggered for the same thread and 11562 location, the step event is reported before the breakpoint event. 11563 <p/> 11564 If the current location is the exit point of a method (that is, the last 11565 location before returning to the caller), the 11566 <eventlink id="MethodExit"></eventlink> event and 11567 the <eventlink id="FramePop"></eventlink> event (if requested) 11568 are reported after all other events at the current location in the same 11569 thread. There is no specified ordering of these two events 11570 with respect to each other. 11571 <p/> 11572 Co-located events can be triggered during the processing of some other 11573 event by the agent at the same location in the same thread. 11574 If such an event, of type <i>y</i>, is triggered during the processing of 11575 an event of type <i>x</i>, and if <i>x</i> 11576 precedes <i>y</i> in the ordering specified above, the co-located event 11577 <i>y</i> is reported for the current thread and location. If <i>x</i> does not precede 11578 <i>y</i>, <i>y</i> is not reported for the current thread and location. 11579 For example, if a breakpoint is set at the current location 11580 during the processing of <eventlink id="SingleStep"></eventlink>, 11581 that breakpoint will be reported before the thread moves off the current 11582 location. 11583 <p/>The following events are never considered to be co-located with 11584 other events. 11585 <ul> 11586 <li><eventlink id="VMStart"></eventlink></li> 11587 <li><eventlink id="VMInit"></eventlink></li> 11588 <li><eventlink id="VMDeath"></eventlink></li> 11589 <li><eventlink id="ThreadStart"></eventlink></li> 11590 <li><eventlink id="ThreadEnd"></eventlink></li> 11591 <li><eventlink id="ClassLoad"></eventlink></li> 11592 <li><eventlink id="ClassPrepare"></eventlink></li> 11593 </ul> 11594 </intro> 11595 11596 <intro label="Event Callbacks" id="jvmtiEventCallbacks"> 11597 The event callback structure below is used to specify the handler function 11598 for events. It is set with the 11599 <functionlink id="SetEventCallbacks"></functionlink> function. 11600 </intro> 11601 11602 <event label="Single Step" 11603 id="SingleStep" const="JVMTI_EVENT_SINGLE_STEP" filtered="thread" num="60"> 11604 <description> 11605 Single step events allow the agent to trace thread execution 11606 at the finest granularity allowed by the VM. A single step event is 11607 generated whenever a thread reaches a new location. 11608 Typically, single step events represent the completion of one VM 11609 instruction as defined in <vmspec/>. However, some implementations 11610 may define locations differently. In any case the 11611 <code>method</code> and <code>location</code> 11612 parameters uniquely identify the current location and allow 11613 the mapping to source file and line number when that information is 11614 available. 11615 <p/> 11616 No single step events are generated from within native methods. 11617 </description> 11618 <origin>jvmdi</origin> 11619 <capabilities> 11620 <required id="can_generate_single_step_events"></required> 11621 </capabilities> 11622 <parameters> 11623 <param id="jni_env"> 11624 <outptr> 11625 <struct>JNIEnv</struct> 11626 </outptr> 11627 <description> 11628 The JNI environment of the event (current) thread 11629 </description> 11630 </param> 11631 <param id="thread"> 11632 <jthread/> 11633 <description> 11634 Thread about to execution a new instruction 11635 </description> 11636 </param> 11637 <param id="klass"> 11638 <jclass method="method"/> 11639 <description> 11640 Class of the method about to execute a new instruction 11641 </description> 11642 </param> 11643 <param id="method"> 11644 <jmethodID class="klass"/> 11645 <description> 11646 Method about to execute a new instruction 11647 </description> 11648 </param> 11649 <param id="location"> 11650 <jlocation/> 11651 <description> 11652 Location of the new instruction 11653 </description> 11654 </param> 11655 </parameters> 11656 </event> 11657 11658 <event label="Breakpoint" 11659 id="Breakpoint" const="JVMTI_EVENT_BREAKPOINT" filtered="thread" num="62"> 11660 <description> 11661 Breakpoint events are generated whenever a thread reaches a location 11662 designated as a breakpoint with <functionlink id="SetBreakpoint"></functionlink>. 11663 The <code>method</code> and <code>location</code> 11664 parameters uniquely identify the current location and allow 11665 the mapping to source file and line number when that information is 11666 available. 11667 </description> 11668 <origin>jvmdi</origin> 11669 <capabilities> 11670 <required id="can_generate_breakpoint_events"></required> 11671 </capabilities> 11672 <parameters> 11673 <param id="jni_env"> 11674 <outptr> 11675 <struct>JNIEnv</struct> 11676 </outptr> 11677 <description> 11678 The JNI environment of the event (current) thread. 11679 </description> 11680 </param> 11681 <param id="thread"> 11682 <jthread/> 11683 <description> 11684 Thread that hit the breakpoint 11685 </description> 11686 </param> 11687 <param id="klass"> 11688 <jclass method="method"/> 11689 <description> 11690 Class of the method that hit the breakpoint 11691 </description> 11692 </param> 11693 <param id="method"> 11694 <jmethodID class="klass"/> 11695 <description> 11696 Method that hit the breakpoint 11697 </description> 11698 </param> 11699 <param id="location"> 11700 <jlocation/> 11701 <description> 11702 location of the breakpoint 11703 </description> 11704 </param> 11705 </parameters> 11706 </event> 11707 11708 <event label="Field Access" 11709 id="FieldAccess" const="JVMTI_EVENT_FIELD_ACCESS" filtered="thread" num="63"> 11710 <description> 11711 Field access events are generated whenever a thread accesses 11712 a field that was designated as a watchpoint 11713 with <functionlink id="SetFieldAccessWatch"></functionlink>. 11714 The <code>method</code> and <code>location</code> 11715 parameters uniquely identify the current location and allow 11716 the mapping to source file and line number when that information is 11717 available. 11718 </description> 11719 <origin>jvmdi</origin> 11720 <capabilities> 11721 <required id="can_generate_field_access_events"></required> 11722 </capabilities> 11723 <parameters> 11724 <param id="jni_env"> 11725 <outptr> 11726 <struct>JNIEnv</struct> 11727 </outptr> 11728 <description> 11729 The JNI environment of the event (current) thread 11730 </description> 11731 </param> 11732 <param id="thread"> 11733 <jthread/> 11734 <description> 11735 Thread accessing the field 11736 </description> 11737 </param> 11738 <param id="klass"> 11739 <jclass method="method"/> 11740 <description> 11741 Class of the method where the access is occurring 11742 </description> 11743 </param> 11744 <param id="method"> 11745 <jmethodID class="klass"/> 11746 <description> 11747 Method where the access is occurring 11748 </description> 11749 </param> 11750 <param id="location"> 11751 <jlocation/> 11752 <description> 11753 Location where the access is occurring 11754 </description> 11755 </param> 11756 <param id="field_klass"> 11757 <jclass field="field"/> 11758 <description> 11759 Class of the field being accessed 11760 </description> 11761 </param> 11762 <param id="object"> 11763 <jobject/> 11764 <description> 11765 Object with the field being accessed if the field is an 11766 instance field; <code>NULL</code> otherwise 11767 </description> 11768 </param> 11769 <param id="field"> 11770 <jfieldID class="field_klass"/> 11771 <description> 11772 Field being accessed 11773 </description> 11774 </param> 11775 </parameters> 11776 </event> 11777 11778 <event label="Field Modification" 11779 id="FieldModification" const="JVMTI_EVENT_FIELD_MODIFICATION" filtered="thread" num="64"> 11780 <description> 11781 Field modification events are generated whenever a thread modifies 11782 a field that was designated as a watchpoint 11783 with <functionlink id="SetFieldModificationWatch"></functionlink>. 11784 The <code>method</code> and <code>location</code> 11785 parameters uniquely identify the current location and allow 11786 the mapping to source file and line number when that information is 11787 available. 11788 </description> 11789 <origin>jvmdi</origin> 11790 <capabilities> 11791 <required id="can_generate_field_modification_events"></required> 11792 </capabilities> 11793 <parameters> 11794 <param id="jni_env"> 11795 <outptr> 11796 <struct>JNIEnv</struct> 11797 </outptr> 11798 <description> 11799 The JNI environment of the event (current) thread 11800 </description> 11801 </param> 11802 <param id="thread"> 11803 <jthread/> 11804 <description> 11805 Thread modifying the field 11806 </description> 11807 </param> 11808 <param id="klass"> 11809 <jclass method="method"/> 11810 <description> 11811 Class of the method where the modification is occurring 11812 </description> 11813 </param> 11814 <param id="method"> 11815 <jmethodID class="klass"/> 11816 <description> 11817 Method where the modification is occurring 11818 </description> 11819 </param> 11820 <param id="location"> 11821 <jlocation/> 11822 <description> 11823 Location where the modification is occurring 11824 </description> 11825 </param> 11826 <param id="field_klass"> 11827 <jclass field="field"/> 11828 <description> 11829 Class of the field being modified 11830 </description> 11831 </param> 11832 <param id="object"> 11833 <jobject/> 11834 <description> 11835 Object with the field being modified if the field is an 11836 instance field; <code>NULL</code> otherwise 11837 </description> 11838 </param> 11839 <param id="field"> 11840 <jfieldID class="field_klass"/> 11841 <description> 11842 Field being modified 11843 </description> 11844 </param> 11845 <param id="signature_type"> 11846 <char/> 11847 <description> 11848 Signature type of the new value 11849 </description> 11850 </param> 11851 <param id="new_value"> 11852 <jvalue/> 11853 <description> 11854 The new value 11855 </description> 11856 </param> 11857 </parameters> 11858 </event> 11859 11860 <event label="Frame Pop" 11861 id="FramePop" const="JVMTI_EVENT_FRAME_POP" filtered="thread" num="61"> 11862 <description> 11863 Frame pop events are generated upon exit from a single method 11864 in a single frame as specified 11865 in a call to <functionlink id="NotifyFramePop"></functionlink>. 11866 This is true whether termination is caused by 11867 executing its return instruction 11868 or by throwing an exception to its caller 11869 (see <paramlink id="was_popped_by_exception"></paramlink>). 11870 However, frame pops caused by the <functionlink id="PopFrame"/> 11871 function are not reported. 11872 <p/> 11873 The location reported by <functionlink id="GetFrameLocation"></functionlink> 11874 identifies the executable location in the returning method, 11875 immediately prior to the return. 11876 </description> 11877 <origin>jvmdi</origin> 11878 <capabilities> 11879 <required id="can_generate_frame_pop_events"></required> 11880 </capabilities> 11881 <parameters> 11882 <param id="jni_env"> 11883 <outptr> 11884 <struct>JNIEnv</struct> 11885 </outptr> 11886 <description> 11887 The JNI environment of the event (current) thread 11888 </description> 11889 </param> 11890 <param id="thread"> 11891 <jthread/> 11892 <description> 11893 Thread that is popping the frame 11894 </description> 11895 </param> 11896 <param id="klass"> 11897 <jclass method="method"/> 11898 <description> 11899 Class of the method being popped 11900 </description> 11901 </param> 11902 <param id="method"> 11903 <jmethodID class="klass"/> 11904 <description> 11905 Method being popped 11906 </description> 11907 </param> 11908 <param id="was_popped_by_exception"> 11909 <jboolean/> 11910 <description> 11911 True if frame was popped by a thrown exception. 11912 False if method exited through its return instruction. 11913 </description> 11914 </param> 11915 </parameters> 11916 </event> 11917 11918 <event label="Method Entry" 11919 id="MethodEntry" const="JVMTI_EVENT_METHOD_ENTRY" filtered="thread" num="65"> 11920 <description> 11921 Method entry events are generated upon entry of Java 11922 programming language methods (including native methods). 11923 <p/> 11924 The location reported by <functionlink id="GetFrameLocation"></functionlink> 11925 identifies the initial executable location in 11926 the method. 11927 <p/> 11928 Enabling method 11929 entry or exit events will significantly degrade performance on many platforms and is thus 11930 not advised for performance critical usage (such as profiling). 11931 <internallink id="bci">Bytecode instrumentation</internallink> should be 11932 used in these cases. 11933 </description> 11934 <origin>jvmdi</origin> 11935 <capabilities> 11936 <required id="can_generate_method_entry_events"></required> 11937 </capabilities> 11938 <parameters> 11939 <param id="jni_env"> 11940 <outptr> 11941 <struct>JNIEnv</struct> 11942 </outptr> 11943 <description> 11944 The JNI environment of the event (current) thread 11945 </description> 11946 </param> 11947 <param id="thread"> 11948 <jthread/> 11949 <description> 11950 Thread entering the method 11951 </description> 11952 </param> 11953 <param id="klass"> 11954 <jclass method="method"/> 11955 <description> 11956 Class of the method being entered 11957 </description> 11958 </param> 11959 <param id="method"> 11960 <jmethodID class="klass"/> 11961 <description> 11962 Method being entered 11963 </description> 11964 </param> 11965 </parameters> 11966 </event> 11967 11968 <event label="Method Exit" 11969 id="MethodExit" const="JVMTI_EVENT_METHOD_EXIT" filtered="thread" num="66"> 11970 <description> 11971 Method exit events are generated upon exit from Java 11972 programming language methods (including native methods). 11973 This is true whether termination is caused by 11974 executing its return instruction 11975 or by throwing an exception to its caller 11976 (see <paramlink id="was_popped_by_exception"></paramlink>). 11977 <p/> 11978 The <code>method</code> field uniquely identifies the 11979 method being entered or exited. The <code>frame</code> field provides 11980 access to the stack frame for the method. 11981 <p/> 11982 The location reported by <functionlink id="GetFrameLocation"></functionlink> 11983 identifies the executable location in the returning method 11984 immediately prior to the return. 11985 <p/> 11986 Enabling method 11987 entry or exit events will significantly degrade performance on many platforms and is thus 11988 not advised for performance critical usage (such as profiling). 11989 <internallink id="bci">Bytecode instrumentation</internallink> should be 11990 used in these cases. 11991 </description> 11992 <origin>jvmdi</origin> 11993 <capabilities> 11994 <required id="can_generate_method_exit_events"></required> 11995 </capabilities> 11996 <parameters> 11997 <param id="jni_env"> 11998 <outptr> 11999 <struct>JNIEnv</struct> 12000 </outptr> 12001 <description> 12002 The JNI environment of the event (current) thread 12003 </description> 12004 </param> 12005 <param id="thread"> 12006 <jthread/> 12007 <description> 12008 Thread exiting the method 12009 </description> 12010 </param> 12011 <param id="klass"> 12012 <jclass method="method"/> 12013 <description> 12014 Class of the method being exited 12015 </description> 12016 </param> 12017 <param id="method"> 12018 <jmethodID class="klass"/> 12019 <description> 12020 Method being exited 12021 </description> 12022 </param> 12023 <param id="was_popped_by_exception"> 12024 <jboolean/> 12025 <description> 12026 True if frame was popped by a thrown exception. 12027 False if method exited through its return instruction. 12028 </description> 12029 </param> 12030 <param id="return_value"> 12031 <jvalue/> 12032 <description> 12033 The return value of the method being exited. 12034 Undefined and should not be used if 12035 <paramlink id="was_popped_by_exception"></paramlink> 12036 is true. 12037 </description> 12038 </param> 12039 </parameters> 12040 </event> 12041 12042 <event label="Native Method Bind" phase="any" 12043 id="NativeMethodBind" const="JVMTI_EVENT_NATIVE_METHOD_BIND" num="67"> 12044 <description> 12045 A Native Method Bind event is sent when a VM binds a 12046 Java programming language native method 12047 to the address of a function that implements the native method. 12048 This will occur when the native method is called for the first time 12049 and also occurs when the JNI function <code>RegisterNatives</code> is called. 12050 This event allows the bind to be redirected to an agent-specified 12051 proxy function. 12052 This event is not sent when the native method is unbound. 12053 Typically, this proxy function will need to be specific to a 12054 particular method or, to handle the general case, automatically 12055 generated assembly code, since after instrumentation code is 12056 executed the function at the original binding 12057 address will usually be invoked. 12058 The original binding can be restored or the redirection changed 12059 by use of the JNI function <code>RegisterNatives</code>. 12060 Some events may be sent during the primordial phase, JNI and 12061 most of <jvmti/> cannot be used at this time but the method and 12062 address can be saved for use later. 12063 </description> 12064 <origin>new</origin> 12065 <capabilities> 12066 <required id="can_generate_native_method_bind_events"></required> 12067 </capabilities> 12068 <parameters> 12069 <param id="jni_env"> 12070 <outptr> 12071 <struct>JNIEnv</struct> 12072 </outptr> 12073 <description> 12074 The JNI environment of the event (current) thread 12075 Will be <code>NULL</code> if sent during the primordial 12076 <functionlink id="GetPhase">phase</functionlink>. 12077 </description> 12078 </param> 12079 <param id="thread"> 12080 <jthread/> 12081 <description> 12082 Thread requesting the bind 12083 </description> 12084 </param> 12085 <param id="klass"> 12086 <jclass method="method"/> 12087 <description> 12088 Class of the method being bound 12089 </description> 12090 </param> 12091 <param id="method"> 12092 <jmethodID class="klass"/> 12093 <description> 12094 Native method being bound 12095 </description> 12096 </param> 12097 <param id="address"> 12098 <outptr><void/></outptr> 12099 <description> 12100 The address the VM is about to bind to--that is, the 12101 address of the implementation of the native method 12102 </description> 12103 </param> 12104 <param id="new_address_ptr"> 12105 <agentbuf><void/></agentbuf> 12106 <description> 12107 if the referenced address is changed (that is, if 12108 <code>*new_address_ptr</code> is set), the binding 12109 will instead be made to the supplied address. 12110 </description> 12111 </param> 12112 </parameters> 12113 </event> 12114 12115 <event label="Exception" 12116 id="Exception" const="JVMTI_EVENT_EXCEPTION" filtered="thread" num="58"> 12117 <description> 12118 Exception events are generated whenever an exception is first detected 12119 in a Java programming language method. 12120 Where "exception" means any <code>java.lang.Throwable</code>. 12121 The exception may have been thrown by a Java programming language or native 12122 method, but in the case of native methods, the event is not generated 12123 until the exception is first seen by a Java programming language method. If an exception is 12124 set and cleared in a native method (and thus is never visible to Java programming language code), 12125 no exception event is generated. 12126 <p/> 12127 The <code>method</code> and <code>location</code> 12128 parameters uniquely identify the current location 12129 (where the exception was detected) and allow 12130 the mapping to source file and line number when that information is 12131 available. The <code>exception</code> field identifies the thrown 12132 exception object. The <code>catch_method</code> 12133 and <code>catch_location</code> identify the location of the catch clause, 12134 if any, that handles the thrown exception. If there is no such catch clause, 12135 each field is set to 0. There is no guarantee that the thread will ever 12136 reach this catch clause. If there are native methods on the call stack 12137 between the throw location and the catch clause, the exception may 12138 be reset by one of those native methods. 12139 Similarly, exceptions that are reported as uncaught (<code>catch_klass</code> 12140 et al. set to 0) may in fact be caught by native code. 12141 Agents can check for these occurrences by monitoring 12142 <eventlink id="ExceptionCatch"></eventlink> events. 12143 Note that finally clauses are implemented as catch and re-throw. Therefore they 12144 will be reported in the catch location. 12145 </description> 12146 <origin>jvmdi</origin> 12147 <capabilities> 12148 <required id="can_generate_exception_events"></required> 12149 </capabilities> 12150 <parameters> 12151 <param id="jni_env"> 12152 <outptr> 12153 <struct>JNIEnv</struct> 12154 </outptr> 12155 <description> 12156 The JNI environment of the event (current) thread 12157 </description> 12158 </param> 12159 <param id="thread"> 12160 <jthread/> 12161 <description> 12162 Thread generating the exception 12163 </description> 12164 </param> 12165 <param id="klass"> 12166 <jclass method="method"/> 12167 <description> 12168 Class generating the exception 12169 </description> 12170 </param> 12171 <param id="method"> 12172 <jmethodID class="klass"/> 12173 <description> 12174 Method generating the exception 12175 </description> 12176 </param> 12177 <param id="location"> 12178 <jlocation/> 12179 <description> 12180 Location where exception occurred 12181 </description> 12182 </param> 12183 <param id="exception"> 12184 <jobject/> 12185 <description> 12186 The exception being thrown 12187 </description> 12188 </param> 12189 <param id="catch_klass"> 12190 <jclass method="catch_method"/> 12191 <description> 12192 Class that will catch the exception, or <code>NULL</code> if no known catch 12193 </description> 12194 </param> 12195 <param id="catch_method"> 12196 <jmethodID class="catch_klass"/> 12197 <description> 12198 Method that will catch the exception, or <code>NULL</code> if no known catch 12199 </description> 12200 </param> 12201 <param id="catch_location"> 12202 <jlocation/> 12203 <description> 12204 location which will catch the exception or zero if no known catch 12205 </description> 12206 </param> 12207 </parameters> 12208 </event> 12209 12210 <event label="Exception Catch" 12211 id="ExceptionCatch" const="JVMTI_EVENT_EXCEPTION_CATCH" filtered="thread" num="59"> 12212 <description> 12213 Exception catch events are generated whenever a thrown exception is caught. 12214 Where "exception" means any <code>java.lang.Throwable</code>. 12215 If the exception is caught in a Java programming language method, the event is generated 12216 when the catch clause is reached. If the exception is caught in a native 12217 method, the event is generated as soon as control is returned to a Java programming language 12218 method. Exception catch events are generated for any exception for which 12219 a throw was detected in a Java programming language method. 12220 Note that finally clauses are implemented as catch and re-throw. Therefore they 12221 will generate exception catch events. 12222 <p/> 12223 The <code>method</code> and <code>location</code> 12224 parameters uniquely identify the current location 12225 and allow the mapping to source file and line number when that information is 12226 available. For exceptions caught in a Java programming language method, the 12227 <code>exception</code> object identifies the exception object. Exceptions 12228 caught in native methods are not necessarily available by the time the 12229 exception catch is reported, so the <code>exception</code> field is set 12230 to <code>NULL</code>. 12231 </description> 12232 <origin>jvmdi</origin> 12233 <capabilities> 12234 <required id="can_generate_exception_events"></required> 12235 </capabilities> 12236 <parameters> 12237 <param id="jni_env"> 12238 <outptr> 12239 <struct>JNIEnv</struct> 12240 </outptr> 12241 <description> 12242 The JNI environment of the event (current) thread 12243 </description> 12244 </param> 12245 <param id="thread"> 12246 <jthread/> 12247 <description> 12248 Thread catching the exception 12249 </description> 12250 </param> 12251 <param id="klass"> 12252 <jclass method="method"/> 12253 <description> 12254 Class catching the exception 12255 </description> 12256 </param> 12257 <param id="method"> 12258 <jmethodID class="klass"/> 12259 <description> 12260 Method catching the exception 12261 </description> 12262 </param> 12263 <param id="location"> 12264 <jlocation/> 12265 <description> 12266 Location where exception is being caught 12267 </description> 12268 </param> 12269 <param id="exception"> 12270 <jobject/> 12271 <description> 12272 Exception being caught 12273 </description> 12274 </param> 12275 </parameters> 12276 </event> 12277 12278 <event label="Thread Start" 12279 id="ThreadStart" const="JVMTI_EVENT_THREAD_START" num="52" phase="start"> 12280 <description> 12281 Thread start events are generated by a new thread before its initial 12282 method executes. 12283 <p/> 12284 A thread may be listed in the array returned by 12285 <functionlink id="GetAllThreads"></functionlink> 12286 before its thread start event is generated. 12287 It is possible for other events to be generated 12288 on a thread before its thread start event. 12289 <p/> 12290 The event is sent on the newly started <paramlink id="thread"></paramlink>. 12291 </description> 12292 <origin>jvmdi</origin> 12293 <capabilities> 12294 </capabilities> 12295 <parameters> 12296 <param id="jni_env"> 12297 <outptr> 12298 <struct>JNIEnv</struct> 12299 </outptr> 12300 <description> 12301 The JNI environment of the event (current) thread. 12302 </description> 12303 </param> 12304 <param id="thread"> 12305 <jthread/> 12306 <description> 12307 Thread starting 12308 </description> 12309 </param> 12310 </parameters> 12311 </event> 12312 12313 <event label="Thread End" 12314 id="ThreadEnd" const="JVMTI_EVENT_THREAD_END" filtered="thread" num="53" phase="start"> 12315 <description> 12316 Thread end events are generated by a terminating thread 12317 after its initial method has finished execution. 12318 <p/> 12319 A thread may be listed in the array returned by 12320 <functionlink id="GetAllThreads"></functionlink> 12321 after its thread end event is generated. 12322 No events are generated on a thread 12323 after its thread end event. 12324 <p/> 12325 The event is sent on the dying <paramlink id="thread"></paramlink>. 12326 </description> 12327 <origin>jvmdi</origin> 12328 <capabilities> 12329 </capabilities> 12330 <parameters> 12331 <param id="jni_env"> 12332 <outptr> 12333 <struct>JNIEnv</struct> 12334 </outptr> 12335 <description> 12336 The JNI environment of the event (current) thread. 12337 </description> 12338 </param> 12339 <param id="thread"> 12340 <jthread/> 12341 <description> 12342 Thread ending 12343 </description> 12344 </param> 12345 </parameters> 12346 </event> 12347 12348 <event label="Class Load" 12349 id="ClassLoad" const="JVMTI_EVENT_CLASS_LOAD" filtered="thread" phase="start" num="55"> 12350 <description> 12351 A class load event is generated when a class is first loaded. The order 12352 of class load events generated by a particular thread are guaranteed 12353 to match the order of class loading within that thread. 12354 Array class creation does not generate a class load event. 12355 The creation of a primitive class (for example, java.lang.Integer.TYPE) 12356 does not generate a class load event. 12357 <p/> 12358 This event is sent at an early stage in loading the class. As 12359 a result the class should be used carefully. Note, for example, 12360 that methods and fields are not yet loaded, so queries for methods, 12361 fields, subclasses, and so on will not give correct results. 12362 See "Loading of Classes and Interfaces" in the <i>Java Language 12363 Specification</i>. For most 12364 purposes the <eventlink id="ClassPrepare"></eventlink> event will 12365 be more useful. 12366 </description> 12367 <origin>jvmdi</origin> 12368 <capabilities> 12369 </capabilities> 12370 <parameters> 12371 <param id="jni_env"> 12372 <outptr> 12373 <struct>JNIEnv</struct> 12374 </outptr> 12375 <description> 12376 The JNI environment of the event (current) thread 12377 </description> 12378 </param> 12379 <param id="thread"> 12380 <jthread/> 12381 <description> 12382 Thread loading the class 12383 </description> 12384 </param> 12385 <param id="klass"> 12386 <jclass/> 12387 <description> 12388 Class being loaded 12389 </description> 12390 </param> 12391 </parameters> 12392 </event> 12393 12394 <elide> 12395 <event label="Class Unload" 12396 id="ClassUnload" const="JVMTI_EVENT_CLASS_UNLOAD" num="57"> 12397 <description> 12398 A class unload event is generated when the class is about to be unloaded. 12399 Class unload events take place during garbage collection and must be 12400 handled extremely carefully. The garbage collector holds many locks 12401 and has suspended all other threads, so the event handler cannot depend 12402 on the ability to acquire any locks. The class unload event handler should 12403 do as little as possible, perhaps by queuing information to be processed 12404 later. In particular, the <code>jclass</code> should be used only in 12405 the JNI function <code>isSameObject</code> or in the following <jvmti/> functions: 12406 <ul> 12407 <li><functionlink id="GetClassSignature"></functionlink></li> 12408 <li><functionlink id="GetSourceFileName"></functionlink></li> 12409 <li><functionlink id="IsInterface"></functionlink></li> 12410 <li><functionlink id="IsArrayClass"></functionlink></li> 12411 </ul> 12412 </description> 12413 <origin>jvmdi</origin> 12414 <capabilities> 12415 </capabilities> 12416 <parameters> 12417 <param id="jni_env"> 12418 <outptr> 12419 <struct>JNIEnv</struct> 12420 </outptr> 12421 <description> 12422 The JNI environment of the event (current) thread 12423 </description> 12424 </param> 12425 <param id="thread"> 12426 <jthread/> 12427 <description> 12428 Thread generating the class unload 12429 </description> 12430 </param> 12431 <param id="klass"> 12432 <jclass/> 12433 <description> 12434 Class being unloaded 12435 </description> 12436 </param> 12437 </parameters> 12438 </event> 12439 </elide> 12440 12441 <event label="Class Prepare" 12442 id="ClassPrepare" const="JVMTI_EVENT_CLASS_PREPARE" filtered="thread" phase="start" num="56"> 12443 <description> 12444 A class prepare event is generated when class preparation is complete. 12445 At this point, class fields, methods, and implemented interfaces are 12446 available, and no code from the class has been executed. Since array 12447 classes never have fields or methods, class prepare events are not 12448 generated for them. Class prepare events are not generated for 12449 primitive classes (for example, <code>java.lang.Integer.TYPE</code>). 12450 </description> 12451 <origin>jvmdi</origin> 12452 <capabilities> 12453 </capabilities> 12454 <parameters> 12455 <param id="jni_env"> 12456 <outptr> 12457 <struct>JNIEnv</struct> 12458 </outptr> 12459 <description> 12460 The JNI environment of the event (current) thread 12461 </description> 12462 </param> 12463 <param id="thread"> 12464 <jthread/> 12465 <description> 12466 Thread generating the class prepare 12467 </description> 12468 </param> 12469 <param id="klass"> 12470 <jclass/> 12471 <description> 12472 Class being prepared 12473 </description> 12474 </param> 12475 </parameters> 12476 </event> 12477 12478 <event label="Class File Load Hook" phase="any" 12479 id="ClassFileLoadHook" const="JVMTI_EVENT_CLASS_FILE_LOAD_HOOK" num="54"> 12480 <description> 12481 This event is sent when the VM obtains class file data, 12482 but before it constructs 12483 the in-memory representation for that class. 12484 This event is also sent when the class is being modified by the 12485 <functionlink id="RetransformClasses"/> function or 12486 the <functionlink id="RedefineClasses"/> function, 12487 called in any <jvmti/> environment. 12488 The agent can instrument 12489 the existing class file data sent by the VM to include profiling/debugging hooks. 12490 See the description of 12491 <internallink id="bci">bytecode instrumentation</internallink> 12492 for usage information. 12493 <p/> 12494 When the capabilities 12495 <internallink id="jvmtiCapabilities.can_generate_early_class_hook_events"> 12496 <code>can_generate_early_class_hook_events</code></internallink> and 12497 <internallink id="jvmtiCapabilities.can_generate_all_class_hook_events"> 12498 <code>can_generate_all_class_hook_events</code></internallink> 12499 are enabled then this event may be sent in the primordial phase. 12500 Otherwise, this event may be sent before the VM is initialized (the start 12501 <functionlink id="GetPhase">phase</functionlink>). 12502 Some classes might not be compatible 12503 with the function (eg. ROMized classes or implementation defined classes) and this event will 12504 not be generated for these classes. 12505 <p/> 12506 The agent must allocate the space for the modified 12507 class file data buffer 12508 using the memory allocation function 12509 <functionlink id="Allocate"></functionlink> because the 12510 VM is responsible for freeing the new class file data buffer 12511 using <functionlink id="Deallocate"></functionlink>. 12512 <p/> 12513 If the agent wishes to modify the class file, it must set 12514 <code>new_class_data</code> to point 12515 to the newly instrumented class file data buffer and set 12516 <code>new_class_data_len</code> to the length of that 12517 buffer before returning 12518 from this call. If no modification is desired, the agent simply 12519 does not set <code>new_class_data</code>. If multiple agents 12520 have enabled this event the results are chained. That is, if 12521 <code>new_class_data</code> has been set, it becomes the 12522 <code>class_data</code> for the next agent. 12523 <p/> 12524 When handling a class load in the live phase, then the 12525 <functionlink id="GetNamedModule"></functionlink> 12526 function can be used to map class loader and a package name to a module. 12527 When a class is being redefined or retransformed then 12528 <code>class_being_redefined</code> is non <code>NULL</code> and so 12529 the JNI <code>GetModule</code> function can also be used 12530 to obtain the Module. 12531 <p/> 12532 The order that this event is sent to each environment differs 12533 from other events. 12534 This event is sent to environments in the following order: 12535 <ul> 12536 <li><fieldlink id="can_retransform_classes" 12537 struct="jvmtiCapabilities">retransformation 12538 incapable</fieldlink> 12539 environments, in the 12540 order in which they were created 12541 </li> 12542 <li><fieldlink id="can_retransform_classes" 12543 struct="jvmtiCapabilities">retransformation 12544 capable</fieldlink> 12545 environments, in the 12546 order in which they were created 12547 </li> 12548 </ul> 12549 When triggered by <functionlink id="RetransformClasses"/>, 12550 this event is sent only to <fieldlink id="can_retransform_classes" 12551 struct="jvmtiCapabilities">retransformation 12552 capable</fieldlink> 12553 environments. 12554 </description> 12555 <origin>jvmpi</origin> 12556 <capabilities> 12557 <capability id="can_generate_all_class_hook_events"></capability> 12558 <capability id="can_generate_early_class_hook_events"></capability> 12559 </capabilities> 12560 <parameters> 12561 <param id="jni_env"> 12562 <outptr> 12563 <struct>JNIEnv</struct> 12564 </outptr> 12565 <description> 12566 The JNI environment of the event (current) thread. 12567 </description> 12568 </param> 12569 <param id="class_being_redefined"> 12570 <jclass/> 12571 <description> 12572 The class being 12573 <functionlink id="RedefineClasses">redefined</functionlink> or 12574 <functionlink id="RetransformClasses">retransformed</functionlink>. 12575 <code>NULL</code> if sent by class load. 12576 </description> 12577 </param> 12578 <param id="loader"> 12579 <jobject/> 12580 <description> 12581 The class loader loading the class. 12582 <code>NULL</code> if the bootstrap class loader. 12583 </description> 12584 </param> 12585 <param id="name"> 12586 <vmbuf><char/></vmbuf> 12587 <description> 12588 Name of class being loaded as a VM internal qualified name 12589 (for example, "java/util/List"), encoded as a 12590 <internallink id="mUTF">modified UTF-8</internallink> string. 12591 Note: if the class is defined with a <code>NULL</code> name or 12592 without a name specified, <code>name</code> will be <code>NULL</code>. 12593 </description> 12594 </param> 12595 <param id="protection_domain"> 12596 <jobject/> 12597 <description> 12598 The <code>ProtectionDomain</code> of the class. 12599 </description> 12600 </param> 12601 <param id="class_data_len"> 12602 <jint/> 12603 <description> 12604 Length of current class file data buffer. 12605 </description> 12606 </param> 12607 <param id="class_data"> 12608 <vmbuf><uchar/></vmbuf> 12609 <description> 12610 Pointer to the current class file data buffer. 12611 </description> 12612 </param> 12613 <param id="new_class_data_len"> 12614 <outptr><jint/></outptr> 12615 <description> 12616 Pointer to the length of the new class file data buffer. 12617 </description> 12618 </param> 12619 <param id="new_class_data"> 12620 <agentbuf incount="new_class_data_len"><uchar/></agentbuf> 12621 <description> 12622 Pointer to the pointer to the instrumented class file data buffer. 12623 </description> 12624 </param> 12625 </parameters> 12626 </event> 12627 12628 <event label="VM Start Event" 12629 id="VMStart" const="JVMTI_EVENT_VM_START" num="57" phase="start"> 12630 <description> 12631 The VM start event signals the start of the VM. 12632 At this time JNI is live but the VM is not yet fully initialized. 12633 Once this event is generated, the agent is free to call any JNI function. 12634 This event signals the beginning of the start phase, 12635 <jvmti/> functions permitted in the start phase may be called. 12636 <p/> 12637 The timing of this event may depend on whether the agent has added the 12638 <internallink id="jvmtiCapabilities.can_generate_early_vmstart"> 12639 <code>can_generate_early_vmstart</code></internallink> capability or not. 12640 If the capability has been added then the VM posts the event as early 12641 as possible. The VM is capable of executing bytecode but it may not have 12642 initialized to the point where it can load classes in modules other than 12643 <code>java.base</code>. Agents that do load-time instrumentation in this 12644 phase must take great care when instrumenting code that potentially 12645 executes in this phase. Care should also be taken with JNI 12646 <code>FindClass</code> as it may not be possible to load classes that are 12647 not in the <code>java.base</code> module. 12648 If the capability has not been added then the VM delays posting this 12649 event until it is capable of loading classes in modules other than 12650 <code>java.base</code> or the VM has completed its initialization. 12651 Agents that create more than one JVM TI environment, where the 12652 capability is added to some but not all environments, may observe the 12653 start phase beginning earlier in the JVM TI environments that possess 12654 the capabilty. 12655 <p/> 12656 In the case of VM start-up failure, this event will not be sent. 12657 </description> 12658 <origin>jvmdi</origin> 12659 <capabilities> 12660 </capabilities> 12661 <parameters> 12662 <param id="jni_env"> 12663 <outptr> 12664 <struct>JNIEnv</struct> 12665 </outptr> 12666 <description> 12667 The JNI environment of the event (current) thread. 12668 </description> 12669 </param> 12670 </parameters> 12671 </event> 12672 12673 <event label="VM Initialization Event" 12674 id="VMInit" const="JVMTI_EVENT_VM_INIT" num="50"> 12675 <description> 12676 The VM initialization event signals the completion of VM initialization. Once 12677 this event is generated, the agent is free to call any JNI or <jvmti/> 12678 function. The VM initialization event can be preceded by or can be concurrent 12679 with other events, but 12680 the preceding events should be handled carefully, if at all, because the 12681 VM has not completed its initialization. The thread start event for the 12682 main application thread is guaranteed not to occur until after the 12683 handler for the VM initialization event returns. 12684 <p/> 12685 In the case of VM start-up failure, this event will not be sent. 12686 </description> 12687 <origin>jvmdi</origin> 12688 <capabilities> 12689 </capabilities> 12690 <parameters> 12691 <param id="jni_env"> 12692 <outptr> 12693 <struct>JNIEnv</struct> 12694 </outptr> 12695 <description> 12696 The JNI environment of the event (current) thread. 12697 </description> 12698 </param> 12699 <param id="thread"> 12700 <jthread/> 12701 <description> 12702 The initial thread 12703 </description> 12704 </param> 12705 </parameters> 12706 </event> 12707 12708 <event label="VM Death Event" 12709 id="VMDeath" const="JVMTI_EVENT_VM_DEATH" num="51"> 12710 <description> 12711 The VM death event notifies the agent of the termination of the VM. 12712 No events will occur after the VMDeath event. 12713 <p/> 12714 In the case of VM start-up failure, this event will not be sent. 12715 Note that <internallink id="onunload">Agent_OnUnload</internallink> 12716 will still be called in these cases. 12717 </description> 12718 <origin>jvmdi</origin> 12719 <capabilities> 12720 </capabilities> 12721 <parameters> 12722 <param id="jni_env"> 12723 <outptr> 12724 <struct>JNIEnv</struct> 12725 </outptr> 12726 <description> 12727 The JNI environment of the event (current) thread 12728 </description> 12729 </param> 12730 </parameters> 12731 </event> 12732 12733 <event label="Compiled Method Load" phase="start" 12734 id="CompiledMethodLoad" const="JVMTI_EVENT_COMPILED_METHOD_LOAD" num="68"> 12735 <description> 12736 Sent when a method is compiled and loaded into memory by the VM. 12737 If it is unloaded, the <eventlink id="CompiledMethodUnload"/> event is sent. 12738 If it is moved, the <eventlink id="CompiledMethodUnload"/> event is sent, 12739 followed by a new <code>CompiledMethodLoad</code> event. 12740 Note that a single method may have multiple compiled forms, and that 12741 this event will be sent for each form. 12742 Note also that several methods may be inlined into a single 12743 address range, and that this event will be sent for each method. 12744 <p/> 12745 These events can be sent after their initial occurrence with 12746 <functionlink id="GenerateEvents"></functionlink>. 12747 </description> 12748 <origin>jvmpi</origin> 12749 <typedef id="jvmtiAddrLocationMap" label="Native address to location entry"> 12750 <field id="start_address"> 12751 <vmbuf><void/></vmbuf> 12752 <description> 12753 Starting native address of code corresponding to a location 12754 </description> 12755 </field> 12756 <field id="location"> 12757 <jlocation/> 12758 <description> 12759 Corresponding location. See 12760 <functionlink id="GetJLocationFormat"></functionlink> 12761 for the meaning of location. 12762 </description> 12763 </field> 12764 </typedef> 12765 <capabilities> 12766 <required id="can_generate_compiled_method_load_events"></required> 12767 </capabilities> 12768 <parameters> 12769 <param id="klass"> 12770 <jclass method="method"/> 12771 <description> 12772 Class of the method being compiled and loaded 12773 </description> 12774 </param> 12775 <param id="method"> 12776 <jmethodID class="klass"/> 12777 <description> 12778 Method being compiled and loaded 12779 </description> 12780 </param> 12781 <param id="code_size"> 12782 <jint/> 12783 <description> 12784 Size of compiled code 12785 </description> 12786 </param> 12787 <param id="code_addr"> 12788 <vmbuf><void/></vmbuf> 12789 <description> 12790 Address where compiled method code is loaded 12791 </description> 12792 </param> 12793 <param id="map_length"> 12794 <jint/> 12795 <description> 12796 Number of <typelink id="jvmtiAddrLocationMap"></typelink> 12797 entries in the address map. 12798 Zero if mapping information cannot be supplied. 12799 </description> 12800 </param> 12801 <param id="map"> 12802 <vmbuf><struct>jvmtiAddrLocationMap</struct></vmbuf> 12803 <description> 12804 Map from native addresses to location. 12805 The native address range of each entry is from 12806 <fieldlink id="start_address" struct="jvmtiAddrLocationMap"></fieldlink> 12807 to <code>start_address-1</code> of the next entry. 12808 <code>NULL</code> if mapping information cannot be supplied. 12809 </description> 12810 </param> 12811 <param id="compile_info"> 12812 <vmbuf><void/></vmbuf> 12813 <description> 12814 VM-specific compilation information. 12815 The referenced compile information is managed by the VM 12816 and must not depend on the agent for collection. 12817 A VM implementation defines the content and lifetime 12818 of the information. 12819 </description> 12820 </param> 12821 </parameters> 12822 </event> 12823 12824 <event label="Compiled Method Unload" phase="start" 12825 id="CompiledMethodUnload" const="JVMTI_EVENT_COMPILED_METHOD_UNLOAD" num="69"> 12826 <description> 12827 Sent when a compiled method is unloaded from memory. 12828 This event might not be sent on the thread which performed the unload. 12829 This event may be sent sometime after the unload occurs, but 12830 will be sent before the memory is reused 12831 by a newly generated compiled method. This event may be sent after 12832 the class is unloaded. 12833 </description> 12834 <origin>jvmpi</origin> 12835 <capabilities> 12836 <required id="can_generate_compiled_method_load_events"></required> 12837 </capabilities> 12838 <parameters> 12839 <param id="klass"> 12840 <jclass method="method"/> 12841 <description> 12842 Class of the compiled method being unloaded. 12843 </description> 12844 </param> 12845 <param id="method"> 12846 <jmethodID class="klass"/> 12847 <description> 12848 Compiled method being unloaded. 12849 For identification of the compiled method only -- the class 12850 may be unloaded and therefore the method should not be used 12851 as an argument to further JNI or <jvmti/> functions. 12852 </description> 12853 </param> 12854 <param id="code_addr"> 12855 <vmbuf><void/></vmbuf> 12856 <description> 12857 Address where compiled method code was loaded. 12858 For identification of the compiled method only -- 12859 the space may have been reclaimed. 12860 </description> 12861 </param> 12862 </parameters> 12863 </event> 12864 12865 <event label="Dynamic Code Generated" phase="any" 12866 id="DynamicCodeGenerated" const="JVMTI_EVENT_DYNAMIC_CODE_GENERATED" num="70"> 12867 <description> 12868 Sent when a component of the virtual machine is generated dynamically. 12869 This does not correspond to Java programming language code that is 12870 compiled--see <eventlink id="CompiledMethodLoad"></eventlink>. 12871 This is for native code--for example, an interpreter that is generated 12872 differently depending on command-line options. 12873 <p/> 12874 Note that this event has no controlling capability. 12875 If a VM cannot generate these events, it simply does not send any. 12876 <p/> 12877 These events can be sent after their initial occurrence with 12878 <functionlink id="GenerateEvents"></functionlink>. 12879 </description> 12880 <origin>jvmpi</origin> 12881 <capabilities> 12882 </capabilities> 12883 <parameters> 12884 <param id="name"> 12885 <vmbuf><char/></vmbuf> 12886 <description> 12887 Name of the code, encoded as a 12888 <internallink id="mUTF">modified UTF-8</internallink> string. 12889 Intended for display to an end-user. 12890 The name might not be unique. 12891 </description> 12892 </param> 12893 <param id="address"> 12894 <vmbuf><void/></vmbuf> 12895 <description> 12896 Native address of the code 12897 </description> 12898 </param> 12899 <param id="length"> 12900 <jint/> 12901 <description> 12902 Length in bytes of the code 12903 </description> 12904 </param> 12905 </parameters> 12906 </event> 12907 12908 <event label="Data Dump Request" 12909 id="DataDumpRequest" const="JVMTI_EVENT_DATA_DUMP_REQUEST" num="71"> 12910 <description> 12911 Sent by the VM to request the agent to dump its data. This 12912 is just a hint and the agent need not react to this event. 12913 This is useful for processing command-line signals from users. For 12914 example, in the Java 2 SDK a CTRL-Break on Win32 and a CTRL-\ on Solaris 12915 causes the VM to send this event to the agent. 12916 </description> 12917 <origin>jvmpi</origin> 12918 <capabilities> 12919 </capabilities> 12920 <parameters> 12921 </parameters> 12922 </event> 12923 12924 <event label="Monitor Contended Enter" 12925 id="MonitorContendedEnter" const="JVMTI_EVENT_MONITOR_CONTENDED_ENTER" filtered="thread" num="75"> 12926 <description> 12927 Sent when a thread is attempting to enter a Java programming language 12928 monitor already acquired by another thread. 12929 </description> 12930 <origin>jvmpi</origin> 12931 <capabilities> 12932 <required id="can_generate_monitor_events"></required> 12933 </capabilities> 12934 <parameters> 12935 <param id="jni_env"> 12936 <outptr> 12937 <struct>JNIEnv</struct> 12938 </outptr> 12939 <description> 12940 The JNI environment of the event (current) thread 12941 </description> 12942 </param> 12943 <param id="thread"> 12944 <jthread/> 12945 <description> 12946 JNI local reference to the thread 12947 attempting to enter the monitor 12948 </description> 12949 </param> 12950 <param id="object"> 12951 <jobject/> 12952 <description> 12953 JNI local reference to the monitor 12954 </description> 12955 </param> 12956 </parameters> 12957 </event> 12958 12959 <event label="Monitor Contended Entered" 12960 id="MonitorContendedEntered" const="JVMTI_EVENT_MONITOR_CONTENDED_ENTERED" filtered="thread" num="76"> 12961 <description> 12962 Sent when a thread enters a Java programming language 12963 monitor after waiting for it to be released by another thread. 12964 </description> 12965 <origin>jvmpi</origin> 12966 <capabilities> 12967 <required id="can_generate_monitor_events"></required> 12968 </capabilities> 12969 <parameters> 12970 <param id="jni_env"> 12971 <outptr> 12972 <struct>JNIEnv</struct> 12973 </outptr> 12974 <description> 12975 The JNI environment of the event (current) thread 12976 </description> 12977 </param> 12978 <param id="thread"> 12979 <jthread/> 12980 <description> 12981 JNI local reference to the thread entering 12982 the monitor 12983 </description> 12984 </param> 12985 <param id="object"> 12986 <jobject/> 12987 <description> 12988 JNI local reference to the monitor 12989 </description> 12990 </param> 12991 </parameters> 12992 </event> 12993 12994 <event label="Monitor Wait" 12995 id="MonitorWait" const="JVMTI_EVENT_MONITOR_WAIT" filtered="thread" num="73"> 12996 <description> 12997 Sent when a thread is about to wait on an object. 12998 </description> 12999 <origin>jvmpi</origin> 13000 <capabilities> 13001 <required id="can_generate_monitor_events"></required> 13002 </capabilities> 13003 <parameters> 13004 <param id="jni_env"> 13005 <outptr> 13006 <struct>JNIEnv</struct> 13007 </outptr> 13008 <description> 13009 The JNI environment of the event (current) thread 13010 </description> 13011 </param> 13012 <param id="thread"> 13013 <jthread/> 13014 <description> 13015 JNI local reference to the thread about to wait 13016 </description> 13017 </param> 13018 <param id="object"> 13019 <jobject/> 13020 <description> 13021 JNI local reference to the monitor 13022 </description> 13023 </param> 13024 <param id="timeout"> 13025 <jlong/> 13026 <description> 13027 The number of milliseconds the thread will wait 13028 </description> 13029 </param> 13030 </parameters> 13031 </event> 13032 13033 <event label="Monitor Waited" 13034 id="MonitorWaited" const="JVMTI_EVENT_MONITOR_WAITED" filtered="thread" num="74"> 13035 <description> 13036 Sent when a thread finishes waiting on an object. 13037 </description> 13038 <origin>jvmpi</origin> 13039 <capabilities> 13040 <required id="can_generate_monitor_events"></required> 13041 </capabilities> 13042 <parameters> 13043 <param id="jni_env"> 13044 <outptr> 13045 <struct>JNIEnv</struct> 13046 </outptr> 13047 <description> 13048 The JNI environment of the event (current) thread 13049 </description> 13050 </param> 13051 <param id="thread"> 13052 <jthread/> 13053 <description> 13054 JNI local reference to the thread that was finished waiting 13055 </description> 13056 </param> 13057 <param id="object"> 13058 <jobject/> 13059 <description> 13060 JNI local reference to the monitor. 13061 </description> 13062 </param> 13063 <param id="timed_out"> 13064 <jboolean/> 13065 <description> 13066 True if the monitor timed out 13067 </description> 13068 </param> 13069 </parameters> 13070 </event> 13071 13072 <event label="Resource Exhausted" 13073 id="ResourceExhausted" const="JVMTI_EVENT_RESOURCE_EXHAUSTED" num="80" 13074 since="1.1"> 13075 <description> 13076 Sent when a VM resource needed by a running application has been exhausted. 13077 Except as required by the optional capabilities, the set of resources 13078 which report exhaustion is implementation dependent. 13079 <p/> 13080 The following bit flags define the properties of the resource exhaustion: 13081 <constants id="jvmtiResourceExhaustionFlags" 13082 label="Resource Exhaustion Flags" 13083 kind="bits" 13084 since="1.1"> 13085 <constant id="JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR" num="0x0001"> 13086 After this event returns, the VM will throw a 13087 <code>java.lang.OutOfMemoryError</code>. 13088 </constant> 13089 <constant id="JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP" num="0x0002"> 13090 The VM was unable to allocate memory from the <tm>Java</tm> 13091 platform <i>heap</i>. 13092 The <i>heap</i> is the runtime 13093 data area from which memory for all class instances and 13094 arrays are allocated. 13095 </constant> 13096 <constant id="JVMTI_RESOURCE_EXHAUSTED_THREADS" num="0x0004"> 13097 The VM was unable to create a thread. 13098 </constant> 13099 </constants> 13100 </description> 13101 <origin>new</origin> 13102 <capabilities> 13103 <capability id="can_generate_resource_exhaustion_heap_events"> 13104 Can generate events when the VM is unable to allocate memory from the 13105 <internallink id="JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP">heap</internallink>. 13106 </capability> 13107 <capability id="can_generate_resource_exhaustion_threads_events"> 13108 Can generate events when the VM is unable to 13109 <internallink id="JVMTI_RESOURCE_EXHAUSTED_THREADS">create 13110 a thread</internallink>. 13111 </capability> 13112 </capabilities> 13113 <parameters> 13114 <param id="jni_env"> 13115 <outptr> 13116 <struct>JNIEnv</struct> 13117 </outptr> 13118 <description> 13119 The JNI environment of the event (current) thread 13120 </description> 13121 </param> 13122 <param id="flags"> 13123 <jint/> 13124 <description> 13125 Flags defining the properties of the of resource exhaustion 13126 as specified by the 13127 <internallink id="jvmtiResourceExhaustionFlags">Resource 13128 Exhaustion Flags</internallink>. 13129 </description> 13130 </param> 13131 <param id="reserved"> 13132 <vmbuf><void/></vmbuf> 13133 <description> 13134 Reserved. 13135 </description> 13136 </param> 13137 <param id="description"> 13138 <vmbuf><char/></vmbuf> 13139 <description> 13140 Description of the resource exhaustion, encoded as a 13141 <internallink id="mUTF">modified UTF-8</internallink> string. 13142 </description> 13143 </param> 13144 </parameters> 13145 </event> 13146 13147 <event label="VM Object Allocation" 13148 id="VMObjectAlloc" const="JVMTI_EVENT_VM_OBJECT_ALLOC" num="84"> 13149 <description> 13150 Sent when a method causes the virtual machine to allocate an 13151 Object visible to Java programming language code and the 13152 allocation is not detectable by other intrumentation mechanisms. 13153 Generally object allocation should be detected by instrumenting 13154 the bytecodes of allocating methods. 13155 Object allocation generated in native code by JNI function 13156 calls should be detected using 13157 <internallink id="jniIntercept">JNI function interception</internallink>. 13158 Some methods might not have associated bytecodes and are not 13159 native methods, they instead are executed directly by the 13160 VM. These methods should send this event. 13161 Virtual machines which are incapable of bytecode instrumentation 13162 for some or all of their methods can send this event. 13163 <p/> 13164 Typical examples where this event might be sent: 13165 <ul> 13166 <li>Reflection -- for example, <code>java.lang.Class.newInstance()</code></li> 13167 <li>Methods not represented by bytecodes -- for example, VM intrinsics and 13168 J2ME preloaded classes</li> 13169 </ul> 13170 Cases where this event would not be generated: 13171 <ul> 13172 <li>Allocation due to bytecodes -- for example, the <code>new</code> 13173 and <code>newarray</code> VM instructions</li> 13174 <li>Allocation due to JNI function calls -- for example, 13175 <code>AllocObject</code></li> 13176 <li>Allocations during VM initialization</li> 13177 <li>VM internal objects</li> 13178 </ul> 13179 </description> 13180 <origin>new</origin> 13181 <capabilities> 13182 <required id="can_generate_vm_object_alloc_events"></required> 13183 </capabilities> 13184 <parameters> 13185 <param id="jni_env"> 13186 <outptr> 13187 <struct>JNIEnv</struct> 13188 </outptr> 13189 <description> 13190 The JNI environment of the event (current) thread 13191 </description> 13192 </param> 13193 <param id="thread"> 13194 <jthread/> 13195 <description> 13196 Thread allocating the object. 13197 </description> 13198 </param> 13199 <param id="object"> 13200 <jobject/> 13201 <description> 13202 JNI local reference to the object that was allocated 13203 </description> 13204 </param> 13205 <param id="object_klass"> 13206 <jclass/> 13207 <description> 13208 JNI local reference to the class of the object 13209 </description> 13210 </param> 13211 <param id="size"> 13212 <jlong/> 13213 <description> 13214 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 13215 </description> 13216 </param> 13217 </parameters> 13218 </event> 13219 13220 <event label="Object Free" 13221 id="ObjectFree" const="JVMTI_EVENT_OBJECT_FREE" num="83"> 13222 <description> 13223 An Object Free event is sent when the garbage collector frees an object. 13224 Events are only sent for tagged objects--see 13225 <internallink id="Heap">heap functions</internallink>. 13226 <p/> 13227 The event handler must not use JNI functions and 13228 must not use <jvmti/> functions except those which 13229 specifically allow such use (see the raw monitor, memory management, 13230 and environment local storage functions). 13231 </description> 13232 <origin>new</origin> 13233 <capabilities> 13234 <required id="can_generate_object_free_events"></required> 13235 </capabilities> 13236 <parameters> 13237 <param id="tag"> 13238 <jlong/> 13239 <description> 13240 The freed object's tag 13241 </description> 13242 </param> 13243 </parameters> 13244 </event> 13245 13246 <event label="Garbage Collection Start" 13247 id="GarbageCollectionStart" const="JVMTI_EVENT_GARBAGE_COLLECTION_START" num="81"> 13248 <description> 13249 A Garbage Collection Start event is sent when a 13250 garbage collection pause begins. 13251 Only stop-the-world collections are reported--that is, collections during 13252 which all threads cease to modify the state of the Java virtual machine. 13253 This means that some collectors will never generate these events. 13254 This event is sent while the VM is still stopped, thus 13255 the event handler must not use JNI functions and 13256 must not use <jvmti/> functions except those which 13257 specifically allow such use (see the raw monitor, memory management, 13258 and environment local storage functions). 13259 <p/> 13260 This event is always sent as a matched pair with 13261 <eventlink id="GarbageCollectionFinish"/> 13262 (assuming both events are enabled) and no garbage collection 13263 events will occur between them. 13264 </description> 13265 <origin>new</origin> 13266 <capabilities> 13267 <required id="can_generate_garbage_collection_events"></required> 13268 </capabilities> 13269 <parameters> 13270 </parameters> 13271 </event> 13272 13273 <event label="Garbage Collection Finish" 13274 id="GarbageCollectionFinish" const="JVMTI_EVENT_GARBAGE_COLLECTION_FINISH" num="82"> 13275 <description> 13276 A Garbage Collection Finish event is sent when a 13277 garbage collection pause ends. 13278 This event is sent while the VM is still stopped, thus 13279 the event handler must not use JNI functions and 13280 must not use <jvmti/> functions except those which 13281 specifically allow such use (see the raw monitor, memory management, 13282 and environment local storage functions). 13283 <p/> 13284 Some agents may need to do post garbage collection operations that 13285 require the use of the disallowed <jvmti/> or JNI functions. For these 13286 cases an agent thread can be created which waits on a raw monitor, 13287 and the handler for the Garbage Collection Finish event simply 13288 notifies the raw monitor 13289 <p/> 13290 This event is always sent as a matched pair with 13291 <eventlink id="GarbageCollectionStart"/> (assuming both events are enabled). 13292 <issue> 13293 The most important use of this event is to provide timing information, 13294 and thus additional information is not required. However, 13295 information about the collection which is "free" should be included - 13296 what that information is needs to be determined. 13297 </issue> 13298 </description> 13299 <origin>new</origin> 13300 <capabilities> 13301 <required id="can_generate_garbage_collection_events"></required> 13302 </capabilities> 13303 <parameters> 13304 </parameters> 13305 </event> 13306 13307 <elide> 13308 <event label="Verbose Output" phase="any" 13309 id="VerboseOutput" const="JVMTI_EVENT_VERBOSE_OUTPUT" num="85"> 13310 <description> 13311 Send verbose messages as strings. 13312 <issue> 13313 This format is extremely fragile, as it can change with each 13314 platform, collector and version. Alternatives include: 13315 <ul> 13316 <li>building off Java programming language M and M APIs</li> 13317 <li>XML</li> 13318 <li>key/value pairs</li> 13319 <li>removing it</li> 13320 </ul> 13321 </issue> 13322 <issue> 13323 Though this seemed trivial to implement. 13324 In the RI it appears this will be quite complex. 13325 </issue> 13326 </description> 13327 <origin>new</origin> 13328 <capabilities> 13329 </capabilities> 13330 <parameters> 13331 <param id="flag"> 13332 <enum>jvmtiVerboseFlag</enum> 13333 <description> 13334 Which verbose output is being sent. 13335 </description> 13336 </param> 13337 <param id="message"> 13338 <vmbuf><char/></vmbuf> 13339 <description> 13340 Message text, encoded as a 13341 <internallink id="mUTF">modified UTF-8</internallink> string. 13342 </description> 13343 </param> 13344 </parameters> 13345 </event> 13346 </elide> 13347 13348 </eventsection> 13349 13350 <datasection> 13351 <intro> 13352 <jvmti/> extends the data types defined by JNI. 13353 </intro> 13354 <basetypes id="jniTypes" label="JNI Types Used in the JVM Tool Interface"> 13355 <basetype id="jboolean"> 13356 <description> 13357 Holds a Java programming language <code>boolean</code>. 13358 Unsigned 8 bits. 13359 </description> 13360 </basetype> 13361 <basetype id="jchar"> 13362 <description> 13363 Holds a Java programming language <code>char</code>. 13364 Unsigned 16 bits. 13365 </description> 13366 </basetype> 13367 <basetype id="jint"> 13368 <description> 13369 Holds a Java programming language <code>int</code>. 13370 Signed 32 bits. 13371 </description> 13372 </basetype> 13373 <basetype id="jlong"> 13374 <description> 13375 Holds a Java programming language <code>long</code>. 13376 Signed 64 bits. 13377 </description> 13378 </basetype> 13379 <basetype id="jfloat"> 13380 <description> 13381 Holds a Java programming language <code>float</code>. 13382 32 bits. 13383 </description> 13384 </basetype> 13385 <basetype id="jdouble"> 13386 <description> 13387 Holds a Java programming language <code>double</code>. 13388 64 bits. 13389 </description> 13390 </basetype> 13391 <basetype id="jobject"> 13392 <description> 13393 Holds a Java programming language object. 13394 </description> 13395 </basetype> 13396 <basetype id="jclass"> 13397 <description> 13398 Holds a Java programming language class. 13399 </description> 13400 </basetype> 13401 <basetype id="jvalue"> 13402 <description> 13403 Is a union of all primitive types and <code>jobject</code>. Thus, holds any Java 13404 programming language value. 13405 </description> 13406 </basetype> 13407 <basetype id="jfieldID"> 13408 <description> 13409 Identifies a Java programming language field. 13410 <code>jfieldID</code>s returned by <jvmti/> functions and events may be 13411 safely stored. 13412 </description> 13413 </basetype> 13414 <basetype id="jmethodID"> 13415 <description> 13416 Identifies a Java programming language method, initializer, or constructor. 13417 <code>jmethodID</code>s returned by <jvmti/> functions and events may be 13418 safely stored. However, if the class is unloaded, they become invalid 13419 and must not be used. 13420 </description> 13421 </basetype> 13422 <basetype id="JNIEnv"> 13423 <description> 13424 Pointer to the JNI function table. Pointer to this (<code>JNIEnv *</code>) 13425 is a JNI environment. 13426 </description> 13427 </basetype> 13428 </basetypes> 13429 13430 <basetypes id="jvmtiTypes" label="JVM Tool Interface Base Types"> 13431 <basetype id="jvmtiEnv"> 13432 <description> 13433 The <jvmti/> <internallink id="environments">environment</internallink> pointer. 13434 See the <internallink id="FunctionSection">Function Section</internallink>. 13435 <code>jvmtiEnv</code> points to the 13436 <internallink id="FunctionTable">function table</internallink> pointer. 13437 </description> 13438 </basetype> 13439 <basetype id="jthread"> 13440 <definition>typedef jobject jthread;</definition> 13441 <description> 13442 Subtype of <datalink id="jobject"></datalink> that holds a thread. 13443 </description> 13444 </basetype> 13445 <basetype id="jthreadGroup"> 13446 <definition>typedef jobject jthreadGroup;</definition> 13447 <description> 13448 Subtype of <datalink id="jobject"></datalink> that holds a thread group. 13449 </description> 13450 </basetype> 13451 <basetype id="jlocation"> 13452 <definition>typedef jlong jlocation;</definition> 13453 <description> 13454 A 64 bit value, representing a monotonically increasing 13455 executable position within a method. 13456 <code>-1</code> indicates a native method. 13457 See <functionlink id="GetJLocationFormat"></functionlink> for the format on a 13458 given VM. 13459 </description> 13460 </basetype> 13461 <basetype id="jrawMonitorID"> 13462 <definition>struct _jrawMonitorID; 13463 typedef struct _jrawMonitorID *jrawMonitorID;</definition> 13464 <description> 13465 A raw monitor. 13466 </description> 13467 </basetype> 13468 <basetype id="jvmtiError"> 13469 <description> 13470 Holds an error return code. 13471 See the <internallink id="ErrorSection">Error section</internallink> for possible values. 13472 <example> 13473 typedef enum { 13474 JVMTI_ERROR_NONE = 0, 13475 JVMTI_ERROR_INVALID_THREAD = 10, 13476 ... 13477 } jvmtiError; 13478 </example> 13479 </description> 13480 </basetype> 13481 <basetype id="jvmtiEvent"> 13482 <description> 13483 An identifier for an event type. 13484 See the <internallink id="EventSection">Event section</internallink> for possible values. 13485 It is guaranteed that future versions of this specification will 13486 never assign zero as an event type identifier. 13487 <example> 13488 typedef enum { 13489 JVMTI_EVENT_SINGLE_STEP = 1, 13490 JVMTI_EVENT_BREAKPOINT = 2, 13491 ... 13492 } jvmtiEvent; 13493 </example> 13494 </description> 13495 </basetype> 13496 <basetype id="jvmtiEventCallbacks"> 13497 <description> 13498 The callbacks used for events. 13499 <example> 13500 typedef struct { 13501 jvmtiEventVMInit VMInit; 13502 jvmtiEventVMDeath VMDeath; 13503 ... 13504 } jvmtiEventCallbacks; 13505 </example> 13506 See <internallink id="jvmtiEventCallbacks">event callbacks</internallink> 13507 for the complete structure. 13508 <p/> 13509 Where, for example, the VM initialization callback is defined: 13510 <example> 13511 typedef void (JNICALL *jvmtiEventVMInit) 13512 (jvmtiEnv *jvmti_env, 13513 JNIEnv* jni_env, 13514 jthread thread); 13515 </example> 13516 See the individual events for the callback function definition. 13517 </description> 13518 </basetype> 13519 <basetype id="jniNativeInterface"> 13520 <definition>typedef struct JNINativeInterface_ jniNativeInterface;</definition> 13521 <description> 13522 Typedef for the JNI function table <code>JNINativeInterface</code> 13523 defined in the 13524 <externallink id="docs/technotes/guides/jni/spec/functions.html#interface_function_table"> 13525 JNI Specification</externallink>. 13526 The JNI reference implementation defines this with an underscore. 13527 </description> 13528 </basetype> 13529 </basetypes> 13530 13531 </datasection> 13532 13533 <issuessection label="Issues"> 13534 <intro id="suspendRequired" label="Resolved Issue: Suspend - Required or Automatic"> 13535 JVMDI requires that the agent suspend threads before calling 13536 certain sensitive functions. JVMPI requires garbage collection to be 13537 disabled before calling certain sensitive functions. 13538 It was suggested that rather than have this requirement, that 13539 VM place itself in a suitable state before performing an 13540 operation. This makes considerable sense since each VM 13541 knows its requirements and can most easily arrange a 13542 safe state. 13543 <p/> 13544 The ability to externally suspend/resume threads will, of 13545 course, remain. The ability to enable/disable garbage collection will not. 13546 <p/> 13547 This issue is resolved--suspend will not 13548 be required. The spec has been updated to reflect this. 13549 </intro> 13550 13551 <intro id="stackSampling" label="Resolved Issue: Call Stack Sampling"> 13552 There are a variety of approaches to sampling call stacks. 13553 The biggest bifurcation is between VM controlled and agent 13554 controlled. 13555 <p/> 13556 This issue is resolved--agent controlled 13557 sampling will be the approach. 13558 </intro> 13559 13560 <intro id="threadRepresentation" label="Resolved Issue: Thread Representation"> 13561 JVMDI represents threads as jthread. JVMPI primarily 13562 uses JNIEnv* to represent threads. 13563 <p/> 13564 The Expert Group has chosen jthread as the representation 13565 for threads in <jvmti/>. 13566 JNIEnv* is sent by 13567 events since it is needed to JNI functions. JNIEnv, per the 13568 JNI spec, are not supposed to be used outside their thread. 13569 </intro> 13570 13571 <intro id="design" label="Resolved Issue: Method Representation"> 13572 The JNI spec allows an implementation to depend on jclass/jmethodID 13573 pairs, rather than simply a jmethodID, to reference a method. 13574 JVMDI, for consistency, choose the same representation. 13575 JVMPI, however, specifies that a jmethodID alone maps to a 13576 method. Both of the Sun <tm>J2SE</tm> virtual machines (Classic and <tm>HotSpot</tm>) store 13577 pointers in jmethodIDs, and as a result, a jmethodID is sufficient. 13578 In fact, any JVM implementation that supports JVMPI must have 13579 such a representation. 13580 <jvmti/> will use jmethodID as a unique representation of a method 13581 (no jclass is used). 13582 There should be efficiency gains, particularly in 13583 functionality like stack dumping, to this representation. 13584 <p/> 13585 Note that fields were not used in JVMPI and that the access profile 13586 of fields differs from methods--for implementation efficiency 13587 reasons, a jclass/jfieldID pair will still be needed for field 13588 reference. 13589 </intro> 13590 13591 <intro id="localReferenceIssue" label="Resolved Issue: Local References"> 13592 Functions return local references. 13593 </intro> 13594 13595 <intro id="frameRep" label="Resolved Issue: Representation of frames"> 13596 In JVMDI, a frame ID is used to represent a frame. Problem with this 13597 is that a VM must track when a frame becomes invalid, a far better 13598 approach, and the one used in <jvmti/>, is to reference frames by depth. 13599 </intro> 13600 13601 <intro id="requiredCapabilities" label="Issue: Required Capabilities"> 13602 Currently, having a required capabilities means that the functionality 13603 is optional. Capabilities are useful even for required functionality 13604 since they can inform the VM is needed set-up. Thus, there should be 13605 a set of capabilities that a conformant implementation must provide 13606 (if requested during Agent_OnLoad). 13607 </intro> 13608 13609 <intro id="taghint" label="Proposal: add tag hint function"> 13610 A hint of the percentage of objects that will be tagged would 13611 help the VM pick a good implementation. 13612 </intro> 13613 13614 <intro id="moreMonitorQueries" label="Request: More Monitor Quires"> 13615 How difficult or easy would be to extend the monitor_info category to include 13616 <pre> 13617 - current number of monitors 13618 - enumeration of monitors 13619 - enumeration of threads waiting on a given monitor 13620 </pre> 13621 The reason for my question is the fact that current get_monitor_info support 13622 requires the agent to specify a given thread to get the info which is probably 13623 OK in the profiling/debugging space, while in the monitoring space the agent 13624 could be watching the monitor list and then decide which thread to ask for 13625 the info. You might ask why is this important for monitoring .... I think it 13626 can aid in the detection/prediction of application contention caused by hot-locks. 13627 </intro> 13628 </issuessection> 13629 13630 <changehistory id="ChangeHistory" update="09/05/07"> 13631 <intro> 13632 The <jvmti/> specification is an evolving document with major, minor, 13633 and micro version numbers. 13634 A released version of the specification is uniquely identified 13635 by its major and minor version. 13636 The functions, events, and capabilities in this specification 13637 indicate a "Since" value which is the major and minor version in 13638 which it was introduced. 13639 The version of the specification implemented by the VM can 13640 be retrieved at runtime with the <functionlink id="GetVersionNumber"/> 13641 function. 13642 </intro> 13643 <change date="14 Nov 2002"> 13644 Converted to XML document. 13645 </change> 13646 <change date="14 Nov 2002"> 13647 Elided heap dump functions (for now) since what was there 13648 was wrong. 13649 </change> 13650 <change date="18 Nov 2002"> 13651 Added detail throughout. 13652 </change> 13653 <change date="18 Nov 2002"> 13654 Changed JVMTI_THREAD_STATUS_RUNNING to JVMTI_THREAD_STATUS_RUNNABLE. 13655 </change> 13656 <change date="19 Nov 2002"> 13657 Added AsyncGetStackTrace. 13658 </change> 13659 <change date="19 Nov 2002"> 13660 Added jframeID return to GetStackTrace. 13661 </change> 13662 <change date="19 Nov 2002"> 13663 Elided GetCurrentFrame and GetCallingFrame functions (for now) since what was there 13664 since they are redundant with GetStackTrace. 13665 </change> 13666 <change date="19 Nov 2002"> 13667 Elided ClearAllBreakpoints since it has always been redundant. 13668 </change> 13669 <change date="19 Nov 2002"> 13670 Added GetSystemProperties. 13671 </change> 13672 <change date="19 Nov 2002"> 13673 Changed the thread local storage functions to use jthread. 13674 </change> 13675 <change date="20 Nov 2002"> 13676 Added GetJLocationFormat. 13677 </change> 13678 <change date="22 Nov 2002"> 13679 Added events and introductory text. 13680 </change> 13681 <change date="22 Nov 2002"> 13682 Cross reference type and constant definitions. 13683 </change> 13684 <change date="24 Nov 2002"> 13685 Added DTD. 13686 </change> 13687 <change date="24 Nov 2002"> 13688 Added capabilities function section. 13689 </change> 13690 <change date="29 Nov 2002"> 13691 Assign capabilities to each function and event. 13692 </change> 13693 <change date="29 Nov 2002"> 13694 Add <internallink id="jniIntercept">JNI interception functions</internallink>. 13695 </change> 13696 <change date="30 Nov 2002"> 13697 Auto generate SetEventNotificationMode capabilities. 13698 </change> 13699 <change date="30 Nov 2002"> 13700 Add <eventlink id="VMObjectAlloc"></eventlink> event. 13701 </change> 13702 <change date="30 Nov 2002"> 13703 Add <eventlink id="DynamicCodeGenerated"></eventlink> event. 13704 </change> 13705 <change date="30 Nov 2002"> 13706 Add const to declarations. 13707 </change> 13708 <change date="30 Nov 2002"> 13709 Change method exit and frame pop to send on exception. 13710 </change> 13711 <change date="1 Dec 2002"> 13712 Add ForceGarbageCollection. 13713 </change> 13714 <change date="2 Dec 2002"> 13715 Redo Xrun section; clarify GetStackTrace and add example; 13716 Fix width problems; use "agent" consistently. 13717 </change> 13718 <change date="8 Dec 2002"> 13719 Remove previous start-up intro. 13720 Add <internallink id="environments"><jvmti/> Environments</internallink> 13721 section. 13722 </change> 13723 <change date="8 Dec 2002"> 13724 Add <functionlink id="DisposeEnvironment"></functionlink>. 13725 </change> 13726 <change date="9 Dec 2002"> 13727 Numerous minor updates. 13728 </change> 13729 <change date="15 Dec 2002"> 13730 Add heap profiling functions added: 13731 get/set annotation, iterate live objects/heap. 13732 Add heap profiling functions place holder added: 13733 heap roots. 13734 Heap profiling event added: object free. 13735 Heap profiling event redesigned: vm object allocation. 13736 Heap profiling event placeholders added: garbage collection start/finish. 13737 Native method bind event added. 13738 </change> 13739 <change date="19 Dec 2002"> 13740 Revamp suspend/resume functions. 13741 Add origin information with jvmdi tag. 13742 Misc fixes. 13743 </change> 13744 <change date="24 Dec 2002"> 13745 Add semantics to types. 13746 </change> 13747 <change date="27 Dec 2002"> 13748 Add local reference section. 13749 Autogenerate parameter descriptions from types. 13750 </change> 13751 <change date="28 Dec 2002"> 13752 Document that RunAgentThread sends threadStart. 13753 </change> 13754 <change date="29 Dec 2002"> 13755 Remove redundant local ref and dealloc warning. 13756 Convert GetRawMonitorName to allocated buffer. 13757 Add GenerateEvents. 13758 </change> 13759 <change date="30 Dec 2002"> 13760 Make raw monitors a type and rename to "jrawMonitorID". 13761 </change> 13762 <change date="1 Jan 2003"> 13763 Include origin information. 13764 Clean-up JVMDI issue references. 13765 Remove Deallocate warnings which are now automatically generated. 13766 </change> 13767 <change date="2 Jan 2003"> 13768 Fix representation issues for jthread. 13769 </change> 13770 <change date="3 Jan 2003"> 13771 Make capabilities buffered out to 64 bits - and do it automatically. 13772 </change> 13773 <change date="4 Jan 2003"> 13774 Make constants which are enumeration into enum types. 13775 Parameters now of enum type. 13776 Clean-up and index type section. 13777 Replace remaining datadef entities with callback. 13778 </change> 13779 <change date="7 Jan 2003"> 13780 Correct GenerateEvents description. 13781 More internal semantics work. 13782 </change> 13783 <change date="9 Jan 2003"> 13784 Replace previous GetSystemProperties with two functions 13785 which use allocated information instead fixed. 13786 Add SetSystemProperty. 13787 More internal semantics work. 13788 </change> 13789 <change date="12 Jan 2003"> 13790 Add varargs to end of SetEventNotificationMode. 13791 </change> 13792 <change date="20 Jan 2003"> 13793 Finish fixing spec to reflect that alloc sizes are jlong. 13794 </change> 13795 <change date="22 Jan 2003"> 13796 Allow NULL as RunAgentThread arg. 13797 </change> 13798 <change date="22 Jan 2003"> 13799 Fixed names to standardized naming convention 13800 Removed AsyncGetStackTrace. 13801 </change> 13802 <change date="29 Jan 2003"> 13803 Since we are using jthread, removed GetThread. 13804 </change> 13805 <change date="31 Jan 2003"> 13806 Change GetFieldName to allow NULLs like GetMethodName. 13807 </change> 13808 <change date="29 Feb 2003" version="v40"> 13809 Rewrite the introductory text, adding sections on 13810 start-up, environments and bytecode instrumentation. 13811 Change the command line arguments per EG discussions. 13812 Add an introduction to the capabilities section. 13813 Add the extension mechanism category and functions. 13814 Mark for deletion, but clarified anyhow, SuspendAllThreads. 13815 Rename IterateOverLiveObjects to IterateOverReachableObjects and 13816 change the text accordingly. 13817 Clarify IterateOverHeap. 13818 Clarify CompiledMethodLoad. 13819 Discuss prerequisite state for Calling Functions. 13820 Clarify SetAllocationHooks. 13821 Added issues ("To be resolved:") through-out. 13822 And so on... 13823 </change> 13824 <change date="6 Mar 2003" version="v41"> 13825 Remove struct from the call to GetOwnedMonitorInfo. 13826 Automatically generate most error documentation, remove 13827 (rather broken) hand written error doc. 13828 Better describe capability use (empty initial set). 13829 Add min value to jint params. 13830 Remove the capability can_access_thread_local_storage. 13831 Rename error JVMTI_ERROR_NOT_IMPLEMENTED to JVMTI_ERROR_MUST_POSSESS_CAPABILITY; 13832 same for *NOT_IMPLEMENTED. 13833 Description fixes. 13834 </change> 13835 <change date="8 Mar 2003" version="v42"> 13836 Rename GetClassSignature to GetClassName. 13837 Rename IterateOverClassObjects to IterateOverInstancesOfClass. 13838 Remove GetMaxStack (operand stack isn't used in <jvmti/>). 13839 Description fixes: define launch-time, remove native frame pop 13840 from PopFrame, and assorted clarifications. 13841 </change> 13842 <change date="8 Mar 2003" version="v43"> 13843 Fix minor editing problem. 13844 </change> 13845 <change date="10 Mar 2003" version="v44"> 13846 Add phase information. 13847 Remap (compact) event numbers. 13848 </change> 13849 <change date="11 Mar 2003" version="v45"> 13850 More phase information - allow "any". 13851 Elide raw monitor queries and events. 13852 Minor description fixes. 13853 </change> 13854 <change date="12 Mar 2003" version="v46"> 13855 Add GetPhase. 13856 Use "phase" through document. 13857 Elide GetRawMonitorName. 13858 Elide GetObjectMonitors. 13859 </change> 13860 <change date="12 Mar 2003" version="v47"> 13861 Fixes from link, XML, and spell checking. 13862 Auto-generate the callback structure. 13863 </change> 13864 <change date="13 Mar 2003" version="v48"> 13865 One character XML fix. 13866 </change> 13867 <change date="13 Mar 2003" version="v49"> 13868 Change function parameter names to be consistent with 13869 event parameters (fooBarBaz becomes foo_bar_baz). 13870 </change> 13871 <change date="14 Mar 2003" version="v50"> 13872 Fix broken link. Fix thread markers. 13873 </change> 13874 <change date="14 Mar 2003" version="v51"> 13875 Change constants so they are under 128 to workaround 13876 compiler problems. 13877 </change> 13878 <change date="23 Mar 2003" version="v52"> 13879 Overhaul capabilities. Separate GetStackTrace into 13880 GetStackTrace and GetStackFrames. 13881 </change> 13882 <change date="8 Apr 2003" version="v54"> 13883 Use depth instead of jframeID to reference frames. 13884 Remove the now irrelevant GetCurrentFrame, GetCallerFrame and GetStackFrames. 13885 Remove frame arg from events. 13886 </change> 13887 <change date="9 Apr 2003" version="v55"> 13888 Remove GetObjectWithAnnotation since tests show bufferred approach more efficient. 13889 Add missing annotation_count to GetObjectsWithAnnotations 13890 </change> 13891 <change date="10 Apr 2003" version="v56"> 13892 Remove confusing parenthetical statement in GetObjectsWithAnnotations 13893 </change> 13894 <change date="13 Apr 2003" version="v58"> 13895 Replace jclass/jmethodID representation of method with simply jmethodID; 13896 Pass JvmtiEnv* as first arg of every event; remove JNIEnv* where inappropriate. 13897 Replace can_access_frames with can_access_local_variables; remove from purely stack access. 13898 Use can_get_synthetic_attribute; fix description. 13899 Clarify that zero length arrays must be deallocated. 13900 Clarify RelinquishCapabilities. 13901 Generalize JVMTI_ERROR_VM_DEAD to JVMTI_ERROR_WRONG_PHASE. 13902 </change> 13903 <change date="27 Apr 2003" version="v59"> 13904 Remove lingering indirect references to OBSOLETE_METHOD_ID. 13905 </change> 13906 <change date="4 May 2003" version="v60"> 13907 Allow DestroyRawMonitor during OnLoad. 13908 </change> 13909 <change date="7 May 2003" version="v61"> 13910 Added not monitor owner error return to DestroyRawMonitor. 13911 </change> 13912 <change date="13 May 2003" version="v62"> 13913 Clarify semantics of raw monitors. 13914 Change flags on <code>GetThreadStatus</code>. 13915 <code>GetClassLoader</code> return NULL for the bootstrap class loader. 13916 Add <code>GetClassName</code> issue. 13917 Define local variable signature. 13918 Disallow zero in annotations array of <code>GetObjectsWithAnnotations</code>. 13919 Remove over specification in <code>GetObjectsWithAnnotations</code>. 13920 Elide <code>SetAllocationHooks</code>. 13921 Elide <code>SuspendAllThreads</code>. 13922 </change> 13923 <change date="14 May 2003" version="v63"> 13924 Define the data type <code>jvmtiEventCallbacks</code>. 13925 Zero length allocations return NULL. 13926 Keep SetAllocationHooks in JVMDI, but remove from <jvmti/>. 13927 Add JVMTI_THREAD_STATUS_FLAG_INTERRUPTED. 13928 </change> 13929 <change date="15 May 2003" version="v64"> 13930 Better wording, per review. 13931 </change> 13932 <change date="15 May 2003" version="v65"> 13933 First Alpha. 13934 Make jmethodID and jfieldID unique, jclass not used. 13935 </change> 13936 <change date="27 May 2003" version="v66"> 13937 Fix minor XSLT errors. 13938 </change> 13939 <change date="13 June 2003" version="v67"> 13940 Undo making jfieldID unique (jmethodID still is). 13941 </change> 13942 <change date="17 June 2003" version="v68"> 13943 Changes per June 11th Expert Group meeting -- 13944 Overhaul Heap functionality: single callback, 13945 remove GetHeapRoots, add reachable iterators, 13946 and rename "annotation" to "tag". 13947 NULL thread parameter on most functions is current 13948 thread. 13949 Add timers. 13950 Remove ForceExit. 13951 Add GetEnvironmentLocalStorage. 13952 Add verbose flag and event. 13953 Add AddToBootstrapClassLoaderSearch. 13954 Update ClassFileLoadHook. 13955 </change> 13956 <change date="18 June 2003" version="v69"> 13957 Clean up issues sections. 13958 Rename GetClassName back to GetClassSignature and 13959 fix description. 13960 Add generic signature to GetClassSignature, 13961 GetFieldSignature, GetMethodSignature, and 13962 GetLocalVariableTable. 13963 Elide EstimateCostOfCapabilities. 13964 Clarify that the system property functions operate 13965 on the VM view of system properties. 13966 Clarify Agent_OnLoad. 13967 Remove "const" from JNIEnv* in events. 13968 Add metadata accessors. 13969 </change> 13970 <change date="18 June 2003" version="v70"> 13971 Add start_depth to GetStackTrace. 13972 Move system properties to a new category. 13973 Add GetObjectSize. 13974 Remove "X" from command line flags. 13975 XML, HTML, and spell check corrections. 13976 </change> 13977 <change date="19 June 2003" version="v71"> 13978 Fix JVMTI_HEAP_ROOT_THREAD to be 6. 13979 Make each synopsis match the function name. 13980 Fix unclear wording. 13981 </change> 13982 <change date="26 June 2003" version="v72"> 13983 SetThreadLocalStorage and SetEnvironmentLocalStorage should allow value 13984 to be set to NULL. 13985 NotifyFramePop, GetFrameLocationm and all the local variable operations 13986 needed to have their wording about frames fixed. 13987 Grammar and clarity need to be fixed throughout. 13988 Capitalization and puntuation need to be consistent. 13989 Need micro version number and masks for accessing major, minor, and micro. 13990 The error code lists should indicate which must be returned by 13991 an implementation. 13992 The command line properties should be visible in the properties functions. 13993 Disallow popping from the current thread. 13994 Allow implementations to return opaque frame error when they cannot pop. 13995 The NativeMethodBind event should be sent during any phase. 13996 The DynamicCodeGenerated event should be sent during any phase. 13997 The following functions should be allowed to operate before VMInit: 13998 Set/GetEnvironmentLocalStorage 13999 GetMethodDeclaringClass 14000 GetClassSignature 14001 GetClassModifiers 14002 IsInterface 14003 IsArrayClass 14004 GetMethodName 14005 GetMethodModifiers 14006 GetMaxLocals 14007 GetArgumentsSize 14008 GetLineNumberTable 14009 GetMethodLocation 14010 IsMethodNative 14011 IsMethodSynthetic. 14012 Other changes (to XSL): 14013 Argument description should show asterisk after not before pointers. 14014 NotifyFramePop, GetFrameLocationm and all the local variable operations 14015 should hsve the NO_MORE_FRAMES error added. 14016 Not alive threads should have a different error return than invalid thread. 14017 </change> 14018 <change date="7 July 2003" version="v73"> 14019 VerboseOutput event was missing message parameter. 14020 Minor fix-ups. 14021 </change> 14022 <change date="14 July 2003" version="v74"> 14023 Technical Publications Department corrections. 14024 Allow thread and environment local storage to be set to NULL. 14025 </change> 14026 <change date="23 July 2003" version="v75"> 14027 Use new Agent_OnLoad rather than overloaded JVM_OnLoad. 14028 Add JNICALL to callbacks (XSL). 14029 Document JNICALL requirement for both events and callbacks (XSL). 14030 Restrict RedefineClasses to methods and attributes. 14031 Elide the VerboseOutput event. 14032 VMObjectAlloc: restrict when event is sent and remove method parameter. 14033 Finish loose ends from Tech Pubs edit. 14034 </change> 14035 <change date="24 July 2003" version="v76"> 14036 Change ClassFileLoadHook event to send the class instead of a boolean of redefine. 14037 </change> 14038 <change date="24 July 2003" version="v77"> 14039 XML fixes. 14040 Minor text clarifications and corrections. 14041 </change> 14042 <change date="24 July 2003" version="v78"> 14043 Remove GetExceptionHandlerTable and GetThrownExceptions from <jvmti/>. 14044 Clarify that stack frames are JVM Spec frames. 14045 Split can_get_source_info into can_get_source_file_name, can_get_line_numbers, 14046 and can_get_source_debug_extension. 14047 PopFrame cannot have a native calling method. 14048 Removed incorrect statement in GetClassloaderClasses 14049 (see <vmspec chapter="4.4"/>). 14050 </change> 14051 <change date="24 July 2003" version="v79"> 14052 XML and text fixes. 14053 Move stack frame description into Stack Frame category. 14054 </change> 14055 <change date="26 July 2003" version="v80"> 14056 Allow NULL (means bootstrap loader) for GetClassloaderClasses. 14057 Add new heap reference kinds for references from classes. 14058 Add timer information struct and query functions. 14059 Add AvailableProcessors. 14060 Rename GetOtherThreadCpuTime to GetThreadCpuTime. 14061 Explicitly add JVMTI_ERROR_INVALID_THREAD and JVMTI_ERROR_THREAD_NOT_ALIVE 14062 to SetEventNotification mode. 14063 Add initial thread to the VM_INIT event. 14064 Remove platform assumptions from AddToBootstrapClassLoaderSearch. 14065 </change> 14066 <change date="26 July 2003" version="v81"> 14067 Grammar and clarity changes per review. 14068 </change> 14069 <change date="27 July 2003" version="v82"> 14070 More grammar and clarity changes per review. 14071 Add Agent_OnUnload. 14072 </change> 14073 <change date="28 July 2003" version="v83"> 14074 Change return type of Agent_OnUnload to void. 14075 </change> 14076 <change date="28 July 2003" version="v84"> 14077 Rename JVMTI_REFERENCE_ARRAY to JVMTI_REFERENCE_ARRAY_ELEMENT. 14078 </change> 14079 <change date="28 July 2003" version="v85"> 14080 Steal java.lang.Runtime.availableProcessors() wording for 14081 AvailableProcessors(). 14082 Guarantee that zero will never be an event ID. 14083 Remove some issues which are no longer issues. 14084 Per review, rename and more completely document the timer 14085 information functions. 14086 </change> 14087 <change date="29 July 2003" version="v86"> 14088 Non-spec visible change to XML controlled implementation: 14089 SetThreadLocalStorage must run in VM mode. 14090 </change> 14091 <change date="5 August 2003" version="0.1.87"> 14092 Add GetErrorName. 14093 Add varargs warning to jvmtiExtensionEvent. 14094 Remove "const" on the jvmtiEnv* of jvmtiExtensionEvent. 14095 Remove unused can_get_exception_info capability. 14096 Pass jvmtiEnv* and JNIEnv* to the jvmtiStartFunction. 14097 Fix jvmtiExtensionFunctionInfo.func declared type. 14098 Extension function returns error code. 14099 Use new version numbering. 14100 </change> 14101 <change date="5 August 2003" version="0.2.88"> 14102 Remove the ClassUnload event. 14103 </change> 14104 <change date="8 August 2003" version="0.2.89"> 14105 Heap reference iterator callbacks return an enum that 14106 allows outgoing object references to be ignored. 14107 Allow JNIEnv as a param type to extension events/functions. 14108 </change> 14109 <change date="15 August 2003" version="0.2.90"> 14110 Fix a typo. 14111 </change> 14112 <change date="2 September 2003" version="0.2.91"> 14113 Remove all metadata functions: GetClassMetadata, 14114 GetFieldMetadata, and GetMethodMetadata. 14115 </change> 14116 <change date="1 October 2003" version="0.2.92"> 14117 Mark the functions Allocate. Deallocate, RawMonitor*, 14118 SetEnvironmentLocalStorage, and GetEnvironmentLocalStorage 14119 as safe for use in heap callbacks and GC events. 14120 </change> 14121 <change date="24 November 2003" version="0.2.93"> 14122 Add pass through opaque user data pointer to heap iterate 14123 functions and callbacks. 14124 In the CompiledMethodUnload event, send the code address. 14125 Add GarbageCollectionOccurred event. 14126 Add constant pool reference kind. 14127 Mark the functions CreateRawMonitor and DestroyRawMonitor 14128 as safe for use in heap callbacks and GC events. 14129 Clarify: VMDeath, GetCurrentThreadCpuTimerInfo, 14130 GetThreadCpuTimerInfo, IterateOverReachableObjects, 14131 IterateOverObjectsReachableFromObject, GetTime and 14132 JVMTI_ERROR_NULL_POINTER. 14133 Add missing errors to: GenerateEvents and 14134 AddToBootstrapClassLoaderSearch. 14135 Fix description of ClassFileLoadHook name parameter. 14136 In heap callbacks and GC/ObjectFree events, specify 14137 that only explicitly allowed functions can be called. 14138 Allow GetCurrentThreadCpuTimerInfo, GetCurrentThreadCpuTime, 14139 GetTimerInfo, and GetTime during callback. 14140 Allow calling SetTag/GetTag during the onload phase. 14141 SetEventNotificationMode, add: error attempted inappropriate 14142 thread level control. 14143 Remove jvmtiExceptionHandlerEntry. 14144 Fix handling of native methods on the stack -- 14145 location_ptr param of GetFrameLocation, remove 14146 JVMTI_ERROR_OPAQUE_FRAME from GetFrameLocation, 14147 jvmtiFrameInfo.location, and jlocation. 14148 Remove typo (from JVMPI) implying that the MonitorWaited 14149 event is sent on sleep. 14150 </change> 14151 <change date="25 November 2003" version="0.2.94"> 14152 Clarifications and typos. 14153 </change> 14154 <change date="3 December 2003" version="0.2.95"> 14155 Allow NULL user_data in heap iterators. 14156 </change> 14157 <change date="28 January 2004" version="0.2.97"> 14158 Add GetThreadState, deprecate GetThreadStatus. 14159 </change> 14160 <change date="29 January 2004" version="0.2.98"> 14161 INVALID_SLOT and TYPE_MISMATCH errors should be optional. 14162 </change> 14163 <change date="12 February 2004" version="0.2.102"> 14164 Remove MonitorContendedExit. 14165 Added JNIEnv parameter to VMObjectAlloc. 14166 Clarified definition of class_tag and referrer_index 14167 parameters to heap callbacks. 14168 </change> 14169 <change date="16 Febuary 2004" version="0.2.103"> 14170 Document JAVA_TOOL_OPTIONS. 14171 </change> 14172 <change date="17 Febuary 2004" version="0.2.105"> 14173 Divide start phase into primordial and start. 14174 Add VMStart event 14175 Change phase associations of functions and events. 14176 </change> 14177 <change date="18 Febuary 2004" version="0.3.6"> 14178 Elide deprecated GetThreadStatus. 14179 Bump minor version, subtract 100 from micro version 14180 </change> 14181 <change date="18 Febuary 2004" version="0.3.7"> 14182 Document that timer nanosecond values are unsigned. 14183 Clarify text having to do with native methods. 14184 </change> 14185 <change date="19 Febuary 2004" version="0.3.8"> 14186 Fix typos. 14187 Remove elided deprecated GetThreadStatus. 14188 </change> 14189 <change date="23 Febuary 2004" version="0.3.9"> 14190 Require NotifyFramePop to act on suspended threads. 14191 </change> 14192 <change date="24 Febuary 2004" version="0.3.10"> 14193 Add capabilities 14194 (<internallink id="jvmtiCapabilities.can_redefine_any_class" 14195 ><code>can_redefine_any_class</code></internallink> 14196 and 14197 <internallink id="jvmtiCapabilities.can_generate_all_class_hook_events" 14198 ><code>can_generate_all_class_hook_events</code></internallink>) 14199 and an error (<errorlink id="JVMTI_ERROR_UNMODIFIABLE_CLASS"></errorlink>) 14200 which allow some classes to be unmodifiable. 14201 </change> 14202 <change date="28 Febuary 2004" version="0.3.11"> 14203 Add JVMTI_ERROR_MUST_POSSESS_CAPABILITY to SetEventNotificationMode. 14204 </change> 14205 <change date="8 March 2004" version="0.3.12"> 14206 Clarified CompiledMethodUnload so that it is clear the event 14207 may be posted after the class has been unloaded. 14208 </change> 14209 <change date="5 March 2004" version="0.3.13"> 14210 Change the size parameter of VMObjectAlloc to jlong to match GetObjectSize. 14211 </change> 14212 <change date="13 March 2004" version="0.3.14"> 14213 Added guideline for the use of the JNI FindClass function in event 14214 callback functions. 14215 </change> 14216 <change date="15 March 2004" version="0.3.15"> 14217 Add GetAllStackTraces and GetThreadListStackTraces. 14218 </change> 14219 <change date="19 March 2004" version="0.3.16"> 14220 ClassLoad and ClassPrepare events can be posted during start phase. 14221 </change> 14222 <change date="25 March 2004" version="0.3.17"> 14223 Add JVMTI_ERROR_NATIVE_METHOD to GetLineNumberTable, GetLocalVariableTable, 14224 GetMaxLocals, GetArgumentsSize, GetMethodLocation, GetBytecodes. 14225 </change> 14226 <change date="29 March 2004" version="0.3.18"> 14227 Return the timer kind in the timer information structure. 14228 </change> 14229 <change date="31 March 2004" version="0.3.19"> 14230 Spec clarifications: 14231 JVMTI_THREAD_STATE_IN_NATIVE might not include JNI or <jvmti/>. 14232 ForceGarbageCollection does not run finalizers. 14233 The context of the specification is the Java platform. 14234 Warn about early instrumentation. 14235 </change> 14236 <change date="1 April 2004" version="0.3.20"> 14237 Refinements to the above clarifications and 14238 Clarify that an error returned by Agent_OnLoad terminates the VM. 14239 </change> 14240 <change date="1 April 2004" version="0.3.21"> 14241 Array class creation does not generate a class load event. 14242 </change> 14243 <change date="7 April 2004" version="0.3.22"> 14244 Align thread state hierarchy more closely with java.lang.Thread.State. 14245 </change> 14246 <change date="12 April 2004" version="0.3.23"> 14247 Clarify the documentation of thread state. 14248 </change> 14249 <change date="19 April 2004" version="0.3.24"> 14250 Remove GarbageCollectionOccurred event -- can be done by agent. 14251 </change> 14252 <change date="22 April 2004" version="0.3.25"> 14253 Define "command-line option". 14254 </change> 14255 <change date="29 April 2004" version="0.3.26"> 14256 Describe the intended use of bytecode instrumentation. 14257 Fix description of extension event first parameter. 14258 </change> 14259 <change date="30 April 2004" version="0.3.27"> 14260 Clarification and typos. 14261 </change> 14262 <change date="18 May 2004" version="0.3.28"> 14263 Remove DataDumpRequest event. 14264 </change> 14265 <change date="18 May 2004" version="0.3.29"> 14266 Clarify RawMonitorWait with zero timeout. 14267 Clarify thread state after RunAgentThread. 14268 </change> 14269 <change date="24 May 2004" version="0.3.30"> 14270 Clean-up: fix bad/old links, etc. 14271 </change> 14272 <change date="30 May 2004" version="0.3.31"> 14273 Clarifications including: 14274 All character strings are modified UTF-8. 14275 Agent thread visibiity. 14276 Meaning of obsolete method version. 14277 Thread invoking heap callbacks, 14278 </change> 14279 <change date="1 June 2004" version="1.0.32"> 14280 Bump major.minor version numbers to "1.0". 14281 </change> 14282 <change date="2 June 2004" version="1.0.33"> 14283 Clarify interaction between ForceGarbageCollection 14284 and ObjectFree. 14285 </change> 14286 <change date="6 June 2004" version="1.0.34"> 14287 Restrict AddToBootstrapClassLoaderSearch and 14288 SetSystemProperty to the OnLoad phase only. 14289 </change> 14290 <change date="11 June 2004" version="1.0.35"> 14291 Fix typo in SetTag. 14292 </change> 14293 <change date="18 June 2004" version="1.0.36"> 14294 Fix trademarks. 14295 Add missing parameter in example GetThreadState usage. 14296 </change> 14297 <change date="4 August 2004" version="1.0.37"> 14298 Copyright updates. 14299 </change> 14300 <change date="5 November 2004" version="1.0.38"> 14301 Add missing function table layout. 14302 Add missing description of C++ member function format of functions. 14303 Clarify that name in CFLH can be NULL. 14304 Released as part of <tm>J2SE</tm> 5.0. 14305 </change> 14306 <change date="24 April 2005" version="1.1.47"> 14307 Bump major.minor version numbers to "1.1". 14308 Add ForceEarlyReturn* functions. 14309 Add GetOwnedMonitorStackDepthInfo function. 14310 Add GetCurrentThread function. 14311 Add "since" version marker. 14312 Add AddToSystemClassLoaderSearch. 14313 Allow AddToBootstrapClassLoaderSearch be used in live phase. 14314 Fix historic rubbish in the descriptions of the heap_object_callback 14315 parameter of IterateOverHeap and IterateOverInstancesOfClass functions; 14316 disallow NULL for this parameter. 14317 Clarify, correct and make consistent: wording about current thread, 14318 opaque frames and insufficient number of frames in PopFrame. 14319 Consistently use "current frame" rather than "topmost". 14320 Clarify the JVMTI_ERROR_TYPE_MISMATCH errors in GetLocal* and SetLocal* 14321 by making them compatible with those in ForceEarlyReturn*. 14322 Many other clarifications and wording clean ups. 14323 </change> 14324 <change date="25 April 2005" version="1.1.48"> 14325 Add GetConstantPool. 14326 Switch references to the first edition of the VM Spec, to the seconds edition. 14327 </change> 14328 <change date="26 April 2005" version="1.1.49"> 14329 Clarify minor/major version order in GetConstantPool. 14330 </change> 14331 <change date="26 April 2005" version="1.1.50"> 14332 Add SetNativeMethodPrefix and SetNativeMethodPrefixes. 14333 Reassign GetOwnedMonitorStackDepthInfo to position 153. 14334 Break out Class Loader Search in its own documentation category. 14335 Deal with overly long lines in XML source. 14336 </change> 14337 <change date="29 April 2005" version="1.1.51"> 14338 Allow agents be started in the live phase. 14339 Added paragraph about deploying agents. 14340 </change> 14341 <change date="30 April 2005" version="1.1.52"> 14342 Add specification description to SetNativeMethodPrefix(es). 14343 Better define the conditions on GetConstantPool. 14344 </change> 14345 <change date="30 April 2005" version="1.1.53"> 14346 Break out the GetClassVersionNumber function from GetConstantPool. 14347 Clean-up the references to the VM Spec. 14348 </change> 14349 <change date="1 May 2005" version="1.1.54"> 14350 Allow SetNativeMethodPrefix(es) in any phase. 14351 Add clarifications about the impact of redefinition on GetConstantPool. 14352 </change> 14353 <change date="2 May 2005" version="1.1.56"> 14354 Various clarifications to SetNativeMethodPrefix(es). 14355 </change> 14356 <change date="2 May 2005" version="1.1.57"> 14357 Add missing performance warning to the method entry event. 14358 </change> 14359 <change date="5 May 2005" version="1.1.58"> 14360 Remove internal JVMDI support. 14361 </change> 14362 <change date="8 May 2005" version="1.1.59"> 14363 Add <functionlink id="RetransformClasses"/>. 14364 Revamp the bytecode instrumentation documentation. 14365 Change <functionlink id="IsMethodObsolete"/> to no longer 14366 require the can_redefine_classes capability. 14367 </change> 14368 <change date="11 May 2005" version="1.1.63"> 14369 Clarifications for retransformation. 14370 </change> 14371 <change date="11 May 2005" version="1.1.64"> 14372 Clarifications for retransformation, per review. 14373 Lock "retransformation (in)capable" at class load enable time. 14374 </change> 14375 <change date="4 June 2005" version="1.1.67"> 14376 Add new heap functionity which supports reporting primitive values, 14377 allows setting the referrer tag, and has more powerful filtering: 14378 FollowReferences, IterateThroughHeap, and their associated 14379 callbacks, structs, enums, and constants. 14380 </change> 14381 <change date="4 June 2005" version="1.1.68"> 14382 Clarification. 14383 </change> 14384 <change date="6 June 2005" version="1.1.69"> 14385 FollowReferences, IterateThroughHeap: Put callbacks in a struct; 14386 Add missing error codes; reduce bits in the visit control flags. 14387 </change> 14388 <change date="14 June 2005" version="1.1.70"> 14389 More on new heap functionity: spec clean-up per review. 14390 </change> 14391 <change date="15 June 2005" version="1.1.71"> 14392 More on new heap functionity: Rename old heap section to Heap (1.0). 14393 </change> 14394 <change date="21 June 2005" version="1.1.72"> 14395 Fix typos. 14396 </change> 14397 <change date="27 June 2005" version="1.1.73"> 14398 Make referrer info structure a union. 14399 </change> 14400 <change date="9 September 2005" version="1.1.74"> 14401 In new heap functions: 14402 Add missing superclass reference kind. 14403 Use a single scheme for computing field indexes. 14404 Remove outdated references to struct based referrer info. 14405 </change> 14406 <change date="12 September 2005" version="1.1.75"> 14407 Don't callback during FollowReferences on frivolous java.lang.Object superclass. 14408 </change> 14409 <change date="13 September 2005" version="1.1.76"> 14410 In string primitive callback, length now Unicode length. 14411 In array and string primitive callbacks, value now "const". 14412 Note possible compiler impacts on setting JNI function table. 14413 </change> 14414 <change date="13 September 2005" version="1.1.77"> 14415 GetClassVersionNumbers() and GetConstantPool() should return 14416 error on array or primitive class. 14417 </change> 14418 <change date="14 September 2005" version="1.1.78"> 14419 Grammar fixes. 14420 </change> 14421 <change date="26 September 2005" version="1.1.79"> 14422 Add IsModifiableClass query. 14423 </change> 14424 <change date="9 February 2006" version="1.1.81"> 14425 Add referrer_class_tag parameter to jvmtiHeapReferenceCallback. 14426 </change> 14427 <change date="13 February 2006" version="1.1.82"> 14428 Doc fixes: update can_redefine_any_class to include retransform. 14429 Clarify that exception events cover all Throwables. 14430 In GetStackTrace, no test is done for start_depth too big if start_depth is zero, 14431 Clarify fields reported in Primitive Field Callback -- static vs instance. 14432 Repair confusing names of heap types, including callback names. 14433 Require consistent usage of stack depth in the face of thread launch methods. 14434 Note incompatibility of <jvmti/> memory management with other systems. 14435 </change> 14436 <change date="14 February 2006" version="1.1.85"> 14437 Fix typos and missing renames. 14438 </change> 14439 <change date="13 March 2006" version="1.1.86"> 14440 Clarify that jmethodIDs and jfieldIDs can be saved. 14441 Clarify that Iterate Over Instances Of Class includes subclasses. 14442 </change> 14443 <change date="14 March 2006" version="1.1.87"> 14444 Better phrasing. 14445 </change> 14446 <change date="16 March 2006" version="1.1.88"> 14447 Match the referrer_index for static fields in Object Reference Callback 14448 with the Reference Implementation (and all other known implementations); 14449 that is, make it match the definition for instance fields. 14450 In GetThreadListStackTraces, add JVMTI_ERROR_INVALID_THREAD to cover 14451 an invalid thread in the list; and specify that not started threads 14452 return empty stacks. 14453 </change> 14454 <change date="17 March 2006" version="1.1.89"> 14455 Typo. 14456 </change> 14457 <change date="25 March 2006" version="1.1.90"> 14458 Typo. 14459 </change> 14460 <change date="6 April 2006" version="1.1.91"> 14461 Remove restrictions on AddToBootstrapClassLoaderSearch and 14462 AddToSystemClassLoaderSearch. 14463 </change> 14464 <change date="1 May 2006" version="1.1.93"> 14465 Changed spec to return -1 for monitor stack depth for the 14466 implementation which can not determine stack depth. 14467 </change> 14468 <change date="3 May 2006" version="1.1.94"> 14469 Corrections for readability and accuracy courtesy of Alan Pratt of IBM. 14470 List the object relationships reported in FollowReferences. 14471 </change> 14472 <change date="5 May 2006" version="1.1.95"> 14473 Clarify the object relationships reported in FollowReferences. 14474 </change> 14475 <change date="28 June 2006" version="1.1.98"> 14476 Clarify DisposeEnvironment; add warning. 14477 Fix typos in SetLocalXXX "retrieve" => "set". 14478 Clarify that native method prefixes must remain set while used. 14479 Clarify that exactly one Agent_OnXXX is called per agent. 14480 Clarify that library loading is independent from start-up. 14481 Remove ambiguous reference to Agent_OnLoad in the Agent_OnUnload spec. 14482 </change> 14483 <change date="31 July 2006" version="1.1.99"> 14484 Clarify the interaction between functions and exceptions. 14485 Clarify and give examples of field indices. 14486 Remove confusing "That is" sentence from MonitorWait and MonitorWaited events. 14487 Update links to point to Java 6. 14488 </change> 14489 <change date="6 August 2006" version="1.1.102"> 14490 Add ResourceExhaustedEvent. 14491 </change> 14492 <change date="11 October 2012" version="1.2.2"> 14493 Fixed the "HTTP" and "Missing Anchor" errors reported by the LinkCheck tool. 14494 </change> 14495 <change date="19 June 2013" version="1.2.3"> 14496 Added support for statically linked agents. 14497 </change> 14498 <change date="5 July 2016" version="9.0.0"> 14499 Support for modules: 14500 - The majorversion is 9 now 14501 - The ClassFileLoadHook events are not sent during the primordial phase anymore. 14502 - Add new function GetAllModules 14503 - Add new capability can_generate_early_vmstart 14504 - Allow CompiledMethodLoad events at start phase 14505 - Add new capability can_generate_early_class_hook_events 14506 - Add new function GetNamedModule 14507 </change> 14508 <change date="16 August 2016" version="9.0.0"> 14509 Clarified can_redefine_any_classes, can_retransform_any_classes and IsModifiableClass API to 14510 disallow some implementation defined classes. 14511 </change> 14512 </changehistory> 14513 14514 </specification> 14515 <!-- Keep this comment at the end of the file 14516 Local variables: 14517 mode: sgml 14518 sgml-omittag:t 14519 sgml-shorttag:t 14520 sgml-namecase-general:t 14521 sgml-general-insert-case:lower 14522 sgml-minimize-attributes:nil 14523 sgml-always-quote-attributes:t 14524 sgml-indent-step:2 14525 sgml-indent-data:t 14526 sgml-parent-document:nil 14527 sgml-exposed-tags:nil 14528 sgml-local-catalogs:nil 14529 sgml-local-ecat-files:nil 14530 End: 14531 -->