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="http://docs.oracle.com/javase/7/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="http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/invocation.html#GetEnv"><code>GetEnv</code></externallink>. 768 See <internallink id="jvmtiEnvAccess">Accessing <jvmti/> Functions</internallink> 769 for more details on the creation and use of 770 <jvmti/> environments. 771 Typically, <jvmti/> environments are created by calling <code>GetEnv</code> from 772 <internallink id="onload"><code>Agent_OnLoad</code></internallink>. 773 </intro> 774 775 <intro id="bci" label="Bytecode Instrumentation"> 776 This interface does not include some events that one might expect in an interface with 777 profiling support. Some examples include object allocation events and full speed 778 method enter and exit events. The interface instead provides support for 779 <i>bytecode instrumentation</i>, the ability to alter the Java virtual machine 780 bytecode instructions which comprise the target program. Typically, these alterations 781 are to add "events" to the code of a method - for example, to add, at the beginning of a method, 782 a call to <code>MyProfiler.methodEntered()</code>. 783 Since the changes are purely additive, they do not modify application 784 state or behavior. 785 Because the inserted agent code is standard bytecodes, the VM can run at full speed, 786 optimizing not only the target program but also the instrumentation. If the 787 instrumentation does not involve switching from bytecode execution, no expensive 788 state transitions are needed. The result is high performance events. 789 This approach also provides complete control to the agent: instrumentation can be 790 restricted to "interesting" portions of the code (e.g., the end user's code) and 791 can be conditional. Instrumentation can run entirely in Java programming language 792 code or can call into the native agent. Instrumentation can simply maintain 793 counters or can statistically sample events. 794 <p/> 795 Instrumentation can be inserted in one of three ways: 796 <ul> 797 <li> 798 Static Instrumentation: The class file is instrumented before it 799 is loaded into the VM - for example, by creating a duplicate directory of 800 <code>*.class</code> files which have been modified to add the instrumentation. 801 This method is extremely awkward and, in general, an agent cannot know 802 the origin of the class files which will be loaded. 803 </li> 804 <li> 805 Load-Time Instrumentation: When a class file is loaded by the VM, the raw 806 bytes of the class file are sent for instrumentation to the agent. 807 The <eventlink id="ClassFileLoadHook"/> 808 event, triggered by the class load, 809 provides this functionality. This mechanism provides efficient 810 and complete access to one-time instrumentation. 811 </li> 812 <li> 813 Dynamic Instrumentation: A class which is already loaded (and possibly 814 even running) is modified. This optional feature is provided by the 815 <eventlink id="ClassFileLoadHook"/> event, triggered by calling the 816 <functionlink id="RetransformClasses"/> function. 817 Classes can be modified multiple times and can be returned to their 818 original state. 819 The mechanism allows instrumentation which changes during the 820 course of execution. 821 </li> 822 </ul> 823 <p/> 824 The class modification functionality provided in this interface 825 is intended to provide a mechanism for instrumentation 826 (the <eventlink id="ClassFileLoadHook"/> event 827 and the <functionlink id="RetransformClasses"/> function) 828 and, during development, for fix-and-continue debugging 829 (the <functionlink id="RedefineClasses"/> function). 830 <p/> 831 Care must be taken to avoid perturbing dependencies, especially when 832 instrumenting core classes. For example, an approach to getting notification 833 of every object allocation is to instrument the constructor on 834 <code>Object</code>. Assuming that the constructor is initially 835 empty, the constructor could be changed to: 836 <example> 837 public Object() { 838 MyProfiler.allocationTracker(this); 839 } 840 </example> 841 However, if this change was made using the 842 <eventlink id="ClassFileLoadHook"/> 843 event then this might impact a typical VM as follows: 844 the first created object will call the constructor causing a class load of 845 <code>MyProfiler</code>; which will then cause 846 object creation, and since <code>MyProfiler</code> isn't loaded yet, 847 infinite recursion; resulting in a stack overflow. A refinement of this 848 would be to delay invoking the tracking method until a safe time. For 849 example, <code>trackAllocations</code> could be set in the 850 handler for the <code>VMInit</code> event. 851 <example> 852 static boolean trackAllocations = false; 853 854 public Object() { 855 if (trackAllocations) { 856 MyProfiler.allocationTracker(this); 857 } 858 } 859 </example> 860 <p/> 861 The <functionlink id="SetNativeMethodPrefix"/> allows native methods 862 to be instrumented by the use of wrapper methods. 863 </intro> 864 865 <intro id="bcimodules" label="Bytecode Instrumentation of code in modules"> 866 Agents that instrument code in named modules may need to arrange for those 867 modules to read other modules. If code is instrumented to invoke a method 868 in a support class in another module, then the module of the instrumented 869 code should read the module of the supporting class. Furthermore, the 870 supporting class will only be accessible to the instrumented code if 871 it is <code>public</code> and in a package that is exported by its module. 872 Agents can use the JNI functions <code>CanReadModule</code> and 873 <code>AddModuleReads</code> to test and update a module to read another. 874 <p/> 875 As an aid to agents that deploy supporting classes on the search path of 876 the bootstrap class loader, or the search path of the class loader that 877 loads the main class, the Java virtual machine arranges for the module 878 of classes transformed by the <eventlink id="ClassFileLoadHook"/> event to 879 read the unnamed module of both class loaders. 880 </intro> 881 882 <intro id="mUTF" label="Modified UTF-8 String Encoding"> 883 <jvmti/> uses modified UTF-8 to encode character strings. 884 This is the same encoding used by JNI. 885 Modified UTF-8 differs 886 from standard UTF-8 in the representation of supplementary characters 887 and of the null character. See the 888 <externallink id="http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/types.html#wp16542"> 889 Modified UTF-8 Strings</externallink> 890 section of the JNI specification for details. 891 </intro> 892 893 <intro id="context" label="Specification Context"> 894 Since this interface provides access to the state of applications running in the 895 Java virtual machine; 896 terminology refers to the Java platform and not the native 897 platform (unless stated otherwise). For example: 898 <ul> 899 <li>"thread" means Java programming language thread.</li> 900 <li>"stack frame" means Java virtual machine stack frame.</li> 901 <li>"class" means Java programming language class.</li> 902 <li>"heap" means Java virtual machine heap.</li> 903 <li>"monitor" means Java programming language object monitor.</li> 904 </ul> 905 <p/> 906 Sun, Sun Microsystems, the Sun logo, Java, and JVM 907 are trademarks or registered trademarks of Oracle 908 and/or its affiliates, in the U.S. and other countries. 909 </intro> 910 911 912 <functionsection label="Functions"> 913 <intro id="jvmtiEnvAccess" label="Accessing Functions"> 914 Native code accesses <jvmti/> features 915 by calling <jvmti/> functions. 916 Access to <jvmti/> functions is by use of an interface pointer 917 in the same manner as 918 <externallink id="http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/design.html">Java 919 Native Interface (JNI) functions</externallink> are accessed. 920 The <jvmti/> interface pointer is called the 921 <i>environment pointer</i>. 922 <p/> 923 An environment pointer is a pointer to an environment and has 924 the type <code>jvmtiEnv*</code>. 925 An environment has information about its <jvmti/> connection. 926 The first value in the environment is a pointer to the function table. 927 The function table is an array of pointers to <jvmti/> functions. 928 Every function pointer is at a predefined offset inside the 929 array. 930 <p/> 931 When used from the C language: 932 double indirection is used to access the functions; 933 the environment pointer provides context and is the first 934 parameter of each function call; for example: 935 <example> 936 jvmtiEnv *jvmti; 937 ... 938 jvmtiError err = (*jvmti)->GetLoadedClasses(jvmti, &class_count, &classes); 939 </example> 940 <p/> 941 When used from the C++ language: 942 functions are accessed as member functions of <code>jvmtiEnv</code>; 943 the environment pointer is not passed to the function call; for example: 944 <example> 945 jvmtiEnv *jvmti; 946 ... 947 jvmtiError err = jvmti->GetLoadedClasses(&class_count, &classes); 948 </example> 949 Unless otherwise stated, all examples and declarations in this 950 specification use the C language. 951 <p/> 952 A <jvmti/> environment can be obtained through the JNI Invocation API 953 <code>GetEnv</code> function: 954 <example> 955 jvmtiEnv *jvmti; 956 ... 957 (*jvm)->GetEnv(jvm, &jvmti, JVMTI_VERSION_1_0); 958 </example> 959 Each call to <code>GetEnv</code> 960 creates a new <jvmti/> connection and thus 961 a new <jvmti/> environment. 962 The <code>version</code> argument of <code>GetEnv</code> must be 963 a <jvmti/> version. 964 The returned environment may have a different version than the 965 requested version but the returned environment must be compatible. 966 <code>GetEnv</code> will return <code>JNI_EVERSION</code> if a 967 compatible version is not available, if <jvmti/> is not supported or 968 <jvmti/> is not supported in the current VM configuration. 969 Other interfaces may be added for creating <jvmti/> environments 970 in specific contexts. 971 Each environment has its own state (for example, 972 <functionlink id="SetEventNotificationMode">desired events</functionlink>, 973 <functionlink id="SetEventCallbacks">event handling functions</functionlink>, and 974 <functionlink id="AddCapabilities">capabilities</functionlink>). 975 An environment is released with 976 <functionlink id="DisposeEnvironment"></functionlink>. 977 Thus, unlike JNI which has one environment per thread, <jvmti/> environments work 978 across threads and are created dynamically. 979 </intro> 980 981 <intro id="functionReturn" label="Function Return Values"> 982 <jvmti/> functions always return an 983 <internallink id="ErrorSection">error code</internallink> via the 984 <datalink id="jvmtiError"/> function return value. 985 Some functions can return additional 986 values through pointers provided by the calling function. 987 In some cases, <jvmti/> functions allocate memory that your program must 988 explicitly deallocate. This is indicated in the individual <jvmti/> 989 function descriptions. Empty lists, arrays, sequences, etc are 990 returned as <code>NULL</code>. 991 <p/> 992 In the event that the <jvmti/> function encounters 993 an error (any return value other than <code>JVMTI_ERROR_NONE</code>) the values 994 of memory referenced by argument pointers is undefined, but no memory 995 will have been allocated and no global references will have been allocated. 996 If the error occurs because of invalid input, no action will have occurred. 997 </intro> 998 999 <intro id="refs" label="Managing JNI Object References"> 1000 <jvmti/> functions identify objects with JNI references 1001 (<datalink id="jobject"/> and <datalink id="jclass"/>) 1002 and their derivatives 1003 (<datalink id="jthread"/> and <datalink id="jthreadGroup"/>). 1004 References passed to 1005 <jvmti/> functions can be either global or local, but they must be 1006 strong references. All references returned by <jvmti/> functions are 1007 local references--these local references are created 1008 during the <jvmti/> call. 1009 Local references are a resource that must be managed (see the 1010 <externallink id="http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/functions.html#wp18654">JNI Documentation</externallink>). 1011 When threads return from native code all local references 1012 are freed. Note that some threads, including typical 1013 agent threads, will never return from native code. 1014 A thread is ensured the ability to create sixteen local 1015 references without the need for any explicit management. 1016 For threads executing a limited number of <jvmti/> calls before 1017 returning from native code 1018 (for example, threads processing events), 1019 it may be determined that no explicit management 1020 is needed. 1021 However, long running agent threads will need explicit 1022 local reference management--usually with the JNI functions 1023 <code>PushLocalFrame</code> and <code>PopLocalFrame</code>. 1024 Conversely, to preserve references beyond the 1025 return from native code, they must be converted to global references. 1026 These rules do not apply to <datalink id="jmethodID"/> and <datalink id="jfieldID"/> 1027 as they are not <datalink id="jobject"/>s. 1028 </intro> 1029 1030 <intro id="prereqState" label="Prerequisite State for Calling Functions"> 1031 Unless the function explicitly states that the agent must bring 1032 a thread or the VM to a particular state (for example, suspended), 1033 the <jvmti/> implementation is responsible for bringing the VM to a 1034 safe and consistent state for performing the function. 1035 </intro> 1036 1037 <intro id="functionsExceptions" label="Exceptions and Functions"> 1038 <jvmti/> functions never throw exceptions; error conditions are 1039 communicated via the 1040 <internallink id="functionReturn">function return value</internallink>. 1041 Any existing exception state is preserved across a call to a 1042 <jvmti/> function. 1043 See the 1044 <externallink 1045 id="http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/design.html#wp770" 1046 >Java Exceptions</externallink> 1047 section of the JNI specification for information on handling exceptions. 1048 </intro> 1049 1050 <category id="memory" label="Memory Management"> 1051 <intro> 1052 These functions provide for the allocation and deallocation of 1053 memory used by <jvmti/> functionality and can be used to provide 1054 working memory for agents. 1055 Memory managed by <jvmti/> is not compatible with other memory 1056 allocation libraries and mechanisms. 1057 </intro> 1058 1059 <function id="Allocate" jkernel="yes" phase="any" callbacksafe="safe" impl="notrace" num="46"> 1060 <synopsis>Allocate</synopsis> 1061 <description> 1062 Allocate an area of memory through the <jvmti/> allocator. 1063 The allocated 1064 memory should be freed with <functionlink id="Deallocate"></functionlink>. 1065 </description> 1066 <origin>jvmdi</origin> 1067 <capabilities> 1068 </capabilities> 1069 <parameters> 1070 <param id="size"> 1071 <jlong/> 1072 <description> 1073 The number of bytes to allocate. 1074 <rationale> 1075 <code>jlong</code> is used for compatibility with JVMDI. 1076 </rationale> 1077 </description> 1078 </param> 1079 <param id="mem_ptr"> 1080 <allocbuf incount="size"><uchar/></allocbuf> 1081 <description> 1082 On return, a pointer to the beginning of the allocated memory. 1083 If <code>size</code> is zero, <code>NULL</code> is returned. 1084 </description> 1085 </param> 1086 </parameters> 1087 <errors> 1088 <error id="JVMTI_ERROR_OUT_OF_MEMORY"> 1089 Memory request cannot be honored. 1090 </error> 1091 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 1092 <paramlink id="size"></paramlink> is less than zero. 1093 </error> 1094 </errors> 1095 </function> 1096 1097 <function id="Deallocate" jkernel="yes" phase="any" callbacksafe="safe" impl="notrace" num="47"> 1098 <synopsis>Deallocate</synopsis> 1099 <description> 1100 Deallocate <code>mem</code> using the <jvmti/> allocator. 1101 This function should 1102 be used to deallocate any memory allocated and returned 1103 by a <jvmti/> function 1104 (including memory allocated with <functionlink id="Allocate"></functionlink>). 1105 All allocated memory must be deallocated 1106 or the memory cannot be reclaimed. 1107 </description> 1108 <origin>jvmdi</origin> 1109 <capabilities> 1110 </capabilities> 1111 <parameters> 1112 <param id="mem"> 1113 <outbuf> 1114 <uchar/> 1115 <nullok>the call is ignored</nullok> 1116 </outbuf> 1117 <description> 1118 A pointer to the beginning of the allocated memory. 1119 Please ignore "On return, the elements are set." 1120 <todo>keep it from generating "On return, the elements are set"</todo> 1121 </description> 1122 </param> 1123 </parameters> 1124 <errors> 1125 </errors> 1126 </function> 1127 </category> 1128 1129 <category id="threadCategory" label="Thread"> 1130 <intro> 1131 </intro> 1132 1133 <function id="GetThreadState" num="17"> 1134 <synopsis>Get Thread State</synopsis> 1135 <description> 1136 Get the state of a thread. The state of the thread is represented by the 1137 answers to the hierarchical set of questions below: 1138 <ul type="circle"> 1139 <li><i>Alive?</i> 1140 <ul> 1141 <li>Not alive. 1142 <ul type="circle"> 1143 <li><i>Why not alive?</i> 1144 <ul> 1145 <li>New.</li> 1146 <li>Terminated (<datalink 1147 id="JVMTI_THREAD_STATE_TERMINATED"><code>JVMTI_THREAD_STATE_TERMINATED</code></datalink>)</li> 1148 </ul> 1149 </li> 1150 </ul> 1151 </li> 1152 <li>Alive (<datalink 1153 id="JVMTI_THREAD_STATE_ALIVE"><code>JVMTI_THREAD_STATE_ALIVE</code></datalink>) 1154 <ul type="circle"> 1155 <li><i>Suspended?</i> 1156 <ul> 1157 <li>Suspended (<datalink 1158 id="JVMTI_THREAD_STATE_SUSPENDED"><code>JVMTI_THREAD_STATE_SUSPENDED</code></datalink>)</li> 1159 <li>Not suspended</li> 1160 </ul> 1161 </li> 1162 <li><i>Interrupted?</i> 1163 <ul> 1164 <li>Interrupted (<datalink 1165 id="JVMTI_THREAD_STATE_INTERRUPTED"><code>JVMTI_THREAD_STATE_INTERRUPTED</code></datalink>)</li> 1166 <li>Not interrupted.</li> 1167 </ul> 1168 </li> 1169 <li><i>In native?</i> 1170 <ul> 1171 <li>In native code (<datalink 1172 id="JVMTI_THREAD_STATE_IN_NATIVE"><code>JVMTI_THREAD_STATE_IN_NATIVE</code></datalink>)</li> 1173 <li>In Java programming language code</li> 1174 </ul> 1175 </li> 1176 <li><i>What alive state?</i> 1177 <ul> 1178 <li>Runnable (<datalink 1179 id="JVMTI_THREAD_STATE_RUNNABLE"><code>JVMTI_THREAD_STATE_RUNNABLE</code></datalink>)</li> 1180 <li>Blocked (<datalink 1181 id="JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER"><code>JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER</code></datalink>)</li> 1182 <li>Waiting (<datalink 1183 id="JVMTI_THREAD_STATE_WAITING"><code>JVMTI_THREAD_STATE_WAITING</code></datalink>) 1184 <ul type="circle"> 1185 <li><i>Timed wait?</i> 1186 <ul> 1187 <li>Indefinite (<datalink 1188 id="JVMTI_THREAD_STATE_WAITING_INDEFINITELY"><code>JVMTI_THREAD_STATE_WAITING_INDEFINITELY</code></datalink></li> 1189 <li>Timed (<datalink 1190 id="JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT"><code>JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT</code></datalink>)</li> 1191 </ul> 1192 </li> 1193 <li><i>Why waiting?</i> 1194 <ul> 1195 <li>Object.wait (<datalink 1196 id="JVMTI_THREAD_STATE_IN_OBJECT_WAIT"><code>JVMTI_THREAD_STATE_IN_OBJECT_WAIT</code></datalink>)</li> 1197 <li>LockSupport.park (<datalink 1198 id="JVMTI_THREAD_STATE_PARKED"><code>JVMTI_THREAD_STATE_PARKED</code></datalink>)</li> 1199 <li>Sleeping (<datalink 1200 id="JVMTI_THREAD_STATE_SLEEPING"><code>JVMTI_THREAD_STATE_SLEEPING</code></datalink>)</li> 1201 </ul> 1202 </li> 1203 </ul> 1204 </li> 1205 </ul> 1206 </li> 1207 </ul> 1208 </li> 1209 </ul> 1210 </li> 1211 </ul> 1212 <p/> 1213 The answers are represented by the following bit vector. 1214 <constants id="jvmtiThreadState" label="Thread State Flags" kind="bits"> 1215 <constant id="JVMTI_THREAD_STATE_ALIVE" num="0x0001"> 1216 Thread is alive. Zero if thread is new (not started) or terminated. 1217 </constant> 1218 <constant id="JVMTI_THREAD_STATE_TERMINATED" num="0x0002"> 1219 Thread has completed execution. 1220 </constant> 1221 <constant id="JVMTI_THREAD_STATE_RUNNABLE" num="0x0004"> 1222 Thread is runnable. 1223 </constant> 1224 <constant id="JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER" num="0x0400"> 1225 Thread is waiting to enter a synchronization block/method or, 1226 after an <code>Object.wait()</code>, waiting to re-enter a 1227 synchronization block/method. 1228 </constant> 1229 <constant id="JVMTI_THREAD_STATE_WAITING" num="0x0080"> 1230 Thread is waiting. 1231 </constant> 1232 <constant id="JVMTI_THREAD_STATE_WAITING_INDEFINITELY" num="0x0010"> 1233 Thread is waiting without a timeout. 1234 For example, <code>Object.wait()</code>. 1235 </constant> 1236 <constant id="JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT" num="0x0020"> 1237 Thread is waiting with a maximum time to wait specified. 1238 For example, <code>Object.wait(long)</code>. 1239 </constant> 1240 <constant id="JVMTI_THREAD_STATE_SLEEPING" num="0x0040"> 1241 Thread is sleeping -- <code>Thread.sleep(long)</code>. 1242 </constant> 1243 <constant id="JVMTI_THREAD_STATE_IN_OBJECT_WAIT" num="0x0100"> 1244 Thread is waiting on an object monitor -- <code>Object.wait</code>. 1245 </constant> 1246 <constant id="JVMTI_THREAD_STATE_PARKED" num="0x0200"> 1247 Thread is parked, for example: <code>LockSupport.park</code>, 1248 <code>LockSupport.parkUtil</code> and <code>LockSupport.parkNanos</code>. 1249 </constant> 1250 <constant id="JVMTI_THREAD_STATE_SUSPENDED" num="0x100000"> 1251 Thread suspended. 1252 <code>java.lang.Thread.suspend()</code> 1253 or a <jvmti/> suspend function 1254 (such as <functionlink id="SuspendThread"></functionlink>) 1255 has been called on the thread. If this bit 1256 is set, the other bits refer to the thread state before suspension. 1257 </constant> 1258 <constant id="JVMTI_THREAD_STATE_INTERRUPTED" num="0x200000"> 1259 Thread has been interrupted. 1260 </constant> 1261 <constant id="JVMTI_THREAD_STATE_IN_NATIVE" num="0x400000"> 1262 Thread is in native code--that is, a native method is running 1263 which has not called back into the VM or Java programming 1264 language code. 1265 <p/> 1266 This flag is not set when running VM compiled Java programming 1267 language code nor is it set when running VM code or 1268 VM support code. Native VM interface functions, such as JNI and 1269 <jvmti/> functions, may be implemented as VM code. 1270 </constant> 1271 <constant id="JVMTI_THREAD_STATE_VENDOR_1" num="0x10000000"> 1272 Defined by VM vendor. 1273 </constant> 1274 <constant id="JVMTI_THREAD_STATE_VENDOR_2" num="0x20000000"> 1275 Defined by VM vendor. 1276 </constant> 1277 <constant id="JVMTI_THREAD_STATE_VENDOR_3" num="0x40000000"> 1278 Defined by VM vendor. 1279 </constant> 1280 </constants> 1281 The following definitions are used to convert <jvmti/> thread state 1282 to <code>java.lang.Thread.State</code> style states. 1283 <constants id="jvmtiJavaLangThreadState" label="java.lang.Thread.State Conversion Masks" kind="bits"> 1284 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_MASK" 1285 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"> 1286 Mask the state with this before comparison 1287 </constant> 1288 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_NEW" 1289 num="0"> 1290 <code>java.lang.Thread.State.NEW</code> 1291 </constant> 1292 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_TERMINATED" 1293 num="JVMTI_THREAD_STATE_TERMINATED"> 1294 <code>java.lang.Thread.State.TERMINATED</code> 1295 </constant> 1296 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_RUNNABLE" 1297 num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_RUNNABLE"> 1298 <code>java.lang.Thread.State.RUNNABLE</code> 1299 </constant> 1300 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_BLOCKED" 1301 num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER"> 1302 <code>java.lang.Thread.State.BLOCKED</code> 1303 </constant> 1304 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_WAITING" 1305 num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_INDEFINITELY"> 1306 <code>java.lang.Thread.State.WAITING</code> 1307 </constant> 1308 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_TIMED_WAITING" 1309 num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT"> 1310 <code>java.lang.Thread.State.TIMED_WAITING</code> 1311 </constant> 1312 </constants> 1313 <b>Rules</b> 1314 <p/> 1315 There can be no more than one answer to a question, although there can be no 1316 answer (because the answer is unknown, does not apply, or none of the answers is 1317 correct). An answer is set only when the enclosing answers match. 1318 That is, no more than one of 1319 <ul type="circle"> 1320 <li><code>JVMTI_THREAD_STATE_RUNNABLE</code></li> 1321 <li><code>JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER</code></li> 1322 <li><code>JVMTI_THREAD_STATE_WAITING</code></li> 1323 </ul> 1324 can be set (a <tm>J2SE</tm> compliant implementation will always set 1325 one of these if <code>JVMTI_THREAD_STATE_ALIVE</code> is set). 1326 And if any of these are set, the enclosing answer 1327 <code>JVMTI_THREAD_STATE_ALIVE</code> is set. 1328 No more than one of 1329 <ul type="circle"> 1330 <li><code>JVMTI_THREAD_STATE_WAITING_INDEFINITELY</code></li> 1331 <li><code>JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT</code></li> 1332 </ul> 1333 can be set (a <tm>J2SE</tm> compliant implementation will always set 1334 one of these if <code>JVMTI_THREAD_STATE_WAITING</code> is set). 1335 And if either is set, the enclosing answers 1336 <code>JVMTI_THREAD_STATE_ALIVE</code> and 1337 <code>JVMTI_THREAD_STATE_WAITING</code> are set. 1338 No more than one of 1339 <ul type="circle"> 1340 <li><code>JVMTI_THREAD_STATE_IN_OBJECT_WAIT</code></li> 1341 <li><code>JVMTI_THREAD_STATE_PARKED</code></li> 1342 <li><code>JVMTI_THREAD_STATE_SLEEPING</code></li> 1343 </ul> 1344 can be set. And if any of these is set, the enclosing answers 1345 <code>JVMTI_THREAD_STATE_ALIVE</code> and 1346 <code>JVMTI_THREAD_STATE_WAITING</code> are set. 1347 Also, if <code>JVMTI_THREAD_STATE_SLEEPING</code> is set, 1348 then <code>JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT</code> is set. 1349 If a state <i>A</i> is implemented using the mechanism of 1350 state <i>B</i> then it is state <i>A</i> which 1351 is returned by this function. 1352 For example, if <code>Thread.sleep(long)</code> 1353 is implemented using <code>Object.wait(long)</code> 1354 then it is still <code>JVMTI_THREAD_STATE_SLEEPING</code> 1355 which is returned. 1356 More than one of 1357 <ul type="circle"> 1358 <li><code>JVMTI_THREAD_STATE_SUSPENDED</code></li> 1359 <li><code>JVMTI_THREAD_STATE_INTERRUPTED</code></li> 1360 <li><code>JVMTI_THREAD_STATE_IN_NATIVE</code></li> 1361 </ul> 1362 can be set, but if any is set, 1363 <code>JVMTI_THREAD_STATE_ALIVE</code> is set. 1364 <p/> 1365 And finally, 1366 <code>JVMTI_THREAD_STATE_TERMINATED</code> cannot be set unless 1367 <code>JVMTI_THREAD_STATE_ALIVE</code> is not set. 1368 <p/> 1369 The thread state representation is designed for extension in future versions 1370 of the specification; thread state values should be used accordingly, that is 1371 they should not be used as ordinals. 1372 Most queries can be made by testing a single bit, if use in a switch statement is desired, 1373 the state bits should be masked with the interesting bits. 1374 All bits not defined above are reserved for future use. 1375 A VM, compliant to the current specification, must set reserved bits to zero. 1376 An agent should ignore reserved bits -- 1377 they should not be assumed to be zero and thus should not be included in comparisons. 1378 <p/> 1379 <b>Examples</b> 1380 <p/> 1381 Note that the values below exclude reserved and vendor bits. 1382 <p/> 1383 The state of a thread blocked at a <code>synchronized</code>-statement would be: 1384 <example> 1385 JVMTI_THREAD_STATE_ALIVE + JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER 1386 </example> 1387 The state of a thread which hasn't started yet would be: 1388 <example> 1389 0 1390 </example> 1391 The state of a thread at a <code>Object.wait(3000)</code> would be: 1392 <example> 1393 JVMTI_THREAD_STATE_ALIVE + JVMTI_THREAD_STATE_WAITING + 1394 JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT + 1395 JVMTI_THREAD_STATE_MONITOR_WAITING 1396 </example> 1397 The state of a thread suspended while runnable would be: 1398 <example> 1399 JVMTI_THREAD_STATE_ALIVE + JVMTI_THREAD_STATE_RUNNABLE + JVMTI_THREAD_STATE_SUSPENDED 1400 </example> 1401 <p/> 1402 <b>Testing the State</b> 1403 <p/> 1404 In most cases, the thread state can be determined by testing the one bit corresponding 1405 to that question. For example, the code to test if a thread is sleeping: 1406 <example> 1407 jint state; 1408 jvmtiError err; 1409 1410 err = (*jvmti)->GetThreadState(jvmti, thread, &state); 1411 if (err == JVMTI_ERROR_NONE) { 1412 if (state & JVMTI_THREAD_STATE_SLEEPING) { ... 1413 </example> 1414 <p/> 1415 For waiting (that is, in <code>Object.wait</code>, parked, or sleeping) it would be: 1416 <example> 1417 if (state & JVMTI_THREAD_STATE_WAITING) { ... 1418 </example> 1419 For some states, more than one bit will need to be tested as is the case 1420 when testing if a thread has not yet been started: 1421 <example> 1422 if ((state & (JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_TERMINATED)) == 0) { ... 1423 </example> 1424 To distinguish timed from untimed <code>Object.wait</code>: 1425 <example> 1426 if (state & JVMTI_THREAD_STATE_IN_OBJECT_WAIT) { 1427 if (state & JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT) { 1428 printf("in Object.wait(long timeout)\n"); 1429 } else { 1430 printf("in Object.wait()\n"); 1431 } 1432 } 1433 </example> 1434 <p/> 1435 <b>Relationship to <code>java.lang.Thread.State</code></b> 1436 <p/> 1437 The thread state represented by <code>java.lang.Thread.State</code> 1438 returned from <code>java.lang.Thread.getState()</code> is a subset of the 1439 information returned from this function. 1440 The corresponding <code>java.lang.Thread.State</code> can be determined 1441 by using the provided conversion masks. 1442 For example, this returns the name of the <code>java.lang.Thread.State</code> thread state: 1443 <example> 1444 err = (*jvmti)->GetThreadState(jvmti, thread, &state); 1445 abortOnError(err); 1446 switch (state & JVMTI_JAVA_LANG_THREAD_STATE_MASK) { 1447 case JVMTI_JAVA_LANG_THREAD_STATE_NEW: 1448 return "NEW"; 1449 case JVMTI_JAVA_LANG_THREAD_STATE_TERMINATED: 1450 return "TERMINATED"; 1451 case JVMTI_JAVA_LANG_THREAD_STATE_RUNNABLE: 1452 return "RUNNABLE"; 1453 case JVMTI_JAVA_LANG_THREAD_STATE_BLOCKED: 1454 return "BLOCKED"; 1455 case JVMTI_JAVA_LANG_THREAD_STATE_WAITING: 1456 return "WAITING"; 1457 case JVMTI_JAVA_LANG_THREAD_STATE_TIMED_WAITING: 1458 return "TIMED_WAITING"; 1459 } 1460 </example> 1461 </description> 1462 <origin>new</origin> 1463 <capabilities> 1464 </capabilities> 1465 <parameters> 1466 <param id="thread"> 1467 <jthread null="current" started="maybe" impl="noconvert"/> 1468 <description> 1469 The thread to query. 1470 </description> 1471 </param> 1472 <param id="thread_state_ptr"> 1473 <outptr><jint/></outptr> 1474 <description> 1475 On return, points to state flags, 1476 as defined by the <internallink id="jvmtiThreadState">Thread State Flags</internallink>. 1477 </description> 1478 </param> 1479 </parameters> 1480 <errors> 1481 </errors> 1482 </function> 1483 1484 <function id="GetCurrentThread" phase="start" num="18" since="1.1"> 1485 <synopsis>Get Current Thread</synopsis> 1486 <description> 1487 Get the current thread. 1488 The current thread is the Java programming language thread which has called the function. 1489 <p/> 1490 Note that most <jvmti/> functions that take a thread 1491 as an argument will accept <code>NULL</code> to mean 1492 the current thread. 1493 </description> 1494 <origin>new</origin> 1495 <capabilities> 1496 </capabilities> 1497 <parameters> 1498 <param id="thread_ptr"> 1499 <outptr><jthread/></outptr> 1500 <description> 1501 On return, points to the current thread. 1502 </description> 1503 </param> 1504 </parameters> 1505 <errors> 1506 </errors> 1507 </function> 1508 1509 <function id="GetAllThreads" num="4"> 1510 <synopsis>Get All Threads</synopsis> 1511 <description> 1512 Get all live threads. 1513 The threads are Java programming language threads; 1514 that is, threads that are attached to the VM. 1515 A thread is live if <code>java.lang.Thread.isAlive()</code> 1516 would return <code>true</code>, that is, the thread has 1517 been started and has not yet died. 1518 The universe of threads is determined by the context of the <jvmti/> 1519 environment, which typically is all threads attached to the VM. 1520 Note that this includes <jvmti/> agent threads 1521 (see <functionlink id="RunAgentThread"/>). 1522 </description> 1523 <origin>jvmdi</origin> 1524 <capabilities> 1525 </capabilities> 1526 <parameters> 1527 <param id="threads_count_ptr"> 1528 <outptr><jint/></outptr> 1529 <description> 1530 On return, points to the number of running threads. 1531 </description> 1532 </param> 1533 <param id="threads_ptr"> 1534 <allocbuf outcount="threads_count_ptr"><jthread/></allocbuf> 1535 <description> 1536 On return, points to an array of references, one 1537 for each running thread. 1538 </description> 1539 </param> 1540 </parameters> 1541 <errors> 1542 </errors> 1543 </function> 1544 1545 <function id="SuspendThread" num="5"> 1546 <synopsis>Suspend Thread</synopsis> 1547 <description> 1548 Suspend the specified thread. If the calling thread is specified, 1549 this function will not return until some other thread calls 1550 <functionlink id="ResumeThread"></functionlink>. 1551 If the thread is currently suspended, this function 1552 does nothing and returns an error. 1553 </description> 1554 <origin>jvmdi</origin> 1555 <capabilities> 1556 <required id="can_suspend"></required> 1557 </capabilities> 1558 <parameters> 1559 <param id="thread"> 1560 <jthread null="current"/> 1561 <description> 1562 The thread to suspend. 1563 </description> 1564 </param> 1565 </parameters> 1566 <errors> 1567 <error id="JVMTI_ERROR_THREAD_SUSPENDED"> 1568 Thread already suspended. 1569 </error> 1570 </errors> 1571 </function> 1572 1573 <elide> 1574 <function id="SuspendAllThreads" num="101"> 1575 <synopsis>Suspend All Threads</synopsis> 1576 <description> 1577 <issue> 1578 There has been no explicit call for this function, and it will 1579 thus be removed if there is no interest. 1580 </issue> 1581 Suspend all live threads except: 1582 <ul> 1583 <li>already suspended threads</li> 1584 <li>those listed in <paramlink id="except_list"></paramlink></li> 1585 <li>certain system (non application) threads, as determined 1586 by the VM implementation</li> 1587 </ul> 1588 The threads are Java programming language threads; 1589 native threads which are not attached to the VM are not 1590 Java programming language threads. 1591 A thread is live if <code>java.lang.Thread.isAlive()</code> 1592 would return <code>true</code>, that is, the thread has 1593 been started and has not yet died. 1594 The universe of threads is determined 1595 by the context of the <jvmti/> 1596 environment, which, typically, is all threads attached to the VM, 1597 except critical VM internal threads and <jvmti/> agent threads 1598 (see <functionlink id="RunAgentThread"/>). 1599 <p/> 1600 If the calling thread is specified, 1601 all other threads are suspended first then the caller thread is suspended - 1602 this function will not return until some other thread calls 1603 <functionlink id="ResumeThread"></functionlink>. 1604 <p/> 1605 The list of actually 1606 suspended threads is returned in 1607 <paramlink id="suspended_list_ptr"></paramlink>. 1608 Suspension is as defined in <functionlink id="SuspendThread"></functionlink>. 1609 <functionlink id="ResumeThreadList"></functionlink> 1610 can be used to resume the suspended threads. 1611 </description> 1612 <origin>new</origin> 1613 <capabilities> 1614 <required id="can_suspend"></required> 1615 </capabilities> 1616 <parameters> 1617 <param id="except_count"> 1618 <jint min="0"/> 1619 <description> 1620 The number of threads in the list of threads not to be suspended. 1621 </description> 1622 </param> 1623 <param id="except_list"> 1624 <inbuf incount="except_count"> 1625 <jthread/> 1626 <nullok>not an error if <code>except_count == 0</code></nullok> 1627 </inbuf> 1628 <description> 1629 The list of threads not to be suspended. 1630 </description> 1631 </param> 1632 <param id="suspended_count_ptr"> 1633 <outptr><jint/></outptr> 1634 <description> 1635 On return, points to the number of threads suspended by this call. 1636 </description> 1637 </param> 1638 <param id="suspended_list_ptr"> 1639 <allocbuf outcount="suspended_count_ptr"><jthread/></allocbuf> 1640 <description> 1641 On return, points to an array of references, one 1642 for each thread suspended. 1643 </description> 1644 </param> 1645 </parameters> 1646 <errors> 1647 <error id="JVMTI_ERROR_INVALID_THREAD"> 1648 A thread in <paramlink id="except_list"></paramlink> was invalid. 1649 </error> 1650 <error id="JVMTI_ERROR_NULL_POINTER"> 1651 Both <paramlink id="except_list"></paramlink> was <code>NULL</code> 1652 and <paramlink id="except_count"></paramlink> was non-zero. 1653 </error> 1654 </errors> 1655 </function> 1656 </elide> 1657 1658 <function id="SuspendThreadList" num="92"> 1659 <synopsis>Suspend Thread List</synopsis> 1660 <description> 1661 Suspend the <paramlink id="request_count"></paramlink> 1662 threads specified in the 1663 <paramlink id="request_list"></paramlink> array. 1664 Threads may be resumed with 1665 <functionlink id="ResumeThreadList"></functionlink> or 1666 <functionlink id="ResumeThread"></functionlink>. 1667 If the calling thread is specified in the 1668 <paramlink id="request_list"></paramlink> array, this function will 1669 not return until some other thread resumes it. 1670 Errors encountered in the suspension of a thread 1671 are returned in the <paramlink id="results"></paramlink> 1672 array, <b>not</b> in the return value of this function. 1673 Threads that are currently suspended do not change state. 1674 </description> 1675 <origin>jvmdi</origin> 1676 <capabilities> 1677 <required id="can_suspend"></required> 1678 </capabilities> 1679 <parameters> 1680 <param id="request_count"> 1681 <jint min="0"/> 1682 <description> 1683 The number of threads to suspend. 1684 </description> 1685 </param> 1686 <param id="request_list"> 1687 <inbuf incount="request_count"><jthread/></inbuf> 1688 <description> 1689 The list of threads to suspend. 1690 </description> 1691 </param> 1692 <param id="results"> 1693 <outbuf incount="request_count"><enum>jvmtiError</enum></outbuf> 1694 <description> 1695 An agent supplied array of 1696 <paramlink id="request_count"></paramlink> elements. 1697 On return, filled with the error code for 1698 the suspend of the corresponding thread. 1699 The error code will be 1700 <errorlink id="JVMTI_ERROR_NONE"></errorlink> 1701 if the thread was suspended by this call. 1702 Possible error codes are those specified 1703 for <functionlink id="SuspendThread"></functionlink>. 1704 </description> 1705 </param> 1706 </parameters> 1707 <errors> 1708 </errors> 1709 </function> 1710 1711 <function id="ResumeThread" num="6"> 1712 <synopsis>Resume Thread</synopsis> 1713 <description> 1714 Resume a suspended thread. 1715 Any threads currently suspended through 1716 a <jvmti/> suspend function (eg. 1717 <functionlink id="SuspendThread"></functionlink>) 1718 or <code>java.lang.Thread.suspend()</code> 1719 will resume execution; 1720 all other threads are unaffected. 1721 </description> 1722 <origin>jvmdi</origin> 1723 <capabilities> 1724 <required id="can_suspend"></required> 1725 </capabilities> 1726 <parameters> 1727 <param id="thread"> 1728 <jthread/> 1729 <description> 1730 The thread to resume. 1731 </description> 1732 </param> 1733 </parameters> 1734 <errors> 1735 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 1736 Thread was not suspended. 1737 </error> 1738 <error id="JVMTI_ERROR_INVALID_TYPESTATE"> 1739 The state of the thread has been modified, and is now inconsistent. 1740 </error> 1741 </errors> 1742 </function> 1743 1744 <function id="ResumeThreadList" num="93"> 1745 <synopsis>Resume Thread List</synopsis> 1746 <description> 1747 Resume the <paramlink id="request_count"></paramlink> 1748 threads specified in the 1749 <paramlink id="request_list"></paramlink> array. 1750 Any thread suspended through 1751 a <jvmti/> suspend function (eg. 1752 <functionlink id="SuspendThreadList"></functionlink>) 1753 or <code>java.lang.Thread.suspend()</code> 1754 will resume execution. 1755 </description> 1756 <origin>jvmdi</origin> 1757 <capabilities> 1758 <required id="can_suspend"></required> 1759 </capabilities> 1760 <parameters> 1761 <param id="request_count"> 1762 <jint min="0"/> 1763 <description> 1764 The number of threads to resume. 1765 </description> 1766 </param> 1767 <param id="request_list"> 1768 <inbuf incount="request_count"><jthread/></inbuf> 1769 <description> 1770 The threads to resume. 1771 </description> 1772 </param> 1773 <param id="results"> 1774 <outbuf incount="request_count"><enum>jvmtiError</enum></outbuf> 1775 <description> 1776 An agent supplied array of 1777 <paramlink id="request_count"></paramlink> elements. 1778 On return, filled with the error code for 1779 the resume of the corresponding thread. 1780 The error code will be 1781 <errorlink id="JVMTI_ERROR_NONE"></errorlink> 1782 if the thread was suspended by this call. 1783 Possible error codes are those specified 1784 for <functionlink id="ResumeThread"></functionlink>. 1785 </description> 1786 </param> 1787 </parameters> 1788 <errors> 1789 </errors> 1790 </function> 1791 1792 <function id="StopThread" num="7"> 1793 <synopsis>Stop Thread</synopsis> 1794 <description> 1795 Send the specified asynchronous exception to the specified thread 1796 (similar to <code>java.lang.Thread.stop</code>). 1797 Normally, this function is used to kill the specified thread with an 1798 instance of the exception <code>ThreadDeath</code>. 1799 </description> 1800 <origin>jvmdi</origin> 1801 <capabilities> 1802 <required id="can_signal_thread"></required> 1803 </capabilities> 1804 <parameters> 1805 <param id="thread"> 1806 <jthread/> 1807 <description> 1808 The thread to stop. 1809 </description> 1810 </param> 1811 <param id="exception"> 1812 <jobject/> 1813 <description> 1814 The asynchronous exception object. 1815 </description> 1816 </param> 1817 </parameters> 1818 <errors> 1819 </errors> 1820 </function> 1821 1822 <function id="InterruptThread" num="8"> 1823 <synopsis>Interrupt Thread</synopsis> 1824 <description> 1825 Interrupt the specified thread 1826 (similar to <code>java.lang.Thread.interrupt</code>). 1827 </description> 1828 <origin>jvmdi</origin> 1829 <capabilities> 1830 <required id="can_signal_thread"></required> 1831 </capabilities> 1832 <parameters> 1833 <param id="thread"> 1834 <jthread impl="noconvert"/> 1835 <description> 1836 The thread to interrupt. 1837 </description> 1838 </param> 1839 </parameters> 1840 <errors> 1841 </errors> 1842 </function> 1843 1844 <function id="GetThreadInfo" num="9"> 1845 <synopsis>Get Thread Info</synopsis> 1846 <typedef id="jvmtiThreadInfo" label="Thread information structure"> 1847 <field id="name"> 1848 <allocfieldbuf><char/></allocfieldbuf> 1849 <description> 1850 The thread name, encoded as a 1851 <internallink id="mUTF">modified UTF-8</internallink> string. 1852 </description> 1853 </field> 1854 <field id="priority"> 1855 <jint/> 1856 <description> 1857 The thread priority. See the thread priority constants: 1858 <datalink id="jvmtiThreadPriority"></datalink>. 1859 </description> 1860 </field> 1861 <field id="is_daemon"> 1862 <jboolean/> 1863 <description> 1864 Is this a daemon thread? 1865 </description> 1866 </field> 1867 <field id="thread_group"> 1868 <jthreadGroup/> 1869 <description> 1870 The thread group to which this thread belongs. 1871 <code>NULL</code> if the thread has died. 1872 </description> 1873 </field> 1874 <field id="context_class_loader"> 1875 <jobject/> 1876 <description> 1877 The context class loader associated with this thread. 1878 </description> 1879 </field> 1880 </typedef> 1881 <description> 1882 Get thread information. The fields of the <datalink id="jvmtiThreadInfo"/> structure 1883 are filled in with details of the specified thread. 1884 </description> 1885 <origin>jvmdi</origin> 1886 <capabilities> 1887 </capabilities> 1888 <parameters> 1889 <param id="thread"> 1890 <jthread null="current" impl="noconvert" started="maybe"/> 1891 <description> 1892 The thread to query. 1893 </description> 1894 </param> 1895 <param id="info_ptr"> 1896 <outptr><struct>jvmtiThreadInfo</struct></outptr> 1897 <description> 1898 On return, filled with information describing the specified thread. 1899 </description> 1900 </param> 1901 </parameters> 1902 <errors> 1903 </errors> 1904 </function> 1905 1906 <function id="GetOwnedMonitorInfo" num="10"> 1907 <synopsis>Get Owned Monitor Info</synopsis> 1908 <description> 1909 Get information about the monitors owned by the 1910 specified thread. 1911 </description> 1912 <origin>jvmdiClone</origin> 1913 <capabilities> 1914 <required id="can_get_owned_monitor_info"></required> 1915 </capabilities> 1916 <parameters> 1917 <param id="thread"> 1918 <jthread null="current"/> 1919 <description> 1920 The thread to query. 1921 </description> 1922 </param> 1923 <param id="owned_monitor_count_ptr"> 1924 <outptr><jint/></outptr> 1925 <description> 1926 The number of monitors returned. 1927 </description> 1928 </param> 1929 <param id="owned_monitors_ptr"> 1930 <allocbuf outcount="owned_monitor_count_ptr"><jobject/></allocbuf> 1931 <description> 1932 The array of owned monitors. 1933 </description> 1934 </param> 1935 </parameters> 1936 <errors> 1937 </errors> 1938 </function> 1939 1940 <function id="GetOwnedMonitorStackDepthInfo" num="153" since="1.1"> 1941 <synopsis>Get Owned Monitor Stack Depth Info</synopsis> 1942 <typedef id="jvmtiMonitorStackDepthInfo" 1943 label="Monitor stack depth information structure"> 1944 <field id="monitor"> 1945 <jobject/> 1946 <description> 1947 The owned monitor. 1948 </description> 1949 </field> 1950 <field id="stack_depth"> 1951 <jint/> 1952 <description> 1953 The stack depth. Corresponds to the stack depth used in the 1954 <internallink id="stack">Stack Frame functions</internallink>. 1955 That is, zero is the current frame, one is the frame which 1956 called the current frame. And it is negative one if the 1957 implementation cannot determine the stack depth (e.g., for 1958 monitors acquired by JNI <code>MonitorEnter</code>). 1959 </description> 1960 </field> 1961 </typedef> 1962 <description> 1963 Get information about the monitors owned by the 1964 specified thread and the depth of the stack frame which locked them. 1965 </description> 1966 <origin>new</origin> 1967 <capabilities> 1968 <required id="can_get_owned_monitor_stack_depth_info"></required> 1969 </capabilities> 1970 <parameters> 1971 <param id="thread"> 1972 <jthread null="current"/> 1973 <description> 1974 The thread to query. 1975 </description> 1976 </param> 1977 <param id="monitor_info_count_ptr"> 1978 <outptr><jint/></outptr> 1979 <description> 1980 The number of monitors returned. 1981 </description> 1982 </param> 1983 <param id="monitor_info_ptr"> 1984 <allocbuf outcount="monitor_info_count_ptr"> 1985 <struct>jvmtiMonitorStackDepthInfo</struct> 1986 </allocbuf> 1987 <description> 1988 The array of owned monitor depth information. 1989 </description> 1990 </param> 1991 </parameters> 1992 <errors> 1993 </errors> 1994 </function> 1995 1996 <function id="GetCurrentContendedMonitor" num="11"> 1997 <synopsis>Get Current Contended Monitor</synopsis> 1998 <description> 1999 Get the object, if any, whose monitor the specified thread is waiting to 2000 enter or waiting to regain through <code>java.lang.Object.wait</code>. 2001 </description> 2002 <origin>jvmdi</origin> 2003 <capabilities> 2004 <required id="can_get_current_contended_monitor"></required> 2005 </capabilities> 2006 <parameters> 2007 <param id="thread"> 2008 <jthread null="current"/> 2009 <description> 2010 The thread to query. 2011 </description> 2012 </param> 2013 <param id="monitor_ptr"> 2014 <outptr><jobject/></outptr> 2015 <description> 2016 On return, filled with the current contended monitor, or 2017 NULL if there is none. 2018 </description> 2019 </param> 2020 </parameters> 2021 <errors> 2022 </errors> 2023 </function> 2024 2025 <callback id="jvmtiStartFunction"> 2026 <void/> 2027 <synopsis>Agent Start Function</synopsis> 2028 <description> 2029 Agent supplied callback function. 2030 This function is the entry point for an agent thread 2031 started with 2032 <functionlink id="RunAgentThread"></functionlink>. 2033 </description> 2034 <parameters> 2035 <param id="jvmti_env"> 2036 <outptr> 2037 <struct>jvmtiEnv</struct> 2038 </outptr> 2039 <description> 2040 The <jvmti/> environment. 2041 </description> 2042 </param> 2043 <param id="jni_env"> 2044 <outptr> 2045 <struct>JNIEnv</struct> 2046 </outptr> 2047 <description> 2048 The JNI environment. 2049 </description> 2050 </param> 2051 <param id="arg"> 2052 <outptr> 2053 <void/> 2054 </outptr> 2055 <description> 2056 The <code>arg</code> parameter passed to 2057 <functionlink id="RunAgentThread"></functionlink>. 2058 </description> 2059 </param> 2060 </parameters> 2061 </callback> 2062 2063 <function id="RunAgentThread" num="12"> 2064 <synopsis>Run Agent Thread</synopsis> 2065 <description> 2066 Starts the execution of an agent thread. with the specified native function. 2067 The parameter <paramlink id="arg"></paramlink> is forwarded on to the 2068 <functionlink id="jvmtiStartFunction">start function</functionlink> 2069 (specified with <paramlink id="proc"></paramlink>) as its single argument. 2070 This function allows the creation of agent threads 2071 for handling communication with another process or for handling events 2072 without the need to load a special subclass of <code>java.lang.Thread</code> or 2073 implementer of <code>java.lang.Runnable</code>. 2074 Instead, the created thread can run entirely in native code. 2075 However, the created thread does require a newly created instance 2076 of <code>java.lang.Thread</code> (referenced by the argument <code>thread</code>) to 2077 which it will be associated. 2078 The thread object can be created with JNI calls. 2079 <p/> 2080 The following common thread priorities are provided for your convenience: 2081 <constants id="jvmtiThreadPriority" label="Thread Priority Constants" kind="const"> 2082 <constant id="JVMTI_THREAD_MIN_PRIORITY" num="1"> 2083 Minimum possible thread priority 2084 </constant> 2085 <constant id="JVMTI_THREAD_NORM_PRIORITY" num="5"> 2086 Normal thread priority 2087 </constant> 2088 <constant id="JVMTI_THREAD_MAX_PRIORITY" num="10"> 2089 Maximum possible thread priority 2090 </constant> 2091 </constants> 2092 <p/> 2093 The new thread is started as a daemon thread with the specified 2094 <paramlink id="priority"></paramlink>. 2095 If enabled, a <eventlink id="ThreadStart"/> event will be sent. 2096 <p/> 2097 Since the thread has been started, the thread will be live when this function 2098 returns, unless the thread has died immediately. 2099 <p/> 2100 The thread group of the thread is ignored -- specifically, the thread is not 2101 added to the thread group and the thread is not seen on queries of the thread 2102 group at either the Java programming language or <jvmti/> levels. 2103 <p/> 2104 The thread is not visible to Java programming language queries but is 2105 included in <jvmti/> queries (for example, 2106 <functionlink id="GetAllThreads"/> and 2107 <functionlink id="GetAllStackTraces"/>). 2108 <p/> 2109 Upon execution of <code>proc</code>, the new thread will be attached to the 2110 VM--see the JNI documentation on 2111 <externallink id="http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/invocation.html#wp1060" 2112 >Attaching to the VM</externallink>. 2113 </description> 2114 <origin>jvmdiClone</origin> 2115 <capabilities> 2116 </capabilities> 2117 <parameters> 2118 <param id="thread"> 2119 <jthread impl="noconvert" started="no"/> 2120 <description> 2121 The thread to run. 2122 </description> 2123 </param> 2124 <param id="proc"> 2125 <ptrtype> 2126 <struct>jvmtiStartFunction</struct> 2127 </ptrtype> 2128 <description> 2129 The start function. 2130 </description> 2131 </param> 2132 <param id="arg"> 2133 <inbuf> 2134 <void/> 2135 <nullok><code>NULL</code> is passed to the start function</nullok> 2136 </inbuf> 2137 <description> 2138 The argument to the start function. 2139 </description> 2140 </param> 2141 <param id="priority"> 2142 <jint/> 2143 <description> 2144 The priority of the started thread. Any thread 2145 priority allowed by <code>java.lang.Thread.setPriority</code> can be used including 2146 those in <datalink id="jvmtiThreadPriority"></datalink>. 2147 </description> 2148 </param> 2149 </parameters> 2150 <errors> 2151 <error id="JVMTI_ERROR_INVALID_PRIORITY"> 2152 <paramlink id="priority"/> is less than 2153 <datalink id="JVMTI_THREAD_MIN_PRIORITY"/> 2154 or greater than 2155 <datalink id="JVMTI_THREAD_MAX_PRIORITY"/> 2156 </error> 2157 </errors> 2158 </function> 2159 2160 <function id="SetThreadLocalStorage" jkernel="yes" impl="notrace" phase="start" num="103"> 2161 <synopsis>Set Thread Local Storage</synopsis> 2162 <description> 2163 The VM stores a pointer value associated with each environment-thread 2164 pair. This pointer value is called <i>thread-local storage</i>. 2165 This value is <code>NULL</code> unless set with this function. 2166 Agents can allocate memory in which they store thread specific 2167 information. By setting thread-local storage it can then be 2168 accessed with 2169 <functionlink id="GetThreadLocalStorage"></functionlink>. 2170 <p/> 2171 This function is called by the agent to set the value of the <jvmti/> 2172 thread-local storage. <jvmti/> supplies to the agent a pointer-size 2173 thread-local storage that can be used to record per-thread 2174 information. 2175 </description> 2176 <origin>jvmpi</origin> 2177 <capabilities> 2178 </capabilities> 2179 <parameters> 2180 <param id="thread"> 2181 <jthread null="current"/> 2182 <description> 2183 Store to this thread. 2184 </description> 2185 </param> 2186 <param id="data"> 2187 <inbuf> 2188 <void/> 2189 <nullok>value is set to <code>NULL</code></nullok> 2190 </inbuf> 2191 <description> 2192 The value to be entered into the thread-local storage. 2193 </description> 2194 </param> 2195 </parameters> 2196 <errors> 2197 </errors> 2198 </function> 2199 2200 <function id="GetThreadLocalStorage" jkernel="yes" impl="innative notrace" phase="start" num="102"> 2201 <synopsis>Get Thread Local Storage</synopsis> 2202 <description> 2203 Called by the agent to get the value of the <jvmti/> thread-local 2204 storage. 2205 </description> 2206 <origin>jvmpi</origin> 2207 <capabilities> 2208 </capabilities> 2209 <parameters> 2210 <param id="thread"> 2211 <jthread null="current" impl="noconvert"/> 2212 <description> 2213 Retrieve from this thread. 2214 </description> 2215 </param> 2216 <param id="data_ptr"> 2217 <agentbuf><void/></agentbuf> 2218 <description> 2219 Pointer through which the value of the thread local 2220 storage is returned. 2221 If thread-local storage has not been set with 2222 <functionlink id="SetThreadLocalStorage"></functionlink> the returned 2223 pointer is <code>NULL</code>. 2224 </description> 2225 </param> 2226 </parameters> 2227 <errors> 2228 </errors> 2229 </function> 2230 2231 </category> 2232 2233 <category id="thread_groups" label="Thread Group"> 2234 <intro> 2235 </intro> 2236 2237 <function id="GetTopThreadGroups" num="13"> 2238 <synopsis>Get Top Thread Groups</synopsis> 2239 <description> 2240 Return all top-level (parentless) thread groups in the VM. 2241 </description> 2242 <origin>jvmdi</origin> 2243 <capabilities> 2244 </capabilities> 2245 <parameters> 2246 <param id="group_count_ptr"> 2247 <outptr><jint/></outptr> 2248 <description> 2249 On return, points to the number of top-level thread groups. 2250 </description> 2251 </param> 2252 <param id="groups_ptr"> 2253 <allocbuf outcount="group_count_ptr"><jthreadGroup/></allocbuf> 2254 <description> 2255 On return, refers to a pointer to the top-level thread group array. 2256 </description> 2257 </param> 2258 </parameters> 2259 <errors> 2260 </errors> 2261 </function> 2262 2263 <function id="GetThreadGroupInfo" num="14"> 2264 <synopsis>Get Thread Group Info</synopsis> 2265 <typedef id="jvmtiThreadGroupInfo" label="Thread group information structure"> 2266 <field id="parent"> 2267 <jthreadGroup/> 2268 <description> 2269 The parent thread group. 2270 </description> 2271 </field> 2272 <field id="name"> 2273 <allocfieldbuf><char/></allocfieldbuf> 2274 <description> 2275 The thread group's name, encoded as a 2276 <internallink id="mUTF">modified UTF-8</internallink> string. 2277 </description> 2278 </field> 2279 <field id="max_priority"> 2280 <jint/> 2281 <description> 2282 The maximum priority for this thread group. 2283 </description> 2284 </field> 2285 <field id="is_daemon"> 2286 <jboolean/> 2287 <description> 2288 Is this a daemon thread group? 2289 </description> 2290 </field> 2291 </typedef> 2292 <description> 2293 Get information about the thread group. The fields of the 2294 <functionlink id="jvmtiThreadGroupInfo"></functionlink> structure 2295 are filled in with details of the specified thread group. 2296 </description> 2297 <origin>jvmdi</origin> 2298 <capabilities> 2299 </capabilities> 2300 <parameters> 2301 <param id="group"> 2302 <jthreadGroup/> 2303 <description> 2304 The thread group to query. 2305 </description> 2306 </param> 2307 <param id="info_ptr"> 2308 <outptr><struct>jvmtiThreadGroupInfo</struct></outptr> 2309 <description> 2310 On return, filled with information describing the specified 2311 thread group. 2312 </description> 2313 </param> 2314 </parameters> 2315 <errors> 2316 </errors> 2317 </function> 2318 2319 <function id="GetThreadGroupChildren" num="15"> 2320 <synopsis>Get Thread Group Children</synopsis> 2321 <description> 2322 Get the live threads and active subgroups in this thread group. 2323 </description> 2324 <origin>jvmdi</origin> 2325 <capabilities> 2326 </capabilities> 2327 <parameters> 2328 <param id="group"> 2329 <jthreadGroup/> 2330 <description> 2331 The group to query. 2332 </description> 2333 </param> 2334 <param id="thread_count_ptr"> 2335 <outptr><jint/></outptr> 2336 <description> 2337 On return, points to the number of live threads in this thread group. 2338 </description> 2339 </param> 2340 <param id="threads_ptr"> 2341 <allocbuf outcount="thread_count_ptr"><jthread/></allocbuf> 2342 <description> 2343 On return, points to an array of the live threads in this thread group. 2344 </description> 2345 </param> 2346 <param id="group_count_ptr"> 2347 <outptr><jint/></outptr> 2348 <description> 2349 On return, points to the number of active child thread groups 2350 </description> 2351 </param> 2352 <param id="groups_ptr"> 2353 <allocbuf outcount="group_count_ptr"><jthreadGroup/></allocbuf> 2354 <description> 2355 On return, points to an array of the active child thread groups. 2356 </description> 2357 </param> 2358 </parameters> 2359 <errors> 2360 </errors> 2361 </function> 2362 </category> 2363 2364 <category id="stack" label="Stack Frame"> 2365 <intro> 2366 These functions provide information about the stack of a thread. 2367 Stack frames are referenced by depth. 2368 The frame at depth zero is the current frame. 2369 <p/> 2370 Stack frames are as described in 2371 <vmspec chapter="3.6"/>, 2372 That is, they correspond to method 2373 invocations (including native methods) but do not correspond to platform native or 2374 VM internal frames. 2375 <p/> 2376 A <jvmti/> implementation may use method invocations to launch a thread and 2377 the corresponding frames may be included in the stack as presented by these functions -- 2378 that is, there may be frames shown 2379 deeper than <code>main()</code> and <code>run()</code>. 2380 However this presentation must be consistent across all <jvmti/> functionality which 2381 uses stack frames or stack depth. 2382 </intro> 2383 2384 <typedef id="jvmtiFrameInfo" label="Stack frame information structure"> 2385 <description> 2386 Information about a stack frame is returned in this structure. 2387 </description> 2388 <field id="method"> 2389 <jmethodID/> 2390 <description> 2391 The method executing in this frame. 2392 </description> 2393 </field> 2394 <field id="location"> 2395 <jlocation/> 2396 <description> 2397 The index of the instruction executing in this frame. 2398 <code>-1</code> if the frame is executing a native method. 2399 </description> 2400 </field> 2401 </typedef> 2402 2403 <typedef id="jvmtiStackInfo" label="Stack information structure"> 2404 <description> 2405 Information about a set of stack frames is returned in this structure. 2406 </description> 2407 <field id="thread"> 2408 <jthread/> 2409 <description> 2410 On return, the thread traced. 2411 </description> 2412 </field> 2413 <field id="state"> 2414 <jint/> 2415 <description> 2416 On return, the thread state. See <functionlink id="GetThreadState"></functionlink>. 2417 </description> 2418 </field> 2419 <field id="frame_buffer"> 2420 <outbuf incount="max_frame_count"> 2421 <struct>jvmtiFrameInfo</struct> 2422 </outbuf> 2423 <description> 2424 On return, this agent allocated buffer is filled 2425 with stack frame information. 2426 </description> 2427 </field> 2428 <field id="frame_count"> 2429 <jint/> 2430 <description> 2431 On return, the number of records filled into 2432 <code>frame_buffer</code>. 2433 This will be 2434 min(<code>max_frame_count</code>, <i>stackDepth</i>). 2435 </description> 2436 </field> 2437 </typedef> 2438 2439 <function id="GetStackTrace" num="104"> 2440 <synopsis>Get Stack Trace</synopsis> 2441 <description> 2442 Get information about the stack of a thread. 2443 If <paramlink id="max_frame_count"></paramlink> is less than the depth of the stack, 2444 the <paramlink id="max_frame_count"></paramlink> topmost frames are returned, 2445 otherwise the entire stack is returned. 2446 The topmost frames, those most recently invoked, are at the beginning of the returned buffer. 2447 <p/> 2448 The following example causes up to five of the topmost frames 2449 to be returned and (if there are any frames) the currently 2450 executing method name to be printed. 2451 <example> 2452 jvmtiFrameInfo frames[5]; 2453 jint count; 2454 jvmtiError err; 2455 2456 err = (*jvmti)->GetStackTrace(jvmti, aThread, 0, 5, 2457 frames, &count); 2458 if (err == JVMTI_ERROR_NONE && count >= 1) { 2459 char *methodName; 2460 err = (*jvmti)->GetMethodName(jvmti, frames[0].method, 2461 &methodName, NULL, NULL); 2462 if (err == JVMTI_ERROR_NONE) { 2463 printf("Executing method: %s", methodName); 2464 } 2465 } 2466 </example> 2467 <todo> 2468 check example code. 2469 </todo> 2470 <p/> 2471 The <paramlink id="thread"></paramlink> need not be suspended 2472 to call this function. 2473 <p/> 2474 The <functionlink id="GetLineNumberTable"></functionlink> 2475 function can be used to map locations to line numbers. Note that 2476 this mapping can be done lazily. 2477 </description> 2478 <origin>jvmpi</origin> 2479 <capabilities> 2480 </capabilities> 2481 <parameters> 2482 <param id="thread"> 2483 <jthread null="current"/> 2484 <description> 2485 Fetch the stack trace of this thread. 2486 </description> 2487 </param> 2488 <param id="start_depth"> 2489 <jint/> 2490 <description> 2491 Begin retrieving frames at this depth. 2492 If non-negative, count from the current frame, 2493 the first frame retrieved is at depth <code>start_depth</code>. 2494 For example, if zero, start from the current frame; if one, start from the 2495 caller of the current frame; if two, start from the caller of the 2496 caller of the current frame; and so on. 2497 If negative, count from below the oldest frame, 2498 the first frame retrieved is at depth <i>stackDepth</i><code> + start_depth</code>, 2499 where <i>stackDepth</i> is the count of frames on the stack. 2500 For example, if negative one, only the oldest frame is retrieved; 2501 if negative two, start from the frame called by the oldest frame. 2502 </description> 2503 </param> 2504 <param id="max_frame_count"> 2505 <jint min="0"/> 2506 <description> 2507 The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve. 2508 </description> 2509 </param> 2510 <param id="frame_buffer"> 2511 <outbuf incount="max_frame_count" outcount="count_ptr"> 2512 <struct>jvmtiFrameInfo</struct> 2513 </outbuf> 2514 <description> 2515 On return, this agent allocated buffer is filled 2516 with stack frame information. 2517 </description> 2518 </param> 2519 <param id="count_ptr"> 2520 <outptr><jint/></outptr> 2521 <description> 2522 On return, points to the number of records filled in. 2523 For non-negative <code>start_depth</code>, this will be 2524 min(<code>max_frame_count</code>, <i>stackDepth</i><code> - start_depth</code>). 2525 For negative <code>start_depth</code>, this will be 2526 min(<code>max_frame_count</code>, <code>-start_depth</code>). 2527 </description> 2528 </param> 2529 </parameters> 2530 <errors> 2531 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 2532 <paramlink id="start_depth"/> is positive and greater than or equal to <i>stackDepth</i>. 2533 Or <paramlink id="start_depth"/> is negative and less than <i>-stackDepth</i>. 2534 </error> 2535 </errors> 2536 </function> 2537 2538 2539 <function id="GetAllStackTraces" num="100"> 2540 <synopsis>Get All Stack Traces</synopsis> 2541 <description> 2542 Get information about the stacks of all live threads 2543 (including <internallink id="RunAgentThread">agent threads</internallink>). 2544 If <paramlink id="max_frame_count"/> is less than the depth of a stack, 2545 the <paramlink id="max_frame_count"/> topmost frames are returned for that thread, 2546 otherwise the entire stack is returned. 2547 The topmost frames, those most recently invoked, are at the beginning of the returned buffer. 2548 <p/> 2549 All stacks are collected simultaneously, that is, no changes will occur to the 2550 thread state or stacks between the sampling of one thread and the next. 2551 The threads need not be suspended. 2552 2553 <example> 2554 jvmtiStackInfo *stack_info; 2555 jint thread_count; 2556 int ti; 2557 jvmtiError err; 2558 2559 err = (*jvmti)->GetAllStackTraces(jvmti, MAX_FRAMES, &stack_info, &thread_count); 2560 if (err != JVMTI_ERROR_NONE) { 2561 ... 2562 } 2563 for (ti = 0; ti < thread_count; ++ti) { 2564 jvmtiStackInfo *infop = &stack_info[ti]; 2565 jthread thread = infop->thread; 2566 jint state = infop->state; 2567 jvmtiFrameInfo *frames = infop->frame_buffer; 2568 int fi; 2569 2570 myThreadAndStatePrinter(thread, state); 2571 for (fi = 0; fi < infop->frame_count; fi++) { 2572 myFramePrinter(frames[fi].method, frames[fi].location); 2573 } 2574 } 2575 /* this one Deallocate call frees all data allocated by GetAllStackTraces */ 2576 err = (*jvmti)->Deallocate(jvmti, stack_info); 2577 </example> 2578 <todo> 2579 check example code. 2580 </todo> 2581 2582 </description> 2583 <origin>new</origin> 2584 <capabilities> 2585 </capabilities> 2586 <parameters> 2587 <param id="max_frame_count"> 2588 <jint min="0"/> 2589 <description> 2590 The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve per thread. 2591 </description> 2592 </param> 2593 <param id="stack_info_ptr"> 2594 <allocbuf> 2595 <struct>jvmtiStackInfo</struct> 2596 </allocbuf> 2597 <description> 2598 On return, this buffer is filled 2599 with stack information for each thread. 2600 The number of <datalink id="jvmtiStackInfo"/> records is determined 2601 by <paramlink id="thread_count_ptr"/>. 2602 <p/> 2603 Note that this buffer is allocated to include the <datalink id="jvmtiFrameInfo"/> 2604 buffers pointed to by <datalink id="jvmtiStackInfo.frame_buffer"/>. 2605 These buffers must not be separately deallocated. 2606 </description> 2607 </param> 2608 <param id="thread_count_ptr"> 2609 <outptr><jint/></outptr> 2610 <description> 2611 The number of threads traced. 2612 </description> 2613 </param> 2614 </parameters> 2615 <errors> 2616 </errors> 2617 </function> 2618 2619 <function id="GetThreadListStackTraces" num="101"> 2620 <synopsis>Get Thread List Stack Traces</synopsis> 2621 <description> 2622 Get information about the stacks of the supplied threads. 2623 If <paramlink id="max_frame_count"/> is less than the depth of a stack, 2624 the <paramlink id="max_frame_count"/> topmost frames are returned for that thread, 2625 otherwise the entire stack is returned. 2626 The topmost frames, those most recently invoked, are at the beginning of the returned buffer. 2627 <p/> 2628 All stacks are collected simultaneously, that is, no changes will occur to the 2629 thread state or stacks between the sampling one thread and the next. 2630 The threads need not be suspended. 2631 <p/> 2632 If a thread has not yet started or terminates before the stack information is collected, 2633 a zero length stack (<datalink id="jvmtiStackInfo.frame_count"/> will be zero) 2634 will be returned and the thread <datalink id="jvmtiStackInfo.state"/> can be checked. 2635 <p/> 2636 See the example for the similar function 2637 <functionlink id="GetAllStackTraces"/>. 2638 </description> 2639 <origin>new</origin> 2640 <capabilities> 2641 </capabilities> 2642 <parameters> 2643 <param id="thread_count"> 2644 <jint min="0"/> 2645 <description> 2646 The number of threads to trace. 2647 </description> 2648 </param> 2649 <param id="thread_list"> 2650 <inbuf incount="thread_count"><jthread/></inbuf> 2651 <description> 2652 The list of threads to trace. 2653 </description> 2654 </param> 2655 <param id="max_frame_count"> 2656 <jint min="0"/> 2657 <description> 2658 The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve per thread. 2659 </description> 2660 </param> 2661 <param id="stack_info_ptr"> 2662 <allocbuf outcount="thread_count"> 2663 <struct>jvmtiStackInfo</struct> 2664 </allocbuf> 2665 <description> 2666 On return, this buffer is filled 2667 with stack information for each thread. 2668 The number of <datalink id="jvmtiStackInfo"/> records is determined 2669 by <paramlink id="thread_count"/>. 2670 <p/> 2671 Note that this buffer is allocated to include the <datalink id="jvmtiFrameInfo"/> 2672 buffers pointed to by <datalink id="jvmtiStackInfo.frame_buffer"/>. 2673 These buffers must not be separately deallocated. 2674 </description> 2675 </param> 2676 </parameters> 2677 <errors> 2678 <error id="JVMTI_ERROR_INVALID_THREAD"> 2679 An element in <paramlink id="thread_list"/> is not a thread object. 2680 </error> 2681 </errors> 2682 </function> 2683 2684 <elide> 2685 <function id="AsyncGetStackTrace" num="1000"> 2686 <synopsis>Get Stack Trace--Asynchronous</synopsis> 2687 <description> 2688 Get information about the entire stack of a thread (or a sub-section of it). 2689 This is the asynchronous version of <functionlink id="GetStackTrace"></functionlink> 2690 and is reentrant and safe to call 2691 from asynchronous signal handlers. 2692 The stack trace is returned only for the calling thread. 2693 <p/> 2694 The <functionlink id="GetLineNumberTable"></functionlink> 2695 function can be used to map locations to line numbers. Note that 2696 this mapping can be done lazily. 2697 </description> 2698 <origin>jvmpi</origin> 2699 <capabilities> 2700 <required id="can_get_async_stack_trace"></required> 2701 <capability id="can_show_JVM_spec_async_frames"> 2702 If <code>false</code>, 2703 <paramlink id="use_java_stack"></paramlink> 2704 must be <code>false</code>. 2705 </capability> 2706 </capabilities> 2707 <parameters> 2708 <param id="use_java_stack"> 2709 <jboolean/> 2710 <description> 2711 Return the stack showing <vmspec/> 2712 model of the stack; 2713 otherwise, show the internal representation of the stack with 2714 inlined and optimized methods missing. If the virtual machine 2715 is using the <i>Java Virtual Machine Specification</i> stack model 2716 internally, this flag is ignored. 2717 </description> 2718 </param> 2719 <param id="max_count"> 2720 <jint min="0"/> 2721 <description> 2722 The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve. 2723 Retrieve this many unless the stack depth is less than <code>max_count</code>. 2724 </description> 2725 </param> 2726 <param id="frame_buffer"> 2727 <outbuf incount="max_count" outcount="count_ptr"> 2728 <struct>jvmtiFrameInfo</struct> 2729 <nullok>this information is not returned</nullok> 2730 </outbuf> 2731 <description> 2732 The agent passes in a buffer 2733 large enough to hold <code>max_count</code> records of 2734 <datalink id="jvmtiFrameInfo"></datalink>. This buffer must be 2735 pre-allocated by the agent. 2736 </description> 2737 </param> 2738 <param id="count_ptr"> 2739 <outptr><jint/></outptr> 2740 <description> 2741 On return, points to the number of records filled in.. 2742 </description> 2743 </param> 2744 </parameters> 2745 <errors> 2746 <error id="JVMTI_ERROR_UNATTACHED_THREAD"> 2747 The thread being used to call this function is not attached 2748 to the virtual machine. Calls must be made from attached threads. 2749 </error> 2750 </errors> 2751 </function> 2752 </elide> 2753 2754 <function id="GetFrameCount" num="16"> 2755 <synopsis>Get Frame Count</synopsis> 2756 <description> 2757 Get the number of frames currently in the specified thread's call stack. 2758 <p/> 2759 If this function is called for a thread actively executing bytecodes (for example, 2760 not the current thread and not suspended), the information returned is transient. 2761 </description> 2762 <origin>jvmdi</origin> 2763 <capabilities> 2764 </capabilities> 2765 <parameters> 2766 <param id="thread"> 2767 <jthread null="current"/> 2768 <description> 2769 The thread to query. 2770 </description> 2771 </param> 2772 <param id="count_ptr"> 2773 <outptr><jint/></outptr> 2774 <description> 2775 On return, points to the number of frames in the call stack. 2776 </description> 2777 </param> 2778 </parameters> 2779 <errors> 2780 </errors> 2781 </function> 2782 2783 <function id="PopFrame" num="80"> 2784 <synopsis>Pop Frame</synopsis> 2785 <description> 2786 Pop the current frame of <code>thread</code>'s stack. 2787 Popping a frame takes you to the previous frame. 2788 When the thread is resumed, the execution 2789 state of the thread is reset to the state 2790 immediately before the called method was invoked. 2791 That is (using <vmspec/> terminology): 2792 <ul> 2793 <li>the current frame is discarded as the previous frame becomes the current one</li> 2794 <li>the operand stack is restored--the argument values are added back 2795 and if the invoke was not <code>invokestatic</code>, 2796 <code>objectref</code> is added back as well</li> 2797 <li>the Java virtual machine PC is restored to the opcode 2798 of the invoke instruction</li> 2799 </ul> 2800 Note however, that any changes to the arguments, which 2801 occurred in the called method, remain; 2802 when execution continues, the first instruction to 2803 execute will be the invoke. 2804 <p/> 2805 Between calling <code>PopFrame</code> and resuming the 2806 thread the state of the stack is undefined. 2807 To pop frames beyond the first, 2808 these three steps must be repeated: 2809 <ul> 2810 <li>suspend the thread via an event (step, breakpoint, ...)</li> 2811 <li>call <code>PopFrame</code></li> 2812 <li>resume the thread</li> 2813 </ul> 2814 <p/> 2815 A lock acquired by calling the called method 2816 (if it is a <code>synchronized</code> method) 2817 and locks acquired by entering <code>synchronized</code> 2818 blocks within the called method are released. 2819 Note: this does not apply to native locks or 2820 <code>java.util.concurrent.locks</code> locks. 2821 <p/> 2822 Finally blocks are not executed. 2823 <p/> 2824 Changes to global state are not addressed and thus remain changed. 2825 <p/> 2826 The specified thread must be suspended (which implies it cannot be the current thread). 2827 <p/> 2828 Both the called method and calling method must be non-native Java programming 2829 language methods. 2830 <p/> 2831 No <jvmti/> events are generated by this function. 2832 </description> 2833 <origin>jvmdi</origin> 2834 <capabilities> 2835 <required id="can_pop_frame"></required> 2836 </capabilities> 2837 <parameters> 2838 <param id="thread"> 2839 <jthread/> 2840 <description> 2841 The thread whose current frame is to be popped. 2842 </description> 2843 </param> 2844 </parameters> 2845 <errors> 2846 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 2847 Called or calling method is a native method. 2848 The implementation is unable to pop this frame. 2849 </error> 2850 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 2851 Thread was not suspended. 2852 </error> 2853 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 2854 There are less than two stack frames on the call stack. 2855 </error> 2856 </errors> 2857 </function> 2858 2859 <function id="GetFrameLocation" num="19"> 2860 <synopsis>Get Frame Location</synopsis> 2861 <description> 2862 <p/> 2863 For a Java programming language frame, return the location of the instruction 2864 currently executing. 2865 </description> 2866 <origin>jvmdiClone</origin> 2867 <capabilities> 2868 </capabilities> 2869 <parameters> 2870 <param id="thread"> 2871 <jthread null="current" frame="frame"/> 2872 <description> 2873 The thread of the frame to query. 2874 </description> 2875 </param> 2876 <param id="depth"> 2877 <jframeID thread="thread"/> 2878 <description> 2879 The depth of the frame to query. 2880 </description> 2881 </param> 2882 <param id="method_ptr"> 2883 <outptr><jmethodID/></outptr> 2884 <description> 2885 On return, points to the method for the current location. 2886 </description> 2887 </param> 2888 <param id="location_ptr"> 2889 <outptr><jlocation/></outptr> 2890 <description> 2891 On return, points to the index of the currently 2892 executing instruction. 2893 Is set to <code>-1</code> if the frame is executing 2894 a native method. 2895 </description> 2896 </param> 2897 </parameters> 2898 <errors> 2899 </errors> 2900 </function> 2901 2902 <function id="NotifyFramePop" num="20"> 2903 <synopsis>Notify Frame Pop</synopsis> 2904 <description> 2905 When the frame that is currently at <paramlink id="depth"></paramlink> 2906 is popped from the stack, generate a 2907 <eventlink id="FramePop"></eventlink> event. See the 2908 <eventlink id="FramePop"></eventlink> event for details. 2909 Only frames corresponding to non-native Java programming language 2910 methods can receive notification. 2911 <p/> 2912 The specified thread must either be the current thread 2913 or the thread must be suspended. 2914 </description> 2915 <origin>jvmdi</origin> 2916 <capabilities> 2917 <required id="can_generate_frame_pop_events"></required> 2918 </capabilities> 2919 <parameters> 2920 <param id="thread"> 2921 <jthread null="current" frame="depth"/> 2922 <description> 2923 The thread of the frame for which the frame pop event will be generated. 2924 </description> 2925 </param> 2926 <param id="depth"> 2927 <jframeID thread="thread"/> 2928 <description> 2929 The depth of the frame for which the frame pop event will be generated. 2930 </description> 2931 </param> 2932 </parameters> 2933 <errors> 2934 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 2935 The frame at <code>depth</code> is executing a 2936 native method. 2937 </error> 2938 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 2939 Thread was not suspended and was not the current thread. 2940 </error> 2941 </errors> 2942 </function> 2943 2944 </category> 2945 2946 <category id="ForceEarlyReturn" label="Force Early Return"> 2947 <intro> 2948 These functions allow an agent to force a method 2949 to return at any point during its execution. 2950 The method which will return early is referred to as the <i>called method</i>. 2951 The called method is the current method 2952 (as defined by 2953 <vmspec chapter="3.6"/>) 2954 for the specified thread at 2955 the time the function is called. 2956 <p/> 2957 The specified thread must be suspended or must be the current thread. 2958 The return occurs when execution of Java programming 2959 language code is resumed on this thread. 2960 Between calling one of these functions and resumption 2961 of thread execution, the state of the stack is undefined. 2962 <p/> 2963 No further instructions are executed in the called method. 2964 Specifically, finally blocks are not executed. 2965 Note: this can cause inconsistent states in the application. 2966 <p/> 2967 A lock acquired by calling the called method 2968 (if it is a <code>synchronized</code> method) 2969 and locks acquired by entering <code>synchronized</code> 2970 blocks within the called method are released. 2971 Note: this does not apply to native locks or 2972 <code>java.util.concurrent.locks</code> locks. 2973 <p/> 2974 Events, such as <eventlink id="MethodExit"></eventlink>, 2975 are generated as they would be in a normal return. 2976 <p/> 2977 The called method must be a non-native Java programming 2978 language method. 2979 Forcing return on a thread with only one frame on the 2980 stack causes the thread to exit when resumed. 2981 </intro> 2982 2983 <function id="ForceEarlyReturnObject" num="81" since="1.1"> 2984 <synopsis>Force Early Return - Object</synopsis> 2985 <description> 2986 This function can be used to return from a method whose 2987 result type is <code>Object</code> 2988 or a subclass of <code>Object</code>. 2989 </description> 2990 <origin>new</origin> 2991 <capabilities> 2992 <required id="can_force_early_return"></required> 2993 </capabilities> 2994 <parameters> 2995 <param id="thread"> 2996 <jthread null="current"/> 2997 <description> 2998 The thread whose current frame is to return early. 2999 </description> 3000 </param> 3001 <param id="value"> 3002 <jobject/> 3003 <description> 3004 The return value for the called frame. 3005 An object or <code>NULL</code>. 3006 </description> 3007 </param> 3008 </parameters> 3009 <errors> 3010 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3011 Attempted to return early from a frame 3012 corresponding to a native method. 3013 Or the implementation is unable to provide 3014 this functionality on this frame. 3015 </error> 3016 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3017 The result type of the called method is not 3018 <code>Object</code> or a subclass of <code>Object</code>. 3019 </error> 3020 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3021 The supplied <paramlink id="value"/> is not compatible with the 3022 result type of the called method. 3023 </error> 3024 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3025 Thread was not the current thread and was not suspended. 3026 </error> 3027 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3028 There are no more frames on the call stack. 3029 </error> 3030 </errors> 3031 </function> 3032 3033 <function id="ForceEarlyReturnInt" num="82" since="1.1"> 3034 <synopsis>Force Early Return - Int</synopsis> 3035 <description> 3036 This function can be used to return from a method whose 3037 result type is <code>int</code>, <code>short</code>, 3038 <code>char</code>, <code>byte</code>, or 3039 <code>boolean</code>. 3040 </description> 3041 <origin>new</origin> 3042 <capabilities> 3043 <required id="can_force_early_return"></required> 3044 </capabilities> 3045 <parameters> 3046 <param id="thread"> 3047 <jthread null="current"/> 3048 <description> 3049 The thread whose current frame is to return early. 3050 </description> 3051 </param> 3052 <param id="value"> 3053 <jint/> 3054 <description> 3055 The return value for the called frame. 3056 </description> 3057 </param> 3058 </parameters> 3059 <errors> 3060 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3061 Attempted to return early from a frame 3062 corresponding to a native method. 3063 Or the implementation is unable to provide 3064 this functionality on this frame. 3065 </error> 3066 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3067 The result type of the called method is not 3068 <code>int</code>, <code>short</code>, 3069 <code>char</code>, <code>byte</code>, or 3070 <code>boolean</code>. 3071 </error> 3072 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3073 Thread was not the current thread and was not suspended. 3074 </error> 3075 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3076 There are no frames on the call stack. 3077 </error> 3078 </errors> 3079 </function> 3080 3081 <function id="ForceEarlyReturnLong" num="83" since="1.1"> 3082 <synopsis>Force Early Return - Long</synopsis> 3083 <description> 3084 This function can be used to return from a method whose 3085 result type is <code>long</code>. 3086 </description> 3087 <origin>new</origin> 3088 <capabilities> 3089 <required id="can_force_early_return"></required> 3090 </capabilities> 3091 <parameters> 3092 <param id="thread"> 3093 <jthread null="current"/> 3094 <description> 3095 The thread whose current frame is to return early. 3096 </description> 3097 </param> 3098 <param id="value"> 3099 <jlong/> 3100 <description> 3101 The return value for the called frame. 3102 </description> 3103 </param> 3104 </parameters> 3105 <errors> 3106 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3107 Attempted to return early from a frame 3108 corresponding to a native method. 3109 Or the implementation is unable to provide 3110 this functionality on this frame. 3111 </error> 3112 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3113 The result type of the called method is not <code>long</code>. 3114 </error> 3115 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3116 Thread was not the current thread and was not suspended. 3117 </error> 3118 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3119 There are no frames on the call stack. 3120 </error> 3121 </errors> 3122 </function> 3123 3124 <function id="ForceEarlyReturnFloat" num="84" since="1.1"> 3125 <synopsis>Force Early Return - Float</synopsis> 3126 <description> 3127 This function can be used to return from a method whose 3128 result type is <code>float</code>. 3129 </description> 3130 <origin>new</origin> 3131 <capabilities> 3132 <required id="can_force_early_return"></required> 3133 </capabilities> 3134 <parameters> 3135 <param id="thread"> 3136 <jthread null="current"/> 3137 <description> 3138 The thread whose current frame is to return early. 3139 </description> 3140 </param> 3141 <param id="value"> 3142 <jfloat/> 3143 <description> 3144 The return value for the called frame. 3145 </description> 3146 </param> 3147 </parameters> 3148 <errors> 3149 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3150 Attempted to return early from a frame 3151 corresponding to a native method. 3152 Or the implementation is unable to provide 3153 this functionality on this frame. 3154 </error> 3155 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3156 The result type of the called method is not <code>float</code>. 3157 </error> 3158 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3159 Thread was not the current thread and was not suspended. 3160 </error> 3161 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3162 There are no frames on the call stack. 3163 </error> 3164 </errors> 3165 </function> 3166 3167 <function id="ForceEarlyReturnDouble" num="85" since="1.1"> 3168 <synopsis>Force Early Return - Double</synopsis> 3169 <description> 3170 This function can be used to return from a method whose 3171 result type is <code>double</code>. 3172 </description> 3173 <origin>new</origin> 3174 <capabilities> 3175 <required id="can_force_early_return"></required> 3176 </capabilities> 3177 <parameters> 3178 <param id="thread"> 3179 <jthread null="current"/> 3180 <description> 3181 The thread whose current frame is to return early. 3182 </description> 3183 </param> 3184 <param id="value"> 3185 <jdouble/> 3186 <description> 3187 The return value for the called frame. 3188 </description> 3189 </param> 3190 </parameters> 3191 <errors> 3192 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3193 Attempted to return early from a frame corresponding to a native method. 3194 Or the implementation is unable to provide this functionality on this frame. 3195 </error> 3196 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3197 The result type of the called method is not <code>double</code>. 3198 </error> 3199 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3200 Thread was not the current thread and was not suspended. 3201 </error> 3202 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3203 There are no frames on the call stack. 3204 </error> 3205 </errors> 3206 </function> 3207 3208 <function id="ForceEarlyReturnVoid" num="86" since="1.1"> 3209 <synopsis>Force Early Return - Void</synopsis> 3210 <description> 3211 This function can be used to return from a method with no result type. 3212 That is, the called method must be declared <code>void</code>. 3213 </description> 3214 <origin>new</origin> 3215 <capabilities> 3216 <required id="can_force_early_return"></required> 3217 </capabilities> 3218 <parameters> 3219 <param id="thread"> 3220 <jthread null="current"/> 3221 <description> 3222 The thread whose current frame is to return early. 3223 </description> 3224 </param> 3225 </parameters> 3226 <errors> 3227 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3228 Attempted to return early from a frame 3229 corresponding to a native method. 3230 Or the implementation is unable to provide 3231 this functionality on this frame. 3232 </error> 3233 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3234 The called method has a result type. 3235 </error> 3236 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3237 Thread was not the current thread and was not suspended. 3238 </error> 3239 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3240 There are no frames on the call stack. 3241 </error> 3242 </errors> 3243 </function> 3244 3245 </category> 3246 3247 <category id="Heap" label="Heap"> 3248 <intro> 3249 These functions are used to analyze the heap. 3250 Functionality includes the ability to view the objects in the 3251 heap and to tag these objects. 3252 </intro> 3253 3254 <intro id="objectTags" label="Object Tags"> 3255 A <i>tag</i> is a value associated with an object. 3256 Tags are explicitly set by the agent using the 3257 <functionlink id="SetTag"></functionlink> function or by 3258 callback functions such as <functionlink id="jvmtiHeapIterationCallback"/>. 3259 <p/> 3260 Tags are local to the environment; that is, the tags of one 3261 environment are not visible in another. 3262 <p/> 3263 Tags are <code>jlong</code> values which can be used 3264 simply to mark an object or to store a pointer to more detailed 3265 information. Objects which have not been tagged have a 3266 tag of zero. 3267 Setting a tag to zero makes the object untagged. 3268 </intro> 3269 3270 <intro id="heapCallbacks" label="Heap Callback Functions"> 3271 Heap functions which iterate through the heap and recursively 3272 follow object references use agent supplied callback functions 3273 to deliver the information. 3274 <p/> 3275 These heap callback functions must adhere to the following restrictions -- 3276 These callbacks must not use JNI functions. 3277 These callbacks must not use <jvmti/> functions except 3278 <i>callback safe</i> functions which 3279 specifically allow such use (see the raw monitor, memory management, 3280 and environment local storage functions). 3281 <p/> 3282 An implementation may invoke a callback on an internal thread or 3283 the thread which called the iteration function. 3284 Heap callbacks are single threaded -- no more than one callback will 3285 be invoked at a time. 3286 <p/> 3287 The Heap Filter Flags can be used to prevent reporting 3288 based on the tag status of an object or its class. 3289 If no flags are set (the <code>jint</code> is zero), objects 3290 will not be filtered out. 3291 3292 <constants id="jvmtiHeapFilter" label="Heap Filter Flags" kind="bits"> 3293 <constant id="JVMTI_HEAP_FILTER_TAGGED" num="0x4"> 3294 Filter out tagged objects. Objects which are tagged are not included. 3295 </constant> 3296 <constant id="JVMTI_HEAP_FILTER_UNTAGGED" num="0x8"> 3297 Filter out untagged objects. Objects which are not tagged are not included. 3298 </constant> 3299 <constant id="JVMTI_HEAP_FILTER_CLASS_TAGGED" num="0x10"> 3300 Filter out objects with tagged classes. Objects whose class is tagged are not included. 3301 </constant> 3302 <constant id="JVMTI_HEAP_FILTER_CLASS_UNTAGGED" num="0x20"> 3303 Filter out objects with untagged classes. Objects whose class is not tagged are not included. 3304 </constant> 3305 </constants> 3306 3307 <p/> 3308 The Heap Visit Control Flags are returned by the heap callbacks 3309 and can be used to abort the iteration. For the 3310 <functionlink id="jvmtiHeapReferenceCallback">Heap 3311 Reference Callback</functionlink>, it can also be used 3312 to prune the graph of traversed references 3313 (<code>JVMTI_VISIT_OBJECTS</code> is not set). 3314 3315 <constants id="jvmtiHeapVisitControl" 3316 label="Heap Visit Control Flags" 3317 kind="bits" 3318 since="1.1"> 3319 <constant id="JVMTI_VISIT_OBJECTS" num="0x100"> 3320 If we are visiting an object and if this callback 3321 was initiated by <functionlink id="FollowReferences"/>, 3322 traverse the references of this object. 3323 Otherwise ignored. 3324 </constant> 3325 <constant id="JVMTI_VISIT_ABORT" num="0x8000"> 3326 Abort the iteration. Ignore all other bits. 3327 </constant> 3328 </constants> 3329 3330 <p/> 3331 The Heap Reference Enumeration is provided by the 3332 <functionlink id="jvmtiHeapReferenceCallback">Heap 3333 Reference Callback</functionlink> and 3334 <functionlink id="jvmtiPrimitiveFieldCallback">Primitive Field 3335 Callback</functionlink> to 3336 describe the kind of reference 3337 being reported. 3338 3339 <constants id="jvmtiHeapReferenceKind" 3340 label="Heap Reference Enumeration" 3341 kind="enum" 3342 since="1.1"> 3343 <constant id="JVMTI_HEAP_REFERENCE_CLASS" num="1"> 3344 Reference from an object to its class. 3345 </constant> 3346 <constant id="JVMTI_HEAP_REFERENCE_FIELD" num="2"> 3347 Reference from an object to the value of one of its instance fields. 3348 </constant> 3349 <constant id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT" num="3"> 3350 Reference from an array to one of its elements. 3351 </constant> 3352 <constant id="JVMTI_HEAP_REFERENCE_CLASS_LOADER" num="4"> 3353 Reference from a class to its class loader. 3354 </constant> 3355 <constant id="JVMTI_HEAP_REFERENCE_SIGNERS" num="5"> 3356 Reference from a class to its signers array. 3357 </constant> 3358 <constant id="JVMTI_HEAP_REFERENCE_PROTECTION_DOMAIN" num="6"> 3359 Reference from a class to its protection domain. 3360 </constant> 3361 <constant id="JVMTI_HEAP_REFERENCE_INTERFACE" num="7"> 3362 Reference from a class to one of its interfaces. 3363 Note: interfaces are defined via a constant pool reference, 3364 so the referenced interfaces may also be reported with a 3365 <code>JVMTI_HEAP_REFERENCE_CONSTANT_POOL</code> reference kind. 3366 </constant> 3367 <constant id="JVMTI_HEAP_REFERENCE_STATIC_FIELD" num="8"> 3368 Reference from a class to the value of one of its static fields. 3369 </constant> 3370 <constant id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL" num="9"> 3371 Reference from a class to a resolved entry in the constant pool. 3372 </constant> 3373 <constant id="JVMTI_HEAP_REFERENCE_SUPERCLASS" num="10"> 3374 Reference from a class to its superclass. 3375 A callback is bot sent if the superclass is <code>java.lang.Object</code>. 3376 Note: loaded classes define superclasses via a constant pool 3377 reference, so the referenced superclass may also be reported with 3378 a <code>JVMTI_HEAP_REFERENCE_CONSTANT_POOL</code> reference kind. 3379 </constant> 3380 <constant id="JVMTI_HEAP_REFERENCE_JNI_GLOBAL" num="21"> 3381 Heap root reference: JNI global reference. 3382 </constant> 3383 <constant id="JVMTI_HEAP_REFERENCE_SYSTEM_CLASS" num="22"> 3384 Heap root reference: System class. 3385 </constant> 3386 <constant id="JVMTI_HEAP_REFERENCE_MONITOR" num="23"> 3387 Heap root reference: monitor. 3388 </constant> 3389 <constant id="JVMTI_HEAP_REFERENCE_STACK_LOCAL" num="24"> 3390 Heap root reference: local variable on the stack. 3391 </constant> 3392 <constant id="JVMTI_HEAP_REFERENCE_JNI_LOCAL" num="25"> 3393 Heap root reference: JNI local reference. 3394 </constant> 3395 <constant id="JVMTI_HEAP_REFERENCE_THREAD" num="26"> 3396 Heap root reference: Thread. 3397 </constant> 3398 <constant id="JVMTI_HEAP_REFERENCE_OTHER" num="27"> 3399 Heap root reference: other heap root reference. 3400 </constant> 3401 </constants> 3402 3403 <p/> 3404 Definitions for the single character type descriptors of 3405 primitive types. 3406 3407 <constants id="jvmtiPrimitiveType" 3408 label="Primitive Type Enumeration" 3409 kind="enum" 3410 since="1.1"> 3411 <constant id="JVMTI_PRIMITIVE_TYPE_BOOLEAN" num="90"> 3412 'Z' - Java programming language <code>boolean</code> - JNI <code>jboolean</code> 3413 </constant> 3414 <constant id="JVMTI_PRIMITIVE_TYPE_BYTE" num="66"> 3415 'B' - Java programming language <code>byte</code> - JNI <code>jbyte</code> 3416 </constant> 3417 <constant id="JVMTI_PRIMITIVE_TYPE_CHAR" num="67"> 3418 'C' - Java programming language <code>char</code> - JNI <code>jchar</code> 3419 </constant> 3420 <constant id="JVMTI_PRIMITIVE_TYPE_SHORT" num="83"> 3421 'S' - Java programming language <code>short</code> - JNI <code>jshort</code> 3422 </constant> 3423 <constant id="JVMTI_PRIMITIVE_TYPE_INT" num="73"> 3424 'I' - Java programming language <code>int</code> - JNI <code>jint</code> 3425 </constant> 3426 <constant id="JVMTI_PRIMITIVE_TYPE_LONG" num="74"> 3427 'J' - Java programming language <code>long</code> - JNI <code>jlong</code> 3428 </constant> 3429 <constant id="JVMTI_PRIMITIVE_TYPE_FLOAT" num="70"> 3430 'F' - Java programming language <code>float</code> - JNI <code>jfloat</code> 3431 </constant> 3432 <constant id="JVMTI_PRIMITIVE_TYPE_DOUBLE" num="68"> 3433 'D' - Java programming language <code>double</code> - JNI <code>jdouble</code> 3434 </constant> 3435 </constants> 3436 </intro> 3437 3438 <typedef id="jvmtiHeapReferenceInfoField" 3439 label="Reference information structure for Field references" 3440 since="1.1"> 3441 <description> 3442 Reference information returned for 3443 <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/> and 3444 <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/> references. 3445 </description> 3446 <field id="index"> 3447 <jint/> 3448 <description> 3449 For <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/>, the 3450 referrer object is not a class or an inteface. 3451 In this case, <code>index</code> is the index of the field 3452 in the class of the referrer object. 3453 This class is referred to below as <i>C</i>. 3454 <p/> 3455 For <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/>, 3456 the referrer object is a class (referred to below as <i>C</i>) 3457 or an interface (referred to below as <i>I</i>). 3458 In this case, <code>index</code> is the index of the field in 3459 that class or interface. 3460 <p/> 3461 If the referrer object is not an interface, then the field 3462 indices are determined as follows: 3463 <ul> 3464 <li>make a list of all the fields in <i>C</i> and its 3465 superclasses, starting with all the fields in 3466 <code>java.lang.Object</code> and ending with all the 3467 fields in <i>C</i>.</li> 3468 <li>Within this list, put 3469 the fields for a given class in the order returned by 3470 <functionlink id="GetClassFields"/>.</li> 3471 <li>Assign the fields in this list indices 3472 <i>n</i>, <i>n</i>+1, ..., in order, where <i>n</i> 3473 is the count of the fields in all the interfaces 3474 implemented by <i>C</i>. 3475 Note that <i>C</i> implements all interfaces 3476 directly implemented by its superclasses; as well 3477 as all superinterfaces of these interfaces.</li> 3478 </ul> 3479 If the referrer object is an interface, then the field 3480 indices are determined as follows: 3481 <ul> 3482 <li>make a list of the fields directly declared in 3483 <i>I</i>.</li> 3484 <li>Within this list, put 3485 the fields in the order returned by 3486 <functionlink id="GetClassFields"/>.</li> 3487 <li>Assign the fields in this list indices 3488 <i>n</i>, <i>n</i>+1, ..., in order, where <i>n</i> 3489 is the count of the fields in all the superinterfaces 3490 of <i>I</i>.</li> 3491 </ul> 3492 All fields are included in this computation, regardless of 3493 field modifier (static, public, private, etc). 3494 <p/> 3495 For example, given the following classes and interfaces: 3496 <example> 3497 interface I0 { 3498 int p = 0; 3499 } 3500 3501 interface I1 extends I0 { 3502 int x = 1; 3503 } 3504 3505 interface I2 extends I0 { 3506 int y = 2; 3507 } 3508 3509 class C1 implements I1 { 3510 public static int a = 3; 3511 private int b = 4; 3512 } 3513 3514 class C2 extends C1 implements I2 { 3515 static int q = 5; 3516 final int r = 6; 3517 } 3518 </example> 3519 Assume that <functionlink id="GetClassFields"/> called on 3520 <code>C1</code> returns the fields of <code>C1</code> in the 3521 order: a, b; and that the fields of <code>C2</code> are 3522 returned in the order: q, r. 3523 An instance of class <code>C1</code> will have the 3524 following field indices: 3525 <dl><dd><table> 3526 <tr> 3527 <td> 3528 a 3529 </td> 3530 <td> 3531 2 3532 </td> 3533 <td align="left"> 3534 The count of the fields in the interfaces 3535 implemented by <code>C1</code> is two (<i>n</i>=2): 3536 <code>p</code> of <code>I0</code> 3537 and <code>x</code> of <code>I1</code>. 3538 </td> 3539 </tr> 3540 <tr> 3541 <td> 3542 b 3543 </td> 3544 <td> 3545 3 3546 </td> 3547 <td align="left"> 3548 the subsequent index. 3549 </td> 3550 </tr> 3551 </table></dd></dl> 3552 The class <code>C1</code> will have the same field indices. 3553 <p/> 3554 An instance of class <code>C2</code> will have the 3555 following field indices: 3556 <dl><dd><table> 3557 <tr> 3558 <td> 3559 a 3560 </td> 3561 <td> 3562 3 3563 </td> 3564 <td align="left"> 3565 The count of the fields in the interfaces 3566 implemented by <code>C2</code> is three (<i>n</i>=3): 3567 <code>p</code> of <code>I0</code>, 3568 <code>x</code> of <code>I1</code> and <code>y</code> of <code>I2</code> 3569 (an interface of <code>C2</code>). Note that the field <code>p</code> 3570 of <code>I0</code> is only included once. 3571 </td> 3572 </tr> 3573 <tr> 3574 <td> 3575 b 3576 </td> 3577 <td> 3578 4 3579 </td> 3580 <td align="left"> 3581 the subsequent index to "a". 3582 </td> 3583 </tr> 3584 <tr> 3585 <td> 3586 q 3587 </td> 3588 <td> 3589 5 3590 </td> 3591 <td align="left"> 3592 the subsequent index to "b". 3593 </td> 3594 </tr> 3595 <tr> 3596 <td> 3597 r 3598 </td> 3599 <td> 3600 6 3601 </td> 3602 <td align="left"> 3603 the subsequent index to "q". 3604 </td> 3605 </tr> 3606 </table></dd></dl> 3607 The class <code>C2</code> will have the same field indices. 3608 Note that a field may have a different index depending on the 3609 object that is viewing it -- for example field "a" above. 3610 Note also: not all field indices may be visible from the 3611 callbacks, but all indices are shown for illustrative purposes. 3612 <p/> 3613 The interface <code>I1</code> will have the 3614 following field indices: 3615 <dl><dd><table> 3616 <tr> 3617 <td> 3618 x 3619 </td> 3620 <td> 3621 1 3622 </td> 3623 <td align="left"> 3624 The count of the fields in the superinterfaces 3625 of <code>I1</code> is one (<i>n</i>=1): 3626 <code>p</code> of <code>I0</code>. 3627 </td> 3628 </tr> 3629 </table></dd></dl> 3630 </description> 3631 </field> 3632 </typedef> 3633 3634 <typedef id="jvmtiHeapReferenceInfoArray" 3635 label="Reference information structure for Array references" 3636 since="1.1"> 3637 <description> 3638 Reference information returned for 3639 <datalink id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT"/> references. 3640 </description> 3641 <field id="index"> 3642 <jint/> 3643 <description> 3644 The array index. 3645 </description> 3646 </field> 3647 </typedef> 3648 3649 <typedef id="jvmtiHeapReferenceInfoConstantPool" 3650 label="Reference information structure for Constant Pool references" 3651 since="1.1"> 3652 <description> 3653 Reference information returned for 3654 <datalink id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL"/> references. 3655 </description> 3656 <field id="index"> 3657 <jint/> 3658 <description> 3659 The index into the constant pool of the class. See the description in 3660 <vmspec chapter="4.4"/>. 3661 </description> 3662 </field> 3663 </typedef> 3664 3665 <typedef id="jvmtiHeapReferenceInfoStackLocal" 3666 label="Reference information structure for Local Variable references" 3667 since="1.1"> 3668 <description> 3669 Reference information returned for 3670 <datalink id="JVMTI_HEAP_REFERENCE_STACK_LOCAL"/> references. 3671 </description> 3672 <field id="thread_tag"> 3673 <jlong/> 3674 <description> 3675 The tag of the thread corresponding to this stack, zero if not tagged. 3676 </description> 3677 </field> 3678 <field id="thread_id"> 3679 <jlong/> 3680 <description> 3681 The unique thread ID of the thread corresponding to this stack. 3682 </description> 3683 </field> 3684 <field id="depth"> 3685 <jint/> 3686 <description> 3687 The depth of the frame. 3688 </description> 3689 </field> 3690 <field id="method"> 3691 <jmethodID/> 3692 <description> 3693 The method executing in this frame. 3694 </description> 3695 </field> 3696 <field id="location"> 3697 <jlocation/> 3698 <description> 3699 The currently executing location in this frame. 3700 </description> 3701 </field> 3702 <field id="slot"> 3703 <jint/> 3704 <description> 3705 The slot number of the local variable. 3706 </description> 3707 </field> 3708 </typedef> 3709 3710 <typedef id="jvmtiHeapReferenceInfoJniLocal" 3711 label="Reference information structure for JNI local references" 3712 since="1.1"> 3713 <description> 3714 Reference information returned for 3715 <datalink id="JVMTI_HEAP_REFERENCE_JNI_LOCAL"/> references. 3716 </description> 3717 <field id="thread_tag"> 3718 <jlong/> 3719 <description> 3720 The tag of the thread corresponding to this stack, zero if not tagged. 3721 </description> 3722 </field> 3723 <field id="thread_id"> 3724 <jlong/> 3725 <description> 3726 The unique thread ID of the thread corresponding to this stack. 3727 </description> 3728 </field> 3729 <field id="depth"> 3730 <jint/> 3731 <description> 3732 The depth of the frame. 3733 </description> 3734 </field> 3735 <field id="method"> 3736 <jmethodID/> 3737 <description> 3738 The method executing in this frame. 3739 </description> 3740 </field> 3741 </typedef> 3742 3743 <typedef id="jvmtiHeapReferenceInfoReserved" 3744 label="Reference information structure for Other references" 3745 since="1.1"> 3746 <description> 3747 Reference information returned for other references. 3748 </description> 3749 <field id="reserved1"> 3750 <jlong/> 3751 <description> 3752 reserved for future use. 3753 </description> 3754 </field> 3755 <field id="reserved2"> 3756 <jlong/> 3757 <description> 3758 reserved for future use. 3759 </description> 3760 </field> 3761 <field id="reserved3"> 3762 <jlong/> 3763 <description> 3764 reserved for future use. 3765 </description> 3766 </field> 3767 <field id="reserved4"> 3768 <jlong/> 3769 <description> 3770 reserved for future use. 3771 </description> 3772 </field> 3773 <field id="reserved5"> 3774 <jlong/> 3775 <description> 3776 reserved for future use. 3777 </description> 3778 </field> 3779 <field id="reserved6"> 3780 <jlong/> 3781 <description> 3782 reserved for future use. 3783 </description> 3784 </field> 3785 <field id="reserved7"> 3786 <jlong/> 3787 <description> 3788 reserved for future use. 3789 </description> 3790 </field> 3791 <field id="reserved8"> 3792 <jlong/> 3793 <description> 3794 reserved for future use. 3795 </description> 3796 </field> 3797 </typedef> 3798 3799 <uniontypedef id="jvmtiHeapReferenceInfo" 3800 label="Reference information structure" 3801 since="1.1"> 3802 <description> 3803 The information returned about referrers. 3804 Represented as a union of the various kinds of reference information. 3805 </description> 3806 <field id="field"> 3807 <struct>jvmtiHeapReferenceInfoField</struct> 3808 <description> 3809 The referrer information for 3810 <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/> 3811 and <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/> references. 3812 </description> 3813 </field> 3814 <field id="array"> 3815 <struct>jvmtiHeapReferenceInfoArray</struct> 3816 <description> 3817 The referrer information for 3818 For <datalink id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT"/> references. 3819 </description> 3820 </field> 3821 <field id="constant_pool"> 3822 <struct>jvmtiHeapReferenceInfoConstantPool</struct> 3823 <description> 3824 The referrer information for 3825 For <datalink id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL"/> references. 3826 </description> 3827 </field> 3828 <field id="stack_local"> 3829 <struct>jvmtiHeapReferenceInfoStackLocal</struct> 3830 <description> 3831 The referrer information for 3832 For <datalink id="JVMTI_HEAP_REFERENCE_STACK_LOCAL"/> references. 3833 </description> 3834 </field> 3835 <field id="jni_local"> 3836 <struct>jvmtiHeapReferenceInfoJniLocal</struct> 3837 <description> 3838 The referrer information for 3839 For <datalink id="JVMTI_HEAP_REFERENCE_JNI_LOCAL"/> references. 3840 </description> 3841 </field> 3842 <field id="other"> 3843 <struct>jvmtiHeapReferenceInfoReserved</struct> 3844 <description> 3845 reserved for future use. 3846 </description> 3847 </field> 3848 </uniontypedef> 3849 3850 <typedef id="jvmtiHeapCallbacks" 3851 label="Heap callback function structure" 3852 since="1.1"> 3853 <field id="heap_iteration_callback"> 3854 <ptrtype> 3855 <struct>jvmtiHeapIterationCallback</struct> 3856 </ptrtype> 3857 <description> 3858 The callback to be called to describe an 3859 object in the heap. Used by the 3860 <functionlink id="IterateThroughHeap"/> function, ignored by the 3861 <functionlink id="FollowReferences"/> function. 3862 </description> 3863 </field> 3864 <field id="heap_reference_callback"> 3865 <ptrtype> 3866 <struct>jvmtiHeapReferenceCallback</struct> 3867 </ptrtype> 3868 <description> 3869 The callback to be called to describe an 3870 object reference. Used by the 3871 <functionlink id="FollowReferences"/> function, ignored by the 3872 <functionlink id="IterateThroughHeap"/> function. 3873 </description> 3874 </field> 3875 <field id="primitive_field_callback"> 3876 <ptrtype> 3877 <struct>jvmtiPrimitiveFieldCallback</struct> 3878 </ptrtype> 3879 <description> 3880 The callback to be called to describe a 3881 primitive field. 3882 </description> 3883 </field> 3884 <field id="array_primitive_value_callback"> 3885 <ptrtype> 3886 <struct>jvmtiArrayPrimitiveValueCallback</struct> 3887 </ptrtype> 3888 <description> 3889 The callback to be called to describe an 3890 array of primitive values. 3891 </description> 3892 </field> 3893 <field id="string_primitive_value_callback"> 3894 <ptrtype> 3895 <struct>jvmtiStringPrimitiveValueCallback</struct> 3896 </ptrtype> 3897 <description> 3898 The callback to be called to describe a String value. 3899 </description> 3900 </field> 3901 <field id="reserved5"> 3902 <ptrtype> 3903 <struct>jvmtiReservedCallback</struct> 3904 </ptrtype> 3905 <description> 3906 Reserved for future use.. 3907 </description> 3908 </field> 3909 <field id="reserved6"> 3910 <ptrtype> 3911 <struct>jvmtiReservedCallback</struct> 3912 </ptrtype> 3913 <description> 3914 Reserved for future use.. 3915 </description> 3916 </field> 3917 <field id="reserved7"> 3918 <ptrtype> 3919 <struct>jvmtiReservedCallback</struct> 3920 </ptrtype> 3921 <description> 3922 Reserved for future use.. 3923 </description> 3924 </field> 3925 <field id="reserved8"> 3926 <ptrtype> 3927 <struct>jvmtiReservedCallback</struct> 3928 </ptrtype> 3929 <description> 3930 Reserved for future use.. 3931 </description> 3932 </field> 3933 <field id="reserved9"> 3934 <ptrtype> 3935 <struct>jvmtiReservedCallback</struct> 3936 </ptrtype> 3937 <description> 3938 Reserved for future use.. 3939 </description> 3940 </field> 3941 <field id="reserved10"> 3942 <ptrtype> 3943 <struct>jvmtiReservedCallback</struct> 3944 </ptrtype> 3945 <description> 3946 Reserved for future use.. 3947 </description> 3948 </field> 3949 <field id="reserved11"> 3950 <ptrtype> 3951 <struct>jvmtiReservedCallback</struct> 3952 </ptrtype> 3953 <description> 3954 Reserved for future use.. 3955 </description> 3956 </field> 3957 <field id="reserved12"> 3958 <ptrtype> 3959 <struct>jvmtiReservedCallback</struct> 3960 </ptrtype> 3961 <description> 3962 Reserved for future use.. 3963 </description> 3964 </field> 3965 <field id="reserved13"> 3966 <ptrtype> 3967 <struct>jvmtiReservedCallback</struct> 3968 </ptrtype> 3969 <description> 3970 Reserved for future use.. 3971 </description> 3972 </field> 3973 <field id="reserved14"> 3974 <ptrtype> 3975 <struct>jvmtiReservedCallback</struct> 3976 </ptrtype> 3977 <description> 3978 Reserved for future use.. 3979 </description> 3980 </field> 3981 <field id="reserved15"> 3982 <ptrtype> 3983 <struct>jvmtiReservedCallback</struct> 3984 </ptrtype> 3985 <description> 3986 Reserved for future use.. 3987 </description> 3988 </field> 3989 </typedef> 3990 3991 3992 <intro> 3993 <rationale> 3994 The heap dumping functionality (below) uses a callback 3995 for each object. While it would seem that a buffered approach 3996 would provide better throughput, tests do 3997 not show this to be the case--possibly due to locality of 3998 memory reference or array access overhead. 3999 </rationale> 4000 4001 <issue> 4002 Still under investigation as to if java.lang.ref references 4003 are reported as a different type of reference. 4004 </issue> 4005 4006 <issue> 4007 Should or can an indication of the cost or relative cost of 4008 these operations be included? 4009 </issue> 4010 4011 </intro> 4012 4013 <callback id="jvmtiHeapIterationCallback" since="1.1"> 4014 <jint/> 4015 <synopsis>Heap Iteration Callback</synopsis> 4016 <description> 4017 Agent supplied callback function. 4018 Describes (but does not pass in) an object in the heap. 4019 <p/> 4020 This function should return a bit vector of the desired 4021 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>. 4022 This will determine if the entire iteration should be aborted 4023 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored). 4024 <p/> 4025 See the <internallink id="heapCallbacks">heap callback 4026 function restrictions</internallink>. 4027 </description> 4028 <parameters> 4029 <param id="class_tag"> 4030 <jlong/> 4031 <description> 4032 The tag of the class of object (zero if the class is not tagged). 4033 If the object represents a runtime class, 4034 the <code>class_tag</code> is the tag 4035 associated with <code>java.lang.Class</code> 4036 (zero if <code>java.lang.Class</code> is not tagged). 4037 </description> 4038 </param> 4039 <param id="size"> 4040 <jlong/> 4041 <description> 4042 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 4043 </description> 4044 </param> 4045 <param id="tag_ptr"> 4046 <outptr><jlong/></outptr> 4047 <description> 4048 The object tag value, or zero if the object is not tagged. 4049 To set the tag value to be associated with the object 4050 the agent sets the <code>jlong</code> pointed to by the parameter. 4051 </description> 4052 </param> 4053 <param id="length"> 4054 <jint/> 4055 <description> 4056 If this object is an array, the length of the array. Otherwise negative one (-1). 4057 </description> 4058 </param> 4059 <param id="user_data"> 4060 <outptr><void/></outptr> 4061 <description> 4062 The user supplied data that was passed into the iteration function. 4063 </description> 4064 </param> 4065 </parameters> 4066 </callback> 4067 4068 <callback id="jvmtiHeapReferenceCallback" since="1.1"> 4069 <jint/> 4070 <synopsis>Heap Reference Callback</synopsis> 4071 <description> 4072 Agent supplied callback function. 4073 Describes a reference from an object or the VM (the referrer) to another object 4074 (the referree) or a heap root to a referree. 4075 <p/> 4076 This function should return a bit vector of the desired 4077 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>. 4078 This will determine if the objects referenced by the referree 4079 should be visited or if the entire iteration should be aborted. 4080 <p/> 4081 See the <internallink id="heapCallbacks">heap callback 4082 function restrictions</internallink>. 4083 </description> 4084 <parameters> 4085 <param id="reference_kind"> 4086 <enum>jvmtiHeapReferenceKind</enum> 4087 <description> 4088 The kind of reference. 4089 </description> 4090 </param> 4091 <param id="reference_info"> 4092 <inptr> 4093 <struct>jvmtiHeapReferenceInfo</struct> 4094 </inptr> 4095 <description> 4096 Details about the reference. 4097 Set when the <datalink id="jvmtiHeapReferenceCallback.reference_kind">reference_kind</datalink> is 4098 <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/>, 4099 <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/>, 4100 <datalink id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT"/>, 4101 <datalink id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL"/>, 4102 <datalink id="JVMTI_HEAP_REFERENCE_STACK_LOCAL"/>, 4103 or <datalink id="JVMTI_HEAP_REFERENCE_JNI_LOCAL"/>. 4104 Otherwise <code>NULL</code>. 4105 </description> 4106 </param> 4107 <param id="class_tag"> 4108 <jlong/> 4109 <description> 4110 The tag of the class of referree object (zero if the class is not tagged). 4111 If the referree object represents a runtime class, 4112 the <code>class_tag</code> is the tag 4113 associated with <code>java.lang.Class</code> 4114 (zero if <code>java.lang.Class</code> is not tagged). 4115 </description> 4116 </param> 4117 <param id="referrer_class_tag"> 4118 <jlong/> 4119 <description> 4120 The tag of the class of the referrer object (zero if the class is not tagged 4121 or the referree is a heap root). If the referrer object represents a runtime 4122 class, the <code>referrer_class_tag</code> is the tag associated with 4123 the <code>java.lang.Class</code> 4124 (zero if <code>java.lang.Class</code> is not tagged). 4125 </description> 4126 </param> 4127 <param id="size"> 4128 <jlong/> 4129 <description> 4130 Size of the referree object (in bytes). 4131 See <functionlink id="GetObjectSize"/>. 4132 </description> 4133 </param> 4134 <param id="tag_ptr"> 4135 <outptr><jlong/></outptr> 4136 <description> 4137 Points to the referree object tag value, or zero if the object is not 4138 tagged. 4139 To set the tag value to be associated with the object 4140 the agent sets the <code>jlong</code> pointed to by the parameter. 4141 </description> 4142 </param> 4143 <param id="referrer_tag_ptr"> 4144 <outptr><jlong/></outptr> 4145 <description> 4146 Points to the tag of the referrer object, or 4147 points to the zero if the referrer 4148 object is not tagged. 4149 <code>NULL</code> if the referrer in not an object (that is, 4150 this callback is reporting a heap root). 4151 To set the tag value to be associated with the referrer object 4152 the agent sets the <code>jlong</code> pointed to by the parameter. 4153 If this callback is reporting a reference from an object to itself, 4154 <code>referrer_tag_ptr == tag_ptr</code>. 4155 </description> 4156 </param> 4157 <param id="length"> 4158 <jint/> 4159 <description> 4160 If this object is an array, the length of the array. Otherwise negative one (-1). 4161 </description> 4162 </param> 4163 <param id="user_data"> 4164 <outptr><void/></outptr> 4165 <description> 4166 The user supplied data that was passed into the iteration function. 4167 </description> 4168 </param> 4169 </parameters> 4170 </callback> 4171 4172 <callback id="jvmtiPrimitiveFieldCallback" since="1.1"> 4173 <jint/> 4174 <synopsis>Primitive Field Callback</synopsis> 4175 <description> 4176 Agent supplied callback function which 4177 describes a primitive field of an object (<i>the object</i>). 4178 A primitive field is a field whose type is a primitive type. 4179 This callback will describe a static field if the object is a class, 4180 and otherwise will describe an instance field. 4181 <p/> 4182 This function should return a bit vector of the desired 4183 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>. 4184 This will determine if the entire iteration should be aborted 4185 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored). 4186 <p/> 4187 See the <internallink id="heapCallbacks">heap callback 4188 function restrictions</internallink>. 4189 </description> 4190 <parameters> 4191 <param id="kind"> 4192 <enum>jvmtiHeapReferenceKind</enum> 4193 <description> 4194 The kind of field -- instance or static (<datalink id="JVMTI_HEAP_REFERENCE_FIELD"/> or 4195 <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/>). 4196 </description> 4197 </param> 4198 <param id="info"> 4199 <inptr> 4200 <struct>jvmtiHeapReferenceInfo</struct> 4201 </inptr> 4202 <description> 4203 Which field (the field index). 4204 </description> 4205 </param> 4206 <param id="object_class_tag"> 4207 <jlong/> 4208 <description> 4209 The tag of the class of the object (zero if the class is not tagged). 4210 If the object represents a runtime class, the 4211 <code>object_class_tag</code> is the tag 4212 associated with <code>java.lang.Class</code> 4213 (zero if <code>java.lang.Class</code> is not tagged). 4214 </description> 4215 </param> 4216 <param id="object_tag_ptr"> 4217 <outptr><jlong/></outptr> 4218 <description> 4219 Points to the tag of the object, or zero if the object is not 4220 tagged. 4221 To set the tag value to be associated with the object 4222 the agent sets the <code>jlong</code> pointed to by the parameter. 4223 </description> 4224 </param> 4225 <param id="value"> 4226 <jvalue/> 4227 <description> 4228 The value of the field. 4229 </description> 4230 </param> 4231 <param id="value_type"> 4232 <enum>jvmtiPrimitiveType</enum> 4233 <description> 4234 The type of the field. 4235 </description> 4236 </param> 4237 <param id="user_data"> 4238 <outptr><void/></outptr> 4239 <description> 4240 The user supplied data that was passed into the iteration function. 4241 </description> 4242 </param> 4243 </parameters> 4244 </callback> 4245 4246 <callback id="jvmtiArrayPrimitiveValueCallback" since="1.1"> 4247 <jint/> 4248 <synopsis>Array Primitive Value Callback</synopsis> 4249 <description> 4250 Agent supplied callback function. 4251 Describes the values in an array of a primitive type. 4252 <p/> 4253 This function should return a bit vector of the desired 4254 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>. 4255 This will determine if the entire iteration should be aborted 4256 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored). 4257 <p/> 4258 See the <internallink id="heapCallbacks">heap callback 4259 function restrictions</internallink>. 4260 </description> 4261 <parameters> 4262 <param id="class_tag"> 4263 <jlong/> 4264 <description> 4265 The tag of the class of the array object (zero if the class is not tagged). 4266 </description> 4267 </param> 4268 <param id="size"> 4269 <jlong/> 4270 <description> 4271 Size of the array (in bytes). 4272 See <functionlink id="GetObjectSize"/>. 4273 </description> 4274 </param> 4275 <param id="tag_ptr"> 4276 <outptr><jlong/></outptr> 4277 <description> 4278 Points to the tag of the array object, or zero if the object is not 4279 tagged. 4280 To set the tag value to be associated with the object 4281 the agent sets the <code>jlong</code> pointed to by the parameter. 4282 </description> 4283 </param> 4284 <param id="element_count"> 4285 <jint/> 4286 <description> 4287 The length of the primitive array. 4288 </description> 4289 </param> 4290 <param id="element_type"> 4291 <enum>jvmtiPrimitiveType</enum> 4292 <description> 4293 The type of the elements of the array. 4294 </description> 4295 </param> 4296 <param id="elements"> 4297 <vmbuf><void/></vmbuf> 4298 <description> 4299 The elements of the array in a packed array of <code>element_count</code> 4300 items of <code>element_type</code> size each. 4301 </description> 4302 </param> 4303 <param id="user_data"> 4304 <outptr><void/></outptr> 4305 <description> 4306 The user supplied data that was passed into the iteration function. 4307 </description> 4308 </param> 4309 </parameters> 4310 </callback> 4311 4312 <callback id="jvmtiStringPrimitiveValueCallback" since="1.1"> 4313 <jint/> 4314 <synopsis>String Primitive Value Callback</synopsis> 4315 <description> 4316 Agent supplied callback function. 4317 Describes the value of a java.lang.String. 4318 <p/> 4319 This function should return a bit vector of the desired 4320 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>. 4321 This will determine if the entire iteration should be aborted 4322 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored). 4323 <p/> 4324 See the <internallink id="heapCallbacks">heap callback 4325 function restrictions</internallink>. 4326 </description> 4327 <parameters> 4328 <param id="class_tag"> 4329 <jlong/> 4330 <description> 4331 The tag of the class of the String class (zero if the class is not tagged). 4332 <issue>Is this needed?</issue> 4333 </description> 4334 </param> 4335 <param id="size"> 4336 <jlong/> 4337 <description> 4338 Size of the string (in bytes). 4339 See <functionlink id="GetObjectSize"/>. 4340 </description> 4341 </param> 4342 <param id="tag_ptr"> 4343 <outptr><jlong/></outptr> 4344 <description> 4345 Points to the tag of the String object, or zero if the object is not 4346 tagged. 4347 To set the tag value to be associated with the object 4348 the agent sets the <code>jlong</code> pointed to by the parameter. 4349 </description> 4350 </param> 4351 <param id="value"> 4352 <vmbuf><jchar/></vmbuf> 4353 <description> 4354 The value of the String, encoded as a Unicode string. 4355 </description> 4356 </param> 4357 <param id="value_length"> 4358 <jint/> 4359 <description> 4360 The length of the string. 4361 The length is equal to the number of 16-bit Unicode 4362 characters in the string. 4363 </description> 4364 </param> 4365 <param id="user_data"> 4366 <outptr><void/></outptr> 4367 <description> 4368 The user supplied data that was passed into the iteration function. 4369 </description> 4370 </param> 4371 </parameters> 4372 </callback> 4373 4374 4375 <callback id="jvmtiReservedCallback" since="1.1"> 4376 <jint/> 4377 <synopsis>reserved for future use Callback</synopsis> 4378 <description> 4379 Placeholder -- reserved for future use. 4380 </description> 4381 <parameters> 4382 </parameters> 4383 </callback> 4384 4385 <function id="FollowReferences" num="115" since="1.1"> 4386 <synopsis>Follow References</synopsis> 4387 <description> 4388 This function initiates a traversal over the objects that are 4389 directly and indirectly reachable from the specified object or, 4390 if <code>initial_object</code> is not specified, all objects 4391 reachable from the heap roots. 4392 The heap root are the set of system classes, 4393 JNI globals, references from thread stacks, and other objects used as roots 4394 for the purposes of garbage collection. 4395 <p/> 4396 This function operates by traversing the reference graph. 4397 Let <i>A</i>, <i>B</i>, ... represent objects. 4398 When a reference from <i>A</i> to <i>B</i> is traversed, 4399 when a reference from a heap root to <i>B</i> is traversed, 4400 or when <i>B</i> is specified as the <paramlink id="initial_object"/>, 4401 then <i>B</i> is said to be <i>visited</i>. 4402 A reference from <i>A</i> to <i>B</i> is not traversed until <i>A</i> 4403 is visited. 4404 References are reported in the same order that the references are traversed. 4405 Object references are reported by invoking the agent supplied 4406 callback function <functionlink id="jvmtiHeapReferenceCallback"/>. 4407 In a reference from <i>A</i> to <i>B</i>, <i>A</i> is known 4408 as the <i>referrer</i> and <i>B</i> as the <i>referree</i>. 4409 The callback is invoked exactly once for each reference from a referrer; 4410 this is true even if there are reference cycles or multiple paths to 4411 the referrer. 4412 There may be more than one reference between a referrer and a referree, 4413 each reference is reported. 4414 These references may be distinguished by examining the 4415 <datalink 4416 id="jvmtiHeapReferenceCallback.reference_kind"><code>reference_kind</code></datalink> 4417 and 4418 <datalink 4419 id="jvmtiHeapReferenceCallback.reference_info"><code>reference_info</code></datalink> 4420 parameters of the <functionlink id="jvmtiHeapReferenceCallback"/> callback. 4421 <p/> 4422 This function reports a Java programming language view of object references, 4423 not a virtual machine implementation view. The following object references 4424 are reported when they are non-null: 4425 <ul> 4426 <li>Instance objects report references to each non-primitive instance fields 4427 (including inherited fields).</li> 4428 <li>Instance objects report a reference to the object type (class).</li> 4429 <li>Classes report a reference to the superclass and directly 4430 implemented/extended interfaces.</li> 4431 <li>Classes report a reference to the class loader, protection domain, 4432 signers, and resolved entries in the constant pool.</li> 4433 <li>Classes report a reference to each directly declared non-primitive 4434 static field.</li> 4435 <li>Arrays report a reference to the array type (class) and each 4436 array element.</li> 4437 <li>Primitive arrays report a reference to the array type.</li> 4438 </ul> 4439 <p/> 4440 This function can also be used to examine primitive (non-object) values. 4441 The primitive value of an array or String 4442 is reported after the object has been visited; 4443 it is reported by invoking the agent supplied callback function 4444 <functionlink id="jvmtiArrayPrimitiveValueCallback"/> or 4445 <functionlink id="jvmtiStringPrimitiveValueCallback"/>. 4446 A primitive field 4447 is reported after the object with that field is visited; 4448 it is reported by invoking the agent supplied callback function 4449 <functionlink id="jvmtiPrimitiveFieldCallback"/>. 4450 <p/> 4451 Whether a callback is provided or is <code>NULL</code> only determines 4452 whether the callback will be invoked, it does not influence 4453 which objects are visited nor does it influence whether other callbacks 4454 will be invoked. 4455 However, the 4456 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink> 4457 returned by <functionlink id="jvmtiHeapReferenceCallback"/> 4458 do determine if the objects referenced by the 4459 current object as visited. 4460 The <datalink id="jvmtiHeapFilter">heap filter flags</datalink> 4461 and <paramlink id="klass"/> provided as parameters to this function 4462 do not control which objects are visited but they do control which 4463 objects and primitive values are reported by the callbacks. 4464 For example, if the only callback that was set is 4465 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> and <code>klass</code> 4466 is set to the array of bytes class, then only arrays of byte will be 4467 reported. 4468 The table below summarizes this: 4469 <p/> 4470 <table> 4471 <tr> 4472 <th/> 4473 <th> 4474 Controls objects visited 4475 </th> 4476 <th> 4477 Controls objects reported 4478 </th> 4479 <th> 4480 Controls primitives reported 4481 </th> 4482 </tr> 4483 <tr> 4484 <th align="left"> 4485 the 4486 <datalink id="jvmtiHeapVisitControl">Heap Visit Control Flags</datalink> 4487 returned by <functionlink id="jvmtiHeapReferenceCallback"/> 4488 </th> 4489 <td> 4490 <b>Yes</b> 4491 </td> 4492 <td> 4493 <b>Yes</b>, since visits are controlled 4494 </td> 4495 <td> 4496 <b>Yes</b>, since visits are controlled 4497 </td> 4498 </tr> 4499 <tr> 4500 <th align="left"> 4501 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> 4502 in <paramlink id="callbacks"/> set 4503 </th> 4504 <td> 4505 No 4506 </td> 4507 <td> 4508 <b>Yes</b> 4509 </td> 4510 <td> 4511 No 4512 </td> 4513 </tr> 4514 <tr> 4515 <th align="left"> 4516 <paramlink id="heap_filter"/> 4517 </th> 4518 <td> 4519 No 4520 </td> 4521 <td> 4522 <b>Yes</b> 4523 </td> 4524 <td> 4525 <b>Yes</b> 4526 </td> 4527 </tr> 4528 <tr> 4529 <th align="left"> 4530 <paramlink id="klass"/> 4531 </th> 4532 <td> 4533 No 4534 </td> 4535 <td> 4536 <b>Yes</b> 4537 </td> 4538 <td> 4539 <b>Yes</b> 4540 </td> 4541 </tr> 4542 </table> 4543 <p/> 4544 During the execution of this function the state of the heap 4545 does not change: no objects are allocated, no objects are 4546 garbage collected, and the state of objects (including 4547 held values) does not change. 4548 As a result, threads executing Java 4549 programming language code, threads attempting to resume the 4550 execution of Java programming language code, and threads 4551 attempting to execute JNI functions are typically stalled. 4552 </description> 4553 <origin>new</origin> 4554 <capabilities> 4555 <required id="can_tag_objects"></required> 4556 </capabilities> 4557 <parameters> 4558 <param id="heap_filter"> 4559 <jint/> 4560 <description> 4561 This bit vector of 4562 <datalink id="jvmtiHeapFilter">heap filter flags</datalink>. 4563 restricts the objects for which the callback function is called. 4564 This applies to both the object and primitive callbacks. 4565 </description> 4566 </param> 4567 <param id="klass"> 4568 <ptrtype> 4569 <jclass/> 4570 <nullok>callbacks are not limited to instances of a particular 4571 class</nullok> 4572 </ptrtype> 4573 <description> 4574 Callbacks are only reported when the object is an instance of 4575 this class. 4576 Objects which are instances of a subclass of <code>klass</code> 4577 are not reported. 4578 If <code>klass</code> is an interface, no objects are reported. 4579 This applies to both the object and primitive callbacks. 4580 </description> 4581 </param> 4582 <param id="initial_object"> 4583 <ptrtype> 4584 <jobject/> 4585 <nullok>references are followed from the heap roots</nullok> 4586 </ptrtype> 4587 <description> 4588 The object to follow 4589 </description> 4590 </param> 4591 <param id="callbacks"> 4592 <inptr> 4593 <struct>jvmtiHeapCallbacks</struct> 4594 </inptr> 4595 <description> 4596 Structure defining the set of callback functions. 4597 </description> 4598 </param> 4599 <param id="user_data"> 4600 <inbuf> 4601 <void/> 4602 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 4603 </inbuf> 4604 <description> 4605 User supplied data to be passed to the callback. 4606 </description> 4607 </param> 4608 </parameters> 4609 <errors> 4610 <error id="JVMTI_ERROR_INVALID_CLASS"> 4611 <paramlink id="klass"/> is not a valid class. 4612 </error> 4613 <error id="JVMTI_ERROR_INVALID_OBJECT"> 4614 <paramlink id="initial_object"/> is not a valid object. 4615 </error> 4616 </errors> 4617 </function> 4618 4619 4620 <function id="IterateThroughHeap" num="116" since="1.1"> 4621 <synopsis>Iterate Through Heap</synopsis> 4622 <description> 4623 Initiate an iteration over all objects in the heap. 4624 This includes both reachable and 4625 unreachable objects. Objects are visited in no particular order. 4626 <p/> 4627 Heap objects are reported by invoking the agent supplied 4628 callback function <functionlink id="jvmtiHeapIterationCallback"/>. 4629 References between objects are not reported. 4630 If only reachable objects are desired, or if object reference information 4631 is needed, use <functionlink id="FollowReferences"/>. 4632 <p/> 4633 This function can also be used to examine primitive (non-object) values. 4634 The primitive value of an array or String 4635 is reported after the object has been visited; 4636 it is reported by invoking the agent supplied callback function 4637 <functionlink id="jvmtiArrayPrimitiveValueCallback"/> or 4638 <functionlink id="jvmtiStringPrimitiveValueCallback"/>. 4639 A primitive field 4640 is reported after the object with that field is visited; 4641 it is reported by invoking the agent supplied 4642 callback function 4643 <functionlink id="jvmtiPrimitiveFieldCallback"/>. 4644 <p/> 4645 Unless the iteration is aborted by the 4646 <datalink id="jvmtiHeapVisitControl">Heap Visit Control Flags</datalink> 4647 returned by a callback, all objects in the heap are visited. 4648 Whether a callback is provided or is <code>NULL</code> only determines 4649 whether the callback will be invoked, it does not influence 4650 which objects are visited nor does it influence whether other callbacks 4651 will be invoked. 4652 The <datalink id="jvmtiHeapFilter">heap filter flags</datalink> 4653 and <paramlink id="klass"/> provided as parameters to this function 4654 do not control which objects are visited but they do control which 4655 objects and primitive values are reported by the callbacks. 4656 For example, if the only callback that was set is 4657 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> and <code>klass</code> 4658 is set to the array of bytes class, then only arrays of byte will be 4659 reported. The table below summarizes this (contrast this with 4660 <functionlink id="FollowReferences"/>): 4661 <p/> 4662 <table> 4663 <tr> 4664 <th/> 4665 <th> 4666 Controls objects visited 4667 </th> 4668 <th> 4669 Controls objects reported 4670 </th> 4671 <th> 4672 Controls primitives reported 4673 </th> 4674 </tr> 4675 <tr> 4676 <th align="left"> 4677 the 4678 <datalink id="jvmtiHeapVisitControl">Heap Visit Control Flags</datalink> 4679 returned by <functionlink id="jvmtiHeapIterationCallback"/> 4680 </th> 4681 <td> 4682 No<br/>(unless they abort the iteration) 4683 </td> 4684 <td> 4685 No<br/>(unless they abort the iteration) 4686 </td> 4687 <td> 4688 No<br/>(unless they abort the iteration) 4689 </td> 4690 </tr> 4691 <tr> 4692 <th align="left"> 4693 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> 4694 in <paramlink id="callbacks"/> set 4695 </th> 4696 <td> 4697 No 4698 </td> 4699 <td> 4700 <b>Yes</b> 4701 </td> 4702 <td> 4703 No 4704 </td> 4705 </tr> 4706 <tr> 4707 <th align="left"> 4708 <paramlink id="heap_filter"/> 4709 </th> 4710 <td> 4711 No 4712 </td> 4713 <td> 4714 <b>Yes</b> 4715 </td> 4716 <td> 4717 <b>Yes</b> 4718 </td> 4719 </tr> 4720 <tr> 4721 <th align="left"> 4722 <paramlink id="klass"/> 4723 </th> 4724 <td> 4725 No 4726 </td> 4727 <td> 4728 <b>Yes</b> 4729 </td> 4730 <td> 4731 <b>Yes</b> 4732 </td> 4733 </tr> 4734 </table> 4735 <p/> 4736 During the execution of this function the state of the heap 4737 does not change: no objects are allocated, no objects are 4738 garbage collected, and the state of objects (including 4739 held values) does not change. 4740 As a result, threads executing Java 4741 programming language code, threads attempting to resume the 4742 execution of Java programming language code, and threads 4743 attempting to execute JNI functions are typically stalled. 4744 </description> 4745 <origin>new</origin> 4746 <capabilities> 4747 <required id="can_tag_objects"></required> 4748 </capabilities> 4749 <parameters> 4750 <param id="heap_filter"> 4751 <jint/> 4752 <description> 4753 This bit vector of 4754 <datalink id="jvmtiHeapFilter">heap filter flags</datalink>. 4755 restricts the objects for which the callback function is called. 4756 This applies to both the object and primitive callbacks. 4757 </description> 4758 </param> 4759 <param id="klass"> 4760 <ptrtype> 4761 <jclass/> 4762 <nullok>callbacks are not limited to instances of a particular class</nullok> 4763 </ptrtype> 4764 <description> 4765 Callbacks are only reported when the object is an instance of 4766 this class. 4767 Objects which are instances of a subclass of <code>klass</code> 4768 are not reported. 4769 If <code>klass</code> is an interface, no objects are reported. 4770 This applies to both the object and primitive callbacks. 4771 </description> 4772 </param> 4773 <param id="callbacks"> 4774 <inptr> 4775 <struct>jvmtiHeapCallbacks</struct> 4776 </inptr> 4777 <description> 4778 Structure defining the set callback functions. 4779 </description> 4780 </param> 4781 <param id="user_data"> 4782 <inbuf> 4783 <void/> 4784 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 4785 </inbuf> 4786 <description> 4787 User supplied data to be passed to the callback. 4788 </description> 4789 </param> 4790 </parameters> 4791 <errors> 4792 <error id="JVMTI_ERROR_INVALID_CLASS"> 4793 <paramlink id="klass"/> is not a valid class. 4794 </error> 4795 </errors> 4796 </function> 4797 4798 <function id="GetTag" phase="start" num="106"> 4799 <synopsis>Get Tag</synopsis> 4800 <description> 4801 Retrieve the tag associated with an object. 4802 The tag is a long value typically used to store a 4803 unique identifier or pointer to object information. 4804 The tag is set with 4805 <functionlink id="SetTag"></functionlink>. 4806 Objects for which no tags have been set return a 4807 tag value of zero. 4808 </description> 4809 <origin>new</origin> 4810 <capabilities> 4811 <required id="can_tag_objects"></required> 4812 </capabilities> 4813 <parameters> 4814 <param id="object"> 4815 <jobject/> 4816 <description> 4817 The object whose tag is to be retrieved. 4818 </description> 4819 </param> 4820 <param id="tag_ptr"> 4821 <outptr><jlong/></outptr> 4822 <description> 4823 On return, the referenced long is set to the value 4824 of the tag. 4825 </description> 4826 </param> 4827 </parameters> 4828 <errors> 4829 </errors> 4830 </function> 4831 4832 <function id="SetTag" phase="start" num="107"> 4833 <synopsis>Set Tag</synopsis> 4834 <description> 4835 Set the tag associated with an object. 4836 The tag is a long value typically used to store a 4837 unique identifier or pointer to object information. 4838 The tag is visible with 4839 <functionlink id="GetTag"></functionlink>. 4840 </description> 4841 <origin>new</origin> 4842 <capabilities> 4843 <required id="can_tag_objects"></required> 4844 </capabilities> 4845 <parameters> 4846 <param id="object"> 4847 <jobject/> 4848 <description> 4849 The object whose tag is to be set. 4850 </description> 4851 </param> 4852 <param id="tag"> 4853 <jlong/> 4854 <description> 4855 The new value of the tag. 4856 </description> 4857 </param> 4858 </parameters> 4859 <errors> 4860 </errors> 4861 </function> 4862 4863 <function id="GetObjectsWithTags" num="114"> 4864 <synopsis>Get Objects With Tags</synopsis> 4865 <description> 4866 Return objects in the heap with the specified tags. 4867 The format is parallel arrays of objects and tags. 4868 </description> 4869 <origin>new</origin> 4870 <capabilities> 4871 <required id="can_tag_objects"></required> 4872 </capabilities> 4873 <parameters> 4874 <param id="tag_count"> 4875 <jint min="0"/> 4876 <description> 4877 Number of tags to scan for. 4878 </description> 4879 </param> 4880 <param id="tags"> 4881 <inbuf incount="tag_count"> 4882 <jlong/> 4883 </inbuf> 4884 <description> 4885 Scan for objects with these tags. 4886 Zero is not permitted in this array. 4887 </description> 4888 </param> 4889 <param id="count_ptr"> 4890 <outptr> 4891 <jint/> 4892 </outptr> 4893 <description> 4894 Return the number of objects with any of the tags 4895 in <paramlink id="tags"/>. 4896 </description> 4897 </param> 4898 <param id="object_result_ptr"> 4899 <allocbuf outcount="count_ptr"> 4900 <jobject/> 4901 <nullok>this information is not returned</nullok> 4902 </allocbuf> 4903 <description> 4904 Returns the array of objects with any of the tags 4905 in <paramlink id="tags"/>. 4906 </description> 4907 </param> 4908 <param id="tag_result_ptr"> 4909 <allocbuf outcount="count_ptr"> 4910 <jlong/> 4911 <nullok>this information is not returned</nullok> 4912 </allocbuf> 4913 <description> 4914 For each object in <paramlink id="object_result_ptr"/>, 4915 return the tag at the corresponding index. 4916 </description> 4917 </param> 4918 </parameters> 4919 <errors> 4920 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 4921 Zero is present in <paramlink id="tags"></paramlink>. 4922 </error> 4923 </errors> 4924 </function> 4925 4926 <function id="ForceGarbageCollection" num="108"> 4927 <synopsis>Force Garbage Collection</synopsis> 4928 <description> 4929 Force the VM to perform a garbage collection. 4930 The garbage collection is as complete as possible. 4931 This function does not cause finalizers to be run. 4932 This function does not return until the garbage collection 4933 is finished. 4934 <p/> 4935 Although garbage collection is as complete 4936 as possible there is no guarantee that all 4937 <eventlink id="ObjectFree"/> 4938 events will have been 4939 sent by the time that this function 4940 returns. In particular, an object may be 4941 prevented from being freed because it 4942 is awaiting finalization. 4943 </description> 4944 <origin>new</origin> 4945 <capabilities> 4946 </capabilities> 4947 <parameters> 4948 </parameters> 4949 <errors> 4950 </errors> 4951 </function> 4952 4953 4954 </category> 4955 4956 <category id="Heap_1_0" label="Heap (1.0)"> 4957 <intro> 4958 <b> 4959 These functions and data types were introduced in the original 4960 <jvmti/> version 1.0 and have been superseded by more 4961 </b> 4962 <internallink id="Heap"><b>powerful and flexible versions</b></internallink> 4963 <b> 4964 which: 4965 </b> 4966 <ul> 4967 <li> 4968 <b> 4969 Allow access to primitive values (the value of Strings, arrays, 4970 and primitive fields) 4971 </b> 4972 </li> 4973 <li> 4974 <b> 4975 Allow the tag of the referrer to be set, thus enabling more 4976 efficient localized reference graph building 4977 </b> 4978 </li> 4979 <li> 4980 <b> 4981 Provide more extensive filtering abilities 4982 </b> 4983 </li> 4984 <li> 4985 <b> 4986 Are extensible, allowing their abilities to grow in future versions of <jvmti/> 4987 </b> 4988 </li> 4989 </ul> 4990 <p/> 4991 <b>Please use the </b> 4992 <internallink id="Heap"><b>current Heap functions</b></internallink>. 4993 <p/> 4994 <constants id="jvmtiHeapObjectFilter" label="Heap Object Filter Enumeration" kind="enum"> 4995 <constant id="JVMTI_HEAP_OBJECT_TAGGED" num="1"> 4996 Tagged objects only. 4997 </constant> 4998 <constant id="JVMTI_HEAP_OBJECT_UNTAGGED" num="2"> 4999 Untagged objects only. 5000 </constant> 5001 <constant id="JVMTI_HEAP_OBJECT_EITHER" num="3"> 5002 Either tagged or untagged objects. 5003 </constant> 5004 </constants> 5005 5006 <constants id="jvmtiHeapRootKind" label="Heap Root Kind Enumeration" kind="enum"> 5007 <constant id="JVMTI_HEAP_ROOT_JNI_GLOBAL" num="1"> 5008 JNI global reference. 5009 </constant> 5010 <constant id="JVMTI_HEAP_ROOT_SYSTEM_CLASS" num="2"> 5011 System class. 5012 </constant> 5013 <constant id="JVMTI_HEAP_ROOT_MONITOR" num="3"> 5014 Monitor. 5015 </constant> 5016 <constant id="JVMTI_HEAP_ROOT_STACK_LOCAL" num="4"> 5017 Stack local. 5018 </constant> 5019 <constant id="JVMTI_HEAP_ROOT_JNI_LOCAL" num="5"> 5020 JNI local reference. 5021 </constant> 5022 <constant id="JVMTI_HEAP_ROOT_THREAD" num="6"> 5023 Thread. 5024 </constant> 5025 <constant id="JVMTI_HEAP_ROOT_OTHER" num="7"> 5026 Other. 5027 </constant> 5028 </constants> 5029 5030 <constants id="jvmtiObjectReferenceKind" label="Object Reference Enumeration" kind="enum"> 5031 <constant id="JVMTI_REFERENCE_CLASS" num="1"> 5032 Reference from an object to its class. 5033 </constant> 5034 <constant id="JVMTI_REFERENCE_FIELD" num="2"> 5035 Reference from an object to the value of one of its instance fields. 5036 For references of this kind the <code>referrer_index</code> 5037 parameter to the <internallink id="jvmtiObjectReferenceCallback"> 5038 jvmtiObjectReferenceCallback</internallink> is the index of the 5039 the instance field. The index is based on the order of all the 5040 object's fields. This includes all fields of the directly declared 5041 static and instance fields in the class, and includes all fields (both 5042 public and private) fields declared in superclasses and superinterfaces. 5043 The index is thus calculated by summing the index of the field in the directly 5044 declared class (see <functionlink id="GetClassFields"/>), with the total 5045 number of fields (both public and private) declared in all superclasses 5046 and superinterfaces. The index starts at zero. 5047 </constant> 5048 <constant id="JVMTI_REFERENCE_ARRAY_ELEMENT" num="3"> 5049 Reference from an array to one of its elements. 5050 For references of this kind the <code>referrer_index</code> 5051 parameter to the <internallink id="jvmtiObjectReferenceCallback"> 5052 jvmtiObjectReferenceCallback</internallink> is the array index. 5053 </constant> 5054 <constant id="JVMTI_REFERENCE_CLASS_LOADER" num="4"> 5055 Reference from a class to its class loader. 5056 </constant> 5057 <constant id="JVMTI_REFERENCE_SIGNERS" num="5"> 5058 Reference from a class to its signers array. 5059 </constant> 5060 <constant id="JVMTI_REFERENCE_PROTECTION_DOMAIN" num="6"> 5061 Reference from a class to its protection domain. 5062 </constant> 5063 <constant id="JVMTI_REFERENCE_INTERFACE" num="7"> 5064 Reference from a class to one of its interfaces. 5065 </constant> 5066 <constant id="JVMTI_REFERENCE_STATIC_FIELD" num="8"> 5067 Reference from a class to the value of one of its static fields. 5068 For references of this kind the <code>referrer_index</code> 5069 parameter to the <internallink id="jvmtiObjectReferenceCallback"> 5070 jvmtiObjectReferenceCallback</internallink> is the index of the 5071 the static field. The index is based on the order of all the 5072 object's fields. This includes all fields of the directly declared 5073 static and instance fields in the class, and includes all fields (both 5074 public and private) fields declared in superclasses and superinterfaces. 5075 The index is thus calculated by summing the index of the field in the directly 5076 declared class (see <functionlink id="GetClassFields"/>), with the total 5077 number of fields (both public and private) declared in all superclasses 5078 and superinterfaces. The index starts at zero. 5079 Note: this definition differs from that in the <jvmti/> 1.0 Specification. 5080 <rationale>No known implementations used the 1.0 definition.</rationale> 5081 </constant> 5082 <constant id="JVMTI_REFERENCE_CONSTANT_POOL" num="9"> 5083 Reference from a class to a resolved entry in the constant pool. 5084 For references of this kind the <code>referrer_index</code> 5085 parameter to the <internallink id="jvmtiObjectReferenceCallback"> 5086 jvmtiObjectReferenceCallback</internallink> is the index into 5087 constant pool table of the class, starting at 1. See 5088 <vmspec chapter="4.4"/>. 5089 </constant> 5090 </constants> 5091 5092 <constants id="jvmtiIterationControl" label="Iteration Control Enumeration" kind="enum"> 5093 <constant id="JVMTI_ITERATION_CONTINUE" num="1"> 5094 Continue the iteration. 5095 If this is a reference iteration, follow the references of this object. 5096 </constant> 5097 <constant id="JVMTI_ITERATION_IGNORE" num="2"> 5098 Continue the iteration. 5099 If this is a reference iteration, ignore the references of this object. 5100 </constant> 5101 <constant id="JVMTI_ITERATION_ABORT" num="0"> 5102 Abort the iteration. 5103 </constant> 5104 </constants> 5105 </intro> 5106 5107 <callback id="jvmtiHeapObjectCallback"> 5108 <enum>jvmtiIterationControl</enum> 5109 <synopsis>Heap Object Callback</synopsis> 5110 <description> 5111 Agent supplied callback function. 5112 Describes (but does not pass in) an object in the heap. 5113 <p/> 5114 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration, 5115 or <code>JVMTI_ITERATION_ABORT</code> to stop iteration. 5116 <p/> 5117 See the <internallink id="heapCallbacks">heap callback 5118 function restrictions</internallink>. 5119 </description> 5120 <parameters> 5121 <param id="class_tag"> 5122 <jlong/> 5123 <description> 5124 The tag of the class of object (zero if the class is not tagged). 5125 If the object represents a runtime class, 5126 the <code>class_tag</code> is the tag 5127 associated with <code>java.lang.Class</code> 5128 (zero if <code>java.lang.Class</code> is not tagged). 5129 </description> 5130 </param> 5131 <param id="size"> 5132 <jlong/> 5133 <description> 5134 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 5135 </description> 5136 </param> 5137 <param id="tag_ptr"> 5138 <outptr><jlong/></outptr> 5139 <description> 5140 The object tag value, or zero if the object is not tagged. 5141 To set the tag value to be associated with the object 5142 the agent sets the <code>jlong</code> pointed to by the parameter. 5143 </description> 5144 </param> 5145 <param id="user_data"> 5146 <outptr><void/></outptr> 5147 <description> 5148 The user supplied data that was passed into the iteration function. 5149 </description> 5150 </param> 5151 </parameters> 5152 </callback> 5153 5154 <callback id="jvmtiHeapRootCallback"> 5155 <enum>jvmtiIterationControl</enum> 5156 <synopsis>Heap Root Object Callback</synopsis> 5157 <description> 5158 Agent supplied callback function. 5159 Describes (but does not pass in) an object that is a root for the purposes 5160 of garbage collection. 5161 <p/> 5162 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration, 5163 <code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing 5164 references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration. 5165 <p/> 5166 See the <internallink id="heapCallbacks">heap callback 5167 function restrictions</internallink>. 5168 </description> 5169 <parameters> 5170 <param id="root_kind"> 5171 <enum>jvmtiHeapRootKind</enum> 5172 <description> 5173 The kind of heap root. 5174 </description> 5175 </param> 5176 <param id="class_tag"> 5177 <jlong/> 5178 <description> 5179 The tag of the class of object (zero if the class is not tagged). 5180 If the object represents a runtime class, the <code>class_tag</code> is the tag 5181 associated with <code>java.lang.Class</code> 5182 (zero if <code>java.lang.Class</code> is not tagged). 5183 </description> 5184 </param> 5185 <param id="size"> 5186 <jlong/> 5187 <description> 5188 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 5189 </description> 5190 </param> 5191 <param id="tag_ptr"> 5192 <outptr><jlong/></outptr> 5193 <description> 5194 The object tag value, or zero if the object is not tagged. 5195 To set the tag value to be associated with the object 5196 the agent sets the <code>jlong</code> pointed to by the parameter. 5197 </description> 5198 </param> 5199 <param id="user_data"> 5200 <outptr><void/></outptr> 5201 <description> 5202 The user supplied data that was passed into the iteration function. 5203 </description> 5204 </param> 5205 </parameters> 5206 </callback> 5207 5208 <callback id="jvmtiStackReferenceCallback"> 5209 <enum>jvmtiIterationControl</enum> 5210 <synopsis>Stack Reference Object Callback</synopsis> 5211 <description> 5212 Agent supplied callback function. 5213 Describes (but does not pass in) an object on the stack that is a root for 5214 the purposes of garbage collection. 5215 <p/> 5216 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration, 5217 <code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing 5218 references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration. 5219 <p/> 5220 See the <internallink id="heapCallbacks">heap callback 5221 function restrictions</internallink>. 5222 </description> 5223 <parameters> 5224 <param id="root_kind"> 5225 <enum>jvmtiHeapRootKind</enum> 5226 <description> 5227 The kind of root (either <code>JVMTI_HEAP_ROOT_STACK_LOCAL</code> or 5228 <code>JVMTI_HEAP_ROOT_JNI_LOCAL</code>). 5229 </description> 5230 </param> 5231 <param id="class_tag"> 5232 <jlong/> 5233 <description> 5234 The tag of the class of object (zero if the class is not tagged). 5235 If the object represents a runtime class, the <code>class_tag</code> is the tag 5236 associated with <code>java.lang.Class</code> 5237 (zero if <code>java.lang.Class</code> is not tagged). 5238 </description> 5239 </param> 5240 <param id="size"> 5241 <jlong/> 5242 <description> 5243 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 5244 </description> 5245 </param> 5246 <param id="tag_ptr"> 5247 <outptr><jlong/></outptr> 5248 <description> 5249 The object tag value, or zero if the object is not tagged. 5250 To set the tag value to be associated with the object 5251 the agent sets the <code>jlong</code> pointed to by the parameter. 5252 </description> 5253 </param> 5254 <param id="thread_tag"> 5255 <jlong/> 5256 <description> 5257 The tag of the thread corresponding to this stack, zero if not tagged. 5258 </description> 5259 </param> 5260 <param id="depth"> 5261 <jint/> 5262 <description> 5263 The depth of the frame. 5264 </description> 5265 </param> 5266 <param id="method"> 5267 <jmethodID/> 5268 <description> 5269 The method executing in this frame. 5270 </description> 5271 </param> 5272 <param id="slot"> 5273 <jint/> 5274 <description> 5275 The slot number. 5276 </description> 5277 </param> 5278 <param id="user_data"> 5279 <outptr><void/></outptr> 5280 <description> 5281 The user supplied data that was passed into the iteration function. 5282 </description> 5283 </param> 5284 </parameters> 5285 </callback> 5286 5287 <callback id="jvmtiObjectReferenceCallback"> 5288 <enum>jvmtiIterationControl</enum> 5289 <synopsis>Object Reference Callback</synopsis> 5290 <description> 5291 Agent supplied callback function. 5292 Describes a reference from an object (the referrer) to another object 5293 (the referree). 5294 <p/> 5295 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration, 5296 <code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing 5297 references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration. 5298 <p/> 5299 See the <internallink id="heapCallbacks">heap callback 5300 function restrictions</internallink>. 5301 </description> 5302 <parameters> 5303 <param id="reference_kind"> 5304 <enum>jvmtiObjectReferenceKind</enum> 5305 <description> 5306 The type of reference. 5307 </description> 5308 </param> 5309 <param id="class_tag"> 5310 <jlong/> 5311 <description> 5312 The tag of the class of referree object (zero if the class is not tagged). 5313 If the referree object represents a runtime class, 5314 the <code>class_tag</code> is the tag 5315 associated with <code>java.lang.Class</code> 5316 (zero if <code>java.lang.Class</code> is not tagged). 5317 </description> 5318 </param> 5319 <param id="size"> 5320 <jlong/> 5321 <description> 5322 Size of the referree object (in bytes). 5323 See <functionlink id="GetObjectSize"/>. 5324 </description> 5325 </param> 5326 <param id="tag_ptr"> 5327 <outptr><jlong/></outptr> 5328 <description> 5329 The referree object tag value, or zero if the object is not 5330 tagged. 5331 To set the tag value to be associated with the object 5332 the agent sets the <code>jlong</code> pointed to by the parameter. 5333 </description> 5334 </param> 5335 <param id="referrer_tag"> 5336 <jlong/> 5337 <description> 5338 The tag of the referrer object, or zero if the referrer 5339 object is not tagged. 5340 </description> 5341 </param> 5342 <param id="referrer_index"> 5343 <jint/> 5344 <description> 5345 For references of type <code>JVMTI_REFERENCE_FIELD</code> or 5346 <code>JVMTI_REFERENCE_STATIC_FIELD</code> the index 5347 of the field in the referrer object. The index is based on the 5348 order of all the object's fields - see <internallink 5349 id="JVMTI_REFERENCE_FIELD">JVMTI_REFERENCE_FIELD</internallink> 5350 or <internallink 5351 id="JVMTI_REFERENCE_STATIC_FIELD">JVMTI_REFERENCE_STATIC_FIELD 5352 </internallink> for further description. 5353 <p/> 5354 For references of type <code>JVMTI_REFERENCE_ARRAY_ELEMENT</code> 5355 the array index - see <internallink id="JVMTI_REFERENCE_ARRAY_ELEMENT"> 5356 JVMTI_REFERENCE_ARRAY_ELEMENT</internallink> for further description. 5357 <p/> 5358 For references of type <code>JVMTI_REFERENCE_CONSTANT_POOL</code> 5359 the index into the constant pool of the class - see 5360 <internallink id="JVMTI_REFERENCE_CONSTANT_POOL"> 5361 JVMTI_REFERENCE_CONSTANT_POOL</internallink> for further 5362 description. 5363 <p/> 5364 For references of other kinds the <code>referrer_index</code> is 5365 <code>-1</code>. 5366 </description> 5367 </param> 5368 <param id="user_data"> 5369 <outptr><void/></outptr> 5370 <description> 5371 The user supplied data that was passed into the iteration function. 5372 </description> 5373 </param> 5374 </parameters> 5375 </callback> 5376 5377 <function id="IterateOverObjectsReachableFromObject" num="109"> 5378 <synopsis>Iterate Over Objects Reachable From Object</synopsis> 5379 <description> 5380 This function iterates over all objects that are directly 5381 and indirectly reachable from the specified object. 5382 For each object <i>A</i> (known 5383 as the referrer) with a reference to object <i>B</i> the specified 5384 callback function is called to describe the object reference. 5385 The callback is called exactly once for each reference from a referrer; 5386 this is true even if there are reference cycles or multiple paths to 5387 the referrer. 5388 There may be more than one reference between a referrer and a referree, 5389 These may be distinguished by the 5390 <datalink id="jvmtiObjectReferenceCallback.reference_kind"></datalink> and 5391 <datalink id="jvmtiObjectReferenceCallback.referrer_index"></datalink>. 5392 The callback for an object will always occur after the callback for 5393 its referrer. 5394 <p/> 5395 See <functionlink id="FollowReferences"/> for the object 5396 references which are reported. 5397 <p/> 5398 During the execution of this function the state of the heap 5399 does not change: no objects are allocated, no objects are 5400 garbage collected, and the state of objects (including 5401 held values) does not change. 5402 As a result, threads executing Java 5403 programming language code, threads attempting to resume the 5404 execution of Java programming language code, and threads 5405 attempting to execute JNI functions are typically stalled. 5406 </description> 5407 <origin>new</origin> 5408 <capabilities> 5409 <required id="can_tag_objects"></required> 5410 </capabilities> 5411 <parameters> 5412 <param id="object"> 5413 <jobject/> 5414 <description> 5415 The object 5416 </description> 5417 </param> 5418 <param id="object_reference_callback"> 5419 <ptrtype> 5420 <struct>jvmtiObjectReferenceCallback</struct> 5421 </ptrtype> 5422 <description> 5423 The callback to be called to describe each 5424 object reference. 5425 </description> 5426 </param> 5427 <param id="user_data"> 5428 <inbuf> 5429 <void/> 5430 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 5431 </inbuf> 5432 <description> 5433 User supplied data to be passed to the callback. 5434 </description> 5435 </param> 5436 </parameters> 5437 <errors> 5438 </errors> 5439 </function> 5440 5441 <function id="IterateOverReachableObjects" num="110"> 5442 <synopsis>Iterate Over Reachable Objects</synopsis> 5443 <description> 5444 This function iterates over the root objects and all objects that 5445 are directly and indirectly reachable from the root objects. 5446 The root objects comprise the set of system classes, 5447 JNI globals, references from thread stacks, and other objects used as roots 5448 for the purposes of garbage collection. 5449 <p/> 5450 For each root the <paramlink id="heap_root_callback"></paramlink> 5451 or <paramlink id="stack_ref_callback"></paramlink> callback is called. 5452 An object can be a root object for more than one reason and in that case 5453 the appropriate callback is called for each reason. 5454 <p/> 5455 For each object reference the <paramlink id="object_ref_callback"></paramlink> 5456 callback function is called to describe the object reference. 5457 The callback is called exactly once for each reference from a referrer; 5458 this is true even if there are reference cycles or multiple paths to 5459 the referrer. 5460 There may be more than one reference between a referrer and a referree, 5461 These may be distinguished by the 5462 <datalink id="jvmtiObjectReferenceCallback.reference_kind"></datalink> and 5463 <datalink id="jvmtiObjectReferenceCallback.referrer_index"></datalink>. 5464 The callback for an object will always occur after the callback for 5465 its referrer. 5466 <p/> 5467 See <functionlink id="FollowReferences"/> for the object 5468 references which are reported. 5469 <p/> 5470 Roots are always reported to the profiler before any object references 5471 are reported. In other words, the <paramlink id="object_ref_callback"></paramlink> 5472 callback will not be called until the appropriate callback has been called 5473 for all roots. If the <paramlink id="object_ref_callback"></paramlink> callback is 5474 specified as <code>NULL</code> then this function returns after 5475 reporting the root objects to the profiler. 5476 <p/> 5477 During the execution of this function the state of the heap 5478 does not change: no objects are allocated, no objects are 5479 garbage collected, and the state of objects (including 5480 held values) does not change. 5481 As a result, threads executing Java 5482 programming language code, threads attempting to resume the 5483 execution of Java programming language code, and threads 5484 attempting to execute JNI functions are typically stalled. 5485 </description> 5486 <origin>new</origin> 5487 <capabilities> 5488 <required id="can_tag_objects"></required> 5489 </capabilities> 5490 <parameters> 5491 <param id="heap_root_callback"> 5492 <ptrtype> 5493 <struct>jvmtiHeapRootCallback</struct> 5494 <nullok>do not report heap roots</nullok> 5495 </ptrtype> 5496 <description> 5497 The callback function to be called for each heap root of type 5498 <code>JVMTI_HEAP_ROOT_JNI_GLOBAL</code>, 5499 <code>JVMTI_HEAP_ROOT_SYSTEM_CLASS</code>, 5500 <code>JVMTI_HEAP_ROOT_MONITOR</code>, 5501 <code>JVMTI_HEAP_ROOT_THREAD</code>, or 5502 <code>JVMTI_HEAP_ROOT_OTHER</code>. 5503 </description> 5504 </param> 5505 <param id="stack_ref_callback"> 5506 <ptrtype> 5507 <struct>jvmtiStackReferenceCallback</struct> 5508 <nullok>do not report stack references</nullok> 5509 </ptrtype> 5510 <description> 5511 The callback function to be called for each heap root of 5512 <code>JVMTI_HEAP_ROOT_STACK_LOCAL</code> or 5513 <code>JVMTI_HEAP_ROOT_JNI_LOCAL</code>. 5514 </description> 5515 </param> 5516 <param id="object_ref_callback"> 5517 <ptrtype> 5518 <struct>jvmtiObjectReferenceCallback</struct> 5519 <nullok>do not follow references from the root objects</nullok> 5520 </ptrtype> 5521 <description> 5522 The callback function to be called for each object reference. 5523 </description> 5524 </param> 5525 <param id="user_data"> 5526 <inbuf> 5527 <void/> 5528 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 5529 </inbuf> 5530 <description> 5531 User supplied data to be passed to the callback. 5532 </description> 5533 </param> 5534 </parameters> 5535 <errors> 5536 </errors> 5537 </function> 5538 5539 <function id="IterateOverHeap" num="111"> 5540 <synopsis>Iterate Over Heap</synopsis> 5541 <description> 5542 Iterate over all objects in the heap. This includes both reachable and 5543 unreachable objects. 5544 <p/> 5545 The <paramlink id="object_filter"></paramlink> parameter indicates the 5546 objects for which the callback function is called. If this parameter 5547 is <code>JVMTI_HEAP_OBJECT_TAGGED</code> then the callback will only be 5548 called for every object that is tagged. If the parameter is 5549 <code>JVMTI_HEAP_OBJECT_UNTAGGED</code> then the callback will only be 5550 for objects that are not tagged. If the parameter 5551 is <code>JVMTI_HEAP_OBJECT_EITHER</code> then the callback will be 5552 called for every object in the heap, irrespective of whether it is 5553 tagged or not. 5554 <p/> 5555 During the execution of this function the state of the heap 5556 does not change: no objects are allocated, no objects are 5557 garbage collected, and the state of objects (including 5558 held values) does not change. 5559 As a result, threads executing Java 5560 programming language code, threads attempting to resume the 5561 execution of Java programming language code, and threads 5562 attempting to execute JNI functions are typically stalled. 5563 </description> 5564 <origin>new</origin> 5565 <capabilities> 5566 <required id="can_tag_objects"></required> 5567 </capabilities> 5568 <parameters> 5569 <param id="object_filter"> 5570 <enum>jvmtiHeapObjectFilter</enum> 5571 <description> 5572 Indicates the objects for which the callback function is called. 5573 </description> 5574 </param> 5575 <param id="heap_object_callback"> 5576 <ptrtype> 5577 <struct>jvmtiHeapObjectCallback</struct> 5578 </ptrtype> 5579 <description> 5580 The iterator function to be called for each 5581 object matching the <paramlink id="object_filter"/>. 5582 </description> 5583 </param> 5584 <param id="user_data"> 5585 <inbuf> 5586 <void/> 5587 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 5588 </inbuf> 5589 <description> 5590 User supplied data to be passed to the callback. 5591 </description> 5592 </param> 5593 </parameters> 5594 <errors> 5595 </errors> 5596 </function> 5597 5598 <function id="IterateOverInstancesOfClass" num="112"> 5599 <synopsis>Iterate Over Instances Of Class</synopsis> 5600 <description> 5601 Iterate over all objects in the heap that are instances of the specified class. 5602 This includes direct instances of the specified class and 5603 instances of all subclasses of the specified class. 5604 This includes both reachable and unreachable objects. 5605 <p/> 5606 The <paramlink id="object_filter"></paramlink> parameter indicates the 5607 objects for which the callback function is called. If this parameter 5608 is <code>JVMTI_HEAP_OBJECT_TAGGED</code> then the callback will only be 5609 called for every object that is tagged. If the parameter is 5610 <code>JVMTI_HEAP_OBJECT_UNTAGGED</code> then the callback will only be 5611 called for objects that are not tagged. If the parameter 5612 is <code>JVMTI_HEAP_OBJECT_EITHER</code> then the callback will be 5613 called for every object in the heap, irrespective of whether it is 5614 tagged or not. 5615 <p/> 5616 During the execution of this function the state of the heap 5617 does not change: no objects are allocated, no objects are 5618 garbage collected, and the state of objects (including 5619 held values) does not change. 5620 As a result, threads executing Java 5621 programming language code, threads attempting to resume the 5622 execution of Java programming language code, and threads 5623 attempting to execute JNI functions are typically stalled. 5624 </description> 5625 <origin>new</origin> 5626 <capabilities> 5627 <required id="can_tag_objects"></required> 5628 </capabilities> 5629 <parameters> 5630 <param id="klass"> 5631 <jclass/> 5632 <description> 5633 Iterate over objects of this class only. 5634 </description> 5635 </param> 5636 <param id="object_filter"> 5637 <enum>jvmtiHeapObjectFilter</enum> 5638 <description> 5639 Indicates the objects for which the callback function is called. 5640 </description> 5641 </param> 5642 <param id="heap_object_callback"> 5643 <ptrtype> 5644 <struct>jvmtiHeapObjectCallback</struct> 5645 </ptrtype> 5646 <description> 5647 The iterator function to be called for each 5648 <paramlink id="klass"/> instance matching 5649 the <paramlink id="object_filter"/>. 5650 </description> 5651 </param> 5652 <param id="user_data"> 5653 <inbuf> 5654 <void/> 5655 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 5656 </inbuf> 5657 <description> 5658 User supplied data to be passed to the callback. 5659 </description> 5660 </param> 5661 </parameters> 5662 <errors> 5663 </errors> 5664 </function> 5665 5666 </category> 5667 5668 <category id="local" label="Local Variable"> 5669 5670 <intro> 5671 These functions are used to retrieve or set the value of a local variable. 5672 The variable is identified by the depth of the frame containing its 5673 value and the variable's slot number within that frame. 5674 The mapping of variables to 5675 slot numbers can be obtained with the function 5676 <functionlink id="GetLocalVariableTable"></functionlink>. 5677 </intro> 5678 5679 <function id="GetLocalObject" num="21"> 5680 <synopsis>Get Local Variable - Object</synopsis> 5681 <description> 5682 This function can be used to retrieve the value of a local 5683 variable whose type is <code>Object</code> or a subclass of <code>Object</code>. 5684 </description> 5685 <origin>jvmdi</origin> 5686 <capabilities> 5687 <required id="can_access_local_variables"></required> 5688 </capabilities> 5689 <parameters> 5690 <param id="thread"> 5691 <jthread null="current" frame="frame"/> 5692 <description> 5693 The thread of the frame containing the variable's value. 5694 </description> 5695 </param> 5696 <param id="depth"> 5697 <jframeID thread="thread"/> 5698 <description> 5699 The depth of the frame containing the variable's value. 5700 </description> 5701 </param> 5702 <param id="slot"> 5703 <jint/> 5704 <description> 5705 The variable's slot number. 5706 </description> 5707 </param> 5708 <param id="value_ptr"> 5709 <outptr><jobject/></outptr> 5710 <description> 5711 On return, points to the variable's value. 5712 </description> 5713 </param> 5714 </parameters> 5715 <errors> 5716 <error id="JVMTI_ERROR_INVALID_SLOT"> 5717 Invalid <code>slot</code>. 5718 </error> 5719 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 5720 The variable type is not 5721 <code>Object</code> or a subclass of <code>Object</code>. 5722 </error> 5723 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 5724 Not a visible frame 5725 </error> 5726 </errors> 5727 </function> 5728 5729 <function id="GetLocalInstance" num="155" since="1.2"> 5730 <synopsis>Get Local Instance</synopsis> 5731 <description> 5732 This function can be used to retrieve the value of the local object 5733 variable at slot 0 (the "<code>this</code>" object) from non-static 5734 frames. This function can retrieve the "<code>this</code>" object from 5735 native method frames, whereas <code>GetLocalObject()</code> would 5736 return <code>JVMTI_ERROR_OPAQUE_FRAME</code> in those cases. 5737 </description> 5738 <origin>new</origin> 5739 <capabilities> 5740 <required id="can_access_local_variables"></required> 5741 </capabilities> 5742 <parameters> 5743 <param id="thread"> 5744 <jthread null="current" frame="frame"/> 5745 <description> 5746 The thread of the frame containing the variable's value. 5747 </description> 5748 </param> 5749 <param id="depth"> 5750 <jframeID thread="thread"/> 5751 <description> 5752 The depth of the frame containing the variable's value. 5753 </description> 5754 </param> 5755 <param id="value_ptr"> 5756 <outptr><jobject/></outptr> 5757 <description> 5758 On return, points to the variable's value. 5759 </description> 5760 </param> 5761 </parameters> 5762 <errors> 5763 <error id="JVMTI_ERROR_INVALID_SLOT"> 5764 If the specified frame is a static method frame. 5765 </error> 5766 </errors> 5767 </function> 5768 <function id="GetLocalInt" num="22"> 5769 <synopsis>Get Local Variable - Int</synopsis> 5770 <description> 5771 This function can be used to retrieve the value of a local 5772 variable whose type is <code>int</code>, 5773 <code>short</code>, <code>char</code>, <code>byte</code>, or 5774 <code>boolean</code>. 5775 </description> 5776 <origin>jvmdi</origin> 5777 <capabilities> 5778 <required id="can_access_local_variables"></required> 5779 </capabilities> 5780 <parameters> 5781 <param id="thread"> 5782 <jthread null="current" frame="frame"/> 5783 <description> 5784 The thread of the frame containing the variable's value. 5785 </description> 5786 </param> 5787 <param id="depth"> 5788 <jframeID thread="thread"/> 5789 <description> 5790 The depth of the frame containing the variable's value. 5791 </description> 5792 </param> 5793 <param id="slot"> 5794 <jint/> 5795 <description> 5796 The variable's slot number. 5797 </description> 5798 </param> 5799 <param id="value_ptr"> 5800 <outptr><jint/></outptr> 5801 <description> 5802 On return, points to the variable's value. 5803 </description> 5804 </param> 5805 </parameters> 5806 <errors> 5807 <error id="JVMTI_ERROR_INVALID_SLOT"> 5808 Invalid <code>slot</code>. 5809 </error> 5810 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 5811 The variable type is not 5812 <code>int</code>, <code>short</code>, 5813 <code>char</code>, <code>byte</code>, or 5814 <code>boolean</code>. 5815 </error> 5816 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 5817 Not a visible frame 5818 </error> 5819 </errors> 5820 </function> 5821 5822 <function id="GetLocalLong" num="23"> 5823 <synopsis>Get Local Variable - Long</synopsis> 5824 <description> 5825 This function can be used to retrieve the value of a local 5826 variable whose type is <code>long</code>. 5827 </description> 5828 <origin>jvmdi</origin> 5829 <capabilities> 5830 <required id="can_access_local_variables"></required> 5831 </capabilities> 5832 <parameters> 5833 <param id="thread"> 5834 <jthread null="current" frame="frame"/> 5835 <description> 5836 The thread of the frame containing the variable's value. 5837 </description> 5838 </param> 5839 <param id="depth"> 5840 <jframeID thread="thread"/> 5841 <description> 5842 The depth of the frame containing the variable's value. 5843 </description> 5844 </param> 5845 <param id="slot"> 5846 <jint/> 5847 <description> 5848 The variable's slot number. 5849 </description> 5850 </param> 5851 <param id="value_ptr"> 5852 <outptr><jlong/></outptr> 5853 <description> 5854 On return, points to the variable's value. 5855 </description> 5856 </param> 5857 </parameters> 5858 <errors> 5859 <error id="JVMTI_ERROR_INVALID_SLOT"> 5860 Invalid <code>slot</code>. 5861 </error> 5862 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 5863 The variable type is not <code>long</code>. 5864 </error> 5865 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 5866 Not a visible frame 5867 </error> 5868 </errors> 5869 </function> 5870 5871 <function id="GetLocalFloat" num="24"> 5872 <synopsis>Get Local Variable - Float</synopsis> 5873 <description> 5874 This function can be used to retrieve the value of a local 5875 variable whose type is <code>float</code>. 5876 </description> 5877 <origin>jvmdi</origin> 5878 <capabilities> 5879 <required id="can_access_local_variables"></required> 5880 </capabilities> 5881 <parameters> 5882 <param id="thread"> 5883 <jthread null="current" frame="frame"/> 5884 <description> 5885 The thread of the frame containing the variable's value. 5886 </description> 5887 </param> 5888 <param id="depth"> 5889 <jframeID thread="thread"/> 5890 <description> 5891 The depth of the frame containing the variable's value. 5892 </description> 5893 </param> 5894 <param id="slot"> 5895 <jint/> 5896 <description> 5897 The variable's slot number. 5898 </description> 5899 </param> 5900 <param id="value_ptr"> 5901 <outptr><jfloat/></outptr> 5902 <description> 5903 On return, points to the variable's value. 5904 </description> 5905 </param> 5906 </parameters> 5907 <errors> 5908 <error id="JVMTI_ERROR_INVALID_SLOT"> 5909 Invalid <code>slot</code>. 5910 </error> 5911 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 5912 The variable type is not <code>float</code>. 5913 </error> 5914 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 5915 Not a visible frame 5916 </error> 5917 </errors> 5918 </function> 5919 5920 <function id="GetLocalDouble" num="25"> 5921 <synopsis>Get Local Variable - Double</synopsis> 5922 <description> 5923 This function can be used to retrieve the value of a local 5924 variable whose type is <code>long</code>. 5925 </description> 5926 <origin>jvmdi</origin> 5927 <capabilities> 5928 <required id="can_access_local_variables"></required> 5929 </capabilities> 5930 <parameters> 5931 <param id="thread"> 5932 <jthread null="current" frame="frame"/> 5933 <description> 5934 The thread of the frame containing the variable's value. 5935 </description> 5936 </param> 5937 <param id="depth"> 5938 <jframeID thread="thread"/> 5939 <description> 5940 The depth of the frame containing the variable's value. 5941 </description> 5942 </param> 5943 <param id="slot"> 5944 <jint/> 5945 <description> 5946 The variable's slot number. 5947 </description> 5948 </param> 5949 <param id="value_ptr"> 5950 <outptr><jdouble/></outptr> 5951 <description> 5952 On return, points to the variable's value. 5953 </description> 5954 </param> 5955 </parameters> 5956 <errors> 5957 <error id="JVMTI_ERROR_INVALID_SLOT"> 5958 Invalid <code>slot</code>. 5959 </error> 5960 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 5961 The variable type is not <code>double</code>. 5962 </error> 5963 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 5964 Not a visible frame 5965 </error> 5966 </errors> 5967 </function> 5968 5969 <function id="SetLocalObject" num="26"> 5970 <synopsis>Set Local Variable - Object</synopsis> 5971 <description> 5972 This function can be used to set the value of a local 5973 variable whose type is <code>Object</code> or a subclass of <code>Object</code>. 5974 </description> 5975 <origin>jvmdi</origin> 5976 <capabilities> 5977 <required id="can_access_local_variables"></required> 5978 </capabilities> 5979 <parameters> 5980 <param id="thread"> 5981 <jthread null="current" frame="frame"/> 5982 <description> 5983 The thread of the frame containing the variable's value. 5984 </description> 5985 </param> 5986 <param id="depth"> 5987 <jframeID thread="thread"/> 5988 <description> 5989 The depth of the frame containing the variable's value. 5990 </description> 5991 </param> 5992 <param id="slot"> 5993 <jint/> 5994 <description> 5995 The variable's slot number. 5996 </description> 5997 </param> 5998 <param id="value"> 5999 <jobject/> 6000 <description> 6001 The new value for the variable. 6002 </description> 6003 </param> 6004 </parameters> 6005 <errors> 6006 <error id="JVMTI_ERROR_INVALID_SLOT"> 6007 Invalid <code>slot</code>. 6008 </error> 6009 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6010 The variable type is not 6011 <code>Object</code> or a subclass of <code>Object</code>. 6012 </error> 6013 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6014 The supplied <paramlink id="value"/> is not compatible 6015 with the variable type. 6016 </error> 6017 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6018 Not a visible frame 6019 </error> 6020 </errors> 6021 </function> 6022 6023 <function id="SetLocalInt" num="27"> 6024 <synopsis>Set Local Variable - Int</synopsis> 6025 <description> 6026 This function can be used to set the value of a local 6027 variable whose type is <code>int</code>, 6028 <code>short</code>, <code>char</code>, <code>byte</code>, or 6029 <code>boolean</code>. 6030 </description> 6031 <origin>jvmdi</origin> 6032 <capabilities> 6033 <required id="can_access_local_variables"></required> 6034 </capabilities> 6035 <parameters> 6036 <param id="thread"> 6037 <jthread null="current" frame="frame"/> 6038 <description> 6039 The thread of the frame containing the variable's value. 6040 </description> 6041 </param> 6042 <param id="depth"> 6043 <jframeID thread="thread"/> 6044 <description> 6045 The depth of the frame containing the variable's value. 6046 </description> 6047 </param> 6048 <param id="slot"> 6049 <jint/> 6050 <description> 6051 The variable's slot number. 6052 </description> 6053 </param> 6054 <param id="value"> 6055 <jint/> 6056 <description> 6057 The new value for the variable. 6058 </description> 6059 </param> 6060 </parameters> 6061 <errors> 6062 <error id="JVMTI_ERROR_INVALID_SLOT"> 6063 Invalid <code>slot</code>. 6064 </error> 6065 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6066 The variable type is not 6067 <code>int</code>, <code>short</code>, 6068 <code>char</code>, <code>byte</code>, or 6069 <code>boolean</code>. 6070 </error> 6071 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6072 Not a visible frame 6073 </error> 6074 </errors> 6075 </function> 6076 6077 <function id="SetLocalLong" num="28"> 6078 <synopsis>Set Local Variable - Long</synopsis> 6079 <description> 6080 This function can be used to set the value of a local 6081 variable whose type is <code>long</code>. 6082 </description> 6083 <origin>jvmdi</origin> 6084 <capabilities> 6085 <required id="can_access_local_variables"></required> 6086 </capabilities> 6087 <parameters> 6088 <param id="thread"> 6089 <jthread null="current" frame="frame"/> 6090 <description> 6091 The thread of the frame containing the variable's value. 6092 </description> 6093 </param> 6094 <param id="depth"> 6095 <jframeID thread="thread"/> 6096 <description> 6097 The depth of the frame containing the variable's value. 6098 </description> 6099 </param> 6100 <param id="slot"> 6101 <jint/> 6102 <description> 6103 The variable's slot number. 6104 </description> 6105 </param> 6106 <param id="value"> 6107 <jlong/> 6108 <description> 6109 The new value for the variable. 6110 </description> 6111 </param> 6112 </parameters> 6113 <errors> 6114 <error id="JVMTI_ERROR_INVALID_SLOT"> 6115 Invalid <code>slot</code>. 6116 </error> 6117 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6118 The variable type is not <code>long</code>. 6119 </error> 6120 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6121 Not a visible frame 6122 </error> 6123 </errors> 6124 </function> 6125 6126 <function id="SetLocalFloat" num="29"> 6127 <synopsis>Set Local Variable - Float</synopsis> 6128 <description> 6129 This function can be used to set the value of a local 6130 variable whose type is <code>float</code>. 6131 </description> 6132 <origin>jvmdi</origin> 6133 <capabilities> 6134 <required id="can_access_local_variables"></required> 6135 </capabilities> 6136 <parameters> 6137 <param id="thread"> 6138 <jthread null="current" frame="frame"/> 6139 <description> 6140 The thread of the frame containing the variable's value. 6141 </description> 6142 </param> 6143 <param id="depth"> 6144 <jframeID thread="thread"/> 6145 <description> 6146 The depth of the frame containing the variable's value. 6147 </description> 6148 </param> 6149 <param id="slot"> 6150 <jint/> 6151 <description> 6152 The variable's slot number. 6153 </description> 6154 </param> 6155 <param id="value"> 6156 <jfloat/> 6157 <description> 6158 The new value for the variable. 6159 </description> 6160 </param> 6161 </parameters> 6162 <errors> 6163 <error id="JVMTI_ERROR_INVALID_SLOT"> 6164 Invalid <code>slot</code>. 6165 </error> 6166 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6167 The variable type is not <code>float</code>. 6168 </error> 6169 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6170 Not a visible frame 6171 </error> 6172 </errors> 6173 </function> 6174 6175 <function id="SetLocalDouble" num="30"> 6176 <synopsis>Set Local Variable - Double</synopsis> 6177 <description> 6178 This function can be used to set the value of a local 6179 variable whose type is <code>double</code>. 6180 </description> 6181 <origin>jvmdi</origin> 6182 <capabilities> 6183 <required id="can_access_local_variables"></required> 6184 </capabilities> 6185 <parameters> 6186 <param id="thread"> 6187 <jthread null="current" frame="frame"/> 6188 <description> 6189 The thread of the frame containing the variable's value. 6190 </description> 6191 </param> 6192 <param id="depth"> 6193 <jframeID thread="thread"/> 6194 <description> 6195 The depth of the frame containing the variable's value. 6196 </description> 6197 </param> 6198 <param id="slot"> 6199 <jint/> 6200 <description> 6201 The variable's slot number. 6202 </description> 6203 </param> 6204 <param id="value"> 6205 <jdouble/> 6206 <description> 6207 The new value for the variable. 6208 </description> 6209 </param> 6210 </parameters> 6211 <errors> 6212 <error id="JVMTI_ERROR_INVALID_SLOT"> 6213 Invalid <code>slot</code>. 6214 </error> 6215 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6216 The variable type is not <code>double</code>. 6217 </error> 6218 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6219 Not a visible frame 6220 </error> 6221 </errors> 6222 </function> 6223 </category> 6224 6225 <category id="breakpointCategory" label="Breakpoint"> 6226 6227 <intro> 6228 </intro> 6229 6230 <function id="SetBreakpoint" num="38"> 6231 <synopsis>Set Breakpoint</synopsis> 6232 <description> 6233 Set a breakpoint at the instruction indicated by 6234 <code>method</code> and <code>location</code>. 6235 An instruction can only have one breakpoint. 6236 <p/> 6237 Whenever the designated instruction is about to be executed, a 6238 <eventlink id="Breakpoint"></eventlink> event is generated. 6239 </description> 6240 <origin>jvmdi</origin> 6241 <capabilities> 6242 <required id="can_generate_breakpoint_events"></required> 6243 </capabilities> 6244 <parameters> 6245 <param id="klass"> 6246 <jclass method="method"/> 6247 <description> 6248 The class in which to set the breakpoint 6249 </description> 6250 </param> 6251 <param id="method"> 6252 <jmethodID class="klass"/> 6253 <description> 6254 The method in which to set the breakpoint 6255 </description> 6256 </param> 6257 <param id="location"> 6258 <jlocation/> 6259 <description> 6260 the index of the instruction at which to set the breakpoint 6261 6262 </description> 6263 </param> 6264 </parameters> 6265 <errors> 6266 <error id="JVMTI_ERROR_DUPLICATE"> 6267 The designated bytecode already has a breakpoint. 6268 </error> 6269 </errors> 6270 </function> 6271 6272 <function id="ClearBreakpoint" num="39"> 6273 <synopsis>Clear Breakpoint</synopsis> 6274 <description> 6275 Clear the breakpoint at the bytecode indicated by 6276 <code>method</code> and <code>location</code>. 6277 </description> 6278 <origin>jvmdi</origin> 6279 <capabilities> 6280 <required id="can_generate_breakpoint_events"></required> 6281 </capabilities> 6282 <parameters> 6283 <param id="klass"> 6284 <jclass method="method"/> 6285 <description> 6286 The class in which to clear the breakpoint 6287 </description> 6288 </param> 6289 <param id="method"> 6290 <jmethodID class="klass"/> 6291 <description> 6292 The method in which to clear the breakpoint 6293 </description> 6294 </param> 6295 <param id="location"> 6296 <jlocation/> 6297 <description> 6298 the index of the instruction at which to clear the breakpoint 6299 </description> 6300 </param> 6301 </parameters> 6302 <errors> 6303 <error id="JVMTI_ERROR_NOT_FOUND"> 6304 There's no breakpoint at the designated bytecode. 6305 </error> 6306 </errors> 6307 </function> 6308 6309 </category> 6310 6311 <category id="fieldWatch" label="Watched Field"> 6312 6313 <intro> 6314 </intro> 6315 6316 <function id="SetFieldAccessWatch" num="41"> 6317 <synopsis>Set Field Access Watch</synopsis> 6318 <description> 6319 Generate a <eventlink id="FieldAccess"></eventlink> event 6320 when the field specified 6321 by <code>klass</code> and 6322 <code>field</code> is about to be accessed. 6323 An event will be generated for each access of the field 6324 until it is canceled with 6325 <functionlink id="ClearFieldAccessWatch"></functionlink>. 6326 Field accesses from Java programming language code or from JNI code are watched, 6327 fields modified by other means are not watched. 6328 Note that <jvmti/> users should be aware that their own field accesses 6329 will trigger the watch. 6330 A field can only have one field access watch set. 6331 Modification of a field is not considered an access--use 6332 <functionlink id="SetFieldModificationWatch"></functionlink> 6333 to monitor modifications. 6334 </description> 6335 <origin>jvmdi</origin> 6336 <capabilities> 6337 <required id="can_generate_field_access_events"></required> 6338 </capabilities> 6339 <parameters> 6340 <param id="klass"> 6341 <jclass field="field"/> 6342 <description> 6343 The class containing the field to watch 6344 </description> 6345 </param> 6346 <param id="field"> 6347 <jfieldID class="klass"/> 6348 <description> 6349 The field to watch 6350 6351 </description> 6352 </param> 6353 </parameters> 6354 <errors> 6355 <error id="JVMTI_ERROR_DUPLICATE"> 6356 The designated field is already being watched for accesses. 6357 </error> 6358 </errors> 6359 </function> 6360 6361 <function id="ClearFieldAccessWatch" num="42"> 6362 <synopsis>Clear Field Access Watch</synopsis> 6363 <description> 6364 Cancel a field access watch previously set by 6365 <functionlink id="SetFieldAccessWatch"></functionlink>, on the 6366 field specified 6367 by <code>klass</code> and 6368 <code>field</code>. 6369 </description> 6370 <origin>jvmdi</origin> 6371 <capabilities> 6372 <required id="can_generate_field_access_events"></required> 6373 </capabilities> 6374 <parameters> 6375 <param id="klass"> 6376 <jclass field="field"/> 6377 <description> 6378 The class containing the field to watch 6379 </description> 6380 </param> 6381 <param id="field"> 6382 <jfieldID class="klass"/> 6383 <description> 6384 The field to watch 6385 6386 </description> 6387 </param> 6388 </parameters> 6389 <errors> 6390 <error id="JVMTI_ERROR_NOT_FOUND"> 6391 The designated field is not being watched for accesses. 6392 </error> 6393 </errors> 6394 </function> 6395 6396 <function id="SetFieldModificationWatch" num="43"> 6397 <synopsis>Set Field Modification Watch</synopsis> 6398 <description> 6399 Generate a <eventlink id="FieldModification"></eventlink> event 6400 when the field specified 6401 by <code>klass</code> and 6402 <code>field</code> is about to be modified. 6403 An event will be generated for each modification of the field 6404 until it is canceled with 6405 <functionlink id="ClearFieldModificationWatch"></functionlink>. 6406 Field modifications from Java programming language code or from JNI code are watched, 6407 fields modified by other means are not watched. 6408 Note that <jvmti/> users should be aware that their own field modifications 6409 will trigger the watch. 6410 A field can only have one field modification watch set. 6411 </description> 6412 <origin>jvmdi</origin> 6413 <capabilities> 6414 <required id="can_generate_field_modification_events"></required> 6415 </capabilities> 6416 <parameters> 6417 <param id="klass"> 6418 <jclass field="field"/> 6419 <description> 6420 The class containing the field to watch 6421 </description> 6422 </param> 6423 <param id="field"> 6424 <jfieldID class="klass"/> 6425 <description> 6426 The field to watch 6427 6428 </description> 6429 </param> 6430 </parameters> 6431 <errors> 6432 <error id="JVMTI_ERROR_DUPLICATE"> 6433 The designated field is already being watched for modifications. 6434 </error> 6435 </errors> 6436 </function> 6437 6438 <function id="ClearFieldModificationWatch" num="44"> 6439 <synopsis>Clear Field Modification Watch</synopsis> 6440 <description> 6441 6442 Cancel a field modification watch previously set by 6443 <functionlink id="SetFieldModificationWatch"></functionlink>, on the 6444 field specified 6445 by <code>klass</code> and 6446 <code>field</code>. 6447 </description> 6448 <origin>jvmdi</origin> 6449 <capabilities> 6450 <required id="can_generate_field_modification_events"></required> 6451 </capabilities> 6452 <parameters> 6453 <param id="klass"> 6454 <jclass field="field"/> 6455 <description> 6456 The class containing the field to watch 6457 </description> 6458 </param> 6459 <param id="field"> 6460 <jfieldID class="klass"/> 6461 <description> 6462 The field to watch 6463 6464 </description> 6465 </param> 6466 </parameters> 6467 <errors> 6468 <error id="JVMTI_ERROR_NOT_FOUND"> 6469 The designated field is not being watched for modifications. 6470 </error> 6471 </errors> 6472 </function> 6473 </category> 6474 6475 <category id="module" label="Module"> 6476 6477 <intro> 6478 </intro> 6479 6480 <function id="GetAllModules" num="3" since="9"> 6481 <synopsis>Get All Modules</synopsis> 6482 <description> 6483 Return an array of all modules loaded in the virtual machine. 6484 The array includes the unnamed module for each class loader. 6485 The number of modules in the array is returned via 6486 <code>module_count_ptr</code>, and the array itself via 6487 <code>modules_ptr</code>. 6488 <p/> 6489 </description> 6490 <origin>new</origin> 6491 <capabilities> 6492 </capabilities> 6493 <parameters> 6494 <param id="module_count_ptr"> 6495 <outptr><jint/></outptr> 6496 <description> 6497 On return, points to the number of returned modules. 6498 </description> 6499 </param> 6500 <param id="modules_ptr"> 6501 <allocbuf outcount="module_count_ptr"><jobject/></allocbuf> 6502 <description> 6503 On return, points to an array of references, one 6504 for each module. 6505 </description> 6506 </param> 6507 </parameters> 6508 <errors> 6509 </errors> 6510 </function> 6511 6512 <function id="GetNamedModule" num="40" since="9"> 6513 <synopsis>Get Named Module</synopsis> 6514 <description> 6515 Return the <code>java.lang.reflect.Module</code> object for a named 6516 module defined to a class loader that contains a given package. 6517 The module is returned via <code>module_ptr</code>. 6518 <p/> 6519 If a named module is defined to the class loader and it 6520 contains the package then that named module is returned, 6521 otherwise <code>NULL</code> is returned. 6522 <p/> 6523 </description> 6524 <origin>new</origin> 6525 <capabilities> 6526 </capabilities> 6527 <parameters> 6528 <param id="class_loader"> 6529 <ptrtype> 6530 <jobject/> 6531 <nullok>the bootstrap loader is assumed</nullok> 6532 </ptrtype> 6533 <description> 6534 A class loader. 6535 If the <code>class_loader</code> is not <code>NULL</code> 6536 or a subclass of <code>java.lang.ClassLoader</code> 6537 this function returns 6538 <errorlink id="JVMTI_ERROR_ILLEGAL_ARGUMENT"></errorlink>. 6539 </description> 6540 </param> 6541 <param id="package_name"> 6542 <inbuf><char/></inbuf> 6543 <description> 6544 The name of the package, encoded as a 6545 <internallink id="mUTF">modified UTF-8</internallink> string. 6546 The package name is in internal form (JVMS 4.2.1); 6547 identifiers are separated by forward slashes rather than periods. 6548 </description> 6549 </param> 6550 <param id="module_ptr"> 6551 <outptr><jobject/></outptr> 6552 <description> 6553 On return, points to a <code>java.lang.reflect.Module</code> object 6554 or points to <code>NULL</code>. 6555 </description> 6556 </param> 6557 </parameters> 6558 <errors> 6559 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 6560 If class loader is not <code>NULL</code> and is not a class loader object. 6561 </error> 6562 </errors> 6563 </function> 6564 </category> 6565 6566 <category id="class" label="Class"> 6567 6568 <intro> 6569 </intro> 6570 6571 <function id="GetLoadedClasses" jkernel="yes" num="78"> 6572 <synopsis>Get Loaded Classes</synopsis> 6573 <description> 6574 Return an array of all classes loaded in the virtual machine. 6575 The number of classes in the array is returned via 6576 <code>class_count_ptr</code>, and the array itself via 6577 <code>classes_ptr</code>. 6578 <p/> 6579 Array classes of all types (including arrays of primitive types) are 6580 included in the returned list. Primitive classes (for example, 6581 <code>java.lang.Integer.TYPE</code>) are <i>not</i> included in this list. 6582 </description> 6583 <origin>jvmdi</origin> 6584 <capabilities> 6585 </capabilities> 6586 <parameters> 6587 <param id="class_count_ptr"> 6588 <outptr><jint/></outptr> 6589 <description> 6590 On return, points to the number of classes. 6591 </description> 6592 </param> 6593 <param id="classes_ptr"> 6594 <allocbuf outcount="class_count_ptr"><jclass/></allocbuf> 6595 <description> 6596 On return, points to an array of references, one 6597 for each class. 6598 </description> 6599 </param> 6600 </parameters> 6601 <errors> 6602 </errors> 6603 </function> 6604 6605 <function id="GetClassLoaderClasses" jkernel="yes" num="79"> 6606 <synopsis>Get Classloader Classes</synopsis> 6607 <description> 6608 Returns an array of those classes for which this class loader has 6609 been recorded as an initiating loader. Each 6610 class in the returned array was created by this class loader, 6611 either by defining it directly or by delegation to another class loader. 6612 See <vmspec chapter="5.3"/>. 6613 <p/> 6614 The number of classes in the array is returned via 6615 <code>class_count_ptr</code>, and the array itself via 6616 <code>classes_ptr</code>. 6617 </description> 6618 <origin>jvmdi</origin> 6619 <capabilities> 6620 </capabilities> 6621 <parameters> 6622 <param id="initiating_loader"> 6623 <ptrtype> 6624 <jobject/> 6625 <nullok>the classes initiated by the bootstrap loader will be returned</nullok> 6626 </ptrtype> 6627 <description> 6628 An initiating class loader. 6629 </description> 6630 </param> 6631 <param id="class_count_ptr"> 6632 <outptr><jint/></outptr> 6633 <description> 6634 On return, points to the number of classes. 6635 </description> 6636 </param> 6637 <param id="classes_ptr"> 6638 <allocbuf outcount="class_count_ptr"><jclass/></allocbuf> 6639 <description> 6640 On return, points to an array of references, one 6641 for each class. 6642 </description> 6643 </param> 6644 </parameters> 6645 <errors> 6646 </errors> 6647 </function> 6648 6649 <function id="GetClassSignature" phase="start" num="48"> 6650 <synopsis>Get Class Signature</synopsis> 6651 <description> 6652 For the class indicated by <code>klass</code>, return the 6653 <externallink id="http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/types.html#wp16432">JNI 6654 type signature</externallink> 6655 and the generic signature of the class. 6656 For example, <code>java.util.List</code> is <code>"Ljava/util/List;"</code> 6657 and <code>int[]</code> is <code>"[I"</code> 6658 The returned name for primitive classes 6659 is the type signature character of the corresponding primitive type. 6660 For example, <code>java.lang.Integer.TYPE</code> is <code>"I"</code>. 6661 </description> 6662 <origin>jvmdiClone</origin> 6663 <capabilities> 6664 </capabilities> 6665 <parameters> 6666 <param id="klass"> 6667 <jclass/> 6668 <description> 6669 The class to query. 6670 </description> 6671 </param> 6672 <param id="signature_ptr"> 6673 <allocbuf> 6674 <char/> 6675 <nullok>the signature is not returned</nullok> 6676 </allocbuf> 6677 <description> 6678 On return, points to the JNI type signature of the class, encoded as a 6679 <internallink id="mUTF">modified UTF-8</internallink> string. 6680 </description> 6681 </param> 6682 <param id="generic_ptr"> 6683 <allocbuf> 6684 <char/> 6685 <nullok>the generic signature is not returned</nullok> 6686 </allocbuf> 6687 <description> 6688 On return, points to the generic signature of the class, encoded as a 6689 <internallink id="mUTF">modified UTF-8</internallink> string. 6690 If there is no generic signature attribute for the class, then, 6691 on return, points to <code>NULL</code>. 6692 </description> 6693 </param> 6694 </parameters> 6695 <errors> 6696 </errors> 6697 </function> 6698 6699 <function id="GetClassStatus" phase="start" num="49"> 6700 <synopsis>Get Class Status</synopsis> 6701 <description> 6702 Get the status of the class. Zero or more of the following bits can be 6703 set. 6704 <constants id="jvmtiClassStatus" label="Class Status Flags" kind="bits"> 6705 <constant id="JVMTI_CLASS_STATUS_VERIFIED" num="1"> 6706 Class bytecodes have been verified 6707 </constant> 6708 <constant id="JVMTI_CLASS_STATUS_PREPARED" num="2"> 6709 Class preparation is complete 6710 </constant> 6711 <constant id="JVMTI_CLASS_STATUS_INITIALIZED" num="4"> 6712 Class initialization is complete. Static initializer has been run. 6713 </constant> 6714 <constant id="JVMTI_CLASS_STATUS_ERROR" num="8"> 6715 Error during initialization makes class unusable 6716 </constant> 6717 <constant id="JVMTI_CLASS_STATUS_ARRAY" num="16"> 6718 Class is an array. If set, all other bits are zero. 6719 </constant> 6720 <constant id="JVMTI_CLASS_STATUS_PRIMITIVE" num="32"> 6721 Class is a primitive class (for example, <code>java.lang.Integer.TYPE</code>). 6722 If set, all other bits are zero. 6723 </constant> 6724 </constants> 6725 </description> 6726 <origin>jvmdi</origin> 6727 <capabilities> 6728 </capabilities> 6729 <parameters> 6730 <param id="klass"> 6731 <jclass/> 6732 <description> 6733 The class to query. 6734 </description> 6735 </param> 6736 <param id="status_ptr"> 6737 <outptr><jint/></outptr> 6738 <description> 6739 On return, points to the current state of this class as one or 6740 more of the <internallink id="jvmtiClassStatus">class status flags</internallink>. 6741 </description> 6742 </param> 6743 </parameters> 6744 <errors> 6745 </errors> 6746 </function> 6747 6748 <function id="GetSourceFileName" phase="start" num="50"> 6749 <synopsis>Get Source File Name</synopsis> 6750 <description> 6751 For the class indicated by <code>klass</code>, return the source file 6752 name via <code>source_name_ptr</code>. The returned string 6753 is a file name only and never contains a directory name. 6754 <p/> 6755 For primitive classes (for example, <code>java.lang.Integer.TYPE</code>) 6756 and for arrays this function returns 6757 <errorlink id="JVMTI_ERROR_ABSENT_INFORMATION"></errorlink>. 6758 </description> 6759 <origin>jvmdi</origin> 6760 <capabilities> 6761 <required id="can_get_source_file_name"></required> 6762 </capabilities> 6763 <parameters> 6764 <param id="klass"> 6765 <jclass/> 6766 <description> 6767 The class to query. 6768 </description> 6769 </param> 6770 <param id="source_name_ptr"> 6771 <allocbuf><char/></allocbuf> 6772 <description> 6773 On return, points to the class's source file name, encoded as a 6774 <internallink id="mUTF">modified UTF-8</internallink> string. 6775 </description> 6776 </param> 6777 </parameters> 6778 <errors> 6779 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 6780 Class information does not include a source file name. This includes 6781 cases where the class is an array class or primitive class. 6782 </error> 6783 </errors> 6784 </function> 6785 6786 <function id="GetClassModifiers" phase="start" num="51"> 6787 <synopsis>Get Class Modifiers</synopsis> 6788 <description> 6789 For the class indicated by <code>klass</code>, return the access 6790 flags 6791 via <code>modifiers_ptr</code>. 6792 Access flags are defined in <vmspec chapter="4"/>. 6793 <p/> 6794 If the class is an array class, then its public, private, and protected 6795 modifiers are the same as those of its component type. For arrays of 6796 primitives, this component type is represented by one of the primitive 6797 classes (for example, <code>java.lang.Integer.TYPE</code>). 6798 <p/> 6799 If the class is a primitive class, its public modifier is always true, 6800 and its protected and private modifiers are always false. 6801 <p/> 6802 If the class is an array class or a primitive class then its final 6803 modifier is always true and its interface modifier is always false. 6804 The values of its other modifiers are not determined by this specification. 6805 6806 </description> 6807 <origin>jvmdi</origin> 6808 <capabilities> 6809 </capabilities> 6810 <parameters> 6811 <param id="klass"> 6812 <jclass/> 6813 <description> 6814 The class to query. 6815 </description> 6816 </param> 6817 <param id="modifiers_ptr"> 6818 <outptr><jint/></outptr> 6819 <description> 6820 On return, points to the current access flags of this class. 6821 6822 </description> 6823 </param> 6824 </parameters> 6825 <errors> 6826 </errors> 6827 </function> 6828 6829 <function id="GetClassMethods" phase="start" num="52"> 6830 <synopsis>Get Class Methods</synopsis> 6831 <description> 6832 For the class indicated by <code>klass</code>, return a count of 6833 methods via <code>method_count_ptr</code> and a list of 6834 method IDs via <code>methods_ptr</code>. The method list contains 6835 constructors and static initializers as well as true methods. 6836 Only directly declared methods are returned (not inherited methods). 6837 An empty method list is returned for array classes and primitive classes 6838 (for example, <code>java.lang.Integer.TYPE</code>). 6839 </description> 6840 <origin>jvmdi</origin> 6841 <capabilities> 6842 <capability id="can_maintain_original_method_order"/> 6843 </capabilities> 6844 <parameters> 6845 <param id="klass"> 6846 <jclass/> 6847 <description> 6848 The class to query. 6849 </description> 6850 </param> 6851 <param id="method_count_ptr"> 6852 <outptr><jint/></outptr> 6853 <description> 6854 On return, points to the number of methods declared in this class. 6855 </description> 6856 </param> 6857 <param id="methods_ptr"> 6858 <allocbuf outcount="method_count_ptr"><jmethodID class="klass"/></allocbuf> 6859 <description> 6860 On return, points to the method ID array. 6861 </description> 6862 </param> 6863 </parameters> 6864 <errors> 6865 <error id="JVMTI_ERROR_CLASS_NOT_PREPARED"> 6866 <paramlink id="klass"></paramlink> is not prepared. 6867 </error> 6868 </errors> 6869 </function> 6870 6871 <function id="GetClassFields" phase="start" num="53"> 6872 <synopsis>Get Class Fields</synopsis> 6873 <description> 6874 For the class indicated by <code>klass</code>, return a count of fields 6875 via <code>field_count_ptr</code> and a list of field IDs via 6876 <code>fields_ptr</code>. 6877 Only directly declared fields are returned (not inherited fields). 6878 Fields are returned in the order they occur in the class file. 6879 An empty field list is returned for array classes and primitive classes 6880 (for example, <code>java.lang.Integer.TYPE</code>). 6881 Use JNI to determine the length of an array. 6882 </description> 6883 <origin>jvmdi</origin> 6884 <capabilities> 6885 </capabilities> 6886 <parameters> 6887 <param id="klass"> 6888 <jclass/> 6889 <description> 6890 The class to query. 6891 </description> 6892 </param> 6893 <param id="field_count_ptr"> 6894 <outptr><jint/></outptr> 6895 <description> 6896 On return, points to the number of fields declared in this class. 6897 </description> 6898 </param> 6899 <param id="fields_ptr"> 6900 <allocbuf outcount="field_count_ptr"><jfieldID/></allocbuf> 6901 <description> 6902 On return, points to the field ID array. 6903 </description> 6904 </param> 6905 </parameters> 6906 <errors> 6907 <error id="JVMTI_ERROR_CLASS_NOT_PREPARED"> 6908 <paramlink id="klass"></paramlink> is not prepared. 6909 </error> 6910 </errors> 6911 </function> 6912 6913 <function id="GetImplementedInterfaces" phase="start" num="54"> 6914 <synopsis>Get Implemented Interfaces</synopsis> 6915 <description> 6916 Return the direct super-interfaces of this class. For a class, this 6917 function returns the interfaces declared in its <code>implements</code> 6918 clause. For an interface, this function returns the interfaces declared in 6919 its <code>extends</code> clause. 6920 An empty interface list is returned for array classes and primitive classes 6921 (for example, <code>java.lang.Integer.TYPE</code>). 6922 </description> 6923 <origin>jvmdi</origin> 6924 <capabilities> 6925 </capabilities> 6926 <parameters> 6927 <param id="klass"> 6928 <jclass/> 6929 <description> 6930 The class to query. 6931 </description> 6932 </param> 6933 <param id="interface_count_ptr"> 6934 <outptr><jint/></outptr> 6935 <description> 6936 On return, points to the number of interfaces. 6937 </description> 6938 </param> 6939 <param id="interfaces_ptr"> 6940 <allocbuf outcount="interface_count_ptr"><jclass/></allocbuf> 6941 <description> 6942 On return, points to the interface array. 6943 </description> 6944 </param> 6945 </parameters> 6946 <errors> 6947 <error id="JVMTI_ERROR_CLASS_NOT_PREPARED"> 6948 <paramlink id="klass"></paramlink> is not prepared. 6949 </error> 6950 </errors> 6951 </function> 6952 6953 <function id="GetClassVersionNumbers" phase="start" num="145" since="1.1"> 6954 <synopsis>Get Class Version Numbers</synopsis> 6955 <description> 6956 For the class indicated by <code>klass</code>, 6957 return the minor and major version numbers, 6958 as defined in 6959 <vmspec chapter="4"/>. 6960 </description> 6961 <origin>new</origin> 6962 <capabilities> 6963 </capabilities> 6964 <parameters> 6965 <param id="klass"> 6966 <jclass/> 6967 <description> 6968 The class to query. 6969 </description> 6970 </param> 6971 <param id="minor_version_ptr"> 6972 <outptr><jint/></outptr> 6973 <description> 6974 On return, points to the value of the 6975 <code>minor_version</code> item of the 6976 Class File Format. 6977 Note: to be consistent with the Class File Format, 6978 the minor version number is the first parameter. 6979 </description> 6980 </param> 6981 <param id="major_version_ptr"> 6982 <outptr><jint/></outptr> 6983 <description> 6984 On return, points to the value of the 6985 <code>major_version</code> item of the 6986 Class File Format. 6987 </description> 6988 </param> 6989 </parameters> 6990 <errors> 6991 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 6992 The class is a primitive or array class. 6993 </error> 6994 </errors> 6995 </function> 6996 6997 <function id="GetConstantPool" phase="start" num="146" since="1.1"> 6998 <synopsis>Get Constant Pool</synopsis> 6999 <description> 7000 For the class indicated by <code>klass</code>, 7001 return the raw bytes of the constant pool in the format of the 7002 <code>constant_pool</code> item of 7003 <vmspec chapter="4"/>. 7004 The format of the constant pool may differ between versions 7005 of the Class File Format, so, the 7006 <functionlink id="GetClassVersionNumbers">minor and major 7007 class version numbers</functionlink> should be checked for 7008 compatibility. 7009 <p/> 7010 The returned constant pool might not have the same layout or 7011 contents as the constant pool in the defining class file. 7012 The constant pool returned by GetConstantPool() may have 7013 more or fewer entries than the defining constant pool. 7014 Entries may be in a different order. 7015 The constant pool returned by GetConstantPool() will match the 7016 constant pool used by 7017 <functionlink id="GetBytecodes">GetBytecodes()</functionlink>. 7018 That is, the bytecodes returned by GetBytecodes() will have 7019 constant pool indices which refer to constant pool entries returned 7020 by GetConstantPool(). 7021 Note that since <functionlink id="RetransformClasses"/> 7022 and <functionlink id="RedefineClasses"/> can change 7023 the constant pool, the constant pool returned by this function 7024 can change accordingly. Thus, the correspondence between 7025 GetConstantPool() and GetBytecodes() does not hold if there 7026 is an intervening class retransformation or redefinition. 7027 The value of a constant pool entry used by a given bytecode will 7028 match that of the defining class file (even if the indices don't match). 7029 Constant pool entries which are not used directly or indirectly by 7030 bytecodes (for example, UTF-8 strings associated with annotations) are 7031 not required to exist in the returned constant pool. 7032 </description> 7033 <origin>new</origin> 7034 <capabilities> 7035 <required id="can_get_constant_pool"></required> 7036 </capabilities> 7037 <parameters> 7038 <param id="klass"> 7039 <jclass/> 7040 <description> 7041 The class to query. 7042 </description> 7043 </param> 7044 <param id="constant_pool_count_ptr"> 7045 <outptr><jint/></outptr> 7046 <description> 7047 On return, points to the number of entries 7048 in the constant pool table plus one. 7049 This corresponds to the <code>constant_pool_count</code> 7050 item of the Class File Format. 7051 </description> 7052 </param> 7053 <param id="constant_pool_byte_count_ptr"> 7054 <outptr><jint/></outptr> 7055 <description> 7056 On return, points to the number of bytes 7057 in the returned raw constant pool. 7058 </description> 7059 </param> 7060 <param id="constant_pool_bytes_ptr"> 7061 <allocbuf outcount="constant_pool_byte_count_ptr"><uchar/></allocbuf> 7062 <description> 7063 On return, points to the raw constant pool, that is the bytes 7064 defined by the <code>constant_pool</code> item of the 7065 Class File Format 7066 </description> 7067 </param> 7068 </parameters> 7069 <errors> 7070 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 7071 The class is a primitive or array class. 7072 </error> 7073 </errors> 7074 </function> 7075 7076 <function id="IsInterface" phase="start" num="55"> 7077 <synopsis>Is Interface</synopsis> 7078 <description> 7079 Determines whether a class object reference represents an interface. 7080 The <code>jboolean</code> result is 7081 <code>JNI_TRUE</code> if the "class" is actually an interface, 7082 <code>JNI_FALSE</code> otherwise. 7083 </description> 7084 <origin>jvmdi</origin> 7085 <capabilities> 7086 </capabilities> 7087 <parameters> 7088 <param id="klass"> 7089 <jclass/> 7090 <description> 7091 The class to query. 7092 </description> 7093 </param> 7094 <param id="is_interface_ptr"> 7095 <outptr><jboolean/></outptr> 7096 <description> 7097 On return, points to the boolean result of this function. 7098 7099 </description> 7100 </param> 7101 </parameters> 7102 <errors> 7103 </errors> 7104 </function> 7105 7106 <function id="IsArrayClass" phase="start" num="56"> 7107 <synopsis>Is Array Class</synopsis> 7108 <description> 7109 Determines whether a class object reference represents an array. 7110 The <code>jboolean</code> result is 7111 <code>JNI_TRUE</code> if the class is an array, 7112 <code>JNI_FALSE</code> otherwise. 7113 </description> 7114 <origin>jvmdi</origin> 7115 <capabilities> 7116 </capabilities> 7117 <parameters> 7118 <param id="klass"> 7119 <jclass/> 7120 <description> 7121 The class to query. 7122 </description> 7123 </param> 7124 <param id="is_array_class_ptr"> 7125 <outptr><jboolean/></outptr> 7126 <description> 7127 On return, points to the boolean result of this function. 7128 7129 </description> 7130 </param> 7131 </parameters> 7132 <errors> 7133 </errors> 7134 </function> 7135 7136 <function id="IsModifiableClass" jkernel="yes" phase="start" num="45" since="1.1"> 7137 <synopsis>Is Modifiable Class</synopsis> 7138 <description> 7139 Determines whether a class is modifiable. 7140 If a class is modifiable (<paramlink id="is_modifiable_class_ptr"/> 7141 returns <code>JNI_TRUE</code>) the class can be 7142 redefined with <functionlink id="RedefineClasses"/> (assuming 7143 the agent possesses the 7144 <fieldlink id="can_redefine_classes" struct="jvmtiCapabilities"/> 7145 capability) or 7146 retransformed with <functionlink id="RetransformClasses"/> (assuming 7147 the agent possesses the 7148 <fieldlink id="can_retransform_classes" struct="jvmtiCapabilities"/> 7149 capability). 7150 If a class is not modifiable (<paramlink id="is_modifiable_class_ptr"/> 7151 returns <code>JNI_FALSE</code>) the class can be neither 7152 redefined nor retransformed. 7153 <p/> 7154 Primitive classes (for example, <code>java.lang.Integer.TYPE</code>), 7155 array classes, and some implementation defined classes are never modifiable. 7156 <p/> 7157 </description> 7158 <origin>new</origin> 7159 <capabilities> 7160 <capability id="can_redefine_any_class"> 7161 If possessed then all classes (except primitive, array, and some implementation defined 7162 classes) are modifiable (redefine or retransform). 7163 </capability> 7164 <capability id="can_retransform_any_class"> 7165 If possessed then all classes (except primitive, array, and some implementation defined 7166 classes) are modifiable with <functionlink id="RetransformClasses"/>. 7167 </capability> 7168 <capability id="can_redefine_classes"> 7169 No effect on the result of the function. 7170 But must additionally be possessed to modify the class with 7171 <functionlink id="RedefineClasses"/>. 7172 </capability> 7173 <capability id="can_retransform_classes"> 7174 No effect on the result of the function. 7175 But must additionally be possessed to modify the class with 7176 <functionlink id="RetransformClasses"/>. 7177 </capability> 7178 </capabilities> 7179 <parameters> 7180 <param id="klass"> 7181 <jclass/> 7182 <description> 7183 The class to query. 7184 </description> 7185 </param> 7186 <param id="is_modifiable_class_ptr"> 7187 <outptr><jboolean/></outptr> 7188 <description> 7189 On return, points to the boolean result of this function. 7190 </description> 7191 </param> 7192 </parameters> 7193 <errors> 7194 </errors> 7195 </function> 7196 7197 <function id="GetClassLoader" phase="start" num="57"> 7198 <synopsis>Get Class Loader</synopsis> 7199 <description> 7200 For the class indicated by <code>klass</code>, return via 7201 <code>classloader_ptr</code> a reference to the class loader for the 7202 class. 7203 </description> 7204 <origin>jvmdi</origin> 7205 <capabilities> 7206 </capabilities> 7207 <parameters> 7208 <param id="klass"> 7209 <jclass/> 7210 <description> 7211 The class to query. 7212 </description> 7213 </param> 7214 <param id="classloader_ptr"> 7215 <outptr><jobject/></outptr> 7216 <description> 7217 On return, points to the class loader that loaded 7218 this class. 7219 If the class was not created by a class loader 7220 or if the class loader is the bootstrap class loader, 7221 points to <code>NULL</code>. 7222 </description> 7223 </param> 7224 </parameters> 7225 <errors> 7226 </errors> 7227 7228 </function> 7229 7230 <function id="GetSourceDebugExtension" phase="start" num="90"> 7231 <synopsis>Get Source Debug Extension</synopsis> 7232 <description> 7233 For the class indicated by <code>klass</code>, return the debug 7234 extension via <code>source_debug_extension_ptr</code>. 7235 The returned string 7236 contains exactly the debug extension information present in the 7237 class file of <code>klass</code>. 7238 </description> 7239 <origin>jvmdi</origin> 7240 <capabilities> 7241 <required id="can_get_source_debug_extension"></required> 7242 </capabilities> 7243 <parameters> 7244 <param id="klass"> 7245 <jclass/> 7246 <description> 7247 The class to query. 7248 </description> 7249 </param> 7250 <param id="source_debug_extension_ptr"> 7251 <allocbuf><char/></allocbuf> 7252 <description> 7253 On return, points to the class's debug extension, encoded as a 7254 <internallink id="mUTF">modified UTF-8</internallink> string. 7255 </description> 7256 </param> 7257 </parameters> 7258 <errors> 7259 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 7260 Class information does not include a debug extension. 7261 </error> 7262 </errors> 7263 </function> 7264 7265 <function id="RetransformClasses" jkernel="yes" num="152" since="1.1"> 7266 <synopsis>Retransform Classes</synopsis> 7267 <description> 7268 This function facilitates the 7269 <internallink id="bci">bytecode instrumentation</internallink> 7270 of already loaded classes. 7271 To replace the class definition without reference to the existing 7272 bytecodes, as one might do when recompiling from source for 7273 fix-and-continue debugging, <functionlink id="RedefineClasses"/> 7274 function should be used instead. 7275 <p/> 7276 When classes are initially loaded or when they are 7277 <functionlink id="RedefineClasses">redefined</functionlink>, 7278 the initial class file bytes can be transformed with the 7279 <eventlink id="ClassFileLoadHook"/> event. 7280 This function reruns the transformation process 7281 (whether or not a transformation has previously occurred). 7282 This retransformation follows these steps: 7283 <ul> 7284 <li>starting from the initial class file bytes 7285 </li> 7286 <li>for each <fieldlink id="can_retransform_classes" 7287 struct="jvmtiCapabilities">retransformation 7288 incapable</fieldlink> 7289 agent which received a 7290 <code>ClassFileLoadHook</code> event during the previous 7291 load or redefine, the bytes it returned 7292 (via the <code>new_class_data</code> parameter) 7293 are reused as the output of the transformation; 7294 note that this is equivalent to reapplying 7295 the previous transformation, unaltered. except that 7296 the <code>ClassFileLoadHook</code> event 7297 is <b>not</b> sent to these agents 7298 </li> 7299 <li>for each <fieldlink id="can_retransform_classes" 7300 struct="jvmtiCapabilities">retransformation 7301 capable</fieldlink> 7302 agent, the <code>ClassFileLoadHook</code> event is sent, 7303 allowing a new transformation to be applied 7304 </li> 7305 <li>the transformed class file bytes are installed as the new 7306 definition of the class 7307 </li> 7308 </ul> 7309 See the <eventlink id="ClassFileLoadHook"/> event for more details. 7310 <p/> 7311 The initial class file bytes represent the bytes passed to 7312 <code>ClassLoader.defineClass</code> 7313 or <code>RedefineClasses</code> (before any transformations 7314 were applied), however they may not exactly match them. 7315 The constant pool may differ in ways described in 7316 <functionlink id="GetConstantPool"/>. 7317 Constant pool indices in the bytecodes of methods will correspond. 7318 Some attributes may not be present. 7319 Where order is not meaningful, for example the order of methods, 7320 order may not be preserved. 7321 <p/> 7322 Retransformation can cause new versions of methods to be installed. 7323 Old method versions may become 7324 <internallink id="obsoleteMethods">obsolete</internallink> 7325 The new method version will be used on new invokes. 7326 If a method has active stack frames, those active frames continue to 7327 run the bytecodes of the original method version. 7328 <p/> 7329 This function does not cause any initialization except that which 7330 would occur under the customary JVM semantics. 7331 In other words, retransforming a class does not cause its initializers to be 7332 run. The values of static fields will remain as they were 7333 prior to the call. 7334 <p/> 7335 Threads need not be suspended. 7336 <p/> 7337 All breakpoints in the class are cleared. 7338 <p/> 7339 All attributes are updated. 7340 <p/> 7341 Instances of the retransformed class are not affected -- fields retain their 7342 previous values. 7343 <functionlink id="GetTag">Tags</functionlink> on the instances are 7344 also unaffected. 7345 <p/> 7346 In response to this call, no events other than the 7347 <eventlink id="ClassFileLoadHook"/> event 7348 will be sent. 7349 <p/> 7350 The retransformation may change method bodies, the constant pool and attributes. 7351 The retransformation must not add, remove or rename fields or methods, change the 7352 signatures of methods, change modifiers, or change inheritance. 7353 These restrictions may be lifted in future versions. 7354 See the error return description below for information on error codes 7355 returned if an unsupported retransformation is attempted. 7356 The class file bytes are not verified or installed until they have passed 7357 through the chain of <eventlink id="ClassFileLoadHook"/> events, thus the 7358 returned error code reflects the result of the transformations. 7359 If any error code is returned other than <code>JVMTI_ERROR_NONE</code>, 7360 none of the classes to be retransformed will have a new definition installed. 7361 When this function returns (with the error code of <code>JVMTI_ERROR_NONE</code>) 7362 all of the classes to be retransformed will have their new definitions installed. 7363 </description> 7364 <origin>new</origin> 7365 <capabilities> 7366 <required id="can_retransform_classes"></required> 7367 <capability id="can_retransform_any_class"></capability> 7368 </capabilities> 7369 <parameters> 7370 <param id="class_count"> 7371 <jint min="0"/> 7372 <description> 7373 The number of classes to be retransformed. 7374 </description> 7375 </param> 7376 <param id="classes"> 7377 <inbuf incount="class_count"><jclass/></inbuf> 7378 <description> 7379 The array of classes to be retransformed. 7380 </description> 7381 </param> 7382 </parameters> 7383 <errors> 7384 <error id="JVMTI_ERROR_UNMODIFIABLE_CLASS"> 7385 One of the <paramlink id="classes"/> cannot be modified. 7386 See <functionlink id="IsModifiableClass"/>. 7387 </error> 7388 <error id="JVMTI_ERROR_INVALID_CLASS"> 7389 One of the <paramlink id="classes"/> is not a valid class. 7390 </error> 7391 <error id="JVMTI_ERROR_UNSUPPORTED_VERSION"> 7392 A retransformed class file has a version number not supported by this VM. 7393 </error> 7394 <error id="JVMTI_ERROR_INVALID_CLASS_FORMAT"> 7395 A retransformed class file is malformed (The VM would return a <code>ClassFormatError</code>). 7396 </error> 7397 <error id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION"> 7398 The retransformed class file definitions would lead to a circular definition 7399 (the VM would return a <code>ClassCircularityError</code>). 7400 </error> 7401 <error id="JVMTI_ERROR_FAILS_VERIFICATION"> 7402 The retransformed class file bytes fail verification. 7403 </error> 7404 <error id="JVMTI_ERROR_NAMES_DONT_MATCH"> 7405 The class name defined in a retransformed class file is 7406 different from the name in the old class object. 7407 </error> 7408 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED"> 7409 A retransformed class file would require adding a method. 7410 </error> 7411 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED"> 7412 A retransformed class file changes a field. 7413 </error> 7414 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED"> 7415 A direct superclass is different for a retransformed class file, 7416 or the set of directly implemented 7417 interfaces is different. 7418 </error> 7419 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED"> 7420 A retransformed class file does not declare a method 7421 declared in the old class version. 7422 </error> 7423 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED"> 7424 A retransformed class file has different class modifiers. 7425 </error> 7426 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED"> 7427 A method in the retransformed class file has different modifiers 7428 than its counterpart in the old class version. 7429 </error> 7430 </errors> 7431 </function> 7432 7433 <function id="RedefineClasses" jkernel="yes" num="87"> 7434 <synopsis>Redefine Classes</synopsis> 7435 <typedef id="jvmtiClassDefinition" label="Class redefinition description"> 7436 <field id="klass"> 7437 <jclass/> 7438 <description> 7439 Class object for this class 7440 </description> 7441 </field> 7442 <field id="class_byte_count"> 7443 <jint/> 7444 <description> 7445 Number of bytes defining class (below) 7446 </description> 7447 </field> 7448 <field id="class_bytes"> 7449 <inbuf incount="class_byte_count"><uchar/></inbuf> 7450 <description> 7451 Bytes defining class (in <vmspec chapter="4"/>) 7452 </description> 7453 </field> 7454 </typedef> 7455 <description> 7456 All classes given are redefined according to the definitions 7457 supplied. 7458 This function is used to replace the definition of a class 7459 with a new definition, as might be needed in fix-and-continue 7460 debugging. 7461 Where the existing class file bytes are to be transformed, for 7462 example in 7463 <internallink id="bci">bytecode instrumentation</internallink>, 7464 <functionlink id="RetransformClasses"/> should be used. 7465 <p/> 7466 Redefinition can cause new versions of methods to be installed. 7467 Old method versions may become 7468 <internallink id="obsoleteMethods">obsolete</internallink> 7469 The new method version will be used on new invokes. 7470 If a method has active stack frames, those active frames continue to 7471 run the bytecodes of the original method version. 7472 If resetting of stack frames is desired, use 7473 <functionlink id="PopFrame"></functionlink> 7474 to pop frames with obsolete method versions. 7475 <p/> 7476 This function does not cause any initialization except that which 7477 would occur under the customary JVM semantics. 7478 In other words, redefining a class does not cause its initializers to be 7479 run. The values of static fields will remain as they were 7480 prior to the call. 7481 <p/> 7482 Threads need not be suspended. 7483 <p/> 7484 All breakpoints in the class are cleared. 7485 <p/> 7486 All attributes are updated. 7487 <p/> 7488 Instances of the redefined class are not affected -- fields retain their 7489 previous values. 7490 <functionlink id="GetTag">Tags</functionlink> on the instances are 7491 also unaffected. 7492 <p/> 7493 In response to this call, the <jvmti/> event 7494 <eventlink id="ClassFileLoadHook">Class File Load Hook</eventlink> 7495 will be sent (if enabled), but no other <jvmti/> events will be sent. 7496 <p/> 7497 The redefinition may change method bodies, the constant pool and attributes. 7498 The redefinition must not add, remove or rename fields or methods, change the 7499 signatures of methods, change modifiers, or change inheritance. 7500 These restrictions may be lifted in future versions. 7501 See the error return description below for information on error codes 7502 returned if an unsupported redefinition is attempted. 7503 The class file bytes are not verified or installed until they have passed 7504 through the chain of <eventlink id="ClassFileLoadHook"/> events, thus the 7505 returned error code reflects the result of the transformations applied 7506 to the bytes passed into <paramlink id="class_definitions"/>. 7507 If any error code is returned other than <code>JVMTI_ERROR_NONE</code>, 7508 none of the classes to be redefined will have a new definition installed. 7509 When this function returns (with the error code of <code>JVMTI_ERROR_NONE</code>) 7510 all of the classes to be redefined will have their new definitions installed. 7511 </description> 7512 <origin>jvmdi</origin> 7513 <capabilities> 7514 <required id="can_redefine_classes"></required> 7515 <capability id="can_redefine_any_class"></capability> 7516 </capabilities> 7517 <parameters> 7518 <param id="class_count"> 7519 <jint min="0"/> 7520 <description> 7521 The number of classes specified in <code>class_definitions</code> 7522 </description> 7523 </param> 7524 <param id="class_definitions"> 7525 <inbuf incount="class_count"><struct>jvmtiClassDefinition</struct></inbuf> 7526 <description> 7527 The array of new class definitions 7528 </description> 7529 </param> 7530 </parameters> 7531 <errors> 7532 <error id="JVMTI_ERROR_NULL_POINTER"> 7533 One of <code>class_bytes</code> is <code>NULL</code>. 7534 </error> 7535 <error id="JVMTI_ERROR_UNMODIFIABLE_CLASS"> 7536 An element of <code>class_definitions</code> cannot be modified. 7537 See <functionlink id="IsModifiableClass"/>. 7538 </error> 7539 <error id="JVMTI_ERROR_INVALID_CLASS"> 7540 An element of <code>class_definitions</code> is not a valid class. 7541 </error> 7542 <error id="JVMTI_ERROR_UNSUPPORTED_VERSION"> 7543 A new class file has a version number not supported by this VM. 7544 </error> 7545 <error id="JVMTI_ERROR_INVALID_CLASS_FORMAT"> 7546 A new class file is malformed (The VM would return a <code>ClassFormatError</code>). 7547 </error> 7548 <error id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION"> 7549 The new class file definitions would lead to a circular definition 7550 (the VM would return a <code>ClassCircularityError</code>). 7551 </error> 7552 <error id="JVMTI_ERROR_FAILS_VERIFICATION"> 7553 The class bytes fail verification. 7554 </error> 7555 <error id="JVMTI_ERROR_NAMES_DONT_MATCH"> 7556 The class name defined in a new class file is 7557 different from the name in the old class object. 7558 </error> 7559 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED"> 7560 A new class file would require adding a method. 7561 </error> 7562 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED"> 7563 A new class version changes a field. 7564 </error> 7565 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED"> 7566 A direct superclass is different for a new class 7567 version, or the set of directly implemented 7568 interfaces is different. 7569 </error> 7570 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED"> 7571 A new class version does not declare a method 7572 declared in the old class version. 7573 </error> 7574 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED"> 7575 A new class version has different modifiers. 7576 </error> 7577 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED"> 7578 A method in the new class version has different modifiers 7579 than its counterpart in the old class version. 7580 </error> 7581 </errors> 7582 </function> 7583 7584 </category> 7585 7586 <category id="object" label="Object"> 7587 7588 <function id="GetObjectSize" jkernel="yes" phase="start" num="154"> 7589 <synopsis>Get Object Size</synopsis> 7590 <description> 7591 For the object indicated by <code>object</code>, 7592 return via <code>size_ptr</code> the size of the object. 7593 This size is an implementation-specific approximation of 7594 the amount of storage consumed by this object. 7595 It may include some or all of the object's overhead, and thus 7596 is useful for comparison within an implementation but not 7597 between implementations. 7598 The estimate may change during a single invocation of the JVM. 7599 </description> 7600 <origin>new</origin> 7601 <capabilities> 7602 </capabilities> 7603 <parameters> 7604 <param id="object"> 7605 <jobject/> 7606 <description> 7607 The object to query. 7608 </description> 7609 </param> 7610 <param id="size_ptr"> 7611 <outptr><jlong/></outptr> 7612 <description> 7613 On return, points to the object's size in bytes. 7614 </description> 7615 </param> 7616 </parameters> 7617 <errors> 7618 </errors> 7619 </function> 7620 7621 <function id="GetObjectHashCode" phase="start" num="58"> 7622 <synopsis>Get Object Hash Code</synopsis> 7623 <description> 7624 For the object indicated by <code>object</code>, 7625 return via <code>hash_code_ptr</code> a hash code. 7626 This hash code could be used to maintain a hash table of object references, 7627 however, on some implementations this can cause significant performance 7628 impacts--in most cases 7629 <internallink id="Heap">tags</internallink> 7630 will be a more efficient means of associating information with objects. 7631 This function guarantees 7632 the same hash code value for a particular object throughout its life 7633 </description> 7634 <origin>jvmdi</origin> 7635 <capabilities> 7636 </capabilities> 7637 <parameters> 7638 <param id="object"> 7639 <jobject/> 7640 <description> 7641 The object to query. 7642 </description> 7643 </param> 7644 <param id="hash_code_ptr"> 7645 <outptr><jint/></outptr> 7646 <description> 7647 On return, points to the object's hash code. 7648 </description> 7649 </param> 7650 </parameters> 7651 <errors> 7652 </errors> 7653 </function> 7654 7655 <function id="GetObjectMonitorUsage" num="59"> 7656 <synopsis>Get Object Monitor Usage</synopsis> 7657 <typedef id="jvmtiMonitorUsage" label="Object monitor usage information"> 7658 <field id="owner"> 7659 <jthread/> 7660 <description> 7661 The thread owning this monitor, or <code>NULL</code> if unused 7662 </description> 7663 </field> 7664 <field id="entry_count"> 7665 <jint/> 7666 <description> 7667 The number of times the owning thread has entered the monitor 7668 </description> 7669 </field> 7670 <field id="waiter_count"> 7671 <jint/> 7672 <description> 7673 The number of threads waiting to own this monitor 7674 </description> 7675 </field> 7676 <field id="waiters"> 7677 <allocfieldbuf><jthread/></allocfieldbuf> 7678 <description> 7679 The <code>waiter_count</code> waiting threads 7680 </description> 7681 </field> 7682 <field id="notify_waiter_count"> 7683 <jint/> 7684 <description> 7685 The number of threads waiting to be notified by this monitor 7686 </description> 7687 </field> 7688 <field id="notify_waiters"> 7689 <allocfieldbuf><jthread/></allocfieldbuf> 7690 <description> 7691 The <code>notify_waiter_count</code> threads waiting to be notified 7692 </description> 7693 </field> 7694 </typedef> 7695 <description> 7696 Get information about the object's monitor. 7697 The fields of the <functionlink id="jvmtiMonitorUsage"></functionlink> structure 7698 are filled in with information about usage of the monitor. 7699 <todo> 7700 Decide and then clarify suspend requirements. 7701 </todo> 7702 </description> 7703 <origin>jvmdi</origin> 7704 <capabilities> 7705 <required id="can_get_monitor_info"></required> 7706 </capabilities> 7707 <parameters> 7708 <param id="object"> 7709 <jobject/> 7710 <description> 7711 The object to query. 7712 </description> 7713 </param> 7714 <param id="info_ptr"> 7715 <outptr><struct>jvmtiMonitorUsage</struct></outptr> 7716 <description> 7717 On return, filled with monitor information for the 7718 specified object. 7719 </description> 7720 </param> 7721 </parameters> 7722 <errors> 7723 </errors> 7724 </function> 7725 7726 <elide> 7727 <function id="GetObjectMonitors" num="116"> 7728 <synopsis>Get Object Monitors</synopsis> 7729 <description> 7730 Return the list of object monitors. 7731 <p/> 7732 Note: details about each monitor can be examined with 7733 <functionlink id="GetObjectMonitorUsage"></functionlink>. 7734 </description> 7735 <origin>new</origin> 7736 <capabilities> 7737 <required id="can_get_monitor_info"></required> 7738 </capabilities> 7739 <parameters> 7740 <param id="monitorCnt"> 7741 <outptr><jint/></outptr> 7742 <description> 7743 On return, pointer to the number 7744 of monitors returned in <code>monitors_ptr</code>. 7745 </description> 7746 </param> 7747 <param id="monitors_ptr"> 7748 <allocbuf outcount="monitorCnt"><jobject/></allocbuf> 7749 <description> 7750 On return, pointer to the monitor list. 7751 </description> 7752 </param> 7753 </parameters> 7754 <errors> 7755 </errors> 7756 </function> 7757 </elide> 7758 7759 </category> 7760 7761 <category id="fieldCategory" label="Field"> 7762 7763 <intro> 7764 </intro> 7765 7766 <function id="GetFieldName" phase="start" num="60"> 7767 <synopsis>Get Field Name (and Signature)</synopsis> 7768 <description> 7769 For the field indicated by <paramlink id="klass"/> and <paramlink id="field"/>, 7770 return the field name via <paramlink id="name_ptr"/> and field signature via 7771 <paramlink id="signature_ptr"/>. 7772 <p/> 7773 Field signatures are defined in the JNI Specification and 7774 are referred to as <code>field descriptors</code> in 7775 <vmspec chapter="4.3.2"/>. 7776 </description> 7777 <origin>jvmdiClone</origin> 7778 <capabilities> 7779 </capabilities> 7780 <parameters> 7781 <param id="klass"> 7782 <jclass field="field"/> 7783 <description> 7784 The class of the field to query. 7785 </description> 7786 </param> 7787 <param id="field"> 7788 <jfieldID class="klass"/> 7789 <description> 7790 The field to query. 7791 </description> 7792 </param> 7793 <param id="name_ptr"> 7794 <allocbuf> 7795 <char/> 7796 <nullok>the name is not returned</nullok> 7797 </allocbuf> 7798 <description> 7799 On return, points to the field name, encoded as a 7800 <internallink id="mUTF">modified UTF-8</internallink> string. 7801 </description> 7802 </param> 7803 <param id="signature_ptr"> 7804 <allocbuf> 7805 <char/> 7806 <nullok>the signature is not returned</nullok> 7807 </allocbuf> 7808 <description> 7809 On return, points to the field signature, encoded as a 7810 <internallink id="mUTF">modified UTF-8</internallink> string. 7811 </description> 7812 </param> 7813 <param id="generic_ptr"> 7814 <allocbuf> 7815 <char/> 7816 <nullok>the generic signature is not returned</nullok> 7817 </allocbuf> 7818 <description> 7819 On return, points to the generic signature of the field, encoded as a 7820 <internallink id="mUTF">modified UTF-8</internallink> string. 7821 If there is no generic signature attribute for the field, then, 7822 on return, points to <code>NULL</code>. 7823 </description> 7824 </param> 7825 </parameters> 7826 <errors> 7827 </errors> 7828 </function> 7829 7830 <function id="GetFieldDeclaringClass" phase="start" num="61"> 7831 <synopsis>Get Field Declaring Class</synopsis> 7832 <description> 7833 For the field indicated by <code>klass</code> and <code>field</code> 7834 return the class that defined it via <code>declaring_class_ptr</code>. 7835 The declaring class will either be <code>klass</code>, a superclass, or 7836 an implemented interface. 7837 </description> 7838 <origin>jvmdi</origin> 7839 <capabilities> 7840 </capabilities> 7841 <parameters> 7842 <param id="klass"> 7843 <jclass field="field"/> 7844 <description> 7845 The class to query. 7846 </description> 7847 </param> 7848 <param id="field"> 7849 <jfieldID class="klass"/> 7850 <description> 7851 The field to query. 7852 </description> 7853 </param> 7854 <param id="declaring_class_ptr"> 7855 <outptr><jclass/></outptr> 7856 <description> 7857 On return, points to the declaring class 7858 </description> 7859 </param> 7860 </parameters> 7861 <errors> 7862 </errors> 7863 </function> 7864 7865 <function id="GetFieldModifiers" phase="start" num="62"> 7866 <synopsis>Get Field Modifiers</synopsis> 7867 <description> 7868 For the field indicated by <code>klass</code> and <code>field</code> 7869 return the access flags via <code>modifiers_ptr</code>. 7870 Access flags are defined in <vmspec chapter="4"/>. 7871 </description> 7872 <origin>jvmdi</origin> 7873 <capabilities> 7874 </capabilities> 7875 <parameters> 7876 <param id="klass"> 7877 <jclass field="field"/> 7878 <description> 7879 The class to query. 7880 </description> 7881 </param> 7882 <param id="field"> 7883 <jfieldID class="klass"/> 7884 <description> 7885 The field to query. 7886 </description> 7887 </param> 7888 <param id="modifiers_ptr"> 7889 <outptr><jint/></outptr> 7890 <description> 7891 On return, points to the access flags. 7892 </description> 7893 </param> 7894 </parameters> 7895 <errors> 7896 </errors> 7897 </function> 7898 7899 <function id="IsFieldSynthetic" phase="start" num="63"> 7900 <synopsis>Is Field Synthetic</synopsis> 7901 <description> 7902 For the field indicated by <code>klass</code> and <code>field</code>, return a 7903 value indicating whether the field is synthetic via <code>is_synthetic_ptr</code>. 7904 Synthetic fields are generated by the compiler but not present in the 7905 original source code. 7906 </description> 7907 <origin>jvmdi</origin> 7908 <capabilities> 7909 <required id="can_get_synthetic_attribute"></required> 7910 </capabilities> 7911 <parameters> 7912 <param id="klass"> 7913 <jclass field="field"/> 7914 <description> 7915 The class of the field to query. 7916 </description> 7917 </param> 7918 <param id="field"> 7919 <jfieldID class="klass"/> 7920 <description> 7921 The field to query. 7922 </description> 7923 </param> 7924 <param id="is_synthetic_ptr"> 7925 <outptr><jboolean/></outptr> 7926 <description> 7927 On return, points to the boolean result of this function. 7928 </description> 7929 </param> 7930 </parameters> 7931 <errors> 7932 </errors> 7933 </function> 7934 7935 </category> 7936 7937 <category id="method" label="Method"> 7938 7939 <intro> 7940 These functions provide information about a method (represented as a 7941 <typelink id="jmethodID"/>) and set how methods are processed. 7942 </intro> 7943 7944 <intro id="obsoleteMethods" label="Obsolete Methods"> 7945 The functions <functionlink id="RetransformClasses"/> and 7946 <functionlink id="RedefineClasses"/> can cause new versions 7947 of methods to be installed. 7948 An original version of a method is considered equivalent 7949 to the new version if: 7950 <ul> 7951 <li>their bytecodes are the same except for indices into the 7952 constant pool and </li> 7953 <li>the referenced constants are equal.</li> 7954 </ul> 7955 An original method version which is not equivalent to the 7956 new method version is called obsolete and is assigned a new method ID; 7957 the original method ID now refers to the new method version. 7958 A method ID can be tested for obsolescence with 7959 <functionlink id="IsMethodObsolete"/>. 7960 </intro> 7961 7962 <function id="GetMethodName" phase="start" num="64"> 7963 <synopsis>Get Method Name (and Signature)</synopsis> 7964 <description> 7965 For the method indicated by <code>method</code>, 7966 return the method name via <code>name_ptr</code> and method signature via 7967 <code>signature_ptr</code>. 7968 <p/> 7969 Method signatures are defined in the JNI Specification and are 7970 referred to as <code>method descriptors</code> in 7971 <vmspec chapter="4.3.3"/>. 7972 Note this is different 7973 than method signatures as defined in the <i>Java Language Specification</i>. 7974 </description> 7975 <origin>jvmdiClone</origin> 7976 <capabilities> 7977 </capabilities> 7978 <parameters> 7979 <param id="method"> 7980 <jmethodID/> 7981 <description> 7982 The method to query. 7983 </description> 7984 </param> 7985 <param id="name_ptr"> 7986 <allocbuf> 7987 <char/> 7988 <nullok>the name is not returned</nullok> 7989 </allocbuf> 7990 <description> 7991 On return, points to the method name, encoded as a 7992 <internallink id="mUTF">modified UTF-8</internallink> string. 7993 </description> 7994 </param> 7995 <param id="signature_ptr"> 7996 <allocbuf> 7997 <char/> 7998 <nullok>the signature is not returned</nullok> 7999 </allocbuf> 8000 <description> 8001 On return, points to the method signature, encoded as a 8002 <internallink id="mUTF">modified UTF-8</internallink> string. 8003 </description> 8004 </param> 8005 <param id="generic_ptr"> 8006 <allocbuf> 8007 <char/> 8008 <nullok>the generic signature is not returned</nullok> 8009 </allocbuf> 8010 <description> 8011 On return, points to the generic signature of the method, encoded as a 8012 <internallink id="mUTF">modified UTF-8</internallink> string. 8013 If there is no generic signature attribute for the method, then, 8014 on return, points to <code>NULL</code>. 8015 </description> 8016 </param> 8017 </parameters> 8018 <errors> 8019 </errors> 8020 </function> 8021 8022 <function id="GetMethodDeclaringClass" phase="start" num="65"> 8023 <synopsis>Get Method Declaring Class</synopsis> 8024 <description> 8025 For the method indicated by <code>method</code>, 8026 return the class that defined it via <code>declaring_class_ptr</code>. 8027 </description> 8028 <origin>jvmdi</origin> 8029 <capabilities> 8030 </capabilities> 8031 <parameters> 8032 <param id="klass"> 8033 <jclass method="method"/> 8034 <description> 8035 The class to query. 8036 </description> 8037 </param> 8038 <param id="method"> 8039 <jmethodID class="klass"/> 8040 <description> 8041 The method to query. 8042 </description> 8043 </param> 8044 <param id="declaring_class_ptr"> 8045 <outptr><jclass/></outptr> 8046 <description> 8047 On return, points to the declaring class 8048 </description> 8049 </param> 8050 </parameters> 8051 <errors> 8052 </errors> 8053 </function> 8054 8055 <function id="GetMethodModifiers" phase="start" num="66"> 8056 <synopsis>Get Method Modifiers</synopsis> 8057 <description> 8058 For the method indicated by <code>method</code>, 8059 return the access flags via <code>modifiers_ptr</code>. 8060 Access flags are defined in <vmspec chapter="4"/>. 8061 </description> 8062 <origin>jvmdi</origin> 8063 <capabilities> 8064 </capabilities> 8065 <parameters> 8066 <param id="klass"> 8067 <jclass method="method"/> 8068 <description> 8069 The class to query. 8070 </description> 8071 </param> 8072 <param id="method"> 8073 <jmethodID class="klass"/> 8074 <description> 8075 The method to query. 8076 </description> 8077 </param> 8078 <param id="modifiers_ptr"> 8079 <outptr><jint/></outptr> 8080 <description> 8081 On return, points to the access flags. 8082 </description> 8083 </param> 8084 </parameters> 8085 <errors> 8086 </errors> 8087 </function> 8088 8089 <function id="GetMaxLocals" phase="start" num="68"> 8090 <synopsis>Get Max Locals</synopsis> 8091 <description> 8092 For the method indicated by <code>method</code>, 8093 return the number of local variable slots used by the method, 8094 including the local variables used to pass parameters to the 8095 method on its invocation. 8096 <p/> 8097 See <code>max_locals</code> in <vmspec chapter="4.7.3"/>. 8098 </description> 8099 <origin>jvmdi</origin> 8100 <capabilities> 8101 </capabilities> 8102 <parameters> 8103 <param id="klass"> 8104 <jclass method="method"/> 8105 <description> 8106 The class to query. 8107 </description> 8108 </param> 8109 <param id="method"> 8110 <jmethodID class="klass" native="error"/> 8111 <description> 8112 The method to query. 8113 </description> 8114 </param> 8115 <param id="max_ptr"> 8116 <outptr><jint/></outptr> 8117 <description> 8118 On return, points to the maximum number of local slots 8119 </description> 8120 </param> 8121 </parameters> 8122 <errors> 8123 </errors> 8124 </function> 8125 8126 <function id="GetArgumentsSize" phase="start" num="69"> 8127 <synopsis>Get Arguments Size</synopsis> 8128 <description> 8129 For the method indicated by <code>method</code>, 8130 return via <code>max_ptr</code> the number of local variable slots used 8131 by the method's arguments. 8132 Note that two-word arguments use two slots. 8133 </description> 8134 <origin>jvmdi</origin> 8135 <capabilities> 8136 </capabilities> 8137 <parameters> 8138 <param id="klass"> 8139 <jclass method="method"/> 8140 <description> 8141 The class to query. 8142 </description> 8143 </param> 8144 <param id="method"> 8145 <jmethodID class="klass" native="error"/> 8146 <description> 8147 The method to query. 8148 </description> 8149 </param> 8150 <param id="size_ptr"> 8151 <outptr><jint/></outptr> 8152 <description> 8153 On return, points to the number of argument slots 8154 </description> 8155 </param> 8156 </parameters> 8157 <errors> 8158 </errors> 8159 </function> 8160 8161 <function id="GetLineNumberTable" phase="start" num="70"> 8162 <synopsis>Get Line Number Table</synopsis> 8163 <typedef id="jvmtiLineNumberEntry" label="Line number table entry"> 8164 <field id="start_location"> 8165 <jlocation/> 8166 <description> 8167 the <datalink id="jlocation"></datalink> where the line begins 8168 </description> 8169 </field> 8170 <field id="line_number"> 8171 <jint/> 8172 <description> 8173 the line number 8174 </description> 8175 </field> 8176 </typedef> 8177 <description> 8178 For the method indicated by <code>method</code>, 8179 return a table of source line number entries. The size of the table is 8180 returned via <code>entry_count_ptr</code> and the table itself is 8181 returned via <code>table_ptr</code>. 8182 </description> 8183 <origin>jvmdi</origin> 8184 <capabilities> 8185 <required id="can_get_line_numbers"></required> 8186 </capabilities> 8187 <parameters> 8188 <param id="klass"> 8189 <jclass method="method"/> 8190 <description> 8191 The class to query. 8192 </description> 8193 </param> 8194 <param id="method"> 8195 <jmethodID class="klass" native="error"/> 8196 <description> 8197 The method to query. 8198 </description> 8199 </param> 8200 <param id="entry_count_ptr"> 8201 <outptr><jint/></outptr> 8202 <description> 8203 On return, points to the number of entries in the table 8204 </description> 8205 </param> 8206 <param id="table_ptr"> 8207 <allocbuf outcount="entry_count_ptr"><struct>jvmtiLineNumberEntry</struct></allocbuf> 8208 <description> 8209 On return, points to the line number table pointer. 8210 </description> 8211 </param> 8212 </parameters> 8213 <errors> 8214 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 8215 Class information does not include line numbers. 8216 </error> 8217 </errors> 8218 </function> 8219 8220 <function id="GetMethodLocation" phase="start" num="71"> 8221 <synopsis>Get Method Location</synopsis> 8222 <description> 8223 For the method indicated by <code>method</code>, 8224 return the beginning and ending addresses through 8225 <code>start_location_ptr</code> and <code>end_location_ptr</code>. In a 8226 conventional byte code indexing scheme, 8227 <code>start_location_ptr</code> will always point to zero 8228 and <code>end_location_ptr</code> 8229 will always point to the byte code count minus one. 8230 </description> 8231 <origin>jvmdi</origin> 8232 <capabilities> 8233 </capabilities> 8234 <parameters> 8235 <param id="klass"> 8236 <jclass method="method"/> 8237 <description> 8238 The class to query. 8239 </description> 8240 </param> 8241 <param id="method"> 8242 <jmethodID class="klass" native="error"/> 8243 <description> 8244 The method to query. 8245 </description> 8246 </param> 8247 <param id="start_location_ptr"> 8248 <outptr><jlocation/></outptr> 8249 <description> 8250 On return, points to the first location, or 8251 <code>-1</code> if location information is not available. 8252 If the information is available and 8253 <functionlink id="GetJLocationFormat"></functionlink> 8254 returns <datalink id="JVMTI_JLOCATION_JVMBCI"></datalink> 8255 then this will always be zero. 8256 </description> 8257 </param> 8258 <param id="end_location_ptr"> 8259 <outptr><jlocation/></outptr> 8260 <description> 8261 On return, points to the last location, 8262 or <code>-1</code> if location information is not available. 8263 </description> 8264 </param> 8265 </parameters> 8266 <errors> 8267 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 8268 Class information does not include method sizes. 8269 </error> 8270 </errors> 8271 </function> 8272 8273 <function id="GetLocalVariableTable" num="72"> 8274 <synopsis>Get Local Variable Table</synopsis> 8275 <typedef id="jvmtiLocalVariableEntry" label="Local variable table entry"> 8276 <field id="start_location"> 8277 <jlocation/> 8278 <description> 8279 The code array index where the local variable is first valid 8280 (that is, where it must have a value). 8281 </description> 8282 </field> 8283 <field id="length"> 8284 <jint/> 8285 <description> 8286 The length of the valid section for this local variable. 8287 The last code array index where the local variable is valid 8288 is <code>start_location + length</code>. 8289 </description> 8290 </field> 8291 <field id="name"> 8292 <allocfieldbuf><char/></allocfieldbuf> 8293 <description> 8294 The local variable name, encoded as a 8295 <internallink id="mUTF">modified UTF-8</internallink> string. 8296 </description> 8297 </field> 8298 <field id="signature"> 8299 <allocfieldbuf><char/></allocfieldbuf> 8300 <description> 8301 The local variable's type signature, encoded as a 8302 <internallink id="mUTF">modified UTF-8</internallink> string. 8303 The signature format is the same as that defined in 8304 <vmspec chapter="4.3.2"/>. 8305 </description> 8306 </field> 8307 <field id="generic_signature"> 8308 <allocfieldbuf><char/></allocfieldbuf> 8309 <description> 8310 The local variable's generic signature, encoded as a 8311 <internallink id="mUTF">modified UTF-8</internallink> string. 8312 The value of this field will be <code>NULL</code> for any local 8313 variable which does not have a generic type. 8314 </description> 8315 </field> 8316 <field id="slot"> 8317 <jint/> 8318 <description> 8319 The local variable's slot. See <internallink id="local">Local Variables</internallink>. 8320 </description> 8321 </field> 8322 </typedef> 8323 <description> 8324 Return local variable information. 8325 </description> 8326 <origin>jvmdiClone</origin> 8327 <capabilities> 8328 <required id="can_access_local_variables"></required> 8329 </capabilities> 8330 <parameters> 8331 <param id="method"> 8332 <jmethodID native="error"/> 8333 <description> 8334 The method to query. 8335 </description> 8336 </param> 8337 <param id="entry_count_ptr"> 8338 <outptr><jint/></outptr> 8339 <description> 8340 On return, points to the number of entries in the table 8341 </description> 8342 </param> 8343 <param id="table_ptr"> 8344 <allocbuf outcount="entry_count_ptr"><struct>jvmtiLocalVariableEntry</struct></allocbuf> 8345 <description> 8346 On return, points to an array of local variable table entries. 8347 </description> 8348 </param> 8349 </parameters> 8350 <errors> 8351 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 8352 Class information does not include local variable 8353 information. 8354 </error> 8355 </errors> 8356 </function> 8357 8358 <function id="GetBytecodes" phase="start" num="75"> 8359 <synopsis>Get Bytecodes</synopsis> 8360 <description> 8361 For the method indicated by <code>method</code>, 8362 return the byte codes that implement the method. The number of 8363 bytecodes is returned via <code>bytecode_count_ptr</code>. The byte codes 8364 themselves are returned via <code>bytecodes_ptr</code>. 8365 </description> 8366 <origin>jvmdi</origin> 8367 <capabilities> 8368 <required id="can_get_bytecodes"></required> 8369 </capabilities> 8370 <parameters> 8371 <param id="klass"> 8372 <jclass method="method"/> 8373 <description> 8374 The class to query. 8375 </description> 8376 </param> 8377 <param id="method"> 8378 <jmethodID class="klass" native="error"/> 8379 <description> 8380 The method to query. 8381 </description> 8382 </param> 8383 <param id="bytecode_count_ptr"> 8384 <outptr><jint/></outptr> 8385 <description> 8386 On return, points to the length of the byte code array 8387 </description> 8388 </param> 8389 <param id="bytecodes_ptr"> 8390 <allocbuf outcount="bytecode_count_ptr"><uchar/></allocbuf> 8391 <description> 8392 On return, points to the pointer to the byte code array 8393 </description> 8394 </param> 8395 </parameters> 8396 <errors> 8397 </errors> 8398 </function> 8399 8400 <function id="IsMethodNative" phase="start" num="76"> 8401 <synopsis>Is Method Native</synopsis> 8402 <description> 8403 For the method indicated by <code>method</code>, return a 8404 value indicating whether the method is native via <code>is_native_ptr</code> 8405 </description> 8406 <origin>jvmdi</origin> 8407 <capabilities> 8408 </capabilities> 8409 <parameters> 8410 <param id="klass"> 8411 <jclass method="method"/> 8412 <description> 8413 The class to query. 8414 </description> 8415 </param> 8416 <param id="method"> 8417 <jmethodID class="klass"/> 8418 <description> 8419 The method to query. 8420 </description> 8421 </param> 8422 <param id="is_native_ptr"> 8423 <outptr><jboolean/></outptr> 8424 <description> 8425 On return, points to the boolean result of this function. 8426 </description> 8427 </param> 8428 </parameters> 8429 <errors> 8430 </errors> 8431 </function> 8432 8433 <function id="IsMethodSynthetic" phase="start" num="77"> 8434 <synopsis>Is Method Synthetic</synopsis> 8435 <description> 8436 For the method indicated by <code>method</code>, return a 8437 value indicating whether the method is synthetic via <code>is_synthetic_ptr</code>. 8438 Synthetic methods are generated by the compiler but not present in the 8439 original source code. 8440 </description> 8441 <origin>jvmdi</origin> 8442 <capabilities> 8443 <required id="can_get_synthetic_attribute"></required> 8444 </capabilities> 8445 <parameters> 8446 <param id="klass"> 8447 <jclass method="method"/> 8448 <description> 8449 The class to query. 8450 </description> 8451 </param> 8452 <param id="method"> 8453 <jmethodID class="klass"/> 8454 <description> 8455 The method to query. 8456 </description> 8457 </param> 8458 <param id="is_synthetic_ptr"> 8459 <outptr><jboolean/></outptr> 8460 <description> 8461 On return, points to the boolean result of this function. 8462 </description> 8463 </param> 8464 </parameters> 8465 <errors> 8466 </errors> 8467 </function> 8468 8469 <function id="IsMethodObsolete" phase="start" num="91"> 8470 <synopsis>Is Method Obsolete</synopsis> 8471 <description> 8472 Determine if a method ID refers to an 8473 <internallink id="obsoleteMethods">obsolete</internallink> 8474 method version. 8475 </description> 8476 <origin>jvmdi</origin> 8477 <capabilities> 8478 </capabilities> 8479 <parameters> 8480 <param id="klass"> 8481 <jclass method="method"/> 8482 <description> 8483 The class to query. 8484 </description> 8485 </param> 8486 <param id="method"> 8487 <jmethodID class="klass"/> 8488 <description> 8489 The method ID to query. 8490 </description> 8491 </param> 8492 <param id="is_obsolete_ptr"> 8493 <outptr><jboolean/></outptr> 8494 <description> 8495 On return, points to the boolean result of this function. 8496 </description> 8497 </param> 8498 </parameters> 8499 <errors> 8500 </errors> 8501 </function> 8502 8503 <function id="SetNativeMethodPrefix" jkernel="yes" phase="any" num="73" since="1.1"> 8504 <synopsis>Set Native Method Prefix</synopsis> 8505 <description> 8506 This function modifies the failure handling of 8507 native method resolution by allowing retry 8508 with a prefix applied to the name. 8509 When used with the 8510 <eventlink id="ClassFileLoadHook">ClassFileLoadHook 8511 event</eventlink>, it enables native methods to be 8512 <internallink id="bci">instrumented</internallink>. 8513 <p/> 8514 Since native methods cannot be directly instrumented 8515 (they have no bytecodes), they must be wrapped with 8516 a non-native method which can be instrumented. 8517 For example, if we had: 8518 <example> 8519 native boolean foo(int x);</example> 8520 <p/> 8521 We could transform the class file (with the 8522 ClassFileLoadHook event) so that this becomes: 8523 <example> 8524 boolean foo(int x) { 8525 <i>... record entry to foo ...</i> 8526 return wrapped_foo(x); 8527 } 8528 8529 native boolean wrapped_foo(int x);</example> 8530 <p/> 8531 Where foo becomes a wrapper for the actual native method 8532 with the appended prefix "wrapped_". Note that 8533 "wrapped_" would be a poor choice of prefix since it 8534 might conceivably form the name of an existing method 8535 thus something like "$$$MyAgentWrapped$$$_" would be 8536 better but would make these examples less readable. 8537 <p/> 8538 The wrapper will allow data to be collected on the native 8539 method call, but now the problem becomes linking up the 8540 wrapped method with the native implementation. 8541 That is, the method <code>wrapped_foo</code> needs to be 8542 resolved to the native implementation of <code>foo</code>, 8543 which might be: 8544 <example> 8545 Java_somePackage_someClass_foo(JNIEnv* env, jint x)</example> 8546 <p/> 8547 This function allows the prefix to be specified and the 8548 proper resolution to occur. 8549 Specifically, when the standard resolution fails, the 8550 resolution is retried taking the prefix into consideration. 8551 There are two ways that resolution occurs, explicit 8552 resolution with the JNI function <code>RegisterNatives</code> 8553 and the normal automatic resolution. For 8554 <code>RegisterNatives</code>, the VM will attempt this 8555 association: 8556 <example> 8557 method(foo) -> nativeImplementation(foo)</example> 8558 <p/> 8559 When this fails, the resolution will be retried with 8560 the specified prefix prepended to the method name, 8561 yielding the correct resolution: 8562 <example> 8563 method(wrapped_foo) -> nativeImplementation(foo)</example> 8564 <p/> 8565 For automatic resolution, the VM will attempt: 8566 <example> 8567 method(wrapped_foo) -> nativeImplementation(wrapped_foo)</example> 8568 <p/> 8569 When this fails, the resolution will be retried with 8570 the specified prefix deleted from the implementation name, 8571 yielding the correct resolution: 8572 <example> 8573 method(wrapped_foo) -> nativeImplementation(foo)</example> 8574 <p/> 8575 Note that since the prefix is only used when standard 8576 resolution fails, native methods can be wrapped selectively. 8577 <p/> 8578 Since each <jvmti/> environment is independent and 8579 can do its own transformation of the bytecodes, more 8580 than one layer of wrappers may be applied. Thus each 8581 environment needs its own prefix. Since transformations 8582 are applied in order, the prefixes, if applied, will 8583 be applied in the same order. 8584 The order of transformation application is described in 8585 the <eventlink id="ClassFileLoadHook"/> event. 8586 Thus if three environments applied 8587 wrappers, <code>foo</code> might become 8588 <code>$env3_$env2_$env1_foo</code>. But if, say, 8589 the second environment did not apply a wrapper to 8590 <code>foo</code> it would be just 8591 <code>$env3_$env1_foo</code>. To be able to 8592 efficiently determine the sequence of prefixes, 8593 an intermediate prefix is only applied if its non-native 8594 wrapper exists. Thus, in the last example, even though 8595 <code>$env1_foo</code> is not a native method, the 8596 <code>$env1_</code> prefix is applied since 8597 <code>$env1_foo</code> exists. 8598 <p/> 8599 Since the prefixes are used at resolution time 8600 and since resolution may be arbitrarily delayed, a 8601 native method prefix must remain set as long as there 8602 are corresponding prefixed native methods. 8603 </description> 8604 <origin>new</origin> 8605 <capabilities> 8606 <required id="can_set_native_method_prefix"></required> 8607 </capabilities> 8608 <parameters> 8609 <param id="prefix"> 8610 <inbuf> 8611 <char/> 8612 <nullok> 8613 any existing prefix in this environment is cancelled 8614 </nullok> 8615 </inbuf> 8616 <description> 8617 The prefix to apply, encoded as a 8618 <internallink id="mUTF">modified UTF-8</internallink> string. 8619 </description> 8620 </param> 8621 </parameters> 8622 <errors> 8623 </errors> 8624 </function> 8625 8626 <function id="SetNativeMethodPrefixes" jkernel="yes" phase="any" num="74" since="1.1"> 8627 <synopsis>Set Native Method Prefixes</synopsis> 8628 <description> 8629 For a normal agent, <functionlink id="SetNativeMethodPrefix"/> 8630 will provide all needed native method prefixing. 8631 For a meta-agent that performs multiple independent class 8632 file transformations (for example as a proxy for another 8633 layer of agents) this function allows each transformation 8634 to have its own prefix. 8635 The prefixes are applied in the order supplied and are 8636 processed in the same manor as described for the 8637 application of prefixes from multiple <jvmti/> environments 8638 in <functionlink id="SetNativeMethodPrefix"/>. 8639 <p/> 8640 Any previous prefixes are replaced. Thus, calling this 8641 function with a <paramlink id="prefix_count"/> of <code>0</code> 8642 disables prefixing in this environment. 8643 <p/> 8644 <functionlink id="SetNativeMethodPrefix"/> and this function 8645 are the two ways to set the prefixes. 8646 Calling <code>SetNativeMethodPrefix</code> with 8647 a prefix is the same as calling this function with 8648 <paramlink id="prefix_count"/> of <code>1</code>. 8649 Calling <code>SetNativeMethodPrefix</code> with 8650 <code>NULL</code> is the same as calling this function with 8651 <paramlink id="prefix_count"/> of <code>0</code>. 8652 </description> 8653 <origin>new</origin> 8654 <capabilities> 8655 <required id="can_set_native_method_prefix"></required> 8656 </capabilities> 8657 <parameters> 8658 <param id="prefix_count"> 8659 <jint min="0"/> 8660 <description> 8661 The number of prefixes to apply. 8662 </description> 8663 </param> 8664 <param id="prefixes"> 8665 <agentbuf> 8666 <char/> 8667 </agentbuf> 8668 <description> 8669 The prefixes to apply for this environment, each encoded as a 8670 <internallink id="mUTF">modified UTF-8</internallink> string. 8671 </description> 8672 </param> 8673 </parameters> 8674 <errors> 8675 </errors> 8676 </function> 8677 8678 </category> 8679 8680 <category id="RawMonitors" label="Raw Monitor"> 8681 8682 <function id="CreateRawMonitor" phase="onload" callbacksafe="safe" num="31"> 8683 <synopsis>Create Raw Monitor</synopsis> 8684 <description> 8685 Create a raw monitor. 8686 </description> 8687 <origin>jvmdi</origin> 8688 <capabilities> 8689 </capabilities> 8690 <parameters> 8691 <param id="name"> 8692 <inbuf><char/></inbuf> 8693 <description> 8694 A name to identify the monitor, encoded as a 8695 <internallink id="mUTF">modified UTF-8</internallink> string. 8696 </description> 8697 </param> 8698 <param id="monitor_ptr"> 8699 <outptr><jrawMonitorID/></outptr> 8700 <description> 8701 On return, points to the created monitor. 8702 </description> 8703 </param> 8704 </parameters> 8705 <errors> 8706 </errors> 8707 </function> 8708 8709 <function id="DestroyRawMonitor" phase="onload" callbacksafe="safe" num="32"> 8710 <synopsis>Destroy Raw Monitor</synopsis> 8711 <description> 8712 Destroy the raw monitor. 8713 If the monitor being destroyed has been entered by this thread, it will be 8714 exited before it is destroyed. 8715 If the monitor being destroyed has been entered by another thread, 8716 an error will be returned and the monitor will not be destroyed. 8717 </description> 8718 <origin>jvmdi</origin> 8719 <capabilities> 8720 </capabilities> 8721 <parameters> 8722 <param id="monitor"> 8723 <jrawMonitorID/> 8724 <description> 8725 The monitor 8726 </description> 8727 </param> 8728 </parameters> 8729 <errors> 8730 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 8731 Not monitor owner 8732 </error> 8733 </errors> 8734 </function> 8735 8736 <function id="RawMonitorEnter" phase="any" callbacksafe="safe" impl="innative notrace" num="33"> 8737 <synopsis>Raw Monitor Enter</synopsis> 8738 <description> 8739 Gain exclusive ownership of a raw monitor. 8740 The same thread may enter a monitor more then once. 8741 The thread must 8742 <functionlink id="RawMonitorExit">exit</functionlink> 8743 the monitor the same number of times as it is entered. 8744 If a monitor is entered during <code>OnLoad</code> (before attached threads exist) 8745 and has not exited when attached threads come into existence, the enter 8746 is considered to have occurred on the main thread. 8747 </description> 8748 <origin>jvmdi</origin> 8749 <capabilities> 8750 </capabilities> 8751 <parameters> 8752 <param id="monitor"> 8753 <jrawMonitorID/> 8754 <description> 8755 The monitor 8756 </description> 8757 </param> 8758 </parameters> 8759 <errors> 8760 </errors> 8761 </function> 8762 8763 <function id="RawMonitorExit" phase="any" callbacksafe="safe" impl="innative notrace" num="34"> 8764 <synopsis>Raw Monitor Exit</synopsis> 8765 <description> 8766 Release exclusive ownership of a raw monitor. 8767 </description> 8768 <origin>jvmdi</origin> 8769 <capabilities> 8770 </capabilities> 8771 <parameters> 8772 <param id="monitor"> 8773 <jrawMonitorID/> 8774 <description> 8775 The monitor 8776 </description> 8777 </param> 8778 </parameters> 8779 <errors> 8780 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 8781 Not monitor owner 8782 </error> 8783 </errors> 8784 </function> 8785 8786 <function id="RawMonitorWait" phase="any" callbacksafe="safe" impl="innative notrace" num="35"> 8787 <synopsis>Raw Monitor Wait</synopsis> 8788 <description> 8789 Wait for notification of the raw monitor. 8790 <p/> 8791 Causes the current thread to wait until either another thread calls 8792 <functionlink id="RawMonitorNotify"/> or 8793 <functionlink id="RawMonitorNotifyAll"/> 8794 for the specified raw monitor, or the specified 8795 <paramlink id="millis">timeout</paramlink> 8796 has elapsed. 8797 </description> 8798 <origin>jvmdi</origin> 8799 <capabilities> 8800 </capabilities> 8801 <parameters> 8802 <param id="monitor"> 8803 <jrawMonitorID/> 8804 <description> 8805 The monitor 8806 </description> 8807 </param> 8808 <param id="millis"> 8809 <jlong/> 8810 <description> 8811 The timeout, in milliseconds. If the timeout is 8812 zero, then real time is not taken into consideration 8813 and the thread simply waits until notified. 8814 </description> 8815 </param> 8816 </parameters> 8817 <errors> 8818 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 8819 Not monitor owner 8820 </error> 8821 <error id="JVMTI_ERROR_INTERRUPT"> 8822 Wait was interrupted, try again 8823 </error> 8824 </errors> 8825 </function> 8826 8827 <function id="RawMonitorNotify" phase="any" callbacksafe="safe" impl="notrace" num="36"> 8828 <synopsis>Raw Monitor Notify</synopsis> 8829 <description> 8830 Notify a single thread waiting on the raw monitor. 8831 </description> 8832 <origin>jvmdi</origin> 8833 <capabilities> 8834 </capabilities> 8835 <parameters> 8836 <param id="monitor"> 8837 <jrawMonitorID/> 8838 <description> 8839 The monitor 8840 </description> 8841 </param> 8842 </parameters> 8843 <errors> 8844 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 8845 Not monitor owner 8846 </error> 8847 </errors> 8848 </function> 8849 8850 <function id="RawMonitorNotifyAll" phase="any" callbacksafe="safe" impl="notrace" num="37"> 8851 <synopsis>Raw Monitor Notify All</synopsis> 8852 <description> 8853 Notify all threads waiting on the raw monitor. 8854 </description> 8855 <origin>jvmdi</origin> 8856 <capabilities> 8857 </capabilities> 8858 <parameters> 8859 <param id="monitor"> 8860 <jrawMonitorID/> 8861 <description> 8862 The monitor 8863 </description> 8864 </param> 8865 </parameters> 8866 <errors> 8867 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 8868 Not monitor owner 8869 </error> 8870 </errors> 8871 </function> 8872 8873 <elide> 8874 <function id="GetRawMonitorUse" num="118"> 8875 <synopsis>Get Raw Monitor Use</synopsis> 8876 <description> 8877 The fields of the <functionlink id="jvmtiMonitorUsage"></functionlink> structure 8878 are filled in with information about usage of the raw monitor. 8879 </description> 8880 <origin>new</origin> 8881 <capabilities> 8882 <required id="can_get_raw_monitor_usage"></required> 8883 </capabilities> 8884 <parameters> 8885 <param id="monitor"> 8886 <jrawMonitorID/> 8887 <description> 8888 the raw monitor to query. 8889 </description> 8890 </param> 8891 <param id="info_ptr"> 8892 <outptr><struct>jvmtiMonitorUsage</struct></outptr> 8893 <description> 8894 On return, filled with monitor information for the 8895 specified raw monitor. 8896 </description> 8897 </param> 8898 </parameters> 8899 <errors> 8900 </errors> 8901 </function> 8902 8903 <function id="GetRawMonitors" num="119"> 8904 <synopsis>Get Raw Monitors</synopsis> 8905 <description> 8906 Return the list of raw monitors. 8907 <p/> 8908 Note: details about each monitor can be examined with 8909 <functionlink id="GetRawMonitorUse"></functionlink>. 8910 </description> 8911 <origin>new</origin> 8912 <capabilities> 8913 <required id="can_get_raw_monitor_usage"></required> 8914 </capabilities> 8915 <parameters> 8916 <param id="monitorCnt"> 8917 <outptr><jint/></outptr> 8918 <description> 8919 On return, pointer to the number 8920 of monitors returned in <code>monitors_ptr</code>. 8921 </description> 8922 </param> 8923 <param id="monitors_ptr"> 8924 <allocbuf outcount="monitorCnt"><jrawMonitorID/></allocbuf> 8925 <description> 8926 On return, pointer to the monitor list. 8927 </description> 8928 </param> 8929 </parameters> 8930 <errors> 8931 </errors> 8932 </function> 8933 </elide> 8934 </category> 8935 8936 <category id="jniIntercept" label="JNI Function Interception"> 8937 8938 <intro> 8939 Provides the ability to intercept and resend 8940 Java Native Interface (JNI) function calls 8941 by manipulating the JNI function table. 8942 See <externallink id="http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/functions.html">JNI 8943 Functions</externallink> in the <i>Java Native Interface Specification</i>. 8944 <p/> 8945 The following example illustrates intercepting the 8946 <code>NewGlobalRef</code> JNI call in order to count reference 8947 creation. 8948 <example> 8949 JNIEnv original_jni_Functions; 8950 JNIEnv redirected_jni_Functions; 8951 int my_global_ref_count = 0; 8952 8953 jobject 8954 MyNewGlobalRef(JNIEnv *jni_env, jobject lobj) { 8955 ++my_global_ref_count; 8956 return originalJNIFunctions->NewGlobalRef(env, lobj); 8957 } 8958 8959 void 8960 myInit() { 8961 jvmtiError err; 8962 8963 err = (*jvmti_env)->GetJNIFunctionTable(jvmti_env, &original_jni_Functions); 8964 if (err != JVMTI_ERROR_NONE) { 8965 die(); 8966 } 8967 err = (*jvmti_env)->GetJNIFunctionTable(jvmti_env, &redirected_jni_Functions); 8968 if (err != JVMTI_ERROR_NONE) { 8969 die(); 8970 } 8971 redirectedJNIFunctions->NewGlobalRef = MyNewGlobalRef; 8972 err = (*jvmti_env)->SetJNIFunctionTable(jvmti_env, redirected_jni_Functions); 8973 if (err != JVMTI_ERROR_NONE) { 8974 die(); 8975 } 8976 } 8977 </example> 8978 Sometime after <code>myInit</code> is called the user's JNI 8979 code is executed which makes the call to create a new global 8980 reference. Instead of going to the normal JNI implementation 8981 the call goes to <code>myNewGlobalRef</code>. Note that a 8982 copy of the original function table is kept so that the normal 8983 JNI function can be called after the data is collected. 8984 Note also that any JNI functions which are not overwritten 8985 will behave normally. 8986 <todo> 8987 check that the example compiles and executes. 8988 </todo> 8989 </intro> 8990 8991 <function id="SetJNIFunctionTable" phase="start" num="120"> 8992 <synopsis>Set JNI Function Table</synopsis> 8993 <description> 8994 Set the JNI function table 8995 in all current and future JNI environments. 8996 As a result, all future JNI calls are directed to the specified functions. 8997 Use <functionlink id="GetJNIFunctionTable"></functionlink> to get the 8998 function table to pass to this function. 8999 For this function to take effect the the updated table entries must be 9000 used by the JNI clients. 9001 Since the table is defined <code>const</code> some compilers may optimize 9002 away the access to the table, thus preventing this function from taking 9003 effect. 9004 The table is copied--changes to the local copy of the 9005 table have no effect. 9006 This function affects only the function table, all other aspects of the environment are 9007 unaffected. 9008 See the examples <internallink id="jniIntercept">above</internallink>. 9009 </description> 9010 <origin>new</origin> 9011 <capabilities> 9012 </capabilities> 9013 <parameters> 9014 <param id="function_table"> 9015 <inptr> 9016 <struct>jniNativeInterface</struct> 9017 </inptr> 9018 <description> 9019 Points to the new JNI function table. 9020 </description> 9021 </param> 9022 </parameters> 9023 <errors> 9024 </errors> 9025 </function> 9026 9027 <function id="GetJNIFunctionTable" phase="start" num="121"> 9028 <synopsis>Get JNI Function Table</synopsis> 9029 <description> 9030 Get the JNI function table. 9031 The JNI function table is copied into allocated memory. 9032 If <functionlink id="SetJNIFunctionTable"></functionlink> 9033 has been called, the modified (not the original) function 9034 table is returned. 9035 Only the function table is copied, no other aspects of the environment 9036 are copied. 9037 See the examples <internallink id="jniIntercept">above</internallink>. 9038 </description> 9039 <origin>new</origin> 9040 <capabilities> 9041 </capabilities> 9042 <parameters> 9043 <param id="function_table"> 9044 <allocbuf> 9045 <struct>jniNativeInterface</struct> 9046 </allocbuf> 9047 <description> 9048 On return, <code>*function_table</code> 9049 points a newly allocated copy of the JNI function table. 9050 </description> 9051 </param> 9052 </parameters> 9053 <errors> 9054 </errors> 9055 </function> 9056 9057 </category> 9058 9059 <category id="eventManagement" label="Event Management"> 9060 9061 <function id="SetEventCallbacks" jkernel="yes" phase="onload" num="122"> 9062 <synopsis>Set Event Callbacks</synopsis> 9063 <description> 9064 Set the functions to be called for each event. 9065 The callbacks are specified by supplying a replacement function table. 9066 The function table is copied--changes to the local copy of the 9067 table have no effect. 9068 This is an atomic action, all callbacks are set at once. 9069 No events are sent before this function is called. 9070 When an entry is <code>NULL</code> or when the event is beyond 9071 <paramlink id="size_of_callbacks"></paramlink> no event is sent. 9072 Details on events are 9073 described <internallink id="EventSection">later</internallink> in this document. 9074 An event must be enabled and have a callback in order to be 9075 sent--the order in which this function and 9076 <functionlink id="SetEventNotificationMode"></functionlink> 9077 are called does not affect the result. 9078 </description> 9079 <origin>new</origin> 9080 <capabilities> 9081 </capabilities> 9082 <parameters> 9083 <param id="callbacks"> 9084 <inptr> 9085 <struct>jvmtiEventCallbacks</struct> 9086 <nullok>remove the existing callbacks</nullok> 9087 </inptr> 9088 <description> 9089 The new event callbacks. 9090 </description> 9091 </param> 9092 <param id="size_of_callbacks"> 9093 <jint min="0"/> 9094 <description> 9095 <code>sizeof(jvmtiEventCallbacks)</code>--for version 9096 compatibility. 9097 </description> 9098 </param> 9099 </parameters> 9100 <errors> 9101 </errors> 9102 </function> 9103 9104 <function id="SetEventNotificationMode" jkernel="yes" phase="onload" num="2"> 9105 <synopsis>Set Event Notification Mode</synopsis> 9106 <description> 9107 Control the generation of events. 9108 <constants id="jvmtiEventMode" label="Event Enable/Disable" kind="enum"> 9109 <constant id="JVMTI_ENABLE" num="1"> 9110 If <paramlink id="mode"></paramlink> is <code>JVMTI_ENABLE</code>, 9111 the event <paramlink id="event_type"></paramlink> will be enabled 9112 </constant> 9113 <constant id="JVMTI_DISABLE" num="0"> 9114 If <paramlink id="mode"></paramlink> is <code>JVMTI_DISABLE</code>, 9115 the event <paramlink id="event_type"></paramlink> will be disabled 9116 </constant> 9117 </constants> 9118 If <code>thread</code> is <code>NULL</code>, 9119 the event is enabled or disabled globally; otherwise, it is 9120 enabled or disabled for a particular thread. 9121 An event is generated for 9122 a particular thread if it is enabled either at the thread or global 9123 levels. 9124 <p/> 9125 See <internallink id="EventIndex">below</internallink> for information on specific events. 9126 <p/> 9127 The following events cannot be controlled at the thread 9128 level through this function. 9129 <ul> 9130 <li><eventlink id="VMInit"></eventlink></li> 9131 <li><eventlink id="VMStart"></eventlink></li> 9132 <li><eventlink id="VMDeath"></eventlink></li> 9133 <li><eventlink id="ThreadStart"></eventlink></li> 9134 <li><eventlink id="CompiledMethodLoad"></eventlink></li> 9135 <li><eventlink id="CompiledMethodUnload"></eventlink></li> 9136 <li><eventlink id="DynamicCodeGenerated"></eventlink></li> 9137 <li><eventlink id="DataDumpRequest"></eventlink></li> 9138 </ul> 9139 <p/> 9140 Initially, no events are enabled at either the thread level 9141 or the global level. 9142 <p/> 9143 Any needed capabilities (see Event Enabling Capabilities below) must be possessed 9144 before calling this function. 9145 <p/> 9146 Details on events are 9147 described <internallink id="EventSection">below</internallink>. 9148 </description> 9149 <origin>jvmdiClone</origin> 9150 <eventcapabilities></eventcapabilities> 9151 <parameters> 9152 <param id="mode"> 9153 <enum>jvmtiEventMode</enum> 9154 <description> 9155 <code>JVMTI_ENABLE</code> or <code>JVMTI_DISABLE</code> 9156 </description> 9157 </param> 9158 <param id="event_type"> 9159 <enum>jvmtiEvent</enum> 9160 <description> 9161 the event to control 9162 </description> 9163 </param> 9164 <param id="event_thread"> 9165 <ptrtype> 9166 <jthread impl="noconvert"/> 9167 <nullok>event is controlled at the global level</nullok> 9168 </ptrtype> 9169 <description> 9170 The thread to control 9171 </description> 9172 </param> 9173 <param id="..."> 9174 <varargs/> 9175 <description> 9176 for future expansion 9177 </description> 9178 </param> 9179 </parameters> 9180 <errors> 9181 <error id="JVMTI_ERROR_INVALID_THREAD"> 9182 <paramlink id="event_thread"/> is non-<code>NULL</code> and is not a valid thread. 9183 </error> 9184 <error id="JVMTI_ERROR_THREAD_NOT_ALIVE"> 9185 <paramlink id="event_thread"/> is non-<code>NULL</code> and is not live (has not been started or is now dead). 9186 </error> 9187 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 9188 thread level control was attempted on events which do not 9189 permit thread level control. 9190 </error> 9191 <error id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY"> 9192 The Required Event Enabling Capability is not possessed. 9193 </error> 9194 </errors> 9195 </function> 9196 9197 <function id="GenerateEvents" num="123"> 9198 <synopsis>Generate Events</synopsis> 9199 <description> 9200 Generate events to represent the current state of the VM. 9201 For example, if <paramlink id="event_type"/> is 9202 <code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code>, 9203 a <eventlink id="CompiledMethodLoad"></eventlink> event will be 9204 sent for each currently compiled method. 9205 Methods that were loaded and now have been unloaded are not sent. 9206 The history of what events have previously been sent does not 9207 effect what events are sent by this function--for example, 9208 all currently compiled methods 9209 will be sent each time this function is called. 9210 <p/> 9211 This function is useful when 9212 events may have been missed due to the agent attaching after program 9213 execution begins; this function generates the missed events. 9214 <p/> 9215 Attempts to execute Java programming language code or 9216 JNI functions may be paused until this function returns - 9217 so neither should be called from the thread sending the event. 9218 This function returns only after the missed events have been 9219 sent, processed and have returned. 9220 The event may be sent on a different thread than the thread 9221 on which the event occurred. 9222 The callback for the event must be set with 9223 <functionlink id="SetEventCallbacks"></functionlink> 9224 and the event must be enabled with 9225 <functionlink id="SetEventNotificationMode"></functionlink> 9226 or the events will not occur. 9227 If the VM no longer has the information to generate some or 9228 all of the requested events, the events are simply not sent - 9229 no error is returned. 9230 <p/> 9231 Only the following events are supported: 9232 <ul> 9233 <li><eventlink id="CompiledMethodLoad"></eventlink></li> 9234 <li><eventlink id="DynamicCodeGenerated"></eventlink></li> 9235 </ul> 9236 </description> 9237 <origin>new</origin> 9238 <capabilities> 9239 <capability id="can_generate_compiled_method_load_events"></capability> 9240 </capabilities> 9241 <parameters> 9242 <param id="event_type"> 9243 <enum>jvmtiEvent</enum> 9244 <description> 9245 The type of event to generate. Must be one of these: 9246 <ul> 9247 <li><eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink></li> 9248 <li><eventlink id="DynamicCodeGenerated"><code>JVMTI_EVENT_DYNAMIC_CODE_GENERATED</code></eventlink></li> 9249 </ul> 9250 </description> 9251 </param> 9252 </parameters> 9253 <errors> 9254 <error id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY"> 9255 <paramlink id="event_type"/> is 9256 <eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink> 9257 and <fieldlink id="can_generate_compiled_method_load_events" struct="jvmtiCapabilities"></fieldlink> 9258 is <code>false</code>. 9259 </error> 9260 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 9261 <paramlink id="event_type"/> is other than 9262 <eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink> 9263 or <eventlink id="DynamicCodeGenerated"><code>JVMTI_EVENT_DYNAMIC_CODE_GENERATED</code></eventlink>. 9264 </error> 9265 </errors> 9266 </function> 9267 9268 </category> 9269 9270 <category id="extension" label="Extension Mechanism"> 9271 9272 <intro> 9273 These functions 9274 allow a <jvmti/> implementation to provide functions and events 9275 beyond those defined in this specification. 9276 <p/> 9277 Both extension functions and extension events have parameters 9278 each of which has a 'type' and 'kind' chosen from the following tables: 9279 9280 <constants id="jvmtiParamTypes" label="Extension Function/Event Parameter Types" kind="enum"> 9281 <constant id="JVMTI_TYPE_JBYTE" num="101"> 9282 Java programming language primitive type - <code>byte</code>. 9283 JNI type <code>jbyte</code>. 9284 </constant> 9285 <constant id="JVMTI_TYPE_JCHAR" num="102"> 9286 Java programming language primitive type - <code>char</code>. 9287 JNI type <code>jchar</code>. 9288 </constant> 9289 <constant id="JVMTI_TYPE_JSHORT" num="103"> 9290 Java programming language primitive type - <code>short</code>. 9291 JNI type <code>jshort</code>. 9292 </constant> 9293 <constant id="JVMTI_TYPE_JINT" num="104"> 9294 Java programming language primitive type - <code>int</code>. 9295 JNI type <datalink id="jint"></datalink>. 9296 </constant> 9297 <constant id="JVMTI_TYPE_JLONG" num="105"> 9298 Java programming language primitive type - <code>long</code>. 9299 JNI type <datalink id="jlong"></datalink>. 9300 </constant> 9301 <constant id="JVMTI_TYPE_JFLOAT" num="106"> 9302 Java programming language primitive type - <code>float</code>. 9303 JNI type <datalink id="jfloat"></datalink>. 9304 </constant> 9305 <constant id="JVMTI_TYPE_JDOUBLE" num="107"> 9306 Java programming language primitive type - <code>double</code>. 9307 JNI type <datalink id="jdouble"></datalink>. 9308 </constant> 9309 <constant id="JVMTI_TYPE_JBOOLEAN" num="108"> 9310 Java programming language primitive type - <code>boolean</code>. 9311 JNI type <datalink id="jboolean"></datalink>. 9312 </constant> 9313 <constant id="JVMTI_TYPE_JOBJECT" num="109"> 9314 Java programming language object type - <code>java.lang.Object</code>. 9315 JNI type <datalink id="jobject"></datalink>. 9316 Returned values are JNI local references and must be managed. 9317 </constant> 9318 <constant id="JVMTI_TYPE_JTHREAD" num="110"> 9319 Java programming language object type - <code>java.lang.Thread</code>. 9320 <jvmti/> type <datalink id="jthread"></datalink>. 9321 Returned values are JNI local references and must be managed. 9322 </constant> 9323 <constant id="JVMTI_TYPE_JCLASS" num="111"> 9324 Java programming language object type - <code>java.lang.Class</code>. 9325 JNI type <datalink id="jclass"></datalink>. 9326 Returned values are JNI local references and must be managed. 9327 </constant> 9328 <constant id="JVMTI_TYPE_JVALUE" num="112"> 9329 Union of all Java programming language primitive and object types - 9330 JNI type <datalink id="jvalue"></datalink>. 9331 Returned values which represent object types are JNI local references and must be managed. 9332 </constant> 9333 <constant id="JVMTI_TYPE_JFIELDID" num="113"> 9334 Java programming language field identifier - 9335 JNI type <datalink id="jfieldID"></datalink>. 9336 </constant> 9337 <constant id="JVMTI_TYPE_JMETHODID" num="114"> 9338 Java programming language method identifier - 9339 JNI type <datalink id="jmethodID"></datalink>. 9340 </constant> 9341 <constant id="JVMTI_TYPE_CCHAR" num="115"> 9342 C programming language type - <code>char</code>. 9343 </constant> 9344 <constant id="JVMTI_TYPE_CVOID" num="116"> 9345 C programming language type - <code>void</code>. 9346 </constant> 9347 <constant id="JVMTI_TYPE_JNIENV" num="117"> 9348 JNI environment - <code>JNIEnv</code>. 9349 Should be used with the correct <datalink id="jvmtiParamKind"/> to make it a pointer type. 9350 </constant> 9351 </constants> 9352 9353 <constants id="jvmtiParamKind" label="Extension Function/Event Parameter Kinds" kind="enum"> 9354 <constant id="JVMTI_KIND_IN" num="91"> 9355 Ingoing argument - <code>foo</code>. 9356 </constant> 9357 <constant id="JVMTI_KIND_IN_PTR" num="92"> 9358 Ingoing pointer argument - <code>const foo*</code>. 9359 </constant> 9360 <constant id="JVMTI_KIND_IN_BUF" num="93"> 9361 Ingoing array argument - <code>const foo*</code>. 9362 </constant> 9363 <constant id="JVMTI_KIND_ALLOC_BUF" num="94"> 9364 Outgoing allocated array argument - <code>foo**</code>. 9365 Free with <code>Deallocate</code>. 9366 </constant> 9367 <constant id="JVMTI_KIND_ALLOC_ALLOC_BUF" num="95"> 9368 Outgoing allocated array of allocated arrays argument - <code>foo***</code>. 9369 Free with <code>Deallocate</code>. 9370 </constant> 9371 <constant id="JVMTI_KIND_OUT" num="96"> 9372 Outgoing argument - <code>foo*</code>. 9373 </constant> 9374 <constant id="JVMTI_KIND_OUT_BUF" num="97"> 9375 Outgoing array argument (pre-allocated by agent) - <code>foo*</code>. 9376 Do not <code>Deallocate</code>. 9377 </constant> 9378 </constants> 9379 9380 </intro> 9381 9382 <typedef id="jvmtiParamInfo" label="Extension Function/Event Parameter Info"> 9383 <field id="name"> 9384 <allocfieldbuf><char/></allocfieldbuf> 9385 <description> 9386 The parameter name, encoded as a 9387 <internallink id="mUTF">modified UTF-8</internallink> string 9388 </description> 9389 </field> 9390 <field id="kind"> 9391 <enum>jvmtiParamKind</enum> 9392 <description> 9393 The kind of the parameter - type modifiers 9394 </description> 9395 </field> 9396 <field id="base_type"> 9397 <enum>jvmtiParamTypes</enum> 9398 <description> 9399 The base type of the parameter - modified by <code>kind</code> 9400 </description> 9401 </field> 9402 <field id="null_ok"> 9403 <jboolean/> 9404 <description> 9405 Is a <code>NULL</code> argument permitted? Applies only to pointer and object types. 9406 </description> 9407 </field> 9408 </typedef> 9409 9410 <callback id="jvmtiExtensionFunction"> 9411 <enum>jvmtiError</enum> 9412 <synopsis>Extension Function</synopsis> 9413 <description> 9414 This is the implementation-specific extension function. 9415 </description> 9416 <parameters> 9417 <param id="jvmti_env"> 9418 <outptr> 9419 <struct>jvmtiEnv</struct> 9420 </outptr> 9421 <description> 9422 The <jvmti/> environment is the only fixed parameter for extension functions. 9423 </description> 9424 </param> 9425 <param id="..."> 9426 <varargs/> 9427 <description> 9428 The extension function-specific parameters 9429 </description> 9430 </param> 9431 </parameters> 9432 </callback> 9433 9434 <function id="GetExtensionFunctions" phase="onload" num="124"> 9435 <synopsis>Get Extension Functions</synopsis> 9436 9437 <typedef id="jvmtiExtensionFunctionInfo" label="Extension Function Info"> 9438 <field id="func"> 9439 <ptrtype> 9440 <struct>jvmtiExtensionFunction</struct> 9441 </ptrtype> 9442 <description> 9443 The actual function to call 9444 </description> 9445 </field> 9446 <field id="id"> 9447 <allocfieldbuf><char/></allocfieldbuf> 9448 <description> 9449 The identifier for the extension function, encoded as a 9450 <internallink id="mUTF">modified UTF-8</internallink> string. 9451 Uses package name conventions. 9452 For example, <code>com.sun.hotspot.bar</code> 9453 </description> 9454 </field> 9455 <field id="short_description"> 9456 <allocfieldbuf><char/></allocfieldbuf> 9457 <description> 9458 A one sentence description of the function, encoded as a 9459 <internallink id="mUTF">modified UTF-8</internallink> string. 9460 </description> 9461 </field> 9462 <field id="param_count"> 9463 <jint/> 9464 <description> 9465 The number of parameters excluding <code>jvmtiEnv *jvmti_env</code> 9466 </description> 9467 </field> 9468 <field id="params"> 9469 <allocfieldbuf outcount="param_count"> 9470 <struct>jvmtiParamInfo</struct> 9471 </allocfieldbuf> 9472 <description> 9473 Array of 9474 <fieldlink id="param_count" struct="jvmtiExtensionFunctionInfo"></fieldlink> 9475 parameters (<code>jvmtiEnv *jvmti_env</code> excluded) 9476 </description> 9477 </field> 9478 <field id="error_count"> 9479 <jint/> 9480 <description> 9481 The number of possible error returns (excluding universal errors) 9482 </description> 9483 </field> 9484 <field id="errors"> 9485 <allocfieldbuf outcount="error_count"> 9486 <enum>jvmtiError</enum> 9487 </allocfieldbuf> 9488 <description> 9489 Array of <fieldlink id="error_count" struct="jvmtiExtensionFunctionInfo"></fieldlink> 9490 possible errors 9491 </description> 9492 </field> 9493 </typedef> 9494 9495 <description> 9496 Returns the set of extension functions. 9497 </description> 9498 <origin>new</origin> 9499 <capabilities> 9500 </capabilities> 9501 <parameters> 9502 <param id="extension_count_ptr"> 9503 <outptr><jint/></outptr> 9504 <description> 9505 On return, points to the number of extension functions 9506 </description> 9507 </param> 9508 <param id="extensions"> 9509 <allocbuf outcount="extension_count_ptr"><struct>jvmtiExtensionFunctionInfo</struct></allocbuf> 9510 <description> 9511 Returns an array of extension function info, one per function 9512 </description> 9513 </param> 9514 </parameters> 9515 <errors> 9516 </errors> 9517 </function> 9518 9519 <function id="GetExtensionEvents" phase="onload" num="125"> 9520 <synopsis>Get Extension Events</synopsis> 9521 9522 <typedef id="jvmtiExtensionEventInfo" label="Extension Event Info"> 9523 <field id="extension_event_index"> 9524 <jint/> 9525 <description> 9526 The identifying index of the event 9527 </description> 9528 </field> 9529 <field id="id"> 9530 <allocfieldbuf><char/></allocfieldbuf> 9531 <description> 9532 The identifier for the extension event, encoded as a 9533 <internallink id="mUTF">modified UTF-8</internallink> string. 9534 Uses package name conventions. 9535 For example, <code>com.sun.hotspot.bar</code> 9536 </description> 9537 </field> 9538 <field id="short_description"> 9539 <allocfieldbuf><char/></allocfieldbuf> 9540 <description> 9541 A one sentence description of the event, encoded as a 9542 <internallink id="mUTF">modified UTF-8</internallink> string. 9543 </description> 9544 </field> 9545 <field id="param_count"> 9546 <jint/> 9547 <description> 9548 The number of parameters excluding <code>jvmtiEnv *jvmti_env</code> 9549 </description> 9550 </field> 9551 <field id="params"> 9552 <allocfieldbuf outcount="param_count"> 9553 <struct>jvmtiParamInfo</struct> 9554 </allocfieldbuf> 9555 <description> 9556 Array of 9557 <fieldlink id="param_count" struct="jvmtiExtensionEventInfo"></fieldlink> 9558 parameters (<code>jvmtiEnv *jvmti_env</code> excluded) 9559 </description> 9560 </field> 9561 </typedef> 9562 9563 <description> 9564 Returns the set of extension events. 9565 </description> 9566 <origin>new</origin> 9567 <capabilities> 9568 </capabilities> 9569 <parameters> 9570 <param id="extension_count_ptr"> 9571 <outptr><jint/></outptr> 9572 <description> 9573 On return, points to the number of extension events 9574 </description> 9575 </param> 9576 <param id="extensions"> 9577 <allocbuf outcount="extension_count_ptr"><struct>jvmtiExtensionEventInfo</struct></allocbuf> 9578 <description> 9579 Returns an array of extension event info, one per event 9580 </description> 9581 </param> 9582 </parameters> 9583 <errors> 9584 </errors> 9585 </function> 9586 9587 <callback id="jvmtiExtensionEvent"> 9588 <void/> 9589 <synopsis>Extension Event</synopsis> 9590 <description> 9591 This is the implementation-specific event. 9592 The event handler is set with 9593 <functionlink id="SetExtensionEventCallback"/>. 9594 <p/> 9595 Event handlers for extension events must be declared varargs to match this definition. 9596 Failure to do so could result in calling convention mismatch and undefined behavior 9597 on some platforms. 9598 <p/> 9599 For example, if the <code>jvmtiParamInfo</code> 9600 returned by <functionlink id="GetExtensionEvents"/> indicates that 9601 there is a <code>jint</code> parameter, the event handler should be 9602 declared: 9603 <example> 9604 void JNICALL myHandler(jvmtiEnv* jvmti_env, jint myInt, ...) 9605 </example> 9606 Note the terminal "<code>...</code>" which indicates varargs. 9607 </description> 9608 <parameters> 9609 <param id="jvmti_env"> 9610 <outptr> 9611 <struct>jvmtiEnv</struct> 9612 </outptr> 9613 <description> 9614 The <jvmti/> environment is the only fixed parameter for extension events. 9615 </description> 9616 </param> 9617 <param id="..."> 9618 <varargs/> 9619 <description> 9620 The extension event-specific parameters 9621 </description> 9622 </param> 9623 </parameters> 9624 </callback> 9625 9626 <function id="SetExtensionEventCallback" phase="onload" num="126"> 9627 <synopsis>Set Extension Event Callback</synopsis> 9628 9629 <description> 9630 Sets the callback function for an extension event and 9631 enables the event. Or, if the callback is <code>NULL</code>, disables 9632 the event. Note that unlike standard events, setting 9633 the callback and enabling the event are a single operation. 9634 </description> 9635 <origin>new</origin> 9636 <capabilities> 9637 </capabilities> 9638 <parameters> 9639 <param id="extension_event_index"> 9640 <jint/> 9641 <description> 9642 Identifies which callback to set. 9643 This index is the 9644 <fieldlink id="extension_event_index" struct="jvmtiExtensionEventInfo"></fieldlink> 9645 field of 9646 <datalink id="jvmtiExtensionEventInfo"/>. 9647 </description> 9648 </param> 9649 <param id="callback"> 9650 <ptrtype> 9651 <struct>jvmtiExtensionEvent</struct> 9652 <nullok>disable the event</nullok> 9653 </ptrtype> 9654 <description> 9655 If <code>callback</code> is non-<code>NULL</code>, 9656 set <code>callback</code> to be the event callback function 9657 and enable the event. 9658 </description> 9659 </param> 9660 </parameters> 9661 <errors> 9662 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 9663 <paramlink id="extension_event_index"/> is not an 9664 <fieldlink id="extension_event_index" 9665 struct="jvmtiExtensionEventInfo"/> 9666 returned by 9667 <functionlink id="GetExtensionEvents"/> 9668 </error> 9669 </errors> 9670 </function> 9671 9672 </category> 9673 9674 <category id="capability" label="Capability"> 9675 9676 <intro> 9677 The capabilities functions allow you to change the 9678 functionality available to <jvmti/>--that is, 9679 which <jvmti/> 9680 functions can be called, what events can be generated, 9681 and what functionality these events and functions can 9682 provide. 9683 <p/> 9684 The "Capabilities" section of each function and event describe which 9685 capabilities, if any, they are associated with. "Required Functionality" 9686 means it is available for use and no capabilities must be added to use it. 9687 "Optional Functionality" means the agent must possess the capability 9688 before it can be used. 9689 To possess a capability, the agent must 9690 <functionlink id="AddCapabilities">add the capability</functionlink>. 9691 "Optional Features" describe capabilities which, 9692 if added, extend the feature set. 9693 <p/> 9694 The potentially available capabilities of each <jvmti/> implementation are different. 9695 Depending on the implementation, a capability: 9696 <ul> 9697 <li>may never be added</li> 9698 <li>may be added in either the <code>OnLoad</code> or live phase in any environment</li> 9699 <li>may be added only during the <code>OnLoad</code> phase</li> 9700 <li>may be possessed by only one environment at a time</li> 9701 <li>may be possessed by only one environment at a time, 9702 and only during the <code>OnLoad</code> phase</li> 9703 <li>and so on ...</li> 9704 </ul> 9705 Frequently, the addition of a capability may incur a cost in execution speed, start up 9706 time, and/or memory footprint. Note that the overhead of using a capability 9707 is completely different than the overhead of possessing a capability. 9708 Take single stepping as an example. When single stepping is on (that 9709 is, when the event is enabled and thus actively sending events) 9710 the overhead of sending and processing an event 9711 on each instruction is huge in any implementation. 9712 However, the overhead of possessing the capability may be small or large, 9713 depending on the implementation. Also, when and if a capability is potentially 9714 available depends on the implementation. Some examples: 9715 <ul> 9716 <li>One VM might perform all execution by compiling bytecodes into 9717 native code and be unable to generate single step instructions. 9718 In this implementation the capability can not be added.</li> 9719 <li>Another VM may be able to switch execution to a single stepping 9720 interpreter at any time. In this implementation, having the capability has no 9721 overhead and could be added at any time.</li> 9722 <li>Yet another VM might be able to choose a bytecode compiling or single stepping capable interpreted 9723 execution engine at start up, but be unable to switch between them. 9724 In this implementation the capability would need to be added 9725 during the <code>OnLoad</code> phase (before bytecode 9726 execution begins) and would have a large impact on execution speed 9727 even if single stepping was never used.</li> 9728 <li>Still another VM might be able to add an "is single stepping on" check 9729 into compiled bytecodes or a generated interpreter. Again in this implementation 9730 the capability would need to be added during the <code>OnLoad</code> phase but the overhead (a test 9731 and branch on each instruction) would be considerably less.</li> 9732 </ul> 9733 <p/> 9734 Each <jvmti/> <internallink id="environments">environment</internallink> 9735 has its own set of capabilities. 9736 Initially, that set is empty. 9737 Any desired capability must be added. 9738 If possible, capabilities should be added during the <code>OnLoad</code> phase. For most 9739 virtual machines certain capabilities require special set up for 9740 the virtual machine and this set up must happen 9741 during the <code>OnLoad</code> phase, before the virtual machine begins execution. 9742 Once a capability is added, it can 9743 only be removed if explicitly relinquished by the environment. 9744 <p/> 9745 The agent can, 9746 <functionlink id="GetPotentialCapabilities">determine what 9747 capabilities this VM can potentially provide</functionlink>, 9748 <functionlink id="AddCapabilities">add the capabilities 9749 to be used</functionlink>, 9750 <functionlink id="RelinquishCapabilities">release capabilities 9751 which are no longer needed</functionlink>, and 9752 <functionlink id="GetCapabilities">examine the currently available 9753 capabilities</functionlink>. 9754 </intro> 9755 9756 <intro id="capabilityExamples" label="Capability Examples"> 9757 For example, a freshly started agent (in the <code>OnLoad</code> function) 9758 wants to enable all possible capabilities. 9759 Note that, in general, this is not advisable as the agent may suffer 9760 a performance penalty for functionality it is not using. 9761 The code might look like this in C: 9762 <example> 9763 jvmtiCapabilities capa; 9764 jvmtiError err; 9765 9766 err = (*jvmti)->GetPotentialCapabilities(jvmti, &capa); 9767 if (err == JVMTI_ERROR_NONE) { 9768 err = (*jvmti)->AddCapabilities(jvmti, &capa); 9769 </example> 9770 For example, if an agent wants to check if it can get 9771 the bytecodes of a method (that is, it wants to check 9772 if it previously added this capability and has not 9773 relinquished it), the code might 9774 look like this in C: 9775 <example> 9776 jvmtiCapabilities capa; 9777 jvmtiError err; 9778 9779 err = (*jvmti)->GetCapabilities(jvmti, &capa); 9780 if (err == JVMTI_ERROR_NONE) { 9781 if (capa.can_get_bytecodes) { ... } } 9782 </example> 9783 </intro> 9784 9785 <capabilitiestypedef id="jvmtiCapabilities" label="The Capabilities Structure"> 9786 <description> 9787 The functions in this category use this capabilities structure 9788 which contains boolean flags corresponding to each capability: 9789 </description> 9790 <capabilityfield id="can_tag_objects"> 9791 <description> 9792 Can set and get tags, as described in the 9793 <internallink id="Heap">Heap category</internallink>. 9794 </description> 9795 </capabilityfield> 9796 <capabilityfield id="can_generate_field_modification_events"> 9797 <description> 9798 Can set watchpoints on field modification - 9799 <functionlink id="SetFieldModificationWatch"></functionlink> 9800 </description> 9801 </capabilityfield> 9802 <capabilityfield id="can_generate_field_access_events"> 9803 <description> 9804 Can set watchpoints on field access - 9805 <functionlink id="SetFieldAccessWatch"></functionlink> 9806 </description> 9807 </capabilityfield> 9808 <capabilityfield id="can_get_bytecodes"> 9809 <description> 9810 Can get bytecodes of a method <functionlink id="GetBytecodes"></functionlink> 9811 </description> 9812 </capabilityfield> 9813 <capabilityfield id="can_get_synthetic_attribute"> 9814 <description> 9815 Can test if a field or method is synthetic - 9816 <functionlink id="IsFieldSynthetic"></functionlink> and 9817 <functionlink id="IsMethodSynthetic"></functionlink> 9818 </description> 9819 </capabilityfield> 9820 <capabilityfield id="can_get_owned_monitor_info"> 9821 <description> 9822 Can get information about ownership of monitors - 9823 <functionlink id="GetOwnedMonitorInfo"></functionlink> 9824 </description> 9825 </capabilityfield> 9826 <capabilityfield id="can_get_current_contended_monitor"> 9827 <description> 9828 Can <functionlink id="GetCurrentContendedMonitor"></functionlink> 9829 </description> 9830 </capabilityfield> 9831 <capabilityfield id="can_get_monitor_info"> 9832 <description> 9833 Can <functionlink id="GetObjectMonitorUsage"></functionlink> 9834 </description> 9835 </capabilityfield> 9836 <capabilityfield id="can_pop_frame"> 9837 <description> 9838 Can pop frames off the stack - <functionlink id="PopFrame"></functionlink> 9839 </description> 9840 </capabilityfield> 9841 <capabilityfield id="can_redefine_classes"> 9842 <description> 9843 Can redefine classes with <functionlink id="RedefineClasses"/>. 9844 </description> 9845 </capabilityfield> 9846 <capabilityfield id="can_signal_thread"> 9847 <description> 9848 Can send stop or interrupt to threads 9849 </description> 9850 </capabilityfield> 9851 <capabilityfield id="can_get_source_file_name"> 9852 <description> 9853 Can get the source file name of a class 9854 </description> 9855 </capabilityfield> 9856 <capabilityfield id="can_get_line_numbers"> 9857 <description> 9858 Can get the line number table of a method 9859 </description> 9860 </capabilityfield> 9861 <capabilityfield id="can_get_source_debug_extension"> 9862 <description> 9863 Can get the source debug extension of a class 9864 </description> 9865 </capabilityfield> 9866 <capabilityfield id="can_access_local_variables"> 9867 <description> 9868 Can set and get local variables 9869 </description> 9870 </capabilityfield> 9871 <capabilityfield id="can_maintain_original_method_order"> 9872 <description> 9873 Can return methods in the order they occur in the class file 9874 </description> 9875 </capabilityfield> 9876 <capabilityfield id="can_generate_single_step_events"> 9877 <description> 9878 Can get <eventlink id="SingleStep">single step</eventlink> events 9879 </description> 9880 </capabilityfield> 9881 <capabilityfield id="can_generate_exception_events"> 9882 <description> 9883 Can get <eventlink id="Exception">exception thrown</eventlink> and 9884 <eventlink id="ExceptionCatch">exception catch</eventlink> events 9885 </description> 9886 </capabilityfield> 9887 <capabilityfield id="can_generate_frame_pop_events"> 9888 <description> 9889 Can <functionlink id="NotifyFramePop">set</functionlink> and thus get 9890 <eventlink id="FramePop"></eventlink> events 9891 </description> 9892 </capabilityfield> 9893 <capabilityfield id="can_generate_breakpoint_events"> 9894 <description> 9895 Can <functionlink id="SetBreakpoint">set</functionlink> and thus get 9896 <eventlink id="Breakpoint"></eventlink> events 9897 </description> 9898 </capabilityfield> 9899 <capabilityfield id="can_suspend"> 9900 <description> 9901 Can suspend and resume threads 9902 </description> 9903 </capabilityfield> 9904 <capabilityfield id="can_redefine_any_class"> 9905 <description> 9906 Can modify (retransform or redefine) any modifiable class. 9907 See <functionlink id="IsModifiableClass"/>. 9908 </description> 9909 </capabilityfield> 9910 <capabilityfield id="can_get_current_thread_cpu_time"> 9911 <description> 9912 Can <functionlink id="GetCurrentThreadCpuTime">get</functionlink> 9913 current thread CPU time 9914 </description> 9915 </capabilityfield> 9916 <capabilityfield id="can_get_thread_cpu_time"> 9917 <description> 9918 Can <functionlink id="GetThreadCpuTime">get</functionlink> 9919 thread CPU time 9920 </description> 9921 </capabilityfield> 9922 <capabilityfield id="can_generate_method_entry_events" 9923 disp1="can_generate" disp2="_method_entry_events" 9924 > 9925 <description> 9926 Can generate method entry events on entering a method 9927 </description> 9928 </capabilityfield> 9929 <capabilityfield id="can_generate_method_exit_events" 9930 disp1="can_generate" disp2="_method_exit_events" 9931 > 9932 <description> 9933 Can generate method exit events on leaving a method 9934 </description> 9935 </capabilityfield> 9936 <capabilityfield id="can_generate_all_class_hook_events" 9937 disp1="can_generate" disp2="_all_class_hook_events" 9938 > 9939 <description> 9940 Can generate ClassFileLoadHook events for every loaded class. 9941 </description> 9942 </capabilityfield> 9943 <capabilityfield id="can_generate_compiled_method_load_events" 9944 disp1="can_generate" disp2="_compiled_method_load_events" 9945 > 9946 <description> 9947 Can generate events when a method is compiled or unloaded 9948 </description> 9949 </capabilityfield> 9950 <capabilityfield id="can_generate_monitor_events" 9951 disp1="can_generate" disp2="_monitor_events" 9952 > 9953 <description> 9954 Can generate events on monitor activity 9955 </description> 9956 </capabilityfield> 9957 <capabilityfield id="can_generate_vm_object_alloc_events" 9958 disp1="can_generate" disp2="_vm_object_alloc_events" 9959 > 9960 <description> 9961 Can generate events on VM allocation of an object 9962 </description> 9963 </capabilityfield> 9964 <capabilityfield id="can_generate_native_method_bind_events" 9965 disp1="can_generate" disp2="_native_method_bind_events" 9966 > 9967 <description> 9968 Can generate events when a native method is bound to its 9969 implementation 9970 </description> 9971 </capabilityfield> 9972 <capabilityfield id="can_generate_garbage_collection_events" 9973 disp1="can_generate" disp2="_garbage_collection_events" 9974 > 9975 <description> 9976 Can generate events when garbage collection begins or ends 9977 </description> 9978 </capabilityfield> 9979 <capabilityfield id="can_generate_object_free_events" 9980 disp1="can_generate" disp2="_object_free_events" 9981 > 9982 <description> 9983 Can generate events when the garbage collector frees an object 9984 </description> 9985 </capabilityfield> 9986 <capabilityfield id="can_force_early_return" since="1.1"> 9987 <description> 9988 Can return early from a method, as described in the 9989 <internallink id="ForceEarlyReturn">Force Early Return category</internallink>. 9990 </description> 9991 </capabilityfield> 9992 <capabilityfield id="can_get_owned_monitor_stack_depth_info" since="1.1"> 9993 <description> 9994 Can get information about owned monitors with stack depth - 9995 <functionlink id="GetOwnedMonitorStackDepthInfo"></functionlink> 9996 </description> 9997 </capabilityfield> 9998 <capabilityfield id="can_get_constant_pool" since="1.1"> 9999 <description> 10000 Can get the constant pool of a class - 10001 <functionlink id="GetConstantPool"></functionlink> 10002 </description> 10003 </capabilityfield> 10004 <capabilityfield id="can_set_native_method_prefix" since="1.1"> 10005 <description> 10006 Can set prefix to be applied when native method cannot be resolved - 10007 <functionlink id="SetNativeMethodPrefix"/> and 10008 <functionlink id="SetNativeMethodPrefixes"/> 10009 </description> 10010 </capabilityfield> 10011 <capabilityfield id="can_retransform_classes" since="1.1"> 10012 <description> 10013 Can retransform classes with <functionlink id="RetransformClasses"/>. 10014 In addition to the restrictions imposed by the specific 10015 implementation on this capability (see the 10016 <internallink id="capability">Capability</internallink> section), 10017 this capability must be set before the 10018 <eventlink id="ClassFileLoadHook"/> event is enabled for the 10019 first time in this environment. 10020 An environment that possesses this capability at the time that 10021 <code>ClassFileLoadHook</code> is enabled for the first time is 10022 said to be <i>retransformation capable</i>. 10023 An environment that does not possess this capability at the time that 10024 <code>ClassFileLoadHook</code> is enabled for the first time is 10025 said to be <i>retransformation incapable</i>. 10026 </description> 10027 </capabilityfield> 10028 <capabilityfield id="can_retransform_any_class" since="1.1"> 10029 <description> 10030 <functionlink id="RetransformClasses"/> can be called on any modifiable class. 10031 See <functionlink id="IsModifiableClass"/>. 10032 (<fieldlink id="can_retransform_classes" struct="jvmtiCapabilities"/> 10033 must also be set) 10034 </description> 10035 </capabilityfield> 10036 <capabilityfield id="can_generate_resource_exhaustion_heap_events" since="1.1"> 10037 <description> 10038 Can generate events when the VM is unable to allocate memory from 10039 the <tm>Java</tm> platform heap. 10040 See <eventlink id="ResourceExhausted"/>. 10041 </description> 10042 </capabilityfield> 10043 <capabilityfield id="can_generate_resource_exhaustion_threads_events" since="1.1"> 10044 <description> 10045 Can generate events when the VM is unable to create a thread. 10046 See <eventlink id="ResourceExhausted"/>. 10047 </description> 10048 </capabilityfield> 10049 <capabilityfield id="can_generate_early_vmstart" since="9"> 10050 <description> 10051 Can generate the <code>VMStart</code> event early. 10052 See <eventlink id="VMStart"/>. 10053 </description> 10054 </capabilityfield> 10055 <capabilityfield id="can_generate_early_class_hook_events" since="9"> 10056 <description> 10057 Can generate the <eventlink id="ClassFileLoadHook"/> events 10058 in the primordial phase. If this capability and 10059 <internallink id="jvmtiCapabilities.can_generate_all_class_hook_events"> 10060 <code>can_generate_all_class_hook_events</code></internallink> 10061 are enabled then the <eventlink id="ClassFileLoadHook"/> events 10062 can be posted for classes loaded in the primordial phase. 10063 See <eventlink id="ClassFileLoadHook"/>. 10064 </description> 10065 </capabilityfield> 10066 </capabilitiestypedef> 10067 10068 <function id="GetPotentialCapabilities" jkernel="yes" phase="onload" num="140"> 10069 <synopsis>Get Potential Capabilities</synopsis> 10070 <description> 10071 Returns via <paramlink id="capabilities_ptr"></paramlink> the <jvmti/> 10072 features that can potentially be possessed by this environment 10073 at this time. 10074 The returned capabilities differ from the complete set of capabilities 10075 implemented by the VM in two cases: another environment possesses 10076 capabilities that can only be possessed by one environment, or the 10077 current <functionlink id="GetPhase">phase</functionlink> is live, 10078 and certain capabilities can only be added during the <code>OnLoad</code> phase. 10079 The <functionlink id="AddCapabilities"></functionlink> function 10080 may be used to set any or all or these capabilities. 10081 Currently possessed capabilities are included. 10082 <p/> 10083 Typically this function is used in the <code>OnLoad</code> function. 10084 Some virtual machines may allow a limited set of capabilities to be 10085 added in the live phase. 10086 In this case, the set of potentially available capabilities 10087 will likely differ from the <code>OnLoad</code> phase set. 10088 <p/> 10089 See the 10090 <internallink id="capabilityExamples">Capability Examples</internallink>. 10091 </description> 10092 <origin>new</origin> 10093 <capabilities> 10094 </capabilities> 10095 <parameters> 10096 <param id="capabilities_ptr"> 10097 <outptr><struct>jvmtiCapabilities</struct></outptr> 10098 <description> 10099 On return, points to the <jvmti/> capabilities that may be added. 10100 </description> 10101 </param> 10102 </parameters> 10103 <errors> 10104 </errors> 10105 </function> 10106 10107 <elide> 10108 <function id="EstimateCostOfCapabilities" phase="onload" num="141"> 10109 <synopsis>Estimate Cost Of Capabilities</synopsis> 10110 <description> 10111 <issue>There is strong opposition to this function. The concern is 10112 that it would be difficult or impossible to provide meaningful 10113 numbers, as the amount of impact is conditional on many factors 10114 that a single number could not represent. There is doubt that 10115 conditional implementations would be used or are even a good idea. 10116 The thought is that release documentation for the implementation 10117 would be the best means of exposing this information. 10118 Unless new arguments are presented, I intend to remove this 10119 function in the next revision. 10120 </issue> 10121 <p/> 10122 Return via the <paramlink id="time_impact_ptr"></paramlink> and 10123 <paramlink id="space_impact_ptr"></paramlink> an estimate of the impact 10124 of adding the capabilities pointed to by 10125 <paramlink id="capabilities_ptr"></paramlink>. 10126 The returned estimates are in percentage of additional overhead, thus 10127 a time impact of 100 mean the application might run 10128 at half the speed. 10129 The estimates are very rough approximations and are not guaranteed. 10130 Note also, that the estimates are of the impact of having the 10131 capability available--when and if it is used the impact may be 10132 much greater. 10133 Estimates can be for a single capability or for a set of 10134 capabilities. Note that the costs are not necessarily additive, 10135 adding support for one capability might make another available 10136 for free or conversely having two capabilities at once may 10137 have multiplicative impact. 10138 Estimates are relative to the current set of capabilities - 10139 that is, how much more impact given the currently possessed capabilities. 10140 <p/> 10141 Typically this function is used in the OnLoad function, 10142 some virtual machines may allow a limited set of capabilities to be 10143 added in the live phase. 10144 In this case, the set of potentially available capabilities 10145 will likely differ from the OnLoad phase set. 10146 <p/> 10147 See the 10148 <internallink id="capabilityExamples">Capability Examples</internallink>. 10149 </description> 10150 <origin>new</origin> 10151 <capabilities> 10152 </capabilities> 10153 <parameters> 10154 <param id="capabilities_ptr"> 10155 <inptr><struct>jvmtiCapabilities</struct></inptr> 10156 <description> 10157 points to the <jvmti/> capabilities to evaluate. 10158 </description> 10159 </param> 10160 <param id="time_impact_ptr"> 10161 <outptr><jint/></outptr> 10162 <description> 10163 On return, points to the estimated percentage increase in 10164 run time if this capability was added. 10165 </description> 10166 </param> 10167 <param id="space_impact_ptr"> 10168 <outptr><jint/></outptr> 10169 <description> 10170 On return, points to the estimated percentage increase in 10171 memory space used if this capability was added. 10172 </description> 10173 </param> 10174 </parameters> 10175 <errors> 10176 <error id="JVMTI_ERROR_NOT_AVAILABLE"> 10177 The desired capabilities are not even potentially available. 10178 </error> 10179 </errors> 10180 </function> 10181 </elide> 10182 10183 <function id="AddCapabilities" jkernel="yes" phase="onload" num="142"> 10184 <synopsis>Add Capabilities</synopsis> 10185 <description> 10186 Set new capabilities by adding the capabilities 10187 whose values are set to one (<code>1</code>) in 10188 <code>*</code><paramlink id="capabilities_ptr"></paramlink>. 10189 All previous capabilities are retained. 10190 Typically this function is used in the <code>OnLoad</code> function. 10191 Some virtual machines may allow a limited set of capabilities to be 10192 added in the live phase. 10193 <p/> 10194 See the 10195 <internallink id="capabilityExamples">Capability Examples</internallink>. 10196 </description> 10197 <origin>new</origin> 10198 <capabilities> 10199 </capabilities> 10200 <parameters> 10201 <param id="capabilities_ptr"> 10202 <inptr><struct>jvmtiCapabilities</struct></inptr> 10203 <description> 10204 Points to the <jvmti/> capabilities to add. 10205 </description> 10206 </param> 10207 </parameters> 10208 <errors> 10209 <error id="JVMTI_ERROR_NOT_AVAILABLE"> 10210 The desired capabilities are not even potentially available. 10211 </error> 10212 </errors> 10213 </function> 10214 10215 10216 <function id="RelinquishCapabilities" phase="onload" num="143"> 10217 <synopsis>Relinquish Capabilities</synopsis> 10218 <description> 10219 Relinquish the capabilities 10220 whose values are set to one (<code>1</code>) in 10221 <code>*</code><paramlink id="capabilities_ptr"></paramlink>. 10222 Some implementations may allow only one environment to have a capability 10223 (see the <internallink id="capability">capability introduction</internallink>). 10224 This function releases capabilities 10225 so that they may be used by other agents. 10226 All other capabilities are retained. 10227 The capability will no longer be present in <functionlink id="GetCapabilities"></functionlink>. 10228 Attempting to relinquish a capability that the agent does not possess is not an error. 10229 <issue> 10230 It is possible for the agent to be actively using capabilities 10231 which are being relinquished. For example, a thread is currently 10232 suspended and can_suspend is being relinquished or an event is currently 10233 enabled and can_generate_whatever is being relinquished. 10234 There are three possible ways we could spec this: 10235 <ul> 10236 <li>relinquish automatically releases them</li> 10237 <li>relinquish checks and returns some error code if held</li> 10238 <li>it is the agent's responsibility and it is not checked</li> 10239 </ul> 10240 One of these should be chosen. 10241 </issue> 10242 </description> 10243 <origin>new</origin> 10244 <capabilities> 10245 </capabilities> 10246 <parameters> 10247 <param id="capabilities_ptr"> 10248 <inptr><struct>jvmtiCapabilities</struct></inptr> 10249 <description> 10250 Points to the <jvmti/> capabilities to relinquish. 10251 </description> 10252 </param> 10253 </parameters> 10254 <errors> 10255 </errors> 10256 </function> 10257 10258 10259 10260 <function id="GetCapabilities" jkernel="yes" phase="any" num="89"> 10261 <synopsis>Get Capabilities</synopsis> 10262 <description> 10263 Returns via <paramlink id="capabilities_ptr"></paramlink> the optional <jvmti/> 10264 features which this environment currently possesses. 10265 Each possessed capability is indicated by a one (<code>1</code>) in the 10266 corresponding field of the <internallink id="jvmtiCapabilities">capabilities 10267 structure</internallink>. 10268 An environment does not possess a capability unless it has been successfully added with 10269 <functionlink id="AddCapabilities"/>. 10270 An environment only loses possession of a capability if it has been relinquished with 10271 <functionlink id="RelinquishCapabilities"/>. Thus, this function returns the net result 10272 of the <code>AddCapabilities</code> and <code>RelinquishCapabilities</code> calls which 10273 have been made. 10274 <p/> 10275 See the 10276 <internallink id="capabilityExamples">Capability Examples</internallink>. 10277 </description> 10278 <origin>jvmdiClone</origin> 10279 <capabilities> 10280 </capabilities> 10281 <parameters> 10282 <param id="capabilities_ptr"> 10283 <outptr><struct>jvmtiCapabilities</struct></outptr> 10284 <description> 10285 On return, points to the <jvmti/> capabilities. 10286 </description> 10287 </param> 10288 </parameters> 10289 <errors> 10290 </errors> 10291 </function> 10292 10293 </category> 10294 10295 10296 <category id="timers" label="Timers"> 10297 10298 <intro> 10299 These functions provide timing information. 10300 The resolution at which the time is updated is not specified. 10301 They provides nanosecond precision, but not necessarily nanosecond accuracy. 10302 Details about the timers, such as their maximum values, can be accessed with 10303 the timer information functions. 10304 </intro> 10305 10306 <typedef id="jvmtiTimerInfo" label="Timer Info"> 10307 <description> 10308 The information function for each timer returns this data structure. 10309 </description> 10310 <field id="max_value"> 10311 <jlong/> 10312 <description> 10313 The maximum value the timer can reach. 10314 After this value is reached the timer wraps back to zero. 10315 This is an unsigned value. If tested or printed as a jlong (signed value) 10316 it may appear to be a negative number. 10317 </description> 10318 </field> 10319 <field id="may_skip_forward"> 10320 <jboolean/> 10321 <description> 10322 If true, the timer can be externally adjusted and as a result skip forward. 10323 If false, the timer value will never increase faster than real time. 10324 </description> 10325 </field> 10326 <field id="may_skip_backward"> 10327 <jboolean/> 10328 <description> 10329 If true, the timer can be externally adjusted and as a result skip backward. 10330 If false, the timer value will be monotonically increasing. 10331 </description> 10332 </field> 10333 <field id="kind"> 10334 <enum>jvmtiTimerKind</enum> 10335 <description> 10336 The kind of timer. 10337 On a platform that does not distinguish between user and system time, <datalink 10338 id="JVMTI_TIMER_TOTAL_CPU"><code>JVMTI_TIMER_TOTAL_CPU</code></datalink> 10339 is returned. 10340 </description> 10341 </field> 10342 <field id="reserved1"> 10343 <jlong/> 10344 <description> 10345 Reserved for future use. 10346 </description> 10347 </field> 10348 <field id="reserved2"> 10349 <jlong/> 10350 <description> 10351 Reserved for future use. 10352 </description> 10353 </field> 10354 </typedef> 10355 10356 <intro> 10357 Where the timer kind is -- 10358 10359 <constants id="jvmtiTimerKind" label="Timer Kinds" kind="enum"> 10360 <constant id="JVMTI_TIMER_USER_CPU" num="30"> 10361 CPU time that a thread is in user mode. 10362 </constant> 10363 <constant id="JVMTI_TIMER_TOTAL_CPU" num="31"> 10364 CPU time that a thread is in user or system mode. 10365 </constant> 10366 <constant id="JVMTI_TIMER_ELAPSED" num="32"> 10367 Elapsed time. 10368 </constant> 10369 </constants> 10370 </intro> 10371 10372 <function id="GetCurrentThreadCpuTimerInfo" callbacksafe="safe" impl="innative notrace" phase="start" num="134"> 10373 <synopsis>Get Current Thread CPU Timer Information</synopsis> 10374 <description> 10375 Get information about the 10376 <functionlink id="GetCurrentThreadCpuTime"/> timer. 10377 The fields of the <datalink id="jvmtiTimerInfo"/> structure 10378 are filled in with details about the timer. 10379 This information is specific to the platform and the implementation of 10380 <functionlink id="GetCurrentThreadCpuTime"/> and thus 10381 does not vary by thread nor does it vary 10382 during a particular invocation of the VM. 10383 <p/> 10384 Note that the implementations of <functionlink id="GetCurrentThreadCpuTime"/> 10385 and <functionlink id="GetThreadCpuTime"/> may differ, and thus the values 10386 returned by <code>GetCurrentThreadCpuTimerInfo</code> 10387 and <functionlink id="GetThreadCpuTimerInfo"/> 10388 may differ -- see <functionlink id="GetCurrentThreadCpuTime"/> for more information. 10389 </description> 10390 <origin>new</origin> 10391 <capabilities> 10392 <required id="can_get_current_thread_cpu_time"> 10393 Can get current thread CPU time. 10394 </required> 10395 </capabilities> 10396 <parameters> 10397 <param id="info_ptr"> 10398 <outptr><struct>jvmtiTimerInfo</struct></outptr> 10399 <description> 10400 On return, filled with information describing the time 10401 returned by <functionlink id="GetCurrentThreadCpuTime"/>. 10402 </description> 10403 </param> 10404 </parameters> 10405 <errors> 10406 </errors> 10407 </function> 10408 10409 <function id="GetCurrentThreadCpuTime" callbacksafe="safe" impl="innative notrace" phase="start" num="135"> 10410 <synopsis>Get Current Thread CPU Time</synopsis> 10411 <description> 10412 Return the CPU time utilized by the current thread. 10413 <p/> 10414 Note that the <functionlink id="GetThreadCpuTime"/> 10415 function provides CPU time for any thread, including 10416 the current thread. <code>GetCurrentThreadCpuTime</code> 10417 exists to support platforms which cannot 10418 supply CPU time for threads other than the current 10419 thread or which have more accurate information for 10420 the current thread (see 10421 <functionlink id="GetCurrentThreadCpuTimerInfo"/> vs 10422 <functionlink id="GetThreadCpuTimerInfo"/>). 10423 On many platforms this call will be equivalent to: 10424 <example> 10425 GetThreadCpuTime(env, NULL, nanos_ptr) 10426 </example> 10427 </description> 10428 <origin>new</origin> 10429 <capabilities> 10430 <required id="can_get_current_thread_cpu_time"> 10431 Can get current thread CPU time. 10432 <p/> 10433 If this capability is enabled after threads have started, 10434 the implementation may choose any time up 10435 to and including the time that the capability is enabled 10436 as the point where CPU time collection starts. 10437 <p/> 10438 This capability must be potentially available on any 10439 platform where 10440 <internallink id="jvmtiCapabilities.can_get_thread_cpu_time"><code>can_get_thread_cpu_time</code></internallink> 10441 is potentially available. 10442 </required> 10443 </capabilities> 10444 <parameters> 10445 <param id="nanos_ptr"> 10446 <outptr><jlong/></outptr> 10447 <description> 10448 On return, points to the CPU time used by this thread 10449 in nanoseconds. 10450 This is an unsigned value. If tested or printed as a jlong (signed value) 10451 it may appear to be a negative number. 10452 </description> 10453 </param> 10454 </parameters> 10455 <errors> 10456 </errors> 10457 </function> 10458 10459 <function id="GetThreadCpuTimerInfo" num="136"> 10460 <synopsis>Get Thread CPU Timer Information</synopsis> 10461 <description> 10462 Get information about the 10463 <functionlink id="GetThreadCpuTime"/> timer. 10464 The fields of the <datalink id="jvmtiTimerInfo"/> structure 10465 are filled in with details about the timer. 10466 This information is specific to the platform and the implementation of 10467 <functionlink id="GetThreadCpuTime"/> and thus 10468 does not vary by thread nor does it vary 10469 during a particular invocation of the VM. 10470 <p/> 10471 Note that the implementations of <functionlink id="GetCurrentThreadCpuTime"/> 10472 and <functionlink id="GetThreadCpuTime"/> may differ, and thus the values 10473 returned by <functionlink id="GetCurrentThreadCpuTimerInfo"/> 10474 and <code>GetThreadCpuTimerInfo</code> 10475 may differ -- see <functionlink id="GetCurrentThreadCpuTime"/> for more information. 10476 </description> 10477 <origin>new</origin> 10478 <capabilities> 10479 <required id="can_get_thread_cpu_time"> 10480 Can get thread CPU time. 10481 </required> 10482 </capabilities> 10483 <parameters> 10484 <param id="info_ptr"> 10485 <outptr><struct>jvmtiTimerInfo</struct></outptr> 10486 <description> 10487 On return, filled with information describing the time 10488 returned by <functionlink id="GetThreadCpuTime"/>. 10489 </description> 10490 </param> 10491 </parameters> 10492 <errors> 10493 </errors> 10494 </function> 10495 10496 <function id="GetThreadCpuTime" num="137"> 10497 <synopsis>Get Thread CPU Time</synopsis> 10498 <description> 10499 Return the CPU time utilized by the specified thread. 10500 <p/> 10501 Get information about this timer with 10502 <functionlink id="GetThreadCpuTimerInfo"/>. 10503 </description> 10504 <origin>new</origin> 10505 <capabilities> 10506 <required id="can_get_thread_cpu_time"> 10507 Can get thread CPU time. 10508 <p/> 10509 If this capability is enabled after threads have started, 10510 the implementation may choose any time up 10511 to and including the time that the capability is enabled 10512 as the point where CPU time collection starts. 10513 </required> 10514 </capabilities> 10515 <parameters> 10516 <param id="thread"> 10517 <jthread null="current"/> 10518 <description> 10519 The thread to query. 10520 </description> 10521 </param> 10522 <param id="nanos_ptr"> 10523 <outptr><jlong/></outptr> 10524 <description> 10525 On return, points to the CPU time used by the specified thread 10526 in nanoseconds. 10527 This is an unsigned value. If tested or printed as a jlong (signed value) 10528 it may appear to be a negative number. 10529 </description> 10530 </param> 10531 </parameters> 10532 <errors> 10533 </errors> 10534 </function> 10535 10536 <function id="GetTimerInfo" phase="any" callbacksafe="safe" num="138"> 10537 <synopsis>Get Timer Information</synopsis> 10538 <description> 10539 Get information about the 10540 <functionlink id="GetTime"/> timer. 10541 The fields of the <datalink id="jvmtiTimerInfo"/> structure 10542 are filled in with details about the timer. 10543 This information will not change during a particular invocation of the VM. 10544 </description> 10545 <origin>new</origin> 10546 <capabilities> 10547 </capabilities> 10548 <parameters> 10549 <param id="info_ptr"> 10550 <outptr><struct>jvmtiTimerInfo</struct></outptr> 10551 <description> 10552 On return, filled with information describing the time 10553 returned by <functionlink id="GetTime"/>. 10554 </description> 10555 </param> 10556 </parameters> 10557 <errors> 10558 </errors> 10559 </function> 10560 10561 <function id="GetTime" phase="any" callbacksafe="safe" num="139"> 10562 <synopsis>Get Time</synopsis> 10563 <description> 10564 Return the current value of the system timer, in nanoseconds. 10565 <p/> 10566 The value returned represents nanoseconds since some fixed but 10567 arbitrary time (perhaps in the future, so values may be 10568 negative). This function provides nanosecond precision, but not 10569 necessarily nanosecond accuracy. No guarantees are made about 10570 how frequently values change. 10571 <p/> 10572 Get information about this timer with 10573 <functionlink id="GetTimerInfo"/>. 10574 </description> 10575 <origin>new</origin> 10576 <capabilities> 10577 </capabilities> 10578 <parameters> 10579 <param id="nanos_ptr"> 10580 <outptr><jlong/></outptr> 10581 <description> 10582 On return, points to the time in nanoseconds. 10583 This is an unsigned value. If tested or printed as a jlong (signed value) 10584 it may appear to be a negative number. 10585 </description> 10586 </param> 10587 </parameters> 10588 <errors> 10589 </errors> 10590 </function> 10591 10592 <function id="GetAvailableProcessors" phase="any" num="144"> 10593 <synopsis>Get Available Processors</synopsis> 10594 <description> 10595 Returns the number of processors available to the Java virtual machine. 10596 <p/> 10597 This value may change during a particular invocation of the virtual machine. 10598 Applications that are sensitive to the number of available processors should 10599 therefore occasionally poll this property. 10600 </description> 10601 <origin>new</origin> 10602 <capabilities> 10603 </capabilities> 10604 <parameters> 10605 <param id="processor_count_ptr"> 10606 <outptr><jint/></outptr> 10607 <description> 10608 On return, points to the maximum number of processors available to the 10609 virtual machine; never smaller than one. 10610 </description> 10611 </param> 10612 </parameters> 10613 <errors> 10614 </errors> 10615 </function> 10616 10617 </category> 10618 10619 10620 <category id="classLoaderSearch" label="Class Loader Search"> 10621 10622 <intro> 10623 These functions allow the agent to add to the locations that a class loader searches for a class. 10624 This is useful for installing instrumentation under the correct class loader. 10625 </intro> 10626 10627 <function id="AddToBootstrapClassLoaderSearch" jkernel="yes" phase="onload" num="149"> 10628 <synopsis>Add To Bootstrap Class Loader Search</synopsis> 10629 <description> 10630 This function can be used to cause instrumentation classes to be defined by the 10631 bootstrap class loader. See <vmspec chapter="5.3.1"/>. 10632 After the bootstrap 10633 class loader unsuccessfully searches for a class, the specified platform-dependent 10634 search path <paramlink id="segment"/> will be searched as well. Only one segment may be specified in 10635 the <paramlink id="segment"/>. This function may be called multiple times to add multiple segments, 10636 the segments will be searched in the order that this function was called. 10637 <p/> 10638 In the <code>OnLoad</code> phase the function may be used to specify any platform-dependent 10639 search path segment to be searched after the bootstrap class loader unsuccessfully searches 10640 for a class. The segment is typically a directory or JAR file. 10641 <p/> 10642 In the live phase the <paramlink id="segment"/> may be used to specify any platform-dependent 10643 path to a <externallink id="http://docs.oracle.com/javase/7/docs/technotes/guides/jar/jar.html"> 10644 JAR file</externallink>. The agent should take care that the JAR file does not 10645 contain any classes or resources other than those to be defined by the bootstrap 10646 class loader for the purposes of instrumentation. 10647 <p/> 10648 <vmspec/> specifies that a subsequent attempt to resolve a symbolic 10649 reference that the Java virtual machine has previously unsuccessfully attempted 10650 to resolve always fails with the same error that was thrown as a result of the 10651 initial resolution attempt. Consequently, if the JAR file contains an entry 10652 that corresponds to a class for which the Java virtual machine has 10653 unsuccessfully attempted to resolve a reference, then subsequent attempts to 10654 resolve that reference will fail with the same error as the initial attempt. 10655 </description> 10656 <origin>new</origin> 10657 <capabilities> 10658 </capabilities> 10659 <parameters> 10660 <param id="segment"> 10661 <inbuf><char/></inbuf> 10662 <description> 10663 The platform-dependent search path segment, encoded as a 10664 <internallink id="mUTF">modified UTF-8</internallink> string. 10665 </description> 10666 </param> 10667 </parameters> 10668 <errors> 10669 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 10670 <paramlink id="segment"/> is an invalid path. In the live phase, anything other than an 10671 existing JAR file is an invalid path. 10672 </error> 10673 </errors> 10674 </function> 10675 10676 <function id="AddToSystemClassLoaderSearch" jkernel="yes" phase="onload" num="151" since="1.1"> 10677 <synopsis>Add To System Class Loader Search</synopsis> 10678 <description> 10679 This function can be used to cause instrumentation classes to be 10680 defined by the system class loader. See <vmspec chapter="5.3.2"/>. 10681 After the class loader unsuccessfully searches for a class, the specified platform-dependent search 10682 path <paramlink id="segment"/> will be searched as well. Only one segment may be specified in the 10683 <paramlink id="segment"/>. This function may be called multiple times to add multiple segments, the 10684 segments will be searched in the order that this function was called. 10685 <p/> 10686 In the <code>OnLoad</code> phase the function may be used to specify any platform-dependent 10687 search path segment to be searched after the system class loader unsuccessfully searches 10688 for a class. The segment is typically a directory or JAR file. 10689 <p/> 10690 In the live phase the <paramlink id="segment"/> is a platform-dependent path to a <externallink 10691 id="http://docs.oracle.com/javase/7/docs/technotes/guides/jar/jar.html">JAR file</externallink> to be 10692 searched after the system class loader unsuccessfully searches for a class. The agent should 10693 take care that the JAR file does not contain any classes or resources other than those to be 10694 defined by the system class loader for the purposes of instrumentation. 10695 <p/> 10696 In the live phase the system class loader supports adding a JAR file to be searched if 10697 the system class loader implements a method name <code>appendToClassPathForInstrumentation</code> 10698 which takes a single parameter of type <code>java.lang.String</code>. The method is not required 10699 to have <code>public</code> access. 10700 <p/> 10701 <vmspec/> specifies that a subsequent attempt to resolve a symbolic 10702 reference that the Java virtual machine has previously unsuccessfully attempted 10703 to resolve always fails with the same error that was thrown as a result of the 10704 initial resolution attempt. Consequently, if the JAR file contains an entry 10705 that corresponds to a class for which the Java virtual machine has 10706 unsuccessfully attempted to resolve a reference, then subsequent attempts to 10707 resolve that reference will fail with the same error as the initial attempt. 10708 </description> 10709 <origin>new</origin> 10710 <capabilities> 10711 </capabilities> 10712 <parameters> 10713 <param id="segment"> 10714 <inbuf><char/></inbuf> 10715 <description> 10716 The platform-dependent search path segment, encoded as a 10717 <internallink id="mUTF">modified UTF-8</internallink> string. 10718 </description> 10719 </param> 10720 </parameters> 10721 <errors> 10722 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 10723 <paramlink id="segment"/> is an invalid path. In the live phase, anything other than an 10724 existing JAR file is an invalid path. 10725 </error> 10726 <error id="JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED"> 10727 Operation not supported by the system class loader. 10728 </error> 10729 </errors> 10730 </function> 10731 10732 </category> 10733 10734 10735 <category id="props" label="System Properties"> 10736 10737 <intro> 10738 These functions get and set system properties. 10739 </intro> 10740 10741 <function id="GetSystemProperties" phase="onload" num="130"> 10742 <synopsis>Get System Properties</synopsis> 10743 <description> 10744 The list of VM system property keys which may be used with 10745 <functionlink id="GetSystemProperty"/> is returned. 10746 It is strongly recommended that virtual machines provide the 10747 following property keys: 10748 <ul> 10749 <li><code>java.vm.vendor</code></li> 10750 <li><code>java.vm.version</code></li> 10751 <li><code>java.vm.name</code></li> 10752 <li><code>java.vm.info</code></li> 10753 <li><code>java.library.path</code></li> 10754 <li><code>java.class.path</code></li> 10755 </ul> 10756 Provides access to system properties defined by and used 10757 by the VM. 10758 Properties set on the command-line are included. 10759 This allows getting and setting of these properties 10760 before the VM even begins executing bytecodes. 10761 Since this is a VM view of system properties, the set of available 10762 properties will usually be different than that 10763 in <code>java.lang.System.getProperties</code>. 10764 JNI method invocation may be used to access 10765 <code>java.lang.System.getProperties</code>. 10766 <p/> 10767 The set of properties may grow during execution. 10768 </description> 10769 <origin>new</origin> 10770 <capabilities> 10771 </capabilities> 10772 <parameters> 10773 <param id="count_ptr"> 10774 <outptr><jint/></outptr> 10775 <description> 10776 On return, points to the number of property keys returned. 10777 </description> 10778 </param> 10779 <param id="property_ptr"> 10780 <allocallocbuf outcount="count_ptr"><char/></allocallocbuf> 10781 <description> 10782 On return, points to an array of property keys, encoded as 10783 <internallink id="mUTF">modified UTF-8</internallink> strings. 10784 </description> 10785 </param> 10786 </parameters> 10787 <errors> 10788 </errors> 10789 </function> 10790 10791 <function id="GetSystemProperty" phase="onload" num="131"> 10792 <synopsis>Get System Property</synopsis> 10793 <description> 10794 Return a VM system property value given the property key. 10795 <p/> 10796 The function <functionlink id="GetSystemProperties"/> 10797 returns the set of property keys which may be used. 10798 The properties which can be retrieved may grow during 10799 execution. 10800 <p/> 10801 Since this is a VM view of system properties, the values 10802 of properties may differ from that returned by 10803 <code>java.lang.System.getProperty(String)</code>. 10804 A typical VM might copy the values of the VM system 10805 properties into the <code>Properties</code> held by 10806 <code>java.lang.System</code> during the initialization 10807 of that class. Thereafter any changes to the VM system 10808 properties (with <functionlink id="SetSystemProperty"/>) 10809 or the <code>java.lang.System</code> system properties 10810 (with <code>java.lang.System.setProperty(String,String)</code>) 10811 would cause the values to diverge. 10812 JNI method invocation may be used to access 10813 <code>java.lang.System.getProperty(String)</code>. 10814 </description> 10815 <origin>new</origin> 10816 <capabilities> 10817 </capabilities> 10818 <parameters> 10819 <param id="property"> 10820 <inbuf><char/></inbuf> 10821 <description> 10822 The key of the property to retrieve, encoded as a 10823 <internallink id="mUTF">modified UTF-8</internallink> string. 10824 </description> 10825 </param> 10826 <param id="value_ptr"> 10827 <allocbuf><char/></allocbuf> 10828 <description> 10829 On return, points to the property value, encoded as a 10830 <internallink id="mUTF">modified UTF-8</internallink> string. 10831 </description> 10832 </param> 10833 </parameters> 10834 <errors> 10835 <error id="JVMTI_ERROR_NOT_AVAILABLE"> 10836 This property is not available. 10837 Use <functionlink id="GetSystemProperties"/> to find available properties. 10838 </error> 10839 </errors> 10840 </function> 10841 10842 <function id="SetSystemProperty" phase="onloadOnly" num="132"> 10843 <synopsis>Set System Property</synopsis> 10844 <description> 10845 Set a VM system property value. 10846 <p/> 10847 The function <functionlink id="GetSystemProperties"/> 10848 returns the set of property keys, some of these may be settable. 10849 See <functionlink id="GetSystemProperty"/>. 10850 </description> 10851 <origin>new</origin> 10852 <capabilities> 10853 </capabilities> 10854 <parameters> 10855 <param id="property"> 10856 <inbuf><char/></inbuf> 10857 <description> 10858 The key of the property, encoded as a 10859 <internallink id="mUTF">modified UTF-8</internallink> string. 10860 </description> 10861 </param> 10862 <param id="value_ptr"> 10863 <inbuf> 10864 <char/> 10865 <nullok> 10866 do not set the value, but return <errorlink id="JVMTI_ERROR_NOT_AVAILABLE"/> 10867 if the property is not writeable 10868 </nullok> 10869 </inbuf> 10870 <description> 10871 The property value to set, encoded as a 10872 <internallink id="mUTF">modified UTF-8</internallink> string. 10873 </description> 10874 </param> 10875 </parameters> 10876 <errors> 10877 <error id="JVMTI_ERROR_NOT_AVAILABLE"> 10878 This property is not available or is not writeable. 10879 </error> 10880 </errors> 10881 </function> 10882 10883 </category> 10884 10885 <category id="general" label="General"> 10886 10887 <intro> 10888 </intro> 10889 10890 <function id="GetPhase" jkernel="yes" phase="any" num="133"> 10891 <synopsis>Get Phase</synopsis> 10892 <description> 10893 Return the current phase of VM execution. 10894 The phases proceed in sequence: 10895 <constants id="jvmtiPhase" label="Phases of execution" kind="enum"> 10896 <constant id="JVMTI_PHASE_ONLOAD" num="1"> 10897 <code>OnLoad</code> phase: while in the 10898 <internallink id="onload"><code>Agent_OnLoad</code></internallink> 10899 or, for statically linked agents, the <internallink id="onload"> 10900 <code>Agent_OnLoad_<agent-lib-name> 10901 </code></internallink> function. 10902 </constant> 10903 <constant id="JVMTI_PHASE_PRIMORDIAL" num="2"> 10904 Primordial phase: between return from <code>Agent_OnLoad</code> 10905 or <code>Agent_OnLoad_<agent-lib-name></code> and the 10906 <code>VMStart</code> event. 10907 </constant> 10908 <constant id="JVMTI_PHASE_START" num="6"> 10909 Start phase: when the <eventlink id="VMStart"><code>VMStart</code></eventlink> event 10910 is sent and until the <code>VMInit</code> event is sent. 10911 </constant> 10912 <constant id="JVMTI_PHASE_LIVE" num="4"> 10913 Live phase: when the <eventlink id="VMInit"><code>VMInit</code></eventlink> event is sent 10914 and until the <eventlink id="VMDeath"></eventlink> event returns. 10915 </constant> 10916 <constant id="JVMTI_PHASE_DEAD" num="8"> 10917 Dead phase: after the <eventlink id="VMDeath"></eventlink> event returns or after 10918 start-up failure. 10919 </constant> 10920 </constants> 10921 In the case of start-up failure the VM will proceed directly to the dead 10922 phase skipping intermediate phases and neither a <code>VMInit</code> nor 10923 <code>VMDeath</code> event will be sent. 10924 <p/> 10925 Most <jvmti/> functions operate only in the live phase. 10926 The following functions operate in either the <code>OnLoad</code> or live phases: 10927 <functionphaselist phase="onload"/> 10928 The following functions operate in only the <code>OnLoad</code> phase: 10929 <functionphaselist phase="onloadOnly"/> 10930 The following functions operate in the start or live phases: 10931 <functionphaselist phase="start"/> 10932 The following functions operate in any phase: 10933 <functionphaselist phase="any"/> 10934 JNI functions (except the Invocation API) must only be used in the start or live phases. 10935 <p/> 10936 Most <jvmti/> events are sent only in the live phase. 10937 The following events operate in others phases: 10938 <eventphaselist phase="start"/> 10939 <eventphaselist phase="any"/> 10940 </description> 10941 <origin>new</origin> 10942 <capabilities> 10943 </capabilities> 10944 <parameters> 10945 <param id="phase_ptr"> 10946 <outptr><enum>jvmtiPhase</enum></outptr> 10947 <description> 10948 On return, points to the phase. 10949 </description> 10950 </param> 10951 </parameters> 10952 <errors> 10953 </errors> 10954 </function> 10955 10956 <function id="DisposeEnvironment" jkernel="yes" phase="any" num="127"> 10957 <synopsis>Dispose Environment</synopsis> 10958 <description> 10959 Shutdown a <jvmti/> connection created with JNI <code>GetEnv</code> 10960 (see <internallink id="environments"><jvmti/> Environments</internallink>). 10961 Dispose of any resources held by the environment. 10962 <issue> 10963 What resources are reclaimed? What is undone? 10964 Breakpoints,watchpoints removed? 10965 </issue> 10966 Threads suspended by this environment are not resumed by this call, 10967 this must be done explicitly by the agent. 10968 Memory allocated by this environment via calls to <jvmti/> functions 10969 is not released, this can be done explicitly by the agent 10970 by calling <functionlink id="Deallocate"/>. 10971 Raw monitors created by this environment are not destroyed, 10972 this can be done explicitly by the agent 10973 by calling <functionlink id="DestroyRawMonitor"/>. 10974 The state of threads waiting on raw monitors created by this environment 10975 are not affected. 10976 <p/> 10977 Any <functionlink id="SetNativeMethodPrefix">native method 10978 prefixes</functionlink> for this environment will be unset; 10979 the agent must remove any prefixed native methods before 10980 dispose is called. 10981 <p/> 10982 Any <internallink id="capability">capabilities</internallink> 10983 held by this environment are relinquished. 10984 <p/> 10985 Events enabled by this environment will no longer be sent, however 10986 event handlers currently running will continue to run. Caution must 10987 be exercised in the design of event handlers whose environment may 10988 be disposed and thus become invalid during their execution. 10989 <p/> 10990 This environment may not be used after this call. 10991 This call returns to the caller. 10992 </description> 10993 <origin>new</origin> 10994 <capabilities> 10995 </capabilities> 10996 <parameters> 10997 </parameters> 10998 <errors> 10999 </errors> 11000 </function> 11001 11002 <function id="SetEnvironmentLocalStorage" jkernel="yes" phase="any" callbacksafe="safe" impl="innative notrace" num="148"> 11003 <synopsis>Set Environment Local Storage</synopsis> 11004 <description> 11005 The VM stores a pointer value associated with each environment. 11006 This pointer value is called <i>environment-local storage</i>. 11007 This value is <code>NULL</code> unless set with this function. 11008 Agents can allocate memory in which they store environment specific 11009 information. By setting environment-local storage it can then be 11010 accessed with 11011 <functionlink id="GetEnvironmentLocalStorage"></functionlink>. 11012 <p/> 11013 Called by the agent to set the value of the <jvmti/> 11014 environment-local storage. <jvmti/> supplies to the agent a pointer-size 11015 environment-local storage that can be used to record per-environment 11016 information. 11017 </description> 11018 <origin>new</origin> 11019 <capabilities> 11020 </capabilities> 11021 <parameters> 11022 <param id="data"> 11023 <inbuf> 11024 <void/> 11025 <nullok>value is set to <code>NULL</code></nullok> 11026 </inbuf> 11027 <description> 11028 The value to be entered into the environment-local storage. 11029 </description> 11030 </param> 11031 </parameters> 11032 <errors> 11033 </errors> 11034 </function> 11035 11036 <function id="GetEnvironmentLocalStorage" jkernel="yes" phase="any" callbacksafe="safe" impl="innative notrace" num="147"> 11037 <synopsis>Get Environment Local Storage</synopsis> 11038 <description> 11039 Called by the agent to get the value of the <jvmti/> environment-local 11040 storage. 11041 </description> 11042 <origin>new</origin> 11043 <capabilities> 11044 </capabilities> 11045 <parameters> 11046 <param id="data_ptr"> 11047 <agentbuf><void/></agentbuf> 11048 <description> 11049 Pointer through which the value of the environment local 11050 storage is returned. 11051 If environment-local storage has not been set with 11052 <functionlink id="SetEnvironmentLocalStorage"></functionlink> returned 11053 pointer is <code>NULL</code>. 11054 </description> 11055 </param> 11056 </parameters> 11057 <errors> 11058 </errors> 11059 </function> 11060 11061 <function id="GetVersionNumber" jkernel="yes" phase="any" num="88"> 11062 <synopsis>Get Version Number</synopsis> 11063 <description> 11064 Return the <jvmti/> version via <code>version_ptr</code>. 11065 The return value is the version identifier. 11066 The version identifier includes major, minor and micro 11067 version as well as the interface type. 11068 <constants id="jvmtiVersionInterfaceTypes" label="Version Interface Types" kind="bits"> 11069 <constant id="JVMTI_VERSION_INTERFACE_JNI" num="0x00000000"> 11070 Value of <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> for JNI. 11071 </constant> 11072 <constant id="JVMTI_VERSION_INTERFACE_JVMTI" num="0x30000000"> 11073 Value of <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> for <jvmti/>. 11074 </constant> 11075 </constants> 11076 <constants id="jvmtiVersionMasks" label="Version Masks" kind="bits"> 11077 <constant id="JVMTI_VERSION_MASK_INTERFACE_TYPE" num="0x70000000"> 11078 Mask to extract interface type. 11079 The value of the version returned by this function masked with 11080 <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> is always 11081 <code>JVMTI_VERSION_INTERFACE_JVMTI</code> 11082 since this is a <jvmti/> function. 11083 </constant> 11084 <constant id="JVMTI_VERSION_MASK_MAJOR" num="0x0FFF0000"> 11085 Mask to extract major version number. 11086 </constant> 11087 <constant id="JVMTI_VERSION_MASK_MINOR" num="0x0000FF00"> 11088 Mask to extract minor version number. 11089 </constant> 11090 <constant id="JVMTI_VERSION_MASK_MICRO" num="0x000000FF"> 11091 Mask to extract micro version number. 11092 </constant> 11093 </constants> 11094 <constants id="jvmtiVersionShifts" label="Version Shifts" kind="bits"> 11095 <constant id="JVMTI_VERSION_SHIFT_MAJOR" num="16"> 11096 Shift to extract major version number. 11097 </constant> 11098 <constant id="JVMTI_VERSION_SHIFT_MINOR" num="8"> 11099 Shift to extract minor version number. 11100 </constant> 11101 <constant id="JVMTI_VERSION_SHIFT_MICRO" num="0"> 11102 Shift to extract micro version number. 11103 </constant> 11104 </constants> 11105 </description> 11106 <origin>jvmdi</origin> 11107 <capabilities> 11108 </capabilities> 11109 <parameters> 11110 <param id="version_ptr"> 11111 <outptr><jint/></outptr> 11112 <description> 11113 On return, points to the <jvmti/> version. 11114 </description> 11115 </param> 11116 </parameters> 11117 <errors> 11118 </errors> 11119 </function> 11120 11121 11122 <function id="GetErrorName" phase="any" num="128"> 11123 <synopsis>Get Error Name</synopsis> 11124 <description> 11125 Return the symbolic name for an 11126 <internallink id="ErrorSection">error code</internallink>. 11127 <p/> 11128 For example 11129 <code>GetErrorName(env, JVMTI_ERROR_NONE, &err_name)</code> 11130 would return in <code>err_name</code> the string 11131 <code>"JVMTI_ERROR_NONE"</code>. 11132 </description> 11133 <origin>new</origin> 11134 <capabilities> 11135 </capabilities> 11136 <parameters> 11137 <param id="error"> 11138 <enum>jvmtiError</enum> 11139 <description> 11140 The error code. 11141 </description> 11142 </param> 11143 <param id="name_ptr"> 11144 <allocbuf><char/></allocbuf> 11145 <description> 11146 On return, points to the error name. 11147 The name is encoded as a 11148 <internallink id="mUTF">modified UTF-8</internallink> string, 11149 but is restricted to the ASCII subset. 11150 </description> 11151 </param> 11152 </parameters> 11153 <errors> 11154 </errors> 11155 </function> 11156 11157 <function id="SetVerboseFlag" phase="any" num="150"> 11158 <synopsis>Set Verbose Flag</synopsis> 11159 <description> 11160 <constants id="jvmtiVerboseFlag" label="Verbose Flag Enumeration" kind="enum"> 11161 <constant id="JVMTI_VERBOSE_OTHER" num="0"> 11162 Verbose output other than the below. 11163 </constant> 11164 <constant id="JVMTI_VERBOSE_GC" num="1"> 11165 Verbose garbage collector output, like that specified with <code>-verbose:gc</code>. 11166 </constant> 11167 <constant id="JVMTI_VERBOSE_CLASS" num="2"> 11168 Verbose class loading output, like that specified with <code>-verbose:class</code>. 11169 </constant> 11170 <constant id="JVMTI_VERBOSE_JNI" num="4"> 11171 Verbose JNI output, like that specified with <code>-verbose:jni</code>. 11172 </constant> 11173 </constants> 11174 Control verbose output. 11175 This is the output which typically is sent to <code>stderr</code>. 11176 </description> 11177 <origin>new</origin> 11178 <capabilities> 11179 </capabilities> 11180 <parameters> 11181 <param id="flag"> 11182 <enum>jvmtiVerboseFlag</enum> 11183 <description> 11184 Which verbose flag to set. 11185 </description> 11186 </param> 11187 <param id="value"> 11188 <jboolean/> 11189 <description> 11190 New value of the flag. 11191 </description> 11192 </param> 11193 </parameters> 11194 <errors> 11195 </errors> 11196 </function> 11197 11198 11199 <function id="GetJLocationFormat" phase="any" num="129"> 11200 <synopsis>Get JLocation Format</synopsis> 11201 <description> 11202 Although the greatest functionality is achieved with location information 11203 referencing the virtual machine bytecode index, the definition of 11204 <code>jlocation</code> has intentionally been left unconstrained to allow VM 11205 implementations that do not have this information. 11206 <p/> 11207 This function describes the representation of <code>jlocation</code> used in this VM. 11208 If the returned format is <datalink id="JVMTI_JLOCATION_JVMBCI"></datalink>, 11209 <code>jlocation</code>s can 11210 be used as in indices into the array returned by 11211 <functionlink id="GetBytecodes"></functionlink>. 11212 <constants id="jvmtiJlocationFormat" label="JLocation Format Enumeration" kind="enum"> 11213 <constant id="JVMTI_JLOCATION_JVMBCI" num="1"> 11214 <code>jlocation</code> values represent virtual machine 11215 bytecode indices--that is, offsets into the 11216 virtual machine code for a method. 11217 </constant> 11218 <constant id="JVMTI_JLOCATION_MACHINEPC" num="2"> 11219 <code>jlocation</code> values represent native machine 11220 program counter values. 11221 </constant> 11222 <constant id="JVMTI_JLOCATION_OTHER" num="0"> 11223 <code>jlocation</code> values have some other representation. 11224 </constant> 11225 </constants> 11226 </description> 11227 <origin>new</origin> 11228 <capabilities> 11229 </capabilities> 11230 <parameters> 11231 <param id="format_ptr"> 11232 <outptr><enum>jvmtiJlocationFormat</enum></outptr> 11233 <description> 11234 On return, points to the format identifier for <code>jlocation</code> values. 11235 </description> 11236 </param> 11237 </parameters> 11238 <errors> 11239 </errors> 11240 </function> 11241 11242 </category> 11243 11244 </functionsection> 11245 11246 <errorsection label="Error Reference"> 11247 <intro> 11248 Every <jvmti/> function returns a <b><code>jvmtiError</code></b> error code. 11249 <p/> 11250 It is the responsibility of the agent to call <jvmti/> functions with 11251 valid parameters and in the proper context (calling thread is attached, 11252 phase is correct, etc.). 11253 Detecting some error conditions may be difficult, inefficient, or 11254 impossible for an implementation. 11255 The errors listed in 11256 <internallink id="reqerrors">Function Specific Required Errors</internallink> 11257 must be detected by the implementation. 11258 All other errors represent the recommended response to the error 11259 condition. 11260 </intro> 11261 11262 <errorcategory id="universal-error" label="Universal Errors"> 11263 <intro> 11264 The following errors may be returned by any function 11265 </intro> 11266 11267 <errorid id="JVMTI_ERROR_NONE" num="0"> 11268 No error has occurred. This is the error code that is returned 11269 on successful completion of the function. 11270 </errorid> 11271 <errorid id="JVMTI_ERROR_NULL_POINTER" num="100"> 11272 Pointer is unexpectedly <code>NULL</code>. 11273 </errorid> 11274 <errorid id="JVMTI_ERROR_OUT_OF_MEMORY" num="110"> 11275 The function attempted to allocate memory and no more memory was 11276 available for allocation. 11277 </errorid> 11278 <errorid id="JVMTI_ERROR_ACCESS_DENIED" num="111"> 11279 The desired functionality has not been enabled in this virtual machine. 11280 </errorid> 11281 <errorid id="JVMTI_ERROR_UNATTACHED_THREAD" num="115"> 11282 The thread being used to call this function is not attached 11283 to the virtual machine. Calls must be made from attached threads. 11284 See <code>AttachCurrentThread</code> in the JNI invocation API. 11285 </errorid> 11286 <errorid id="JVMTI_ERROR_INVALID_ENVIRONMENT" num="116"> 11287 The <jvmti/> environment provided is no longer connected or is 11288 not an environment. 11289 </errorid> 11290 <errorid id="JVMTI_ERROR_WRONG_PHASE" num="112"> 11291 The desired functionality is not available in the current 11292 <functionlink id="GetPhase">phase</functionlink>. 11293 Always returned if the virtual machine has completed running. 11294 </errorid> 11295 <errorid id="JVMTI_ERROR_INTERNAL" num="113"> 11296 An unexpected internal error has occurred. 11297 </errorid> 11298 </errorcategory> 11299 11300 <errorcategory id="reqerrors" label="Function Specific Required Errors"> 11301 <intro> 11302 The following errors are returned by some <jvmti/> functions and must 11303 be returned by the implementation when the condition occurs. 11304 </intro> 11305 11306 <errorid id="JVMTI_ERROR_INVALID_PRIORITY" num="12"> 11307 Invalid priority. 11308 </errorid> 11309 <errorid id="JVMTI_ERROR_THREAD_NOT_SUSPENDED" num="13"> 11310 Thread was not suspended. 11311 </errorid> 11312 <errorid id="JVMTI_ERROR_THREAD_SUSPENDED" num="14"> 11313 Thread already suspended. 11314 </errorid> 11315 <errorid id="JVMTI_ERROR_THREAD_NOT_ALIVE" num="15"> 11316 This operation requires the thread to be alive--that is, 11317 it must be started and not yet have died. 11318 </errorid> 11319 <errorid id="JVMTI_ERROR_CLASS_NOT_PREPARED" num="22"> 11320 The class has been loaded but not yet prepared. 11321 </errorid> 11322 <errorid id="JVMTI_ERROR_NO_MORE_FRAMES" num="31"> 11323 There are no Java programming language or JNI stack frames at the specified depth. 11324 </errorid> 11325 <errorid id="JVMTI_ERROR_OPAQUE_FRAME" num="32"> 11326 Information about the frame is not available (e.g. for native frames). 11327 </errorid> 11328 <errorid id="JVMTI_ERROR_DUPLICATE" num="40"> 11329 Item already set. 11330 </errorid> 11331 <errorid id="JVMTI_ERROR_NOT_FOUND" num="41"> 11332 Desired element (e.g. field or breakpoint) not found 11333 </errorid> 11334 <errorid id="JVMTI_ERROR_NOT_MONITOR_OWNER" num="51"> 11335 This thread doesn't own the raw monitor. 11336 </errorid> 11337 <errorid id="JVMTI_ERROR_INTERRUPT" num="52"> 11338 The call has been interrupted before completion. 11339 </errorid> 11340 <errorid id="JVMTI_ERROR_UNMODIFIABLE_CLASS" num="79"> 11341 The class cannot be modified. 11342 </errorid> 11343 <errorid id="JVMTI_ERROR_NOT_AVAILABLE" num="98"> 11344 The functionality is not available in this virtual machine. 11345 </errorid> 11346 <errorid id="JVMTI_ERROR_ABSENT_INFORMATION" num="101"> 11347 The requested information is not available. 11348 </errorid> 11349 <errorid id="JVMTI_ERROR_INVALID_EVENT_TYPE" num="102"> 11350 The specified event type ID is not recognized. 11351 </errorid> 11352 <errorid id="JVMTI_ERROR_NATIVE_METHOD" num="104"> 11353 The requested information is not available for native method. 11354 </errorid> 11355 <errorid id="JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED" num="106"> 11356 The class loader does not support this operation. 11357 </errorid> 11358 </errorcategory> 11359 11360 <errorcategory id="function-specific-errors" label="Function Specific Agent Errors"> 11361 <intro> 11362 The following errors are returned by some <jvmti/> functions. 11363 They are returned in the event of invalid parameters passed by the 11364 agent or usage in an invalid context. 11365 An implementation is not required to detect these errors. 11366 </intro> 11367 11368 <errorid id="JVMTI_ERROR_INVALID_THREAD" num="10"> 11369 The passed thread is not a valid thread. 11370 </errorid> 11371 <errorid id="JVMTI_ERROR_INVALID_FIELDID" num="25"> 11372 Invalid field. 11373 </errorid> 11374 <errorid id="JVMTI_ERROR_INVALID_METHODID" num="23"> 11375 Invalid method. 11376 </errorid> 11377 <errorid id="JVMTI_ERROR_INVALID_LOCATION" num="24"> 11378 Invalid location. 11379 </errorid> 11380 <errorid id="JVMTI_ERROR_INVALID_OBJECT" num="20"> 11381 Invalid object. 11382 </errorid> 11383 <errorid id="JVMTI_ERROR_INVALID_CLASS" num="21"> 11384 Invalid class. 11385 </errorid> 11386 <errorid id="JVMTI_ERROR_TYPE_MISMATCH" num="34"> 11387 The variable is not an appropriate type for the function used. 11388 </errorid> 11389 <errorid id="JVMTI_ERROR_INVALID_SLOT" num="35"> 11390 Invalid slot. 11391 </errorid> 11392 <errorid id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY" num="99"> 11393 The capability being used is false in this environment. 11394 </errorid> 11395 <errorid id="JVMTI_ERROR_INVALID_THREAD_GROUP" num="11"> 11396 Thread group invalid. 11397 </errorid> 11398 <errorid id="JVMTI_ERROR_INVALID_MONITOR" num="50"> 11399 Invalid raw monitor. 11400 </errorid> 11401 <errorid id="JVMTI_ERROR_ILLEGAL_ARGUMENT" num="103"> 11402 Illegal argument. 11403 </errorid> 11404 <errorid id="JVMTI_ERROR_INVALID_TYPESTATE" num="65"> 11405 The state of the thread has been modified, and is now inconsistent. 11406 </errorid> 11407 <errorid id="JVMTI_ERROR_UNSUPPORTED_VERSION" num="68"> 11408 A new class file has a version number not supported by this VM. 11409 </errorid> 11410 <errorid id="JVMTI_ERROR_INVALID_CLASS_FORMAT" num="60"> 11411 A new class file is malformed (the VM would return a <code>ClassFormatError</code>). 11412 </errorid> 11413 <errorid id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION" num="61"> 11414 The new class file definitions would lead to a circular 11415 definition (the VM would return a <code>ClassCircularityError</code>). 11416 </errorid> 11417 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED" num="63"> 11418 A new class file would require adding a method. 11419 </errorid> 11420 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED" num="64"> 11421 A new class version changes a field. 11422 </errorid> 11423 <errorid id="JVMTI_ERROR_FAILS_VERIFICATION" num="62"> 11424 The class bytes fail verification. 11425 </errorid> 11426 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED" num="66"> 11427 A direct superclass is different for the new class 11428 version, or the set of directly implemented 11429 interfaces is different. 11430 </errorid> 11431 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED" num="67"> 11432 A new class version does not declare a method 11433 declared in the old class version. 11434 </errorid> 11435 <errorid id="JVMTI_ERROR_NAMES_DONT_MATCH" num="69"> 11436 The class name defined in the new class file is 11437 different from the name in the old class object. 11438 </errorid> 11439 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED" num="70"> 11440 A new class version has different modifiers. 11441 </errorid> 11442 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED" num="71"> 11443 A method in the new class version has different modifiers 11444 than its counterpart in the old class version. 11445 </errorid> 11446 </errorcategory> 11447 </errorsection> 11448 11449 <eventsection label="Events"> 11450 <intro label="Handling Events" id="eventIntro"> 11451 Agents can be informed of many events that occur in application 11452 programs. 11453 <p/> 11454 To handle events, designate a set of callback functions with 11455 <functionlink id="SetEventCallbacks"></functionlink>. 11456 For each event the corresponding callback function will be 11457 called. 11458 Arguments to the callback function provide additional 11459 information about the event. 11460 <p/> 11461 The callback function is usually called from within an application 11462 thread. The <jvmti/> implementation does not 11463 queue events in any way. This means 11464 that event callback functions must be written 11465 carefully. Here are some general guidelines. See 11466 the individual event descriptions for further 11467 suggestions. 11468 <p/> 11469 <ul> 11470 <li>Any exception thrown during the execution of an event callback can 11471 overwrite any current pending exception in the current application thread. 11472 Care must be taken to preserve a pending exception 11473 when an event callback makes a JNI call that might generate an exception. 11474 </li> 11475 <li>Event callback functions must be re-entrant. The <jvmti/> implementation does 11476 not queue events. If an agent needs to process events one at a time, it 11477 can use a raw monitor inside the 11478 event callback functions to serialize event processing. 11479 </li> 11480 <li>Event callback functions that execute JNI's FindClass function to load 11481 classes need to note that FindClass locates the class loader associated 11482 with the current native method. For the purposes of class loading, an 11483 event callback that includes a JNI environment as a parameter to the 11484 callback will treated as if it is a native call, where the native method 11485 is in the class of the event thread's current frame. 11486 </li> 11487 </ul> 11488 <p/> 11489 Some <jvmti/> events identify objects with JNI references. 11490 All references 11491 in <jvmti/> events are JNI local references and will become invalid 11492 after the event callback returns. 11493 Unless stated otherwise, memory referenced by pointers sent in event 11494 callbacks may not be referenced after the event callback returns. 11495 <p/> 11496 Except where stated otherwise, events are delivered on the thread 11497 that caused the event. 11498 Events are sent at the time they occur. 11499 The specification for each event includes the set of 11500 <functionlink id="GetPhase">phases</functionlink> in which it can be sent; 11501 if an event triggering activity occurs during another phase, no event 11502 is sent. 11503 <p/> 11504 A thread that generates an event does not change its execution status 11505 (for example, the event does not cause the thread to be suspended). 11506 If an agent wishes the event to result in suspension, then the agent 11507 is responsible for explicitly suspending the thread with 11508 <functionlink id="SuspendThread"></functionlink>. 11509 <p/> 11510 If an event is enabled in multiple environments, the event will be sent 11511 to each agent in the order that the environments were created. 11512 </intro> 11513 11514 <intro label="Enabling Events" id="enablingevents"> 11515 All events are initially disabled. In order to receive any 11516 event: 11517 <ul> 11518 <li> 11519 If the event requires a capability, that capability must 11520 be added with 11521 <functionlink id="AddCapabilities"></functionlink>. 11522 </li> 11523 <li> 11524 A callback for the event must be set with 11525 <functionlink id="SetEventCallbacks"></functionlink>. 11526 </li> 11527 <li> 11528 The event must be enabled with 11529 <functionlink id="SetEventNotificationMode"></functionlink>. 11530 </li> 11531 </ul> 11532 </intro> 11533 11534 <intro label="Multiple Co-located Events" id="eventorder"> 11535 In many situations it is possible for multiple events to occur 11536 at the same location in one thread. When this happens, all the events 11537 are reported through the event callbacks in the order specified in this section. 11538 <p/> 11539 If the current location is at the entry point of a method, the 11540 <eventlink id="MethodEntry"></eventlink> event is reported before 11541 any other event at the current location in the same thread. 11542 <p/> 11543 If an exception catch has been detected at the current location, 11544 either because it is the beginning of a catch clause or a native method 11545 that cleared a pending exception has returned, the 11546 <code>exceptionCatch</code> event is reported before 11547 any other event at the current location in the same thread. 11548 <p/> 11549 If a <code>singleStep</code> event or 11550 <code>breakpoint</code> event is triggered at the 11551 current location, the event is defined to occur 11552 immediately before the code at the current location is executed. 11553 These events are reported before any events which are triggered 11554 by the execution of code at the current location in the same 11555 thread (specifically: 11556 <code>exception</code>, 11557 <code>fieldAccess</code>, and 11558 <code>fieldModification</code>). 11559 If both a step and breakpoint event are triggered for the same thread and 11560 location, the step event is reported before the breakpoint event. 11561 <p/> 11562 If the current location is the exit point of a method (that is, the last 11563 location before returning to the caller), the 11564 <eventlink id="MethodExit"></eventlink> event and 11565 the <eventlink id="FramePop"></eventlink> event (if requested) 11566 are reported after all other events at the current location in the same 11567 thread. There is no specified ordering of these two events 11568 with respect to each other. 11569 <p/> 11570 Co-located events can be triggered during the processing of some other 11571 event by the agent at the same location in the same thread. 11572 If such an event, of type <i>y</i>, is triggered during the processing of 11573 an event of type <i>x</i>, and if <i>x</i> 11574 precedes <i>y</i> in the ordering specified above, the co-located event 11575 <i>y</i> is reported for the current thread and location. If <i>x</i> does not precede 11576 <i>y</i>, <i>y</i> is not reported for the current thread and location. 11577 For example, if a breakpoint is set at the current location 11578 during the processing of <eventlink id="SingleStep"></eventlink>, 11579 that breakpoint will be reported before the thread moves off the current 11580 location. 11581 <p/>The following events are never considered to be co-located with 11582 other events. 11583 <ul> 11584 <li><eventlink id="VMStart"></eventlink></li> 11585 <li><eventlink id="VMInit"></eventlink></li> 11586 <li><eventlink id="VMDeath"></eventlink></li> 11587 <li><eventlink id="ThreadStart"></eventlink></li> 11588 <li><eventlink id="ThreadEnd"></eventlink></li> 11589 <li><eventlink id="ClassLoad"></eventlink></li> 11590 <li><eventlink id="ClassPrepare"></eventlink></li> 11591 </ul> 11592 </intro> 11593 11594 <intro label="Event Callbacks" id="jvmtiEventCallbacks"> 11595 The event callback structure below is used to specify the handler function 11596 for events. It is set with the 11597 <functionlink id="SetEventCallbacks"></functionlink> function. 11598 </intro> 11599 11600 <event label="Single Step" 11601 id="SingleStep" const="JVMTI_EVENT_SINGLE_STEP" filtered="thread" num="60"> 11602 <description> 11603 Single step events allow the agent to trace thread execution 11604 at the finest granularity allowed by the VM. A single step event is 11605 generated whenever a thread reaches a new location. 11606 Typically, single step events represent the completion of one VM 11607 instruction as defined in <vmspec/>. However, some implementations 11608 may define locations differently. In any case the 11609 <code>method</code> and <code>location</code> 11610 parameters uniquely identify the current location and allow 11611 the mapping to source file and line number when that information is 11612 available. 11613 <p/> 11614 No single step events are generated from within native methods. 11615 </description> 11616 <origin>jvmdi</origin> 11617 <capabilities> 11618 <required id="can_generate_single_step_events"></required> 11619 </capabilities> 11620 <parameters> 11621 <param id="jni_env"> 11622 <outptr> 11623 <struct>JNIEnv</struct> 11624 </outptr> 11625 <description> 11626 The JNI environment of the event (current) thread 11627 </description> 11628 </param> 11629 <param id="thread"> 11630 <jthread/> 11631 <description> 11632 Thread about to execution a new instruction 11633 </description> 11634 </param> 11635 <param id="klass"> 11636 <jclass method="method"/> 11637 <description> 11638 Class of the method about to execute a new instruction 11639 </description> 11640 </param> 11641 <param id="method"> 11642 <jmethodID class="klass"/> 11643 <description> 11644 Method about to execute a new instruction 11645 </description> 11646 </param> 11647 <param id="location"> 11648 <jlocation/> 11649 <description> 11650 Location of the new instruction 11651 </description> 11652 </param> 11653 </parameters> 11654 </event> 11655 11656 <event label="Breakpoint" 11657 id="Breakpoint" const="JVMTI_EVENT_BREAKPOINT" filtered="thread" num="62"> 11658 <description> 11659 Breakpoint events are generated whenever a thread reaches a location 11660 designated as a breakpoint with <functionlink id="SetBreakpoint"></functionlink>. 11661 The <code>method</code> and <code>location</code> 11662 parameters uniquely identify the current location and allow 11663 the mapping to source file and line number when that information is 11664 available. 11665 </description> 11666 <origin>jvmdi</origin> 11667 <capabilities> 11668 <required id="can_generate_breakpoint_events"></required> 11669 </capabilities> 11670 <parameters> 11671 <param id="jni_env"> 11672 <outptr> 11673 <struct>JNIEnv</struct> 11674 </outptr> 11675 <description> 11676 The JNI environment of the event (current) thread. 11677 </description> 11678 </param> 11679 <param id="thread"> 11680 <jthread/> 11681 <description> 11682 Thread that hit the breakpoint 11683 </description> 11684 </param> 11685 <param id="klass"> 11686 <jclass method="method"/> 11687 <description> 11688 Class of the method that hit the breakpoint 11689 </description> 11690 </param> 11691 <param id="method"> 11692 <jmethodID class="klass"/> 11693 <description> 11694 Method that hit the breakpoint 11695 </description> 11696 </param> 11697 <param id="location"> 11698 <jlocation/> 11699 <description> 11700 location of the breakpoint 11701 </description> 11702 </param> 11703 </parameters> 11704 </event> 11705 11706 <event label="Field Access" 11707 id="FieldAccess" const="JVMTI_EVENT_FIELD_ACCESS" filtered="thread" num="63"> 11708 <description> 11709 Field access events are generated whenever a thread accesses 11710 a field that was designated as a watchpoint 11711 with <functionlink id="SetFieldAccessWatch"></functionlink>. 11712 The <code>method</code> and <code>location</code> 11713 parameters uniquely identify the current location and allow 11714 the mapping to source file and line number when that information is 11715 available. 11716 </description> 11717 <origin>jvmdi</origin> 11718 <capabilities> 11719 <required id="can_generate_field_access_events"></required> 11720 </capabilities> 11721 <parameters> 11722 <param id="jni_env"> 11723 <outptr> 11724 <struct>JNIEnv</struct> 11725 </outptr> 11726 <description> 11727 The JNI environment of the event (current) thread 11728 </description> 11729 </param> 11730 <param id="thread"> 11731 <jthread/> 11732 <description> 11733 Thread accessing the field 11734 </description> 11735 </param> 11736 <param id="klass"> 11737 <jclass method="method"/> 11738 <description> 11739 Class of the method where the access is occurring 11740 </description> 11741 </param> 11742 <param id="method"> 11743 <jmethodID class="klass"/> 11744 <description> 11745 Method where the access is occurring 11746 </description> 11747 </param> 11748 <param id="location"> 11749 <jlocation/> 11750 <description> 11751 Location where the access is occurring 11752 </description> 11753 </param> 11754 <param id="field_klass"> 11755 <jclass field="field"/> 11756 <description> 11757 Class of the field being accessed 11758 </description> 11759 </param> 11760 <param id="object"> 11761 <jobject/> 11762 <description> 11763 Object with the field being accessed if the field is an 11764 instance field; <code>NULL</code> otherwise 11765 </description> 11766 </param> 11767 <param id="field"> 11768 <jfieldID class="field_klass"/> 11769 <description> 11770 Field being accessed 11771 </description> 11772 </param> 11773 </parameters> 11774 </event> 11775 11776 <event label="Field Modification" 11777 id="FieldModification" const="JVMTI_EVENT_FIELD_MODIFICATION" filtered="thread" num="64"> 11778 <description> 11779 Field modification events are generated whenever a thread modifies 11780 a field that was designated as a watchpoint 11781 with <functionlink id="SetFieldModificationWatch"></functionlink>. 11782 The <code>method</code> and <code>location</code> 11783 parameters uniquely identify the current location and allow 11784 the mapping to source file and line number when that information is 11785 available. 11786 </description> 11787 <origin>jvmdi</origin> 11788 <capabilities> 11789 <required id="can_generate_field_modification_events"></required> 11790 </capabilities> 11791 <parameters> 11792 <param id="jni_env"> 11793 <outptr> 11794 <struct>JNIEnv</struct> 11795 </outptr> 11796 <description> 11797 The JNI environment of the event (current) thread 11798 </description> 11799 </param> 11800 <param id="thread"> 11801 <jthread/> 11802 <description> 11803 Thread modifying the field 11804 </description> 11805 </param> 11806 <param id="klass"> 11807 <jclass method="method"/> 11808 <description> 11809 Class of the method where the modification is occurring 11810 </description> 11811 </param> 11812 <param id="method"> 11813 <jmethodID class="klass"/> 11814 <description> 11815 Method where the modification is occurring 11816 </description> 11817 </param> 11818 <param id="location"> 11819 <jlocation/> 11820 <description> 11821 Location where the modification is occurring 11822 </description> 11823 </param> 11824 <param id="field_klass"> 11825 <jclass field="field"/> 11826 <description> 11827 Class of the field being modified 11828 </description> 11829 </param> 11830 <param id="object"> 11831 <jobject/> 11832 <description> 11833 Object with the field being modified if the field is an 11834 instance field; <code>NULL</code> otherwise 11835 </description> 11836 </param> 11837 <param id="field"> 11838 <jfieldID class="field_klass"/> 11839 <description> 11840 Field being modified 11841 </description> 11842 </param> 11843 <param id="signature_type"> 11844 <char/> 11845 <description> 11846 Signature type of the new value 11847 </description> 11848 </param> 11849 <param id="new_value"> 11850 <jvalue/> 11851 <description> 11852 The new value 11853 </description> 11854 </param> 11855 </parameters> 11856 </event> 11857 11858 <event label="Frame Pop" 11859 id="FramePop" const="JVMTI_EVENT_FRAME_POP" filtered="thread" num="61"> 11860 <description> 11861 Frame pop events are generated upon exit from a single method 11862 in a single frame as specified 11863 in a call to <functionlink id="NotifyFramePop"></functionlink>. 11864 This is true whether termination is caused by 11865 executing its return instruction 11866 or by throwing an exception to its caller 11867 (see <paramlink id="was_popped_by_exception"></paramlink>). 11868 However, frame pops caused by the <functionlink id="PopFrame"/> 11869 function are not reported. 11870 <p/> 11871 The location reported by <functionlink id="GetFrameLocation"></functionlink> 11872 identifies the executable location in the returning method, 11873 immediately prior to the return. 11874 </description> 11875 <origin>jvmdi</origin> 11876 <capabilities> 11877 <required id="can_generate_frame_pop_events"></required> 11878 </capabilities> 11879 <parameters> 11880 <param id="jni_env"> 11881 <outptr> 11882 <struct>JNIEnv</struct> 11883 </outptr> 11884 <description> 11885 The JNI environment of the event (current) thread 11886 </description> 11887 </param> 11888 <param id="thread"> 11889 <jthread/> 11890 <description> 11891 Thread that is popping the frame 11892 </description> 11893 </param> 11894 <param id="klass"> 11895 <jclass method="method"/> 11896 <description> 11897 Class of the method being popped 11898 </description> 11899 </param> 11900 <param id="method"> 11901 <jmethodID class="klass"/> 11902 <description> 11903 Method being popped 11904 </description> 11905 </param> 11906 <param id="was_popped_by_exception"> 11907 <jboolean/> 11908 <description> 11909 True if frame was popped by a thrown exception. 11910 False if method exited through its return instruction. 11911 </description> 11912 </param> 11913 </parameters> 11914 </event> 11915 11916 <event label="Method Entry" 11917 id="MethodEntry" const="JVMTI_EVENT_METHOD_ENTRY" filtered="thread" num="65"> 11918 <description> 11919 Method entry events are generated upon entry of Java 11920 programming language methods (including native methods). 11921 <p/> 11922 The location reported by <functionlink id="GetFrameLocation"></functionlink> 11923 identifies the initial executable location in 11924 the method. 11925 <p/> 11926 Enabling method 11927 entry or exit events will significantly degrade performance on many platforms and is thus 11928 not advised for performance critical usage (such as profiling). 11929 <internallink id="bci">Bytecode instrumentation</internallink> should be 11930 used in these cases. 11931 </description> 11932 <origin>jvmdi</origin> 11933 <capabilities> 11934 <required id="can_generate_method_entry_events"></required> 11935 </capabilities> 11936 <parameters> 11937 <param id="jni_env"> 11938 <outptr> 11939 <struct>JNIEnv</struct> 11940 </outptr> 11941 <description> 11942 The JNI environment of the event (current) thread 11943 </description> 11944 </param> 11945 <param id="thread"> 11946 <jthread/> 11947 <description> 11948 Thread entering the method 11949 </description> 11950 </param> 11951 <param id="klass"> 11952 <jclass method="method"/> 11953 <description> 11954 Class of the method being entered 11955 </description> 11956 </param> 11957 <param id="method"> 11958 <jmethodID class="klass"/> 11959 <description> 11960 Method being entered 11961 </description> 11962 </param> 11963 </parameters> 11964 </event> 11965 11966 <event label="Method Exit" 11967 id="MethodExit" const="JVMTI_EVENT_METHOD_EXIT" filtered="thread" num="66"> 11968 <description> 11969 Method exit events are generated upon exit from Java 11970 programming language methods (including native methods). 11971 This is true whether termination is caused by 11972 executing its return instruction 11973 or by throwing an exception to its caller 11974 (see <paramlink id="was_popped_by_exception"></paramlink>). 11975 <p/> 11976 The <code>method</code> field uniquely identifies the 11977 method being entered or exited. The <code>frame</code> field provides 11978 access to the stack frame for the method. 11979 <p/> 11980 The location reported by <functionlink id="GetFrameLocation"></functionlink> 11981 identifies the executable location in the returning method 11982 immediately prior to the return. 11983 <p/> 11984 Enabling method 11985 entry or exit events will significantly degrade performance on many platforms and is thus 11986 not advised for performance critical usage (such as profiling). 11987 <internallink id="bci">Bytecode instrumentation</internallink> should be 11988 used in these cases. 11989 </description> 11990 <origin>jvmdi</origin> 11991 <capabilities> 11992 <required id="can_generate_method_exit_events"></required> 11993 </capabilities> 11994 <parameters> 11995 <param id="jni_env"> 11996 <outptr> 11997 <struct>JNIEnv</struct> 11998 </outptr> 11999 <description> 12000 The JNI environment of the event (current) thread 12001 </description> 12002 </param> 12003 <param id="thread"> 12004 <jthread/> 12005 <description> 12006 Thread exiting the method 12007 </description> 12008 </param> 12009 <param id="klass"> 12010 <jclass method="method"/> 12011 <description> 12012 Class of the method being exited 12013 </description> 12014 </param> 12015 <param id="method"> 12016 <jmethodID class="klass"/> 12017 <description> 12018 Method being exited 12019 </description> 12020 </param> 12021 <param id="was_popped_by_exception"> 12022 <jboolean/> 12023 <description> 12024 True if frame was popped by a thrown exception. 12025 False if method exited through its return instruction. 12026 </description> 12027 </param> 12028 <param id="return_value"> 12029 <jvalue/> 12030 <description> 12031 The return value of the method being exited. 12032 Undefined and should not be used if 12033 <paramlink id="was_popped_by_exception"></paramlink> 12034 is true. 12035 </description> 12036 </param> 12037 </parameters> 12038 </event> 12039 12040 <event label="Native Method Bind" phase="any" 12041 id="NativeMethodBind" const="JVMTI_EVENT_NATIVE_METHOD_BIND" num="67"> 12042 <description> 12043 A Native Method Bind event is sent when a VM binds a 12044 Java programming language native method 12045 to the address of a function that implements the native method. 12046 This will occur when the native method is called for the first time 12047 and also occurs when the JNI function <code>RegisterNatives</code> is called. 12048 This event allows the bind to be redirected to an agent-specified 12049 proxy function. 12050 This event is not sent when the native method is unbound. 12051 Typically, this proxy function will need to be specific to a 12052 particular method or, to handle the general case, automatically 12053 generated assembly code, since after instrumentation code is 12054 executed the function at the original binding 12055 address will usually be invoked. 12056 The original binding can be restored or the redirection changed 12057 by use of the JNI function <code>RegisterNatives</code>. 12058 Some events may be sent during the primordial phase, JNI and 12059 most of <jvmti/> cannot be used at this time but the method and 12060 address can be saved for use later. 12061 </description> 12062 <origin>new</origin> 12063 <capabilities> 12064 <required id="can_generate_native_method_bind_events"></required> 12065 </capabilities> 12066 <parameters> 12067 <param id="jni_env"> 12068 <outptr> 12069 <struct>JNIEnv</struct> 12070 </outptr> 12071 <description> 12072 The JNI environment of the event (current) thread 12073 Will be <code>NULL</code> if sent during the primordial 12074 <functionlink id="GetPhase">phase</functionlink>. 12075 </description> 12076 </param> 12077 <param id="thread"> 12078 <jthread/> 12079 <description> 12080 Thread requesting the bind 12081 </description> 12082 </param> 12083 <param id="klass"> 12084 <jclass method="method"/> 12085 <description> 12086 Class of the method being bound 12087 </description> 12088 </param> 12089 <param id="method"> 12090 <jmethodID class="klass"/> 12091 <description> 12092 Native method being bound 12093 </description> 12094 </param> 12095 <param id="address"> 12096 <outptr><void/></outptr> 12097 <description> 12098 The address the VM is about to bind to--that is, the 12099 address of the implementation of the native method 12100 </description> 12101 </param> 12102 <param id="new_address_ptr"> 12103 <agentbuf><void/></agentbuf> 12104 <description> 12105 if the referenced address is changed (that is, if 12106 <code>*new_address_ptr</code> is set), the binding 12107 will instead be made to the supplied address. 12108 </description> 12109 </param> 12110 </parameters> 12111 </event> 12112 12113 <event label="Exception" 12114 id="Exception" const="JVMTI_EVENT_EXCEPTION" filtered="thread" num="58"> 12115 <description> 12116 Exception events are generated whenever an exception is first detected 12117 in a Java programming language method. 12118 Where "exception" means any <code>java.lang.Throwable</code>. 12119 The exception may have been thrown by a Java programming language or native 12120 method, but in the case of native methods, the event is not generated 12121 until the exception is first seen by a Java programming language method. If an exception is 12122 set and cleared in a native method (and thus is never visible to Java programming language code), 12123 no exception event is generated. 12124 <p/> 12125 The <code>method</code> and <code>location</code> 12126 parameters uniquely identify the current location 12127 (where the exception was detected) and allow 12128 the mapping to source file and line number when that information is 12129 available. The <code>exception</code> field identifies the thrown 12130 exception object. The <code>catch_method</code> 12131 and <code>catch_location</code> identify the location of the catch clause, 12132 if any, that handles the thrown exception. If there is no such catch clause, 12133 each field is set to 0. There is no guarantee that the thread will ever 12134 reach this catch clause. If there are native methods on the call stack 12135 between the throw location and the catch clause, the exception may 12136 be reset by one of those native methods. 12137 Similarly, exceptions that are reported as uncaught (<code>catch_klass</code> 12138 et al. set to 0) may in fact be caught by native code. 12139 Agents can check for these occurrences by monitoring 12140 <eventlink id="ExceptionCatch"></eventlink> events. 12141 Note that finally clauses are implemented as catch and re-throw. Therefore they 12142 will be reported in the catch location. 12143 </description> 12144 <origin>jvmdi</origin> 12145 <capabilities> 12146 <required id="can_generate_exception_events"></required> 12147 </capabilities> 12148 <parameters> 12149 <param id="jni_env"> 12150 <outptr> 12151 <struct>JNIEnv</struct> 12152 </outptr> 12153 <description> 12154 The JNI environment of the event (current) thread 12155 </description> 12156 </param> 12157 <param id="thread"> 12158 <jthread/> 12159 <description> 12160 Thread generating the exception 12161 </description> 12162 </param> 12163 <param id="klass"> 12164 <jclass method="method"/> 12165 <description> 12166 Class generating the exception 12167 </description> 12168 </param> 12169 <param id="method"> 12170 <jmethodID class="klass"/> 12171 <description> 12172 Method generating the exception 12173 </description> 12174 </param> 12175 <param id="location"> 12176 <jlocation/> 12177 <description> 12178 Location where exception occurred 12179 </description> 12180 </param> 12181 <param id="exception"> 12182 <jobject/> 12183 <description> 12184 The exception being thrown 12185 </description> 12186 </param> 12187 <param id="catch_klass"> 12188 <jclass method="catch_method"/> 12189 <description> 12190 Class that will catch the exception, or <code>NULL</code> if no known catch 12191 </description> 12192 </param> 12193 <param id="catch_method"> 12194 <jmethodID class="catch_klass"/> 12195 <description> 12196 Method that will catch the exception, or <code>NULL</code> if no known catch 12197 </description> 12198 </param> 12199 <param id="catch_location"> 12200 <jlocation/> 12201 <description> 12202 location which will catch the exception or zero if no known catch 12203 </description> 12204 </param> 12205 </parameters> 12206 </event> 12207 12208 <event label="Exception Catch" 12209 id="ExceptionCatch" const="JVMTI_EVENT_EXCEPTION_CATCH" filtered="thread" num="59"> 12210 <description> 12211 Exception catch events are generated whenever a thrown exception is caught. 12212 Where "exception" means any <code>java.lang.Throwable</code>. 12213 If the exception is caught in a Java programming language method, the event is generated 12214 when the catch clause is reached. If the exception is caught in a native 12215 method, the event is generated as soon as control is returned to a Java programming language 12216 method. Exception catch events are generated for any exception for which 12217 a throw was detected in a Java programming language method. 12218 Note that finally clauses are implemented as catch and re-throw. Therefore they 12219 will generate exception catch events. 12220 <p/> 12221 The <code>method</code> and <code>location</code> 12222 parameters uniquely identify the current location 12223 and allow the mapping to source file and line number when that information is 12224 available. For exceptions caught in a Java programming language method, the 12225 <code>exception</code> object identifies the exception object. Exceptions 12226 caught in native methods are not necessarily available by the time the 12227 exception catch is reported, so the <code>exception</code> field is set 12228 to <code>NULL</code>. 12229 </description> 12230 <origin>jvmdi</origin> 12231 <capabilities> 12232 <required id="can_generate_exception_events"></required> 12233 </capabilities> 12234 <parameters> 12235 <param id="jni_env"> 12236 <outptr> 12237 <struct>JNIEnv</struct> 12238 </outptr> 12239 <description> 12240 The JNI environment of the event (current) thread 12241 </description> 12242 </param> 12243 <param id="thread"> 12244 <jthread/> 12245 <description> 12246 Thread catching the exception 12247 </description> 12248 </param> 12249 <param id="klass"> 12250 <jclass method="method"/> 12251 <description> 12252 Class catching the exception 12253 </description> 12254 </param> 12255 <param id="method"> 12256 <jmethodID class="klass"/> 12257 <description> 12258 Method catching the exception 12259 </description> 12260 </param> 12261 <param id="location"> 12262 <jlocation/> 12263 <description> 12264 Location where exception is being caught 12265 </description> 12266 </param> 12267 <param id="exception"> 12268 <jobject/> 12269 <description> 12270 Exception being caught 12271 </description> 12272 </param> 12273 </parameters> 12274 </event> 12275 12276 <event label="Thread Start" 12277 id="ThreadStart" const="JVMTI_EVENT_THREAD_START" num="52" phase="start"> 12278 <description> 12279 Thread start events are generated by a new thread before its initial 12280 method executes. 12281 <p/> 12282 A thread may be listed in the array returned by 12283 <functionlink id="GetAllThreads"></functionlink> 12284 before its thread start event is generated. 12285 It is possible for other events to be generated 12286 on a thread before its thread start event. 12287 <p/> 12288 The event is sent on the newly started <paramlink id="thread"></paramlink>. 12289 </description> 12290 <origin>jvmdi</origin> 12291 <capabilities> 12292 </capabilities> 12293 <parameters> 12294 <param id="jni_env"> 12295 <outptr> 12296 <struct>JNIEnv</struct> 12297 </outptr> 12298 <description> 12299 The JNI environment of the event (current) thread. 12300 </description> 12301 </param> 12302 <param id="thread"> 12303 <jthread/> 12304 <description> 12305 Thread starting 12306 </description> 12307 </param> 12308 </parameters> 12309 </event> 12310 12311 <event label="Thread End" 12312 id="ThreadEnd" const="JVMTI_EVENT_THREAD_END" filtered="thread" num="53" phase="start"> 12313 <description> 12314 Thread end events are generated by a terminating thread 12315 after its initial method has finished execution. 12316 <p/> 12317 A thread may be listed in the array returned by 12318 <functionlink id="GetAllThreads"></functionlink> 12319 after its thread end event is generated. 12320 No events are generated on a thread 12321 after its thread end event. 12322 <p/> 12323 The event is sent on the dying <paramlink id="thread"></paramlink>. 12324 </description> 12325 <origin>jvmdi</origin> 12326 <capabilities> 12327 </capabilities> 12328 <parameters> 12329 <param id="jni_env"> 12330 <outptr> 12331 <struct>JNIEnv</struct> 12332 </outptr> 12333 <description> 12334 The JNI environment of the event (current) thread. 12335 </description> 12336 </param> 12337 <param id="thread"> 12338 <jthread/> 12339 <description> 12340 Thread ending 12341 </description> 12342 </param> 12343 </parameters> 12344 </event> 12345 12346 <event label="Class Load" 12347 id="ClassLoad" const="JVMTI_EVENT_CLASS_LOAD" filtered="thread" phase="start" num="55"> 12348 <description> 12349 A class load event is generated when a class is first loaded. The order 12350 of class load events generated by a particular thread are guaranteed 12351 to match the order of class loading within that thread. 12352 Array class creation does not generate a class load event. 12353 The creation of a primitive class (for example, java.lang.Integer.TYPE) 12354 does not generate a class load event. 12355 <p/> 12356 This event is sent at an early stage in loading the class. As 12357 a result the class should be used carefully. Note, for example, 12358 that methods and fields are not yet loaded, so queries for methods, 12359 fields, subclasses, and so on will not give correct results. 12360 See "Loading of Classes and Interfaces" in the <i>Java Language 12361 Specification</i>. For most 12362 purposes the <eventlink id="ClassPrepare"></eventlink> event will 12363 be more useful. 12364 </description> 12365 <origin>jvmdi</origin> 12366 <capabilities> 12367 </capabilities> 12368 <parameters> 12369 <param id="jni_env"> 12370 <outptr> 12371 <struct>JNIEnv</struct> 12372 </outptr> 12373 <description> 12374 The JNI environment of the event (current) thread 12375 </description> 12376 </param> 12377 <param id="thread"> 12378 <jthread/> 12379 <description> 12380 Thread loading the class 12381 </description> 12382 </param> 12383 <param id="klass"> 12384 <jclass/> 12385 <description> 12386 Class being loaded 12387 </description> 12388 </param> 12389 </parameters> 12390 </event> 12391 12392 <elide> 12393 <event label="Class Unload" 12394 id="ClassUnload" const="JVMTI_EVENT_CLASS_UNLOAD" num="57"> 12395 <description> 12396 A class unload event is generated when the class is about to be unloaded. 12397 Class unload events take place during garbage collection and must be 12398 handled extremely carefully. The garbage collector holds many locks 12399 and has suspended all other threads, so the event handler cannot depend 12400 on the ability to acquire any locks. The class unload event handler should 12401 do as little as possible, perhaps by queuing information to be processed 12402 later. In particular, the <code>jclass</code> should be used only in 12403 the JNI function <code>isSameObject</code> or in the following <jvmti/> functions: 12404 <ul> 12405 <li><functionlink id="GetClassSignature"></functionlink></li> 12406 <li><functionlink id="GetSourceFileName"></functionlink></li> 12407 <li><functionlink id="IsInterface"></functionlink></li> 12408 <li><functionlink id="IsArrayClass"></functionlink></li> 12409 </ul> 12410 </description> 12411 <origin>jvmdi</origin> 12412 <capabilities> 12413 </capabilities> 12414 <parameters> 12415 <param id="jni_env"> 12416 <outptr> 12417 <struct>JNIEnv</struct> 12418 </outptr> 12419 <description> 12420 The JNI environment of the event (current) thread 12421 </description> 12422 </param> 12423 <param id="thread"> 12424 <jthread/> 12425 <description> 12426 Thread generating the class unload 12427 </description> 12428 </param> 12429 <param id="klass"> 12430 <jclass/> 12431 <description> 12432 Class being unloaded 12433 </description> 12434 </param> 12435 </parameters> 12436 </event> 12437 </elide> 12438 12439 <event label="Class Prepare" 12440 id="ClassPrepare" const="JVMTI_EVENT_CLASS_PREPARE" filtered="thread" phase="start" num="56"> 12441 <description> 12442 A class prepare event is generated when class preparation is complete. 12443 At this point, class fields, methods, and implemented interfaces are 12444 available, and no code from the class has been executed. Since array 12445 classes never have fields or methods, class prepare events are not 12446 generated for them. Class prepare events are not generated for 12447 primitive classes (for example, <code>java.lang.Integer.TYPE</code>). 12448 </description> 12449 <origin>jvmdi</origin> 12450 <capabilities> 12451 </capabilities> 12452 <parameters> 12453 <param id="jni_env"> 12454 <outptr> 12455 <struct>JNIEnv</struct> 12456 </outptr> 12457 <description> 12458 The JNI environment of the event (current) thread 12459 </description> 12460 </param> 12461 <param id="thread"> 12462 <jthread/> 12463 <description> 12464 Thread generating the class prepare 12465 </description> 12466 </param> 12467 <param id="klass"> 12468 <jclass/> 12469 <description> 12470 Class being prepared 12471 </description> 12472 </param> 12473 </parameters> 12474 </event> 12475 12476 <event label="Class File Load Hook" phase="any" 12477 id="ClassFileLoadHook" const="JVMTI_EVENT_CLASS_FILE_LOAD_HOOK" num="54"> 12478 <description> 12479 This event is sent when the VM obtains class file data, 12480 but before it constructs 12481 the in-memory representation for that class. 12482 This event is also sent when the class is being modified by the 12483 <functionlink id="RetransformClasses"/> function or 12484 the <functionlink id="RedefineClasses"/> function, 12485 called in any <jvmti/> environment. 12486 The agent can instrument 12487 the existing class file data sent by the VM to include profiling/debugging hooks. 12488 See the description of 12489 <internallink id="bci">bytecode instrumentation</internallink> 12490 for usage information. 12491 <p/> 12492 When the capabilities 12493 <internallink id="jvmtiCapabilities.can_generate_early_class_hook_events"> 12494 <code>can_generate_early_class_hook_events</code></internallink> and 12495 <internallink id="jvmtiCapabilities.can_generate_all_class_hook_events"> 12496 <code>can_generate_all_class_hook_events</code></internallink> 12497 are enabled then this event may be sent in the primordial phase. 12498 Otherwise, this event may be sent before the VM is initialized (the start 12499 <functionlink id="GetPhase">phase</functionlink>). 12500 Some classes might not be compatible 12501 with the function (eg. ROMized classes or implementation defined classes) and this event will 12502 not be generated for these classes. 12503 <p/> 12504 The agent must allocate the space for the modified 12505 class file data buffer 12506 using the memory allocation function 12507 <functionlink id="Allocate"></functionlink> because the 12508 VM is responsible for freeing the new class file data buffer 12509 using <functionlink id="Deallocate"></functionlink>. 12510 <p/> 12511 If the agent wishes to modify the class file, it must set 12512 <code>new_class_data</code> to point 12513 to the newly instrumented class file data buffer and set 12514 <code>new_class_data_len</code> to the length of that 12515 buffer before returning 12516 from this call. If no modification is desired, the agent simply 12517 does not set <code>new_class_data</code>. If multiple agents 12518 have enabled this event the results are chained. That is, if 12519 <code>new_class_data</code> has been set, it becomes the 12520 <code>class_data</code> for the next agent. 12521 <p/> 12522 When handling a class load in the live phase, then the 12523 <functionlink id="GetNamedModule"></functionlink> 12524 function can be used to map class loader and a package name to a module. 12525 When a class is being redefined or retransformed then 12526 <code>class_being_redefined</code> is non <code>NULL</code> and so 12527 the JNI <code>GetModule</code> function can also be used 12528 to obtain the Module. 12529 <p/> 12530 The order that this event is sent to each environment differs 12531 from other events. 12532 This event is sent to environments in the following order: 12533 <ul> 12534 <li><fieldlink id="can_retransform_classes" 12535 struct="jvmtiCapabilities">retransformation 12536 incapable</fieldlink> 12537 environments, in the 12538 order in which they were created 12539 </li> 12540 <li><fieldlink id="can_retransform_classes" 12541 struct="jvmtiCapabilities">retransformation 12542 capable</fieldlink> 12543 environments, in the 12544 order in which they were created 12545 </li> 12546 </ul> 12547 When triggered by <functionlink id="RetransformClasses"/>, 12548 this event is sent only to <fieldlink id="can_retransform_classes" 12549 struct="jvmtiCapabilities">retransformation 12550 capable</fieldlink> 12551 environments. 12552 </description> 12553 <origin>jvmpi</origin> 12554 <capabilities> 12555 <capability id="can_generate_all_class_hook_events"></capability> 12556 <capability id="can_generate_early_class_hook_events"></capability> 12557 </capabilities> 12558 <parameters> 12559 <param id="jni_env"> 12560 <outptr> 12561 <struct>JNIEnv</struct> 12562 </outptr> 12563 <description> 12564 The JNI environment of the event (current) thread. 12565 </description> 12566 </param> 12567 <param id="class_being_redefined"> 12568 <jclass/> 12569 <description> 12570 The class being 12571 <functionlink id="RedefineClasses">redefined</functionlink> or 12572 <functionlink id="RetransformClasses">retransformed</functionlink>. 12573 <code>NULL</code> if sent by class load. 12574 </description> 12575 </param> 12576 <param id="loader"> 12577 <jobject/> 12578 <description> 12579 The class loader loading the class. 12580 <code>NULL</code> if the bootstrap class loader. 12581 </description> 12582 </param> 12583 <param id="name"> 12584 <vmbuf><char/></vmbuf> 12585 <description> 12586 Name of class being loaded as a VM internal qualified name 12587 (for example, "java/util/List"), encoded as a 12588 <internallink id="mUTF">modified UTF-8</internallink> string. 12589 Note: if the class is defined with a <code>NULL</code> name or 12590 without a name specified, <code>name</code> will be <code>NULL</code>. 12591 </description> 12592 </param> 12593 <param id="protection_domain"> 12594 <jobject/> 12595 <description> 12596 The <code>ProtectionDomain</code> of the class. 12597 </description> 12598 </param> 12599 <param id="class_data_len"> 12600 <jint/> 12601 <description> 12602 Length of current class file data buffer. 12603 </description> 12604 </param> 12605 <param id="class_data"> 12606 <vmbuf><uchar/></vmbuf> 12607 <description> 12608 Pointer to the current class file data buffer. 12609 </description> 12610 </param> 12611 <param id="new_class_data_len"> 12612 <outptr><jint/></outptr> 12613 <description> 12614 Pointer to the length of the new class file data buffer. 12615 </description> 12616 </param> 12617 <param id="new_class_data"> 12618 <agentbuf incount="new_class_data_len"><uchar/></agentbuf> 12619 <description> 12620 Pointer to the pointer to the instrumented class file data buffer. 12621 </description> 12622 </param> 12623 </parameters> 12624 </event> 12625 12626 <event label="VM Start Event" 12627 id="VMStart" const="JVMTI_EVENT_VM_START" num="57" phase="start"> 12628 <description> 12629 The VM start event signals the start of the VM. 12630 At this time JNI is live but the VM is not yet fully initialized. 12631 Once this event is generated, the agent is free to call any JNI function. 12632 This event signals the beginning of the start phase, 12633 <jvmti/> functions permitted in the start phase may be called. 12634 <p/> 12635 The timing of this event may depend on whether the agent has added the 12636 <internallink id="jvmtiCapabilities.can_generate_early_vmstart"> 12637 <code>can_generate_early_vmstart</code></internallink> capability or not. 12638 If the capability has been added then the VM posts the event as early 12639 as possible. The VM is capable of executing bytecode but it may not have 12640 initialized to the point where it can load classes in modules other than 12641 <code>java.base</code>. Agents that do load-time instrumentation in this 12642 phase must take great care when instrumenting code that potentially 12643 executes in this phase. Care should also be taken with JNI 12644 <code>FindClass</code> as it may not be possible to load classes that are 12645 not in the <code>java.base</code> module. 12646 If the capability has not been added then the VM delays posting this 12647 event until it is capable of loading classes in modules other than 12648 <code>java.base</code> or the VM has completed its initialization. 12649 Agents that create more than one JVM TI environment, where the 12650 capability is added to some but not all environments, may observe the 12651 start phase beginning earlier in the JVM TI environments that possess 12652 the capabilty. 12653 <p/> 12654 In the case of VM start-up failure, this event will not be sent. 12655 </description> 12656 <origin>jvmdi</origin> 12657 <capabilities> 12658 </capabilities> 12659 <parameters> 12660 <param id="jni_env"> 12661 <outptr> 12662 <struct>JNIEnv</struct> 12663 </outptr> 12664 <description> 12665 The JNI environment of the event (current) thread. 12666 </description> 12667 </param> 12668 </parameters> 12669 </event> 12670 12671 <event label="VM Initialization Event" 12672 id="VMInit" const="JVMTI_EVENT_VM_INIT" num="50"> 12673 <description> 12674 The VM initialization event signals the completion of VM initialization. Once 12675 this event is generated, the agent is free to call any JNI or <jvmti/> 12676 function. The VM initialization event can be preceded by or can be concurrent 12677 with other events, but 12678 the preceding events should be handled carefully, if at all, because the 12679 VM has not completed its initialization. The thread start event for the 12680 main application thread is guaranteed not to occur until after the 12681 handler for the VM initialization event returns. 12682 <p/> 12683 In the case of VM start-up failure, this event will not be sent. 12684 </description> 12685 <origin>jvmdi</origin> 12686 <capabilities> 12687 </capabilities> 12688 <parameters> 12689 <param id="jni_env"> 12690 <outptr> 12691 <struct>JNIEnv</struct> 12692 </outptr> 12693 <description> 12694 The JNI environment of the event (current) thread. 12695 </description> 12696 </param> 12697 <param id="thread"> 12698 <jthread/> 12699 <description> 12700 The initial thread 12701 </description> 12702 </param> 12703 </parameters> 12704 </event> 12705 12706 <event label="VM Death Event" 12707 id="VMDeath" const="JVMTI_EVENT_VM_DEATH" num="51"> 12708 <description> 12709 The VM death event notifies the agent of the termination of the VM. 12710 No events will occur after the VMDeath event. 12711 <p/> 12712 In the case of VM start-up failure, this event will not be sent. 12713 Note that <internallink id="onunload">Agent_OnUnload</internallink> 12714 will still be called in these cases. 12715 </description> 12716 <origin>jvmdi</origin> 12717 <capabilities> 12718 </capabilities> 12719 <parameters> 12720 <param id="jni_env"> 12721 <outptr> 12722 <struct>JNIEnv</struct> 12723 </outptr> 12724 <description> 12725 The JNI environment of the event (current) thread 12726 </description> 12727 </param> 12728 </parameters> 12729 </event> 12730 12731 <event label="Compiled Method Load" phase="start" 12732 id="CompiledMethodLoad" const="JVMTI_EVENT_COMPILED_METHOD_LOAD" num="68"> 12733 <description> 12734 Sent when a method is compiled and loaded into memory by the VM. 12735 If it is unloaded, the <eventlink id="CompiledMethodUnload"/> event is sent. 12736 If it is moved, the <eventlink id="CompiledMethodUnload"/> event is sent, 12737 followed by a new <code>CompiledMethodLoad</code> event. 12738 Note that a single method may have multiple compiled forms, and that 12739 this event will be sent for each form. 12740 Note also that several methods may be inlined into a single 12741 address range, and that this event will be sent for each method. 12742 <p/> 12743 These events can be sent after their initial occurrence with 12744 <functionlink id="GenerateEvents"></functionlink>. 12745 </description> 12746 <origin>jvmpi</origin> 12747 <typedef id="jvmtiAddrLocationMap" label="Native address to location entry"> 12748 <field id="start_address"> 12749 <vmbuf><void/></vmbuf> 12750 <description> 12751 Starting native address of code corresponding to a location 12752 </description> 12753 </field> 12754 <field id="location"> 12755 <jlocation/> 12756 <description> 12757 Corresponding location. See 12758 <functionlink id="GetJLocationFormat"></functionlink> 12759 for the meaning of location. 12760 </description> 12761 </field> 12762 </typedef> 12763 <capabilities> 12764 <required id="can_generate_compiled_method_load_events"></required> 12765 </capabilities> 12766 <parameters> 12767 <param id="klass"> 12768 <jclass method="method"/> 12769 <description> 12770 Class of the method being compiled and loaded 12771 </description> 12772 </param> 12773 <param id="method"> 12774 <jmethodID class="klass"/> 12775 <description> 12776 Method being compiled and loaded 12777 </description> 12778 </param> 12779 <param id="code_size"> 12780 <jint/> 12781 <description> 12782 Size of compiled code 12783 </description> 12784 </param> 12785 <param id="code_addr"> 12786 <vmbuf><void/></vmbuf> 12787 <description> 12788 Address where compiled method code is loaded 12789 </description> 12790 </param> 12791 <param id="map_length"> 12792 <jint/> 12793 <description> 12794 Number of <typelink id="jvmtiAddrLocationMap"></typelink> 12795 entries in the address map. 12796 Zero if mapping information cannot be supplied. 12797 </description> 12798 </param> 12799 <param id="map"> 12800 <vmbuf><struct>jvmtiAddrLocationMap</struct></vmbuf> 12801 <description> 12802 Map from native addresses to location. 12803 The native address range of each entry is from 12804 <fieldlink id="start_address" struct="jvmtiAddrLocationMap"></fieldlink> 12805 to <code>start_address-1</code> of the next entry. 12806 <code>NULL</code> if mapping information cannot be supplied. 12807 </description> 12808 </param> 12809 <param id="compile_info"> 12810 <vmbuf><void/></vmbuf> 12811 <description> 12812 VM-specific compilation information. 12813 The referenced compile information is managed by the VM 12814 and must not depend on the agent for collection. 12815 A VM implementation defines the content and lifetime 12816 of the information. 12817 </description> 12818 </param> 12819 </parameters> 12820 </event> 12821 12822 <event label="Compiled Method Unload" phase="start" 12823 id="CompiledMethodUnload" const="JVMTI_EVENT_COMPILED_METHOD_UNLOAD" num="69"> 12824 <description> 12825 Sent when a compiled method is unloaded from memory. 12826 This event might not be sent on the thread which performed the unload. 12827 This event may be sent sometime after the unload occurs, but 12828 will be sent before the memory is reused 12829 by a newly generated compiled method. This event may be sent after 12830 the class is unloaded. 12831 </description> 12832 <origin>jvmpi</origin> 12833 <capabilities> 12834 <required id="can_generate_compiled_method_load_events"></required> 12835 </capabilities> 12836 <parameters> 12837 <param id="klass"> 12838 <jclass method="method"/> 12839 <description> 12840 Class of the compiled method being unloaded. 12841 </description> 12842 </param> 12843 <param id="method"> 12844 <jmethodID class="klass"/> 12845 <description> 12846 Compiled method being unloaded. 12847 For identification of the compiled method only -- the class 12848 may be unloaded and therefore the method should not be used 12849 as an argument to further JNI or <jvmti/> functions. 12850 </description> 12851 </param> 12852 <param id="code_addr"> 12853 <vmbuf><void/></vmbuf> 12854 <description> 12855 Address where compiled method code was loaded. 12856 For identification of the compiled method only -- 12857 the space may have been reclaimed. 12858 </description> 12859 </param> 12860 </parameters> 12861 </event> 12862 12863 <event label="Dynamic Code Generated" phase="any" 12864 id="DynamicCodeGenerated" const="JVMTI_EVENT_DYNAMIC_CODE_GENERATED" num="70"> 12865 <description> 12866 Sent when a component of the virtual machine is generated dynamically. 12867 This does not correspond to Java programming language code that is 12868 compiled--see <eventlink id="CompiledMethodLoad"></eventlink>. 12869 This is for native code--for example, an interpreter that is generated 12870 differently depending on command-line options. 12871 <p/> 12872 Note that this event has no controlling capability. 12873 If a VM cannot generate these events, it simply does not send any. 12874 <p/> 12875 These events can be sent after their initial occurrence with 12876 <functionlink id="GenerateEvents"></functionlink>. 12877 </description> 12878 <origin>jvmpi</origin> 12879 <capabilities> 12880 </capabilities> 12881 <parameters> 12882 <param id="name"> 12883 <vmbuf><char/></vmbuf> 12884 <description> 12885 Name of the code, encoded as a 12886 <internallink id="mUTF">modified UTF-8</internallink> string. 12887 Intended for display to an end-user. 12888 The name might not be unique. 12889 </description> 12890 </param> 12891 <param id="address"> 12892 <vmbuf><void/></vmbuf> 12893 <description> 12894 Native address of the code 12895 </description> 12896 </param> 12897 <param id="length"> 12898 <jint/> 12899 <description> 12900 Length in bytes of the code 12901 </description> 12902 </param> 12903 </parameters> 12904 </event> 12905 12906 <event label="Data Dump Request" 12907 id="DataDumpRequest" const="JVMTI_EVENT_DATA_DUMP_REQUEST" num="71"> 12908 <description> 12909 Sent by the VM to request the agent to dump its data. This 12910 is just a hint and the agent need not react to this event. 12911 This is useful for processing command-line signals from users. For 12912 example, in the Java 2 SDK a CTRL-Break on Win32 and a CTRL-\ on Solaris 12913 causes the VM to send this event to the agent. 12914 </description> 12915 <origin>jvmpi</origin> 12916 <capabilities> 12917 </capabilities> 12918 <parameters> 12919 </parameters> 12920 </event> 12921 12922 <event label="Monitor Contended Enter" 12923 id="MonitorContendedEnter" const="JVMTI_EVENT_MONITOR_CONTENDED_ENTER" filtered="thread" num="75"> 12924 <description> 12925 Sent when a thread is attempting to enter a Java programming language 12926 monitor already acquired by another thread. 12927 </description> 12928 <origin>jvmpi</origin> 12929 <capabilities> 12930 <required id="can_generate_monitor_events"></required> 12931 </capabilities> 12932 <parameters> 12933 <param id="jni_env"> 12934 <outptr> 12935 <struct>JNIEnv</struct> 12936 </outptr> 12937 <description> 12938 The JNI environment of the event (current) thread 12939 </description> 12940 </param> 12941 <param id="thread"> 12942 <jthread/> 12943 <description> 12944 JNI local reference to the thread 12945 attempting to enter the monitor 12946 </description> 12947 </param> 12948 <param id="object"> 12949 <jobject/> 12950 <description> 12951 JNI local reference to the monitor 12952 </description> 12953 </param> 12954 </parameters> 12955 </event> 12956 12957 <event label="Monitor Contended Entered" 12958 id="MonitorContendedEntered" const="JVMTI_EVENT_MONITOR_CONTENDED_ENTERED" filtered="thread" num="76"> 12959 <description> 12960 Sent when a thread enters a Java programming language 12961 monitor after waiting for it to be released by another thread. 12962 </description> 12963 <origin>jvmpi</origin> 12964 <capabilities> 12965 <required id="can_generate_monitor_events"></required> 12966 </capabilities> 12967 <parameters> 12968 <param id="jni_env"> 12969 <outptr> 12970 <struct>JNIEnv</struct> 12971 </outptr> 12972 <description> 12973 The JNI environment of the event (current) thread 12974 </description> 12975 </param> 12976 <param id="thread"> 12977 <jthread/> 12978 <description> 12979 JNI local reference to the thread entering 12980 the monitor 12981 </description> 12982 </param> 12983 <param id="object"> 12984 <jobject/> 12985 <description> 12986 JNI local reference to the monitor 12987 </description> 12988 </param> 12989 </parameters> 12990 </event> 12991 12992 <event label="Monitor Wait" 12993 id="MonitorWait" const="JVMTI_EVENT_MONITOR_WAIT" filtered="thread" num="73"> 12994 <description> 12995 Sent when a thread is about to wait on an object. 12996 </description> 12997 <origin>jvmpi</origin> 12998 <capabilities> 12999 <required id="can_generate_monitor_events"></required> 13000 </capabilities> 13001 <parameters> 13002 <param id="jni_env"> 13003 <outptr> 13004 <struct>JNIEnv</struct> 13005 </outptr> 13006 <description> 13007 The JNI environment of the event (current) thread 13008 </description> 13009 </param> 13010 <param id="thread"> 13011 <jthread/> 13012 <description> 13013 JNI local reference to the thread about to wait 13014 </description> 13015 </param> 13016 <param id="object"> 13017 <jobject/> 13018 <description> 13019 JNI local reference to the monitor 13020 </description> 13021 </param> 13022 <param id="timeout"> 13023 <jlong/> 13024 <description> 13025 The number of milliseconds the thread will wait 13026 </description> 13027 </param> 13028 </parameters> 13029 </event> 13030 13031 <event label="Monitor Waited" 13032 id="MonitorWaited" const="JVMTI_EVENT_MONITOR_WAITED" filtered="thread" num="74"> 13033 <description> 13034 Sent when a thread finishes waiting on an object. 13035 </description> 13036 <origin>jvmpi</origin> 13037 <capabilities> 13038 <required id="can_generate_monitor_events"></required> 13039 </capabilities> 13040 <parameters> 13041 <param id="jni_env"> 13042 <outptr> 13043 <struct>JNIEnv</struct> 13044 </outptr> 13045 <description> 13046 The JNI environment of the event (current) thread 13047 </description> 13048 </param> 13049 <param id="thread"> 13050 <jthread/> 13051 <description> 13052 JNI local reference to the thread that was finished waiting 13053 </description> 13054 </param> 13055 <param id="object"> 13056 <jobject/> 13057 <description> 13058 JNI local reference to the monitor. 13059 </description> 13060 </param> 13061 <param id="timed_out"> 13062 <jboolean/> 13063 <description> 13064 True if the monitor timed out 13065 </description> 13066 </param> 13067 </parameters> 13068 </event> 13069 13070 <event label="Resource Exhausted" 13071 id="ResourceExhausted" const="JVMTI_EVENT_RESOURCE_EXHAUSTED" num="80" 13072 since="1.1"> 13073 <description> 13074 Sent when a VM resource needed by a running application has been exhausted. 13075 Except as required by the optional capabilities, the set of resources 13076 which report exhaustion is implementation dependent. 13077 <p/> 13078 The following bit flags define the properties of the resource exhaustion: 13079 <constants id="jvmtiResourceExhaustionFlags" 13080 label="Resource Exhaustion Flags" 13081 kind="bits" 13082 since="1.1"> 13083 <constant id="JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR" num="0x0001"> 13084 After this event returns, the VM will throw a 13085 <code>java.lang.OutOfMemoryError</code>. 13086 </constant> 13087 <constant id="JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP" num="0x0002"> 13088 The VM was unable to allocate memory from the <tm>Java</tm> 13089 platform <i>heap</i>. 13090 The <i>heap</i> is the runtime 13091 data area from which memory for all class instances and 13092 arrays are allocated. 13093 </constant> 13094 <constant id="JVMTI_RESOURCE_EXHAUSTED_THREADS" num="0x0004"> 13095 The VM was unable to create a thread. 13096 </constant> 13097 </constants> 13098 </description> 13099 <origin>new</origin> 13100 <capabilities> 13101 <capability id="can_generate_resource_exhaustion_heap_events"> 13102 Can generate events when the VM is unable to allocate memory from the 13103 <internallink id="JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP">heap</internallink>. 13104 </capability> 13105 <capability id="can_generate_resource_exhaustion_threads_events"> 13106 Can generate events when the VM is unable to 13107 <internallink id="JVMTI_RESOURCE_EXHAUSTED_THREADS">create 13108 a thread</internallink>. 13109 </capability> 13110 </capabilities> 13111 <parameters> 13112 <param id="jni_env"> 13113 <outptr> 13114 <struct>JNIEnv</struct> 13115 </outptr> 13116 <description> 13117 The JNI environment of the event (current) thread 13118 </description> 13119 </param> 13120 <param id="flags"> 13121 <jint/> 13122 <description> 13123 Flags defining the properties of the of resource exhaustion 13124 as specified by the 13125 <internallink id="jvmtiResourceExhaustionFlags">Resource 13126 Exhaustion Flags</internallink>. 13127 </description> 13128 </param> 13129 <param id="reserved"> 13130 <vmbuf><void/></vmbuf> 13131 <description> 13132 Reserved. 13133 </description> 13134 </param> 13135 <param id="description"> 13136 <vmbuf><char/></vmbuf> 13137 <description> 13138 Description of the resource exhaustion, encoded as a 13139 <internallink id="mUTF">modified UTF-8</internallink> string. 13140 </description> 13141 </param> 13142 </parameters> 13143 </event> 13144 13145 <event label="VM Object Allocation" 13146 id="VMObjectAlloc" const="JVMTI_EVENT_VM_OBJECT_ALLOC" num="84"> 13147 <description> 13148 Sent when a method causes the virtual machine to allocate an 13149 Object visible to Java programming language code and the 13150 allocation is not detectable by other intrumentation mechanisms. 13151 Generally object allocation should be detected by instrumenting 13152 the bytecodes of allocating methods. 13153 Object allocation generated in native code by JNI function 13154 calls should be detected using 13155 <internallink id="jniIntercept">JNI function interception</internallink>. 13156 Some methods might not have associated bytecodes and are not 13157 native methods, they instead are executed directly by the 13158 VM. These methods should send this event. 13159 Virtual machines which are incapable of bytecode instrumentation 13160 for some or all of their methods can send this event. 13161 <p/> 13162 Typical examples where this event might be sent: 13163 <ul> 13164 <li>Reflection -- for example, <code>java.lang.Class.newInstance()</code></li> 13165 <li>Methods not represented by bytecodes -- for example, VM intrinsics and 13166 J2ME preloaded classes</li> 13167 </ul> 13168 Cases where this event would not be generated: 13169 <ul> 13170 <li>Allocation due to bytecodes -- for example, the <code>new</code> 13171 and <code>newarray</code> VM instructions</li> 13172 <li>Allocation due to JNI function calls -- for example, 13173 <code>AllocObject</code></li> 13174 <li>Allocations during VM initialization</li> 13175 <li>VM internal objects</li> 13176 </ul> 13177 </description> 13178 <origin>new</origin> 13179 <capabilities> 13180 <required id="can_generate_vm_object_alloc_events"></required> 13181 </capabilities> 13182 <parameters> 13183 <param id="jni_env"> 13184 <outptr> 13185 <struct>JNIEnv</struct> 13186 </outptr> 13187 <description> 13188 The JNI environment of the event (current) thread 13189 </description> 13190 </param> 13191 <param id="thread"> 13192 <jthread/> 13193 <description> 13194 Thread allocating the object. 13195 </description> 13196 </param> 13197 <param id="object"> 13198 <jobject/> 13199 <description> 13200 JNI local reference to the object that was allocated 13201 </description> 13202 </param> 13203 <param id="object_klass"> 13204 <jclass/> 13205 <description> 13206 JNI local reference to the class of the object 13207 </description> 13208 </param> 13209 <param id="size"> 13210 <jlong/> 13211 <description> 13212 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 13213 </description> 13214 </param> 13215 </parameters> 13216 </event> 13217 13218 <event label="Object Free" 13219 id="ObjectFree" const="JVMTI_EVENT_OBJECT_FREE" num="83"> 13220 <description> 13221 An Object Free event is sent when the garbage collector frees an object. 13222 Events are only sent for tagged objects--see 13223 <internallink id="Heap">heap functions</internallink>. 13224 <p/> 13225 The event handler must not use JNI functions and 13226 must not use <jvmti/> functions except those which 13227 specifically allow such use (see the raw monitor, memory management, 13228 and environment local storage functions). 13229 </description> 13230 <origin>new</origin> 13231 <capabilities> 13232 <required id="can_generate_object_free_events"></required> 13233 </capabilities> 13234 <parameters> 13235 <param id="tag"> 13236 <jlong/> 13237 <description> 13238 The freed object's tag 13239 </description> 13240 </param> 13241 </parameters> 13242 </event> 13243 13244 <event label="Garbage Collection Start" 13245 id="GarbageCollectionStart" const="JVMTI_EVENT_GARBAGE_COLLECTION_START" num="81"> 13246 <description> 13247 A Garbage Collection Start event is sent when a 13248 garbage collection pause begins. 13249 Only stop-the-world collections are reported--that is, collections during 13250 which all threads cease to modify the state of the Java virtual machine. 13251 This means that some collectors will never generate these events. 13252 This event is sent while the VM is still stopped, thus 13253 the event handler must not use JNI functions and 13254 must not use <jvmti/> functions except those which 13255 specifically allow such use (see the raw monitor, memory management, 13256 and environment local storage functions). 13257 <p/> 13258 This event is always sent as a matched pair with 13259 <eventlink id="GarbageCollectionFinish"/> 13260 (assuming both events are enabled) and no garbage collection 13261 events will occur between them. 13262 </description> 13263 <origin>new</origin> 13264 <capabilities> 13265 <required id="can_generate_garbage_collection_events"></required> 13266 </capabilities> 13267 <parameters> 13268 </parameters> 13269 </event> 13270 13271 <event label="Garbage Collection Finish" 13272 id="GarbageCollectionFinish" const="JVMTI_EVENT_GARBAGE_COLLECTION_FINISH" num="82"> 13273 <description> 13274 A Garbage Collection Finish event is sent when a 13275 garbage collection pause ends. 13276 This event is sent while the VM is still stopped, thus 13277 the event handler must not use JNI functions and 13278 must not use <jvmti/> functions except those which 13279 specifically allow such use (see the raw monitor, memory management, 13280 and environment local storage functions). 13281 <p/> 13282 Some agents may need to do post garbage collection operations that 13283 require the use of the disallowed <jvmti/> or JNI functions. For these 13284 cases an agent thread can be created which waits on a raw monitor, 13285 and the handler for the Garbage Collection Finish event simply 13286 notifies the raw monitor 13287 <p/> 13288 This event is always sent as a matched pair with 13289 <eventlink id="GarbageCollectionStart"/> (assuming both events are enabled). 13290 <issue> 13291 The most important use of this event is to provide timing information, 13292 and thus additional information is not required. However, 13293 information about the collection which is "free" should be included - 13294 what that information is needs to be determined. 13295 </issue> 13296 </description> 13297 <origin>new</origin> 13298 <capabilities> 13299 <required id="can_generate_garbage_collection_events"></required> 13300 </capabilities> 13301 <parameters> 13302 </parameters> 13303 </event> 13304 13305 <elide> 13306 <event label="Verbose Output" phase="any" 13307 id="VerboseOutput" const="JVMTI_EVENT_VERBOSE_OUTPUT" num="85"> 13308 <description> 13309 Send verbose messages as strings. 13310 <issue> 13311 This format is extremely fragile, as it can change with each 13312 platform, collector and version. Alternatives include: 13313 <ul> 13314 <li>building off Java programming language M and M APIs</li> 13315 <li>XML</li> 13316 <li>key/value pairs</li> 13317 <li>removing it</li> 13318 </ul> 13319 </issue> 13320 <issue> 13321 Though this seemed trivial to implement. 13322 In the RI it appears this will be quite complex. 13323 </issue> 13324 </description> 13325 <origin>new</origin> 13326 <capabilities> 13327 </capabilities> 13328 <parameters> 13329 <param id="flag"> 13330 <enum>jvmtiVerboseFlag</enum> 13331 <description> 13332 Which verbose output is being sent. 13333 </description> 13334 </param> 13335 <param id="message"> 13336 <vmbuf><char/></vmbuf> 13337 <description> 13338 Message text, encoded as a 13339 <internallink id="mUTF">modified UTF-8</internallink> string. 13340 </description> 13341 </param> 13342 </parameters> 13343 </event> 13344 </elide> 13345 13346 </eventsection> 13347 13348 <datasection> 13349 <intro> 13350 <jvmti/> extends the data types defined by JNI. 13351 </intro> 13352 <basetypes id="jniTypes" label="JNI Types Used in the JVM Tool Interface"> 13353 <basetype id="jboolean"> 13354 <description> 13355 Holds a Java programming language <code>boolean</code>. 13356 Unsigned 8 bits. 13357 </description> 13358 </basetype> 13359 <basetype id="jchar"> 13360 <description> 13361 Holds a Java programming language <code>char</code>. 13362 Unsigned 16 bits. 13363 </description> 13364 </basetype> 13365 <basetype id="jint"> 13366 <description> 13367 Holds a Java programming language <code>int</code>. 13368 Signed 32 bits. 13369 </description> 13370 </basetype> 13371 <basetype id="jlong"> 13372 <description> 13373 Holds a Java programming language <code>long</code>. 13374 Signed 64 bits. 13375 </description> 13376 </basetype> 13377 <basetype id="jfloat"> 13378 <description> 13379 Holds a Java programming language <code>float</code>. 13380 32 bits. 13381 </description> 13382 </basetype> 13383 <basetype id="jdouble"> 13384 <description> 13385 Holds a Java programming language <code>double</code>. 13386 64 bits. 13387 </description> 13388 </basetype> 13389 <basetype id="jobject"> 13390 <description> 13391 Holds a Java programming language object. 13392 </description> 13393 </basetype> 13394 <basetype id="jclass"> 13395 <description> 13396 Holds a Java programming language class. 13397 </description> 13398 </basetype> 13399 <basetype id="jvalue"> 13400 <description> 13401 Is a union of all primitive types and <code>jobject</code>. Thus, holds any Java 13402 programming language value. 13403 </description> 13404 </basetype> 13405 <basetype id="jfieldID"> 13406 <description> 13407 Identifies a Java programming language field. 13408 <code>jfieldID</code>s returned by <jvmti/> functions and events may be 13409 safely stored. 13410 </description> 13411 </basetype> 13412 <basetype id="jmethodID"> 13413 <description> 13414 Identifies a Java programming language method, initializer, or constructor. 13415 <code>jmethodID</code>s returned by <jvmti/> functions and events may be 13416 safely stored. However, if the class is unloaded, they become invalid 13417 and must not be used. 13418 </description> 13419 </basetype> 13420 <basetype id="JNIEnv"> 13421 <description> 13422 Pointer to the JNI function table. Pointer to this (<code>JNIEnv *</code>) 13423 is a JNI environment. 13424 </description> 13425 </basetype> 13426 </basetypes> 13427 13428 <basetypes id="jvmtiTypes" label="JVM Tool Interface Base Types"> 13429 <basetype id="jvmtiEnv"> 13430 <description> 13431 The <jvmti/> <internallink id="environments">environment</internallink> pointer. 13432 See the <internallink id="FunctionSection">Function Section</internallink>. 13433 <code>jvmtiEnv</code> points to the 13434 <internallink id="FunctionTable">function table</internallink> pointer. 13435 </description> 13436 </basetype> 13437 <basetype id="jthread"> 13438 <definition>typedef jobject jthread;</definition> 13439 <description> 13440 Subtype of <datalink id="jobject"></datalink> that holds a thread. 13441 </description> 13442 </basetype> 13443 <basetype id="jthreadGroup"> 13444 <definition>typedef jobject jthreadGroup;</definition> 13445 <description> 13446 Subtype of <datalink id="jobject"></datalink> that holds a thread group. 13447 </description> 13448 </basetype> 13449 <basetype id="jlocation"> 13450 <definition>typedef jlong jlocation;</definition> 13451 <description> 13452 A 64 bit value, representing a monotonically increasing 13453 executable position within a method. 13454 <code>-1</code> indicates a native method. 13455 See <functionlink id="GetJLocationFormat"></functionlink> for the format on a 13456 given VM. 13457 </description> 13458 </basetype> 13459 <basetype id="jrawMonitorID"> 13460 <definition>struct _jrawMonitorID; 13461 typedef struct _jrawMonitorID *jrawMonitorID;</definition> 13462 <description> 13463 A raw monitor. 13464 </description> 13465 </basetype> 13466 <basetype id="jvmtiError"> 13467 <description> 13468 Holds an error return code. 13469 See the <internallink id="ErrorSection">Error section</internallink> for possible values. 13470 <example> 13471 typedef enum { 13472 JVMTI_ERROR_NONE = 0, 13473 JVMTI_ERROR_INVALID_THREAD = 10, 13474 ... 13475 } jvmtiError; 13476 </example> 13477 </description> 13478 </basetype> 13479 <basetype id="jvmtiEvent"> 13480 <description> 13481 An identifier for an event type. 13482 See the <internallink id="EventSection">Event section</internallink> for possible values. 13483 It is guaranteed that future versions of this specification will 13484 never assign zero as an event type identifier. 13485 <example> 13486 typedef enum { 13487 JVMTI_EVENT_SINGLE_STEP = 1, 13488 JVMTI_EVENT_BREAKPOINT = 2, 13489 ... 13490 } jvmtiEvent; 13491 </example> 13492 </description> 13493 </basetype> 13494 <basetype id="jvmtiEventCallbacks"> 13495 <description> 13496 The callbacks used for events. 13497 <example> 13498 typedef struct { 13499 jvmtiEventVMInit VMInit; 13500 jvmtiEventVMDeath VMDeath; 13501 ... 13502 } jvmtiEventCallbacks; 13503 </example> 13504 See <internallink id="jvmtiEventCallbacks">event callbacks</internallink> 13505 for the complete structure. 13506 <p/> 13507 Where, for example, the VM initialization callback is defined: 13508 <example> 13509 typedef void (JNICALL *jvmtiEventVMInit) 13510 (jvmtiEnv *jvmti_env, 13511 JNIEnv* jni_env, 13512 jthread thread); 13513 </example> 13514 See the individual events for the callback function definition. 13515 </description> 13516 </basetype> 13517 <basetype id="jniNativeInterface"> 13518 <definition>typedef struct JNINativeInterface_ jniNativeInterface;</definition> 13519 <description> 13520 Typedef for the JNI function table <code>JNINativeInterface</code> 13521 defined in the 13522 <externallink id="http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/functions.html#wp23720">JNI Specification</externallink>. 13523 The JNI reference implementation defines this with an underscore. 13524 </description> 13525 </basetype> 13526 </basetypes> 13527 13528 </datasection> 13529 13530 <issuessection label="Issues"> 13531 <intro id="suspendRequired" label="Resolved Issue: Suspend - Required or Automatic"> 13532 JVMDI requires that the agent suspend threads before calling 13533 certain sensitive functions. JVMPI requires garbage collection to be 13534 disabled before calling certain sensitive functions. 13535 It was suggested that rather than have this requirement, that 13536 VM place itself in a suitable state before performing an 13537 operation. This makes considerable sense since each VM 13538 knows its requirements and can most easily arrange a 13539 safe state. 13540 <p/> 13541 The ability to externally suspend/resume threads will, of 13542 course, remain. The ability to enable/disable garbage collection will not. 13543 <p/> 13544 This issue is resolved--suspend will not 13545 be required. The spec has been updated to reflect this. 13546 </intro> 13547 13548 <intro id="stackSampling" label="Resolved Issue: Call Stack Sampling"> 13549 There are a variety of approaches to sampling call stacks. 13550 The biggest bifurcation is between VM controlled and agent 13551 controlled. 13552 <p/> 13553 This issue is resolved--agent controlled 13554 sampling will be the approach. 13555 </intro> 13556 13557 <intro id="threadRepresentation" label="Resolved Issue: Thread Representation"> 13558 JVMDI represents threads as jthread. JVMPI primarily 13559 uses JNIEnv* to represent threads. 13560 <p/> 13561 The Expert Group has chosen jthread as the representation 13562 for threads in <jvmti/>. 13563 JNIEnv* is sent by 13564 events since it is needed to JNI functions. JNIEnv, per the 13565 JNI spec, are not supposed to be used outside their thread. 13566 </intro> 13567 13568 <intro id="design" label="Resolved Issue: Method Representation"> 13569 The JNI spec allows an implementation to depend on jclass/jmethodID 13570 pairs, rather than simply a jmethodID, to reference a method. 13571 JVMDI, for consistency, choose the same representation. 13572 JVMPI, however, specifies that a jmethodID alone maps to a 13573 method. Both of the Sun <tm>J2SE</tm> virtual machines (Classic and <tm>HotSpot</tm>) store 13574 pointers in jmethodIDs, and as a result, a jmethodID is sufficient. 13575 In fact, any JVM implementation that supports JVMPI must have 13576 such a representation. 13577 <jvmti/> will use jmethodID as a unique representation of a method 13578 (no jclass is used). 13579 There should be efficiency gains, particularly in 13580 functionality like stack dumping, to this representation. 13581 <p/> 13582 Note that fields were not used in JVMPI and that the access profile 13583 of fields differs from methods--for implementation efficiency 13584 reasons, a jclass/jfieldID pair will still be needed for field 13585 reference. 13586 </intro> 13587 13588 <intro id="localReferenceIssue" label="Resolved Issue: Local References"> 13589 Functions return local references. 13590 </intro> 13591 13592 <intro id="frameRep" label="Resolved Issue: Representation of frames"> 13593 In JVMDI, a frame ID is used to represent a frame. Problem with this 13594 is that a VM must track when a frame becomes invalid, a far better 13595 approach, and the one used in <jvmti/>, is to reference frames by depth. 13596 </intro> 13597 13598 <intro id="requiredCapabilities" label="Issue: Required Capabilities"> 13599 Currently, having a required capabilities means that the functionality 13600 is optional. Capabilities are useful even for required functionality 13601 since they can inform the VM is needed set-up. Thus, there should be 13602 a set of capabilities that a conformant implementation must provide 13603 (if requested during Agent_OnLoad). 13604 </intro> 13605 13606 <intro id="taghint" label="Proposal: add tag hint function"> 13607 A hint of the percentage of objects that will be tagged would 13608 help the VM pick a good implementation. 13609 </intro> 13610 13611 <intro id="moreMonitorQueries" label="Request: More Monitor Quires"> 13612 How difficult or easy would be to extend the monitor_info category to include 13613 <pre> 13614 - current number of monitors 13615 - enumeration of monitors 13616 - enumeration of threads waiting on a given monitor 13617 </pre> 13618 The reason for my question is the fact that current get_monitor_info support 13619 requires the agent to specify a given thread to get the info which is probably 13620 OK in the profiling/debugging space, while in the monitoring space the agent 13621 could be watching the monitor list and then decide which thread to ask for 13622 the info. You might ask why is this important for monitoring .... I think it 13623 can aid in the detection/prediction of application contention caused by hot-locks. 13624 </intro> 13625 </issuessection> 13626 13627 <changehistory id="ChangeHistory" update="09/05/07"> 13628 <intro> 13629 The <jvmti/> specification is an evolving document with major, minor, 13630 and micro version numbers. 13631 A released version of the specification is uniquely identified 13632 by its major and minor version. 13633 The functions, events, and capabilities in this specification 13634 indicate a "Since" value which is the major and minor version in 13635 which it was introduced. 13636 The version of the specification implemented by the VM can 13637 be retrieved at runtime with the <functionlink id="GetVersionNumber"/> 13638 function. 13639 </intro> 13640 <change date="14 Nov 2002"> 13641 Converted to XML document. 13642 </change> 13643 <change date="14 Nov 2002"> 13644 Elided heap dump functions (for now) since what was there 13645 was wrong. 13646 </change> 13647 <change date="18 Nov 2002"> 13648 Added detail throughout. 13649 </change> 13650 <change date="18 Nov 2002"> 13651 Changed JVMTI_THREAD_STATUS_RUNNING to JVMTI_THREAD_STATUS_RUNNABLE. 13652 </change> 13653 <change date="19 Nov 2002"> 13654 Added AsyncGetStackTrace. 13655 </change> 13656 <change date="19 Nov 2002"> 13657 Added jframeID return to GetStackTrace. 13658 </change> 13659 <change date="19 Nov 2002"> 13660 Elided GetCurrentFrame and GetCallingFrame functions (for now) since what was there 13661 since they are redundant with GetStackTrace. 13662 </change> 13663 <change date="19 Nov 2002"> 13664 Elided ClearAllBreakpoints since it has always been redundant. 13665 </change> 13666 <change date="19 Nov 2002"> 13667 Added GetSystemProperties. 13668 </change> 13669 <change date="19 Nov 2002"> 13670 Changed the thread local storage functions to use jthread. 13671 </change> 13672 <change date="20 Nov 2002"> 13673 Added GetJLocationFormat. 13674 </change> 13675 <change date="22 Nov 2002"> 13676 Added events and introductory text. 13677 </change> 13678 <change date="22 Nov 2002"> 13679 Cross reference type and constant definitions. 13680 </change> 13681 <change date="24 Nov 2002"> 13682 Added DTD. 13683 </change> 13684 <change date="24 Nov 2002"> 13685 Added capabilities function section. 13686 </change> 13687 <change date="29 Nov 2002"> 13688 Assign capabilities to each function and event. 13689 </change> 13690 <change date="29 Nov 2002"> 13691 Add <internallink id="jniIntercept">JNI interception functions</internallink>. 13692 </change> 13693 <change date="30 Nov 2002"> 13694 Auto generate SetEventNotificationMode capabilities. 13695 </change> 13696 <change date="30 Nov 2002"> 13697 Add <eventlink id="VMObjectAlloc"></eventlink> event. 13698 </change> 13699 <change date="30 Nov 2002"> 13700 Add <eventlink id="DynamicCodeGenerated"></eventlink> event. 13701 </change> 13702 <change date="30 Nov 2002"> 13703 Add const to declarations. 13704 </change> 13705 <change date="30 Nov 2002"> 13706 Change method exit and frame pop to send on exception. 13707 </change> 13708 <change date="1 Dec 2002"> 13709 Add ForceGarbageCollection. 13710 </change> 13711 <change date="2 Dec 2002"> 13712 Redo Xrun section; clarify GetStackTrace and add example; 13713 Fix width problems; use "agent" consistently. 13714 </change> 13715 <change date="8 Dec 2002"> 13716 Remove previous start-up intro. 13717 Add <internallink id="environments"><jvmti/> Environments</internallink> 13718 section. 13719 </change> 13720 <change date="8 Dec 2002"> 13721 Add <functionlink id="DisposeEnvironment"></functionlink>. 13722 </change> 13723 <change date="9 Dec 2002"> 13724 Numerous minor updates. 13725 </change> 13726 <change date="15 Dec 2002"> 13727 Add heap profiling functions added: 13728 get/set annotation, iterate live objects/heap. 13729 Add heap profiling functions place holder added: 13730 heap roots. 13731 Heap profiling event added: object free. 13732 Heap profiling event redesigned: vm object allocation. 13733 Heap profiling event placeholders added: garbage collection start/finish. 13734 Native method bind event added. 13735 </change> 13736 <change date="19 Dec 2002"> 13737 Revamp suspend/resume functions. 13738 Add origin information with jvmdi tag. 13739 Misc fixes. 13740 </change> 13741 <change date="24 Dec 2002"> 13742 Add semantics to types. 13743 </change> 13744 <change date="27 Dec 2002"> 13745 Add local reference section. 13746 Autogenerate parameter descriptions from types. 13747 </change> 13748 <change date="28 Dec 2002"> 13749 Document that RunAgentThread sends threadStart. 13750 </change> 13751 <change date="29 Dec 2002"> 13752 Remove redundant local ref and dealloc warning. 13753 Convert GetRawMonitorName to allocated buffer. 13754 Add GenerateEvents. 13755 </change> 13756 <change date="30 Dec 2002"> 13757 Make raw monitors a type and rename to "jrawMonitorID". 13758 </change> 13759 <change date="1 Jan 2003"> 13760 Include origin information. 13761 Clean-up JVMDI issue references. 13762 Remove Deallocate warnings which are now automatically generated. 13763 </change> 13764 <change date="2 Jan 2003"> 13765 Fix representation issues for jthread. 13766 </change> 13767 <change date="3 Jan 2003"> 13768 Make capabilities buffered out to 64 bits - and do it automatically. 13769 </change> 13770 <change date="4 Jan 2003"> 13771 Make constants which are enumeration into enum types. 13772 Parameters now of enum type. 13773 Clean-up and index type section. 13774 Replace remaining datadef entities with callback. 13775 </change> 13776 <change date="7 Jan 2003"> 13777 Correct GenerateEvents description. 13778 More internal semantics work. 13779 </change> 13780 <change date="9 Jan 2003"> 13781 Replace previous GetSystemProperties with two functions 13782 which use allocated information instead fixed. 13783 Add SetSystemProperty. 13784 More internal semantics work. 13785 </change> 13786 <change date="12 Jan 2003"> 13787 Add varargs to end of SetEventNotificationMode. 13788 </change> 13789 <change date="20 Jan 2003"> 13790 Finish fixing spec to reflect that alloc sizes are jlong. 13791 </change> 13792 <change date="22 Jan 2003"> 13793 Allow NULL as RunAgentThread arg. 13794 </change> 13795 <change date="22 Jan 2003"> 13796 Fixed names to standardized naming convention 13797 Removed AsyncGetStackTrace. 13798 </change> 13799 <change date="29 Jan 2003"> 13800 Since we are using jthread, removed GetThread. 13801 </change> 13802 <change date="31 Jan 2003"> 13803 Change GetFieldName to allow NULLs like GetMethodName. 13804 </change> 13805 <change date="29 Feb 2003" version="v40"> 13806 Rewrite the introductory text, adding sections on 13807 start-up, environments and bytecode instrumentation. 13808 Change the command line arguments per EG discussions. 13809 Add an introduction to the capabilities section. 13810 Add the extension mechanism category and functions. 13811 Mark for deletion, but clarified anyhow, SuspendAllThreads. 13812 Rename IterateOverLiveObjects to IterateOverReachableObjects and 13813 change the text accordingly. 13814 Clarify IterateOverHeap. 13815 Clarify CompiledMethodLoad. 13816 Discuss prerequisite state for Calling Functions. 13817 Clarify SetAllocationHooks. 13818 Added issues ("To be resolved:") through-out. 13819 And so on... 13820 </change> 13821 <change date="6 Mar 2003" version="v41"> 13822 Remove struct from the call to GetOwnedMonitorInfo. 13823 Automatically generate most error documentation, remove 13824 (rather broken) hand written error doc. 13825 Better describe capability use (empty initial set). 13826 Add min value to jint params. 13827 Remove the capability can_access_thread_local_storage. 13828 Rename error JVMTI_ERROR_NOT_IMPLEMENTED to JVMTI_ERROR_MUST_POSSESS_CAPABILITY; 13829 same for *NOT_IMPLEMENTED. 13830 Description fixes. 13831 </change> 13832 <change date="8 Mar 2003" version="v42"> 13833 Rename GetClassSignature to GetClassName. 13834 Rename IterateOverClassObjects to IterateOverInstancesOfClass. 13835 Remove GetMaxStack (operand stack isn't used in <jvmti/>). 13836 Description fixes: define launch-time, remove native frame pop 13837 from PopFrame, and assorted clarifications. 13838 </change> 13839 <change date="8 Mar 2003" version="v43"> 13840 Fix minor editing problem. 13841 </change> 13842 <change date="10 Mar 2003" version="v44"> 13843 Add phase information. 13844 Remap (compact) event numbers. 13845 </change> 13846 <change date="11 Mar 2003" version="v45"> 13847 More phase information - allow "any". 13848 Elide raw monitor queries and events. 13849 Minor description fixes. 13850 </change> 13851 <change date="12 Mar 2003" version="v46"> 13852 Add GetPhase. 13853 Use "phase" through document. 13854 Elide GetRawMonitorName. 13855 Elide GetObjectMonitors. 13856 </change> 13857 <change date="12 Mar 2003" version="v47"> 13858 Fixes from link, XML, and spell checking. 13859 Auto-generate the callback structure. 13860 </change> 13861 <change date="13 Mar 2003" version="v48"> 13862 One character XML fix. 13863 </change> 13864 <change date="13 Mar 2003" version="v49"> 13865 Change function parameter names to be consistent with 13866 event parameters (fooBarBaz becomes foo_bar_baz). 13867 </change> 13868 <change date="14 Mar 2003" version="v50"> 13869 Fix broken link. Fix thread markers. 13870 </change> 13871 <change date="14 Mar 2003" version="v51"> 13872 Change constants so they are under 128 to workaround 13873 compiler problems. 13874 </change> 13875 <change date="23 Mar 2003" version="v52"> 13876 Overhaul capabilities. Separate GetStackTrace into 13877 GetStackTrace and GetStackFrames. 13878 </change> 13879 <change date="8 Apr 2003" version="v54"> 13880 Use depth instead of jframeID to reference frames. 13881 Remove the now irrelevant GetCurrentFrame, GetCallerFrame and GetStackFrames. 13882 Remove frame arg from events. 13883 </change> 13884 <change date="9 Apr 2003" version="v55"> 13885 Remove GetObjectWithAnnotation since tests show bufferred approach more efficient. 13886 Add missing annotation_count to GetObjectsWithAnnotations 13887 </change> 13888 <change date="10 Apr 2003" version="v56"> 13889 Remove confusing parenthetical statement in GetObjectsWithAnnotations 13890 </change> 13891 <change date="13 Apr 2003" version="v58"> 13892 Replace jclass/jmethodID representation of method with simply jmethodID; 13893 Pass JvmtiEnv* as first arg of every event; remove JNIEnv* where inappropriate. 13894 Replace can_access_frames with can_access_local_variables; remove from purely stack access. 13895 Use can_get_synthetic_attribute; fix description. 13896 Clarify that zero length arrays must be deallocated. 13897 Clarify RelinquishCapabilities. 13898 Generalize JVMTI_ERROR_VM_DEAD to JVMTI_ERROR_WRONG_PHASE. 13899 </change> 13900 <change date="27 Apr 2003" version="v59"> 13901 Remove lingering indirect references to OBSOLETE_METHOD_ID. 13902 </change> 13903 <change date="4 May 2003" version="v60"> 13904 Allow DestroyRawMonitor during OnLoad. 13905 </change> 13906 <change date="7 May 2003" version="v61"> 13907 Added not monitor owner error return to DestroyRawMonitor. 13908 </change> 13909 <change date="13 May 2003" version="v62"> 13910 Clarify semantics of raw monitors. 13911 Change flags on <code>GetThreadStatus</code>. 13912 <code>GetClassLoader</code> return NULL for the bootstrap class loader. 13913 Add <code>GetClassName</code> issue. 13914 Define local variable signature. 13915 Disallow zero in annotations array of <code>GetObjectsWithAnnotations</code>. 13916 Remove over specification in <code>GetObjectsWithAnnotations</code>. 13917 Elide <code>SetAllocationHooks</code>. 13918 Elide <code>SuspendAllThreads</code>. 13919 </change> 13920 <change date="14 May 2003" version="v63"> 13921 Define the data type <code>jvmtiEventCallbacks</code>. 13922 Zero length allocations return NULL. 13923 Keep SetAllocationHooks in JVMDI, but remove from <jvmti/>. 13924 Add JVMTI_THREAD_STATUS_FLAG_INTERRUPTED. 13925 </change> 13926 <change date="15 May 2003" version="v64"> 13927 Better wording, per review. 13928 </change> 13929 <change date="15 May 2003" version="v65"> 13930 First Alpha. 13931 Make jmethodID and jfieldID unique, jclass not used. 13932 </change> 13933 <change date="27 May 2003" version="v66"> 13934 Fix minor XSLT errors. 13935 </change> 13936 <change date="13 June 2003" version="v67"> 13937 Undo making jfieldID unique (jmethodID still is). 13938 </change> 13939 <change date="17 June 2003" version="v68"> 13940 Changes per June 11th Expert Group meeting -- 13941 Overhaul Heap functionality: single callback, 13942 remove GetHeapRoots, add reachable iterators, 13943 and rename "annotation" to "tag". 13944 NULL thread parameter on most functions is current 13945 thread. 13946 Add timers. 13947 Remove ForceExit. 13948 Add GetEnvironmentLocalStorage. 13949 Add verbose flag and event. 13950 Add AddToBootstrapClassLoaderSearch. 13951 Update ClassFileLoadHook. 13952 </change> 13953 <change date="18 June 2003" version="v69"> 13954 Clean up issues sections. 13955 Rename GetClassName back to GetClassSignature and 13956 fix description. 13957 Add generic signature to GetClassSignature, 13958 GetFieldSignature, GetMethodSignature, and 13959 GetLocalVariableTable. 13960 Elide EstimateCostOfCapabilities. 13961 Clarify that the system property functions operate 13962 on the VM view of system properties. 13963 Clarify Agent_OnLoad. 13964 Remove "const" from JNIEnv* in events. 13965 Add metadata accessors. 13966 </change> 13967 <change date="18 June 2003" version="v70"> 13968 Add start_depth to GetStackTrace. 13969 Move system properties to a new category. 13970 Add GetObjectSize. 13971 Remove "X" from command line flags. 13972 XML, HTML, and spell check corrections. 13973 </change> 13974 <change date="19 June 2003" version="v71"> 13975 Fix JVMTI_HEAP_ROOT_THREAD to be 6. 13976 Make each synopsis match the function name. 13977 Fix unclear wording. 13978 </change> 13979 <change date="26 June 2003" version="v72"> 13980 SetThreadLocalStorage and SetEnvironmentLocalStorage should allow value 13981 to be set to NULL. 13982 NotifyFramePop, GetFrameLocationm and all the local variable operations 13983 needed to have their wording about frames fixed. 13984 Grammar and clarity need to be fixed throughout. 13985 Capitalization and puntuation need to be consistent. 13986 Need micro version number and masks for accessing major, minor, and micro. 13987 The error code lists should indicate which must be returned by 13988 an implementation. 13989 The command line properties should be visible in the properties functions. 13990 Disallow popping from the current thread. 13991 Allow implementations to return opaque frame error when they cannot pop. 13992 The NativeMethodBind event should be sent during any phase. 13993 The DynamicCodeGenerated event should be sent during any phase. 13994 The following functions should be allowed to operate before VMInit: 13995 Set/GetEnvironmentLocalStorage 13996 GetMethodDeclaringClass 13997 GetClassSignature 13998 GetClassModifiers 13999 IsInterface 14000 IsArrayClass 14001 GetMethodName 14002 GetMethodModifiers 14003 GetMaxLocals 14004 GetArgumentsSize 14005 GetLineNumberTable 14006 GetMethodLocation 14007 IsMethodNative 14008 IsMethodSynthetic. 14009 Other changes (to XSL): 14010 Argument description should show asterisk after not before pointers. 14011 NotifyFramePop, GetFrameLocationm and all the local variable operations 14012 should hsve the NO_MORE_FRAMES error added. 14013 Not alive threads should have a different error return than invalid thread. 14014 </change> 14015 <change date="7 July 2003" version="v73"> 14016 VerboseOutput event was missing message parameter. 14017 Minor fix-ups. 14018 </change> 14019 <change date="14 July 2003" version="v74"> 14020 Technical Publications Department corrections. 14021 Allow thread and environment local storage to be set to NULL. 14022 </change> 14023 <change date="23 July 2003" version="v75"> 14024 Use new Agent_OnLoad rather than overloaded JVM_OnLoad. 14025 Add JNICALL to callbacks (XSL). 14026 Document JNICALL requirement for both events and callbacks (XSL). 14027 Restrict RedefineClasses to methods and attributes. 14028 Elide the VerboseOutput event. 14029 VMObjectAlloc: restrict when event is sent and remove method parameter. 14030 Finish loose ends from Tech Pubs edit. 14031 </change> 14032 <change date="24 July 2003" version="v76"> 14033 Change ClassFileLoadHook event to send the class instead of a boolean of redefine. 14034 </change> 14035 <change date="24 July 2003" version="v77"> 14036 XML fixes. 14037 Minor text clarifications and corrections. 14038 </change> 14039 <change date="24 July 2003" version="v78"> 14040 Remove GetExceptionHandlerTable and GetThrownExceptions from <jvmti/>. 14041 Clarify that stack frames are JVM Spec frames. 14042 Split can_get_source_info into can_get_source_file_name, can_get_line_numbers, 14043 and can_get_source_debug_extension. 14044 PopFrame cannot have a native calling method. 14045 Removed incorrect statement in GetClassloaderClasses 14046 (see <vmspec chapter="4.4"/>). 14047 </change> 14048 <change date="24 July 2003" version="v79"> 14049 XML and text fixes. 14050 Move stack frame description into Stack Frame category. 14051 </change> 14052 <change date="26 July 2003" version="v80"> 14053 Allow NULL (means bootstrap loader) for GetClassloaderClasses. 14054 Add new heap reference kinds for references from classes. 14055 Add timer information struct and query functions. 14056 Add AvailableProcessors. 14057 Rename GetOtherThreadCpuTime to GetThreadCpuTime. 14058 Explicitly add JVMTI_ERROR_INVALID_THREAD and JVMTI_ERROR_THREAD_NOT_ALIVE 14059 to SetEventNotification mode. 14060 Add initial thread to the VM_INIT event. 14061 Remove platform assumptions from AddToBootstrapClassLoaderSearch. 14062 </change> 14063 <change date="26 July 2003" version="v81"> 14064 Grammar and clarity changes per review. 14065 </change> 14066 <change date="27 July 2003" version="v82"> 14067 More grammar and clarity changes per review. 14068 Add Agent_OnUnload. 14069 </change> 14070 <change date="28 July 2003" version="v83"> 14071 Change return type of Agent_OnUnload to void. 14072 </change> 14073 <change date="28 July 2003" version="v84"> 14074 Rename JVMTI_REFERENCE_ARRAY to JVMTI_REFERENCE_ARRAY_ELEMENT. 14075 </change> 14076 <change date="28 July 2003" version="v85"> 14077 Steal java.lang.Runtime.availableProcessors() wording for 14078 AvailableProcessors(). 14079 Guarantee that zero will never be an event ID. 14080 Remove some issues which are no longer issues. 14081 Per review, rename and more completely document the timer 14082 information functions. 14083 </change> 14084 <change date="29 July 2003" version="v86"> 14085 Non-spec visible change to XML controlled implementation: 14086 SetThreadLocalStorage must run in VM mode. 14087 </change> 14088 <change date="5 August 2003" version="0.1.87"> 14089 Add GetErrorName. 14090 Add varargs warning to jvmtiExtensionEvent. 14091 Remove "const" on the jvmtiEnv* of jvmtiExtensionEvent. 14092 Remove unused can_get_exception_info capability. 14093 Pass jvmtiEnv* and JNIEnv* to the jvmtiStartFunction. 14094 Fix jvmtiExtensionFunctionInfo.func declared type. 14095 Extension function returns error code. 14096 Use new version numbering. 14097 </change> 14098 <change date="5 August 2003" version="0.2.88"> 14099 Remove the ClassUnload event. 14100 </change> 14101 <change date="8 August 2003" version="0.2.89"> 14102 Heap reference iterator callbacks return an enum that 14103 allows outgoing object references to be ignored. 14104 Allow JNIEnv as a param type to extension events/functions. 14105 </change> 14106 <change date="15 August 2003" version="0.2.90"> 14107 Fix a typo. 14108 </change> 14109 <change date="2 September 2003" version="0.2.91"> 14110 Remove all metadata functions: GetClassMetadata, 14111 GetFieldMetadata, and GetMethodMetadata. 14112 </change> 14113 <change date="1 October 2003" version="0.2.92"> 14114 Mark the functions Allocate. Deallocate, RawMonitor*, 14115 SetEnvironmentLocalStorage, and GetEnvironmentLocalStorage 14116 as safe for use in heap callbacks and GC events. 14117 </change> 14118 <change date="24 November 2003" version="0.2.93"> 14119 Add pass through opaque user data pointer to heap iterate 14120 functions and callbacks. 14121 In the CompiledMethodUnload event, send the code address. 14122 Add GarbageCollectionOccurred event. 14123 Add constant pool reference kind. 14124 Mark the functions CreateRawMonitor and DestroyRawMonitor 14125 as safe for use in heap callbacks and GC events. 14126 Clarify: VMDeath, GetCurrentThreadCpuTimerInfo, 14127 GetThreadCpuTimerInfo, IterateOverReachableObjects, 14128 IterateOverObjectsReachableFromObject, GetTime and 14129 JVMTI_ERROR_NULL_POINTER. 14130 Add missing errors to: GenerateEvents and 14131 AddToBootstrapClassLoaderSearch. 14132 Fix description of ClassFileLoadHook name parameter. 14133 In heap callbacks and GC/ObjectFree events, specify 14134 that only explicitly allowed functions can be called. 14135 Allow GetCurrentThreadCpuTimerInfo, GetCurrentThreadCpuTime, 14136 GetTimerInfo, and GetTime during callback. 14137 Allow calling SetTag/GetTag during the onload phase. 14138 SetEventNotificationMode, add: error attempted inappropriate 14139 thread level control. 14140 Remove jvmtiExceptionHandlerEntry. 14141 Fix handling of native methods on the stack -- 14142 location_ptr param of GetFrameLocation, remove 14143 JVMTI_ERROR_OPAQUE_FRAME from GetFrameLocation, 14144 jvmtiFrameInfo.location, and jlocation. 14145 Remove typo (from JVMPI) implying that the MonitorWaited 14146 event is sent on sleep. 14147 </change> 14148 <change date="25 November 2003" version="0.2.94"> 14149 Clarifications and typos. 14150 </change> 14151 <change date="3 December 2003" version="0.2.95"> 14152 Allow NULL user_data in heap iterators. 14153 </change> 14154 <change date="28 January 2004" version="0.2.97"> 14155 Add GetThreadState, deprecate GetThreadStatus. 14156 </change> 14157 <change date="29 January 2004" version="0.2.98"> 14158 INVALID_SLOT and TYPE_MISMATCH errors should be optional. 14159 </change> 14160 <change date="12 February 2004" version="0.2.102"> 14161 Remove MonitorContendedExit. 14162 Added JNIEnv parameter to VMObjectAlloc. 14163 Clarified definition of class_tag and referrer_index 14164 parameters to heap callbacks. 14165 </change> 14166 <change date="16 Febuary 2004" version="0.2.103"> 14167 Document JAVA_TOOL_OPTIONS. 14168 </change> 14169 <change date="17 Febuary 2004" version="0.2.105"> 14170 Divide start phase into primordial and start. 14171 Add VMStart event 14172 Change phase associations of functions and events. 14173 </change> 14174 <change date="18 Febuary 2004" version="0.3.6"> 14175 Elide deprecated GetThreadStatus. 14176 Bump minor version, subtract 100 from micro version 14177 </change> 14178 <change date="18 Febuary 2004" version="0.3.7"> 14179 Document that timer nanosecond values are unsigned. 14180 Clarify text having to do with native methods. 14181 </change> 14182 <change date="19 Febuary 2004" version="0.3.8"> 14183 Fix typos. 14184 Remove elided deprecated GetThreadStatus. 14185 </change> 14186 <change date="23 Febuary 2004" version="0.3.9"> 14187 Require NotifyFramePop to act on suspended threads. 14188 </change> 14189 <change date="24 Febuary 2004" version="0.3.10"> 14190 Add capabilities 14191 (<internallink id="jvmtiCapabilities.can_redefine_any_class" 14192 ><code>can_redefine_any_class</code></internallink> 14193 and 14194 <internallink id="jvmtiCapabilities.can_generate_all_class_hook_events" 14195 ><code>can_generate_all_class_hook_events</code></internallink>) 14196 and an error (<errorlink id="JVMTI_ERROR_UNMODIFIABLE_CLASS"></errorlink>) 14197 which allow some classes to be unmodifiable. 14198 </change> 14199 <change date="28 Febuary 2004" version="0.3.11"> 14200 Add JVMTI_ERROR_MUST_POSSESS_CAPABILITY to SetEventNotificationMode. 14201 </change> 14202 <change date="8 March 2004" version="0.3.12"> 14203 Clarified CompiledMethodUnload so that it is clear the event 14204 may be posted after the class has been unloaded. 14205 </change> 14206 <change date="5 March 2004" version="0.3.13"> 14207 Change the size parameter of VMObjectAlloc to jlong to match GetObjectSize. 14208 </change> 14209 <change date="13 March 2004" version="0.3.14"> 14210 Added guideline for the use of the JNI FindClass function in event 14211 callback functions. 14212 </change> 14213 <change date="15 March 2004" version="0.3.15"> 14214 Add GetAllStackTraces and GetThreadListStackTraces. 14215 </change> 14216 <change date="19 March 2004" version="0.3.16"> 14217 ClassLoad and ClassPrepare events can be posted during start phase. 14218 </change> 14219 <change date="25 March 2004" version="0.3.17"> 14220 Add JVMTI_ERROR_NATIVE_METHOD to GetLineNumberTable, GetLocalVariableTable, 14221 GetMaxLocals, GetArgumentsSize, GetMethodLocation, GetBytecodes. 14222 </change> 14223 <change date="29 March 2004" version="0.3.18"> 14224 Return the timer kind in the timer information structure. 14225 </change> 14226 <change date="31 March 2004" version="0.3.19"> 14227 Spec clarifications: 14228 JVMTI_THREAD_STATE_IN_NATIVE might not include JNI or <jvmti/>. 14229 ForceGarbageCollection does not run finalizers. 14230 The context of the specification is the Java platform. 14231 Warn about early instrumentation. 14232 </change> 14233 <change date="1 April 2004" version="0.3.20"> 14234 Refinements to the above clarifications and 14235 Clarify that an error returned by Agent_OnLoad terminates the VM. 14236 </change> 14237 <change date="1 April 2004" version="0.3.21"> 14238 Array class creation does not generate a class load event. 14239 </change> 14240 <change date="7 April 2004" version="0.3.22"> 14241 Align thread state hierarchy more closely with java.lang.Thread.State. 14242 </change> 14243 <change date="12 April 2004" version="0.3.23"> 14244 Clarify the documentation of thread state. 14245 </change> 14246 <change date="19 April 2004" version="0.3.24"> 14247 Remove GarbageCollectionOccurred event -- can be done by agent. 14248 </change> 14249 <change date="22 April 2004" version="0.3.25"> 14250 Define "command-line option". 14251 </change> 14252 <change date="29 April 2004" version="0.3.26"> 14253 Describe the intended use of bytecode instrumentation. 14254 Fix description of extension event first parameter. 14255 </change> 14256 <change date="30 April 2004" version="0.3.27"> 14257 Clarification and typos. 14258 </change> 14259 <change date="18 May 2004" version="0.3.28"> 14260 Remove DataDumpRequest event. 14261 </change> 14262 <change date="18 May 2004" version="0.3.29"> 14263 Clarify RawMonitorWait with zero timeout. 14264 Clarify thread state after RunAgentThread. 14265 </change> 14266 <change date="24 May 2004" version="0.3.30"> 14267 Clean-up: fix bad/old links, etc. 14268 </change> 14269 <change date="30 May 2004" version="0.3.31"> 14270 Clarifications including: 14271 All character strings are modified UTF-8. 14272 Agent thread visibiity. 14273 Meaning of obsolete method version. 14274 Thread invoking heap callbacks, 14275 </change> 14276 <change date="1 June 2004" version="1.0.32"> 14277 Bump major.minor version numbers to "1.0". 14278 </change> 14279 <change date="2 June 2004" version="1.0.33"> 14280 Clarify interaction between ForceGarbageCollection 14281 and ObjectFree. 14282 </change> 14283 <change date="6 June 2004" version="1.0.34"> 14284 Restrict AddToBootstrapClassLoaderSearch and 14285 SetSystemProperty to the OnLoad phase only. 14286 </change> 14287 <change date="11 June 2004" version="1.0.35"> 14288 Fix typo in SetTag. 14289 </change> 14290 <change date="18 June 2004" version="1.0.36"> 14291 Fix trademarks. 14292 Add missing parameter in example GetThreadState usage. 14293 </change> 14294 <change date="4 August 2004" version="1.0.37"> 14295 Copyright updates. 14296 </change> 14297 <change date="5 November 2004" version="1.0.38"> 14298 Add missing function table layout. 14299 Add missing description of C++ member function format of functions. 14300 Clarify that name in CFLH can be NULL. 14301 Released as part of <tm>J2SE</tm> 5.0. 14302 </change> 14303 <change date="24 April 2005" version="1.1.47"> 14304 Bump major.minor version numbers to "1.1". 14305 Add ForceEarlyReturn* functions. 14306 Add GetOwnedMonitorStackDepthInfo function. 14307 Add GetCurrentThread function. 14308 Add "since" version marker. 14309 Add AddToSystemClassLoaderSearch. 14310 Allow AddToBootstrapClassLoaderSearch be used in live phase. 14311 Fix historic rubbish in the descriptions of the heap_object_callback 14312 parameter of IterateOverHeap and IterateOverInstancesOfClass functions; 14313 disallow NULL for this parameter. 14314 Clarify, correct and make consistent: wording about current thread, 14315 opaque frames and insufficient number of frames in PopFrame. 14316 Consistently use "current frame" rather than "topmost". 14317 Clarify the JVMTI_ERROR_TYPE_MISMATCH errors in GetLocal* and SetLocal* 14318 by making them compatible with those in ForceEarlyReturn*. 14319 Many other clarifications and wording clean ups. 14320 </change> 14321 <change date="25 April 2005" version="1.1.48"> 14322 Add GetConstantPool. 14323 Switch references to the first edition of the VM Spec, to the seconds edition. 14324 </change> 14325 <change date="26 April 2005" version="1.1.49"> 14326 Clarify minor/major version order in GetConstantPool. 14327 </change> 14328 <change date="26 April 2005" version="1.1.50"> 14329 Add SetNativeMethodPrefix and SetNativeMethodPrefixes. 14330 Reassign GetOwnedMonitorStackDepthInfo to position 153. 14331 Break out Class Loader Search in its own documentation category. 14332 Deal with overly long lines in XML source. 14333 </change> 14334 <change date="29 April 2005" version="1.1.51"> 14335 Allow agents be started in the live phase. 14336 Added paragraph about deploying agents. 14337 </change> 14338 <change date="30 April 2005" version="1.1.52"> 14339 Add specification description to SetNativeMethodPrefix(es). 14340 Better define the conditions on GetConstantPool. 14341 </change> 14342 <change date="30 April 2005" version="1.1.53"> 14343 Break out the GetClassVersionNumber function from GetConstantPool. 14344 Clean-up the references to the VM Spec. 14345 </change> 14346 <change date="1 May 2005" version="1.1.54"> 14347 Allow SetNativeMethodPrefix(es) in any phase. 14348 Add clarifications about the impact of redefinition on GetConstantPool. 14349 </change> 14350 <change date="2 May 2005" version="1.1.56"> 14351 Various clarifications to SetNativeMethodPrefix(es). 14352 </change> 14353 <change date="2 May 2005" version="1.1.57"> 14354 Add missing performance warning to the method entry event. 14355 </change> 14356 <change date="5 May 2005" version="1.1.58"> 14357 Remove internal JVMDI support. 14358 </change> 14359 <change date="8 May 2005" version="1.1.59"> 14360 Add <functionlink id="RetransformClasses"/>. 14361 Revamp the bytecode instrumentation documentation. 14362 Change <functionlink id="IsMethodObsolete"/> to no longer 14363 require the can_redefine_classes capability. 14364 </change> 14365 <change date="11 May 2005" version="1.1.63"> 14366 Clarifications for retransformation. 14367 </change> 14368 <change date="11 May 2005" version="1.1.64"> 14369 Clarifications for retransformation, per review. 14370 Lock "retransformation (in)capable" at class load enable time. 14371 </change> 14372 <change date="4 June 2005" version="1.1.67"> 14373 Add new heap functionity which supports reporting primitive values, 14374 allows setting the referrer tag, and has more powerful filtering: 14375 FollowReferences, IterateThroughHeap, and their associated 14376 callbacks, structs, enums, and constants. 14377 </change> 14378 <change date="4 June 2005" version="1.1.68"> 14379 Clarification. 14380 </change> 14381 <change date="6 June 2005" version="1.1.69"> 14382 FollowReferences, IterateThroughHeap: Put callbacks in a struct; 14383 Add missing error codes; reduce bits in the visit control flags. 14384 </change> 14385 <change date="14 June 2005" version="1.1.70"> 14386 More on new heap functionity: spec clean-up per review. 14387 </change> 14388 <change date="15 June 2005" version="1.1.71"> 14389 More on new heap functionity: Rename old heap section to Heap (1.0). 14390 </change> 14391 <change date="21 June 2005" version="1.1.72"> 14392 Fix typos. 14393 </change> 14394 <change date="27 June 2005" version="1.1.73"> 14395 Make referrer info structure a union. 14396 </change> 14397 <change date="9 September 2005" version="1.1.74"> 14398 In new heap functions: 14399 Add missing superclass reference kind. 14400 Use a single scheme for computing field indexes. 14401 Remove outdated references to struct based referrer info. 14402 </change> 14403 <change date="12 September 2005" version="1.1.75"> 14404 Don't callback during FollowReferences on frivolous java.lang.Object superclass. 14405 </change> 14406 <change date="13 September 2005" version="1.1.76"> 14407 In string primitive callback, length now Unicode length. 14408 In array and string primitive callbacks, value now "const". 14409 Note possible compiler impacts on setting JNI function table. 14410 </change> 14411 <change date="13 September 2005" version="1.1.77"> 14412 GetClassVersionNumbers() and GetConstantPool() should return 14413 error on array or primitive class. 14414 </change> 14415 <change date="14 September 2005" version="1.1.78"> 14416 Grammar fixes. 14417 </change> 14418 <change date="26 September 2005" version="1.1.79"> 14419 Add IsModifiableClass query. 14420 </change> 14421 <change date="9 February 2006" version="1.1.81"> 14422 Add referrer_class_tag parameter to jvmtiHeapReferenceCallback. 14423 </change> 14424 <change date="13 February 2006" version="1.1.82"> 14425 Doc fixes: update can_redefine_any_class to include retransform. 14426 Clarify that exception events cover all Throwables. 14427 In GetStackTrace, no test is done for start_depth too big if start_depth is zero, 14428 Clarify fields reported in Primitive Field Callback -- static vs instance. 14429 Repair confusing names of heap types, including callback names. 14430 Require consistent usage of stack depth in the face of thread launch methods. 14431 Note incompatibility of <jvmti/> memory management with other systems. 14432 </change> 14433 <change date="14 February 2006" version="1.1.85"> 14434 Fix typos and missing renames. 14435 </change> 14436 <change date="13 March 2006" version="1.1.86"> 14437 Clarify that jmethodIDs and jfieldIDs can be saved. 14438 Clarify that Iterate Over Instances Of Class includes subclasses. 14439 </change> 14440 <change date="14 March 2006" version="1.1.87"> 14441 Better phrasing. 14442 </change> 14443 <change date="16 March 2006" version="1.1.88"> 14444 Match the referrer_index for static fields in Object Reference Callback 14445 with the Reference Implementation (and all other known implementations); 14446 that is, make it match the definition for instance fields. 14447 In GetThreadListStackTraces, add JVMTI_ERROR_INVALID_THREAD to cover 14448 an invalid thread in the list; and specify that not started threads 14449 return empty stacks. 14450 </change> 14451 <change date="17 March 2006" version="1.1.89"> 14452 Typo. 14453 </change> 14454 <change date="25 March 2006" version="1.1.90"> 14455 Typo. 14456 </change> 14457 <change date="6 April 2006" version="1.1.91"> 14458 Remove restrictions on AddToBootstrapClassLoaderSearch and 14459 AddToSystemClassLoaderSearch. 14460 </change> 14461 <change date="1 May 2006" version="1.1.93"> 14462 Changed spec to return -1 for monitor stack depth for the 14463 implementation which can not determine stack depth. 14464 </change> 14465 <change date="3 May 2006" version="1.1.94"> 14466 Corrections for readability and accuracy courtesy of Alan Pratt of IBM. 14467 List the object relationships reported in FollowReferences. 14468 </change> 14469 <change date="5 May 2006" version="1.1.95"> 14470 Clarify the object relationships reported in FollowReferences. 14471 </change> 14472 <change date="28 June 2006" version="1.1.98"> 14473 Clarify DisposeEnvironment; add warning. 14474 Fix typos in SetLocalXXX "retrieve" => "set". 14475 Clarify that native method prefixes must remain set while used. 14476 Clarify that exactly one Agent_OnXXX is called per agent. 14477 Clarify that library loading is independent from start-up. 14478 Remove ambiguous reference to Agent_OnLoad in the Agent_OnUnload spec. 14479 </change> 14480 <change date="31 July 2006" version="1.1.99"> 14481 Clarify the interaction between functions and exceptions. 14482 Clarify and give examples of field indices. 14483 Remove confusing "That is" sentence from MonitorWait and MonitorWaited events. 14484 Update links to point to Java 6. 14485 </change> 14486 <change date="6 August 2006" version="1.1.102"> 14487 Add ResourceExhaustedEvent. 14488 </change> 14489 <change date="11 October 2012" version="1.2.2"> 14490 Fixed the "HTTP" and "Missing Anchor" errors reported by the LinkCheck tool. 14491 </change> 14492 <change date="19 June 2013" version="1.2.3"> 14493 Added support for statically linked agents. 14494 </change> 14495 <change date="5 July 2016" version="9.0.0"> 14496 Support for modules: 14497 - The majorversion is 9 now 14498 - The ClassFileLoadHook events are not sent during the primordial phase anymore. 14499 - Add new function GetAllModules 14500 - Add new capability can_generate_early_vmstart 14501 - Allow CompiledMethodLoad events at start phase 14502 - Add new capability can_generate_early_class_hook_events 14503 - Add new function GetNamedModule 14504 </change> 14505 <change date="16 August 2016" version="9.0.0"> 14506 Clarified can_redefine_any_classes, can_retransform_any_classes and IsModifiableClass API to 14507 disallow some implementation defined classes. 14508 </change> 14509 </changehistory> 14510 14511 </specification> 14512 <!-- Keep this comment at the end of the file 14513 Local variables: 14514 mode: sgml 14515 sgml-omittag:t 14516 sgml-shorttag:t 14517 sgml-namecase-general:t 14518 sgml-general-insert-case:lower 14519 sgml-minimize-attributes:nil 14520 sgml-always-quote-attributes:t 14521 sgml-indent-step:2 14522 sgml-indent-data:t 14523 sgml-parent-document:nil 14524 sgml-exposed-tags:nil 14525 sgml-local-catalogs:nil 14526 sgml-local-ecat-files:nil 14527 End: 14528 -->