1 <?xml version="1.0" encoding="ISO-8859-1"?> 2 <?xml-stylesheet type="text/xsl" href="jvmti.xsl"?> 3 <!-- 4 Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. 5 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 7 This code is free software; you can redistribute it and/or modify it 8 under the terms of the GNU General Public License version 2 only, as 9 published by the Free Software Foundation. 10 11 This code is distributed in the hope that it will be useful, but WITHOUT 12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 version 2 for more details (a copy is included in the LICENSE file that 15 accompanied this code). 16 17 You should have received a copy of the GNU General Public License version 18 2 along with this work; if not, write to the Free Software Foundation, 19 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 21 Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 or visit www.oracle.com if you need additional information or have any 23 questions. 24 --> 25 26 <!DOCTYPE specification [ 27 <!ELEMENT specification (title, 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 name CDATA #IMPLIED> 232 233 <!ELEMENT definition (#PCDATA|jvmti)*> 234 235 <!ELEMENT eventsection (intro*, (event|elide)*)> 236 <!ATTLIST eventsection label CDATA #REQUIRED> 237 238 <!ELEMENT event (description, origin, typedef*, capabilities, parameters)> 239 <!ATTLIST event id CDATA #REQUIRED 240 label CDATA #REQUIRED 241 const CDATA #REQUIRED 242 num CDATA #REQUIRED 243 phase (onload|start|live|any) #IMPLIED 244 filtered (thread|global) #IMPLIED 245 since CDATA "1.0"> 246 247 <!ELEMENT issuessection (intro*)> 248 <!ATTLIST issuessection label CDATA #REQUIRED> 249 250 <!ELEMENT changehistory (intro*, change*)> 251 <!ATTLIST changehistory update CDATA #REQUIRED 252 id CDATA #REQUIRED> 253 254 <!ELEMENT change ANY> 255 <!ATTLIST change date CDATA #REQUIRED 256 version CDATA #IMPLIED> 257 258 <!ELEMENT functionlink (#PCDATA|jvmti|code|i|b)*> 259 <!ATTLIST functionlink id CDATA #REQUIRED> 260 261 <!ELEMENT datalink (#PCDATA|jvmti|code|i|b)*> 262 <!ATTLIST datalink id CDATA #REQUIRED> 263 264 <!ELEMENT typelink (#PCDATA|jvmti|code|i|b)*> 265 <!ATTLIST typelink id CDATA #REQUIRED> 266 267 <!ELEMENT fieldlink (#PCDATA|jvmti|code|i|b)*> 268 <!ATTLIST fieldlink id CDATA #REQUIRED 269 struct CDATA #REQUIRED> 270 271 <!ELEMENT paramlink (#PCDATA|jvmti|code|i|b)*> 272 <!ATTLIST paramlink id CDATA #REQUIRED> 273 274 <!ELEMENT eventlink (#PCDATA|jvmti|code|i|b)*> 275 <!ATTLIST eventlink id CDATA #REQUIRED> 276 277 <!ELEMENT errorlink (#PCDATA|jvmti|code|i|b|tm)*> 278 <!ATTLIST errorlink id CDATA #REQUIRED> 279 280 <!ELEMENT externallink (#PCDATA|jvmti|code|i|b|tm)*> 281 <!ATTLIST externallink id CDATA #REQUIRED> 282 283 <!ELEMENT vmspec EMPTY> 284 <!ATTLIST vmspec chapter CDATA #IMPLIED> 285 286 <!ELEMENT internallink (#PCDATA|jvmti|code|i|b)*> 287 <!ATTLIST internallink id CDATA #REQUIRED> 288 289 <!ELEMENT functionphaselist EMPTY> 290 <!ATTLIST functionphaselist phase (onload|onloadOnly|start|live|any) #REQUIRED> 291 292 <!ELEMENT eventphaselist EMPTY> 293 <!ATTLIST eventphaselist phase (onload|start|live|any) #REQUIRED> 294 295 <!ELEMENT issue ANY> 296 297 <!ELEMENT rationale ANY> 298 299 <!ELEMENT todo ANY> 300 301 <!ELEMENT origin (#PCDATA)*> 302 303 <!ELEMENT elide (intro|function|callback|event)*> 304 <!ATTLIST elide why CDATA #IMPLIED> 305 306 <!ELEMENT constants (constant*)> 307 <!ATTLIST constants id CDATA #REQUIRED 308 label CDATA #REQUIRED 309 kind (enum|bits|const) #REQUIRED 310 since CDATA "1.0"> 311 312 <!ELEMENT constant ANY> 313 <!ATTLIST constant id CDATA #REQUIRED 314 num CDATA #REQUIRED> 315 316 <!ELEMENT tm (#PCDATA)> 317 318 <!ELEMENT i (#PCDATA|jvmti|tm)*> 319 320 <!ELEMENT b (#PCDATA|jvmti|code)*> 321 322 <!ELEMENT code (#PCDATA|space)*> 323 324 <!ELEMENT pre ANY> 325 326 <!ELEMENT space EMPTY> 327 328 <!ELEMENT jvmti EMPTY> 329 330 <!ELEMENT example (#PCDATA|i)*> 331 332 <!ELEMENT br EMPTY> 333 334 <!ELEMENT p EMPTY> 335 336 <!ELEMENT blockquote ANY> 337 338 <!ELEMENT dl (dt|dd)+> 339 340 <!ELEMENT dd ANY> 341 342 <!ELEMENT dt (#PCDATA|jvmti|code|i|b)*> 343 344 <!ELEMENT table (tr)+> 345 346 <!ELEMENT tr (td|th)*> 347 348 <!ELEMENT td ANY> 349 <!ATTLIST td class CDATA #IMPLIED> 350 351 <!ELEMENT th ANY> 352 <!ATTLIST th class CDATA #IMPLIED> 353 354 <!ELEMENT ul (li)+> 355 <!ATTLIST ul type (disc|circle|square) "disc"> 356 357 <!ELEMENT li ANY> 358 ]> 359 360 <specification label="JVM(TM) Tool Interface" 361 majorversion="9" 362 minorversion="0" 363 microversion="0"> 364 <title subtitle="Version"> 365 <tm>JVM</tm> Tool Interface 366 </title> 367 368 <intro id="whatIs" label="What is the JVM Tool Interface?"> 369 The <tm>JVM</tm> Tool Interface (<jvmti/>) 370 is a programming interface used by development and monitoring tools. 371 It provides both a way to inspect the state and 372 to control the execution of applications running in the 373 <tm>Java</tm> virtual machine (VM). 374 <p/> 375 <jvmti/> is intended to provide a VM interface for the full breadth of tools 376 that need access to VM state, including but not limited to: profiling, 377 debugging, monitoring, thread analysis, and coverage analysis tools. 378 <p/> 379 <jvmti/> may not be available in all implementations of the <tm>Java</tm> virtual 380 machine. 381 <p/> 382 <jvmti/> is a two-way interface. 383 A client of <jvmti/>, hereafter called an <i>agent</i>, 384 can be notified of 385 interesting occurrences through <internallink id="EventSection">events</internallink>. 386 <jvmti/> 387 can query and control the application through many 388 <internallink id="FunctionSection">functions</internallink>, 389 either in response to events or 390 independent of them. 391 <p/> 392 Agents run in the same process with and communicate directly with 393 the virtual machine executing 394 the application being examined. This communication is 395 through a native interface (<jvmti/>). The native in-process interface allows 396 maximal control with minimal intrusion on the part of a tool. 397 Typically, agents are relatively compact. They can be controlled 398 by a separate process which implements the bulk of a tool's 399 function without interfering with the target application's normal execution. 400 </intro> 401 402 <intro id="architecture" label="Architecture"> 403 Tools can be written directly to <jvmti/> or indirectly 404 through higher level interfaces. 405 The Java Platform Debugger Architecture includes <jvmti/>, but also 406 contains higher-level, out-of-process debugger interfaces. The higher-level 407 interfaces are more appropriate than <jvmti/> for many tools. 408 For more information on the Java Platform Debugger Architecture, 409 see the 410 <externallink id="jpda/architecture.html">Java 411 Platform Debugger Architecture website</externallink>. 412 </intro> 413 414 <intro id="writingAgents" label="Writing Agents"> 415 Agents can be written in any native language that supports C 416 language calling conventions and C or C++ 417 definitions. 418 <p/> 419 The function, event, data type, and constant definitions needed for 420 using <jvmti/> are defined in the include file <code>jvmti.h</code>. 421 To use these definitions add the <tm>J2SE</tm> include directory 422 to your include path and add 423 <example> 424 #include <jvmti.h> 425 </example> 426 to your source code. 427 </intro> 428 429 <intro id="deployingAgents" label="Deploying Agents"> 430 An agent is deployed in a platform specific manner but is typically the 431 platform equivalent of a dynamic library. On the <tm>Windows</tm> operating 432 system, for example, an agent library is a "Dynamic Linked Library" (DLL). 433 On the <tm>Solaris</tm> Operating Environment, an agent library is a shared 434 object (<code>.so</code> file). 435 <p/> 436 437 An agent may be started at VM startup by specifying the agent library 438 name using a <internallink id="starting">command line option</internallink>. 439 Some implementations may support a mechanism to <internallink id="onattach"> 440 start agents</internallink> in the live <functionlink id="GetPhase">phase</functionlink>. 441 The details of how this is initiated are implementation specific. 442 </intro> 443 444 <intro id="entryPoint" label="Statically Linked Agents (since version 1.2.3)"> 445 446 A native JVMTI Agent may be <i>statically linked</i> with the VM. 447 The manner in which the library and VM image are combined is 448 implementation-dependent. 449 An agent L whose image has been combined with the VM is defined as 450 <i>statically linked</i> if and only if the agent exports a function 451 called Agent_OnLoad_L. 452 <p/> 453 If a <i>statically linked</i> agent L exports a function called 454 Agent_OnLoad_L and a function called Agent_OnLoad, the Agent_OnLoad 455 function will be ignored. 456 If an agent L is <i>statically linked</i>, an Agent_OnLoad_L 457 function will be invoked with the same arguments and expected return 458 value as specified for the Agent_OnLoad function. 459 An agent L that is <i>statically linked</i> will prohibit an agent of 460 the same name from being loaded dynamically. 461 <p/> 462 The VM will invoke the Agent_OnUnload_L function of the agent, if such 463 a function is exported, at the same point during VM execution as it would 464 have called the dynamic entry point Agent_OnUnLoad. A statically loaded 465 agent cannot be unloaded. The Agent_OnUnload_L function will still be 466 called to do any other agent shutdown related tasks. 467 If a <i>statically linked</i> agent L exports a function called 468 Agent_OnUnLoad_L and a function called Agent_OnUnLoad, the Agent_OnUnLoad 469 function will be ignored. 470 <p/> 471 If an agent L is <i>statically linked</i>, an Agent_OnAttach_L function 472 will be invoked with the same arguments and expected return value as 473 specified for the Agent_OnAttach function. 474 If a <i>statically linked</i> agent L exports a function called 475 Agent_OnAttach_L and a function called Agent_OnAttach, the Agent_OnAttach 476 function will be ignored. 477 </intro> 478 479 <intro id="starting" label="Agent Command Line Options"> 480 The term "command-line option" is used below to 481 mean options supplied in the <code>JavaVMInitArgs</code> argument 482 to the <code>JNI_CreateJavaVM</code> function of the JNI 483 Invocation API. 484 <p/> 485 One of the two following 486 command-line options is used on VM startup to 487 properly load and run agents. 488 These arguments identify the library containing 489 the agent as well as an options 490 string to be passed in at startup. 491 <dl> 492 <dt><code>-agentlib:</code><i><agent-lib-name></i><code>=</code><i><options></i></dt> 493 <dd> 494 The name following <code>-agentlib:</code> is the name of the 495 library to load. Lookup of the library, both its full name and location, 496 proceeds in a platform-specific manner. 497 Typically, the <i><agent-lib-name></i> is expanded to an 498 operating system specific file name. 499 The <i><options></i> will be passed to the agent on start-up. 500 For example, if the option 501 <code>-agentlib:foo=opt1,opt2</code> is specified, the VM will attempt to 502 load the shared library <code>foo.dll</code> from the system <code>PATH</code> 503 under <tm>Windows</tm> or <code>libfoo.so</code> from the 504 <code>LD_LIBRARY_PATH</code> under the <tm>Solaris</tm> operating 505 environment. 506 If the agent library is statically linked into the executable 507 then no actual loading takes place. 508 <p/> 509 </dd> 510 <dt><code>-agentpath:</code><i><path-to-agent></i><code>=</code><i><options></i></dt> 511 <dd> 512 The path following <code>-agentpath:</code> is the absolute path from which 513 to load the library. 514 No library name expansion will occur. 515 The <i><options></i> will be passed to the agent on start-up. 516 For example, if the option 517 <code>-agentpath:c:\myLibs\foo.dll=opt1,opt2</code> is specified, the VM will attempt to 518 load the shared library <code>c:\myLibs\foo.dll</code>. If the agent 519 library is statically linked into the executable 520 then no actual loading takes place. 521 <p/> 522 </dd> 523 </dl> 524 For a dynamic shared library agent, the start-up routine 525 <internallink id="onload"><code>Agent_OnLoad</code></internallink> 526 in the library will be invoked. If the agent library is statically linked 527 into the executable then the system will attempt to invoke the 528 <code>Agent_OnLoad_<agent-lib-name></code> entry point where 529 <agent-lib-name> is the basename of the 530 agent. In the above example <code>-agentpath:c:\myLibs\foo.dll=opt1,opt2</code>, 531 the system will attempt to find and call the <code>Agent_OnLoad_foo</code> start-up routine. 532 <p/> 533 Libraries loaded with <code>-agentlib:</code> or <code>-agentpath:</code> 534 will be searched for JNI native method implementations to facilitate the 535 use of Java programming language code in tools, as is needed for 536 <internallink id="bci">bytecode instrumentation</internallink>. 537 <p/> 538 The agent libraries will be searched after all other libraries have been 539 searched (agents wishing to override or intercept the native method 540 implementations of non-agent methods can use the 541 <eventlink id="NativeMethodBind">NativeMethodBind event</eventlink>). 542 <p/> 543 These switches do the above and nothing more - they do not change the 544 state of the VM or <jvmti/>. No command line options are needed 545 to enable <jvmti/> 546 or aspects of <jvmti/>, this is handled programmatically 547 by the use of 548 <internallink id="capability">capabilities</internallink>. 549 </intro> 550 551 <intro id="startup" label="Agent Start-Up"> 552 The VM starts each agent by invoking a start-up function. 553 If the agent is started in the <code>OnLoad</code> 554 <functionlink id="GetPhase">phase</functionlink> the function 555 <internallink id="onload"><code>Agent_OnLoad</code></internallink> 556 or <internallink id="onload"><code>Agent_OnLoad_L</code></internallink> 557 for statically linked agents will be invoked. 558 If the agent is started in the live 559 <functionlink id="GetPhase">phase</functionlink> the function 560 <internallink id="onattach"><code>Agent_OnAttach</code></internallink> 561 or <internallink id="onattach"><code>Agent_OnAttach_L</code></internallink> 562 for statically linked agents will be invoked. 563 Exactly one call to a start-up function is made per agent. 564 </intro> 565 566 <intro id="onload" label="Agent Start-Up (OnLoad phase)"> 567 If an agent is started during the <code>OnLoad</code> phase then its 568 agent library must export a start-up function with the following prototype: 569 <example> 570 JNIEXPORT jint JNICALL 571 Agent_OnLoad(JavaVM *vm, char *options, void *reserved)</example> 572 Or for a statically linked agent named 'L': 573 <example> 574 JNIEXPORT jint JNICALL 575 Agent_OnLoad_L(JavaVM *vm, char *options, void *reserved)</example> 576 577 The VM will start the agent by calling this function. 578 It will be called early enough in VM initialization that: 579 <ul> 580 <li><functionlink id="SetSystemProperty">system properties</functionlink> 581 may be set before they have been used in the start-up of the VM</li> 582 <li>the full set of 583 <internallink id="capability">capabilities</internallink> 584 is still available (note that capabilities that configure the VM 585 may only be available at this time--see the 586 <internallink id="capability">Capability function section</internallink>)</li> 587 <li>no bytecodes have executed</li> 588 <li>no classes have been loaded</li> 589 <li>no objects have been created</li> 590 </ul> 591 <p/> 592 The VM will call the <code>Agent_OnLoad</code> or 593 <code>Agent_OnLoad_<agent-lib-name></code> function with 594 <i><options></i> as the second argument - 595 that is, using the command-line option examples, 596 <code>"opt1,opt2"</code> will be passed to the <code>char *options</code> 597 argument of <code>Agent_OnLoad</code>. 598 The <code>options</code> argument is encoded as a 599 <internallink id="mUTF">modified UTF-8</internallink> string. 600 If <i>=<options></i> is not specified, 601 a zero length string is passed to <code>options</code>. 602 The lifespan of the <code>options</code> string is the 603 <code>Agent_OnLoad</code> or <code>Agent_OnLoad_<agent-lib-name></code> 604 call. If needed beyond this time the string or parts of the string must 605 be copied. 606 The period between when <code>Agent_OnLoad</code> is called and when it 607 returns is called the <i>OnLoad phase</i>. 608 Since the VM is not initialized during the OnLoad 609 <functionlink id="GetPhase">phase</functionlink>, 610 the set of allowed operations 611 inside <code>Agent_OnLoad</code> is restricted (see the function descriptions for the 612 functionality available at this time). 613 The agent can safely process the options and set 614 event callbacks with <functionlink id="SetEventCallbacks"></functionlink>. Once 615 the VM initialization event is received 616 (that is, the <eventlink id="VMInit">VMInit</eventlink> 617 callback is invoked), the agent 618 can complete its initialization. 619 <rationale> 620 Early startup is required so that agents can set the desired capabilities, 621 many of which must be set before the VM is initialized. 622 In JVMDI, the -Xdebug command-line option provided 623 very coarse-grain control of capabilities. 624 JVMPI implementations use various tricks to provide a single "JVMPI on" switch. 625 No reasonable command-line 626 option could provide the fine-grain of control required to balance needed capabilities vs 627 performance impact. 628 Early startup is also needed so that agents can control the execution 629 environment - modifying the file system and system properties to install 630 their functionality. 631 </rationale> 632 <p/> 633 The return value from <code>Agent_OnLoad</code> or 634 <code>Agent_OnLoad_<agent-lib-name></code> is used to indicate an error. 635 Any value other than zero indicates an error and causes termination of the VM. 636 </intro> 637 638 <intro id="onattach" label="Agent Start-Up (Live phase)"> 639 A VM may support a mechanism that allows agents to be started in the VM during the live 640 <functionlink id="GetPhase">phase</functionlink>. The details of how this is supported, 641 are implementation specific. For example, a tool may use some platform specific mechanism, 642 or implementation specific API, to attach to the running VM, and request it start a given 643 agent. 644 <p/> 645 If an agent is started during the live phase then its agent library 646 must export a start-up function 647 with the following prototype: 648 <example> 649 JNIEXPORT jint JNICALL 650 Agent_OnAttach(JavaVM* vm, char *options, void *reserved)</example> 651 Or for a statically linked agent named 'L': 652 <example> 653 JNIEXPORT jint JNICALL 654 Agent_OnAttach_L(JavaVM* vm, char *options, void *reserved)</example> 655 656 <p/> 657 The VM will start the agent by calling this function. 658 It will be called in the context of a thread 659 that is attached to the VM. The first argument <i><vm></i> is the Java VM. 660 The <i><options></i> argument is the startup options provided to the agent. 661 <i><options></i> is encoded as a <internallink id="mUTF">modified UTF-8 662 </internallink> string. 663 If startup options were not provided, a zero length string is passed to 664 <code>options</code>. The lifespan of the <code>options</code> string is the 665 <code>Agent_OnAttach</code> or <code>Agent_OnAttach_<agent-lib-name></code> call. 666 If needed beyond this time the string or parts of the string must be copied. 667 <p/> 668 Note that some <internallink id="capability">capabilities</internallink> 669 may not be available in the live phase. 670 <p/> 671 The <code>Agent_OnAttach</code> or <code>Agent_OnAttach_<agent-lib-name 672 ></code> function initializes the agent and returns a value 673 to the VM to indicate if an error occurred. Any value other than zero indicates an error. 674 An error does not cause the VM to terminate. Instead the VM ignores the error, or takes 675 some implementation specific action -- for example it might print an error to standard error, 676 or record the error in a system log. 677 </intro> 678 679 <intro id="onunload" label="Agent Shutdown"> 680 The library may optionally export a 681 shutdown function with the following prototype: 682 <example> 683 JNIEXPORT void JNICALL 684 Agent_OnUnload(JavaVM *vm)</example> 685 Or for a statically linked agent named 'L': 686 <example> 687 JNIEXPORT void JNICALL 688 Agent_OnUnload_L(JavaVM *vm)</example> 689 690 This function will be called by the VM when the library is about to be unloaded. 691 The library will be unloaded (unless it is statically linked into the 692 executable) and this function will be called if some platform specific 693 mechanism causes the unload (an unload mechanism is not specified in this document) 694 or the library is (in effect) unloaded by the termination of the VM whether through 695 normal termination or VM failure, including start-up failure. 696 Uncontrolled shutdown is, of course, an exception to this rule. 697 Note the distinction between this function and the 698 <eventlink id="VMDeath">VM Death event</eventlink>: for the VM Death event 699 to be sent, the VM must have run at least to the point of initialization and a valid 700 <jvmti/> environment must exist which has set a callback for VMDeath 701 and enabled the event. 702 None of these are required for <code>Agent_OnUnload</code> or 703 <code>Agent_OnUnload_<agent-lib-name></code> and this function 704 is also called if the library is unloaded for other reasons. 705 In the case that a VM Death event is sent, it will be sent before this 706 function is called (assuming this function is called due to VM termination). 707 This function can be used to clean-up resources allocated by the agent. 708 </intro> 709 710 <intro id="tooloptions" label="JAVA_TOOL_OPTIONS"> 711 Since the command-line cannot always be accessed or modified, for example in embedded VMs 712 or simply VMs launched deep within scripts, a <code>JAVA_TOOL_OPTIONS</code> variable is 713 provided so that agents may be launched in these cases. 714 <p/> 715 Platforms which support environment variables or other named strings, may support the 716 <code>JAVA_TOOL_OPTIONS</code> variable. This variable will be broken into options at white-space 717 boundaries. White-space characters include space, tab, carriage-return, new-line, 718 vertical-tab, and form-feed. Sequences of white-space characters are considered 719 equivalent to a single white-space character. No white-space is included in the options 720 unless quoted. Quoting is as follows: 721 <ul> 722 <li>All characters enclosed between a pair of single quote marks (''), except a single 723 quote, are quoted.</li> 724 <li>Double quote characters have no special meaning inside a pair of single quote marks.</li> 725 <li>All characters enclosed between a pair of double quote marks (""), except a double 726 quote, are quoted.</li> 727 <li>Single quote characters have no special meaning inside a pair of double quote marks.</li> 728 <li>A quoted part can start or end anywhere in the variable.</li> 729 <li>White-space characters have no special meaning when quoted -- they are included in 730 the option like any other character and do not mark white-space boundaries.</li> 731 <li>The pair of quote marks is not included in the option.</li> 732 </ul> 733 <code>JNI_CreateJavaVM</code> (in the JNI Invocation API) will prepend these options to the options supplied 734 in its <code>JavaVMInitArgs</code> argument. Platforms may disable this feature in cases where security is 735 a concern; for example, the Reference Implementation disables this feature on Unix systems when 736 the effective user or group ID differs from the real ID. 737 This feature is intended to support the initialization of tools -- specifically including the 738 launching of native or Java programming language agents. Multiple tools may wish to use this 739 feature, so the variable should not be overwritten, instead, options should be appended to 740 the variable. Note that since the variable is processed at the time of the JNI Invocation 741 API create VM call, options processed by a launcher (e.g., VM selection options) will not be handled. 742 </intro> 743 744 <intro id="environments" label="Environments"> 745 The <jvmti/> specification supports the use of multiple simultaneous 746 <jvmti/> agents. 747 Each agent has its own <jvmti/> environment. 748 That is, the <jvmti/> state is 749 separate for each agent - changes to one environment do not affect the 750 others. The state of a <jvmti/> 751 environment includes: 752 <ul> 753 <li><functionlink id="SetEventCallbacks">the event callbacks</functionlink></li> 754 <li><functionlink id="SetEventNotificationMode">the set of events which are enabled</functionlink></li> 755 <li><internallink id="capability">the capabilities</internallink></li> 756 <li><internallink id="memory">the memory allocation/deallocation hooks</internallink></li> 757 </ul> 758 Although their <jvmti/> state 759 is separate, agents inspect and modify the shared state 760 of the VM, they also share the native environment in which they execute. 761 As such, an agent can perturb the results of other agents or cause them 762 to fail. It is the responsibility of the agent writer to specify the level 763 of compatibility with other agents. <jvmti/> implementations are not capable 764 of preventing destructive interactions between agents. Techniques to reduce 765 the likelihood of these occurrences are beyond the scope of this document. 766 <p/> 767 An agent creates a <jvmti/> environment 768 by passing a <jvmti/> version 769 as the interface ID to the JNI Invocation API function 770 <externallink id="jni/invocation.html#getenv"> 771 <code>GetEnv</code></externallink>. 772 See <internallink id="jvmtiEnvAccess">Accessing <jvmti/> Functions</internallink> 773 for more details on the creation and use of 774 <jvmti/> environments. 775 Typically, <jvmti/> environments are created by calling <code>GetEnv</code> from 776 <internallink id="onload"><code>Agent_OnLoad</code></internallink>. 777 </intro> 778 779 <intro id="bci" label="Bytecode Instrumentation"> 780 This interface does not include some events that one might expect in an interface with 781 profiling support. Some examples include object allocation events and full speed 782 method enter and exit events. The interface instead provides support for 783 <i>bytecode instrumentation</i>, the ability to alter the Java virtual machine 784 bytecode instructions which comprise the target program. Typically, these alterations 785 are to add "events" to the code of a method - for example, to add, at the beginning of a method, 786 a call to <code>MyProfiler.methodEntered()</code>. 787 Since the changes are purely additive, they do not modify application 788 state or behavior. 789 Because the inserted agent code is standard bytecodes, the VM can run at full speed, 790 optimizing not only the target program but also the instrumentation. If the 791 instrumentation does not involve switching from bytecode execution, no expensive 792 state transitions are needed. The result is high performance events. 793 This approach also provides complete control to the agent: instrumentation can be 794 restricted to "interesting" portions of the code (e.g., the end user's code) and 795 can be conditional. Instrumentation can run entirely in Java programming language 796 code or can call into the native agent. Instrumentation can simply maintain 797 counters or can statistically sample events. 798 <p/> 799 Instrumentation can be inserted in one of three ways: 800 <ul> 801 <li> 802 Static Instrumentation: The class file is instrumented before it 803 is loaded into the VM - for example, by creating a duplicate directory of 804 <code>*.class</code> files which have been modified to add the instrumentation. 805 This method is extremely awkward and, in general, an agent cannot know 806 the origin of the class files which will be loaded. 807 </li> 808 <li> 809 Load-Time Instrumentation: When a class file is loaded by the VM, the raw 810 bytes of the class file are sent for instrumentation to the agent. 811 The <eventlink id="ClassFileLoadHook"/> 812 event, triggered by the class load, 813 provides this functionality. This mechanism provides efficient 814 and complete access to one-time instrumentation. 815 </li> 816 <li> 817 Dynamic Instrumentation: A class which is already loaded (and possibly 818 even running) is modified. This optional feature is provided by the 819 <eventlink id="ClassFileLoadHook"/> event, triggered by calling the 820 <functionlink id="RetransformClasses"/> function. 821 Classes can be modified multiple times and can be returned to their 822 original state. 823 The mechanism allows instrumentation which changes during the 824 course of execution. 825 </li> 826 </ul> 827 <p/> 828 The class modification functionality provided in this interface 829 is intended to provide a mechanism for instrumentation 830 (the <eventlink id="ClassFileLoadHook"/> event 831 and the <functionlink id="RetransformClasses"/> function) 832 and, during development, for fix-and-continue debugging 833 (the <functionlink id="RedefineClasses"/> function). 834 <p/> 835 Care must be taken to avoid perturbing dependencies, especially when 836 instrumenting core classes. For example, an approach to getting notification 837 of every object allocation is to instrument the constructor on 838 <code>Object</code>. Assuming that the constructor is initially 839 empty, the constructor could be changed to: 840 <example> 841 public Object() { 842 MyProfiler.allocationTracker(this); 843 } 844 </example> 845 However, if this change was made using the 846 <eventlink id="ClassFileLoadHook"/> 847 event then this might impact a typical VM as follows: 848 the first created object will call the constructor causing a class load of 849 <code>MyProfiler</code>; which will then cause 850 object creation, and since <code>MyProfiler</code> isn't loaded yet, 851 infinite recursion; resulting in a stack overflow. A refinement of this 852 would be to delay invoking the tracking method until a safe time. For 853 example, <code>trackAllocations</code> could be set in the 854 handler for the <code>VMInit</code> event. 855 <example> 856 static boolean trackAllocations = false; 857 858 public Object() { 859 if (trackAllocations) { 860 MyProfiler.allocationTracker(this); 861 } 862 } 863 </example> 864 <p/> 865 The <functionlink id="SetNativeMethodPrefix"/> allows native methods 866 to be instrumented by the use of wrapper methods. 867 </intro> 868 869 <intro id="bcimodules" label="Bytecode Instrumentation of code in modules"> 870 Agents can use the functions <functionlink id="AddModuleReads"/>, 871 <functionlink id="AddModuleExports"/>, <functionlink id="AddModuleOpens"/>, 872 <functionlink id="AddModuleUses"/> and <functionlink id="AddModuleProvides"/> 873 to update a module to expand the set of modules that it reads, the set of 874 packages that it exports or opens to other modules, or the services that it 875 uses and provides. 876 <p/> 877 As an aid to agents that deploy supporting classes on the search path of 878 the bootstrap class loader, or the search path of the class loader that 879 loads the main class, the Java virtual machine arranges for the module 880 of classes transformed by the <eventlink id="ClassFileLoadHook"/> event to 881 read the unnamed module of both class loaders. 882 </intro> 883 884 <intro id="mUTF" label="Modified UTF-8 String Encoding"> 885 <jvmti/> uses modified UTF-8 to encode character strings. 886 This is the same encoding used by JNI. 887 Modified UTF-8 differs 888 from standard UTF-8 in the representation of supplementary characters 889 and of the null character. See the 890 <externallink id="jni/types.html#modified-utf-8-strings"> 891 Modified UTF-8 Strings</externallink> 892 section of the JNI specification for details. 893 </intro> 894 895 <intro id="context" label="Specification Context"> 896 Since this interface provides access to the state of applications running in the 897 Java virtual machine; 898 terminology refers to the Java platform and not the native 899 platform (unless stated otherwise). For example: 900 <ul> 901 <li>"thread" means Java programming language thread.</li> 902 <li>"stack frame" means Java virtual machine stack frame.</li> 903 <li>"class" means Java programming language class.</li> 904 <li>"heap" means Java virtual machine heap.</li> 905 <li>"monitor" means Java programming language object monitor.</li> 906 </ul> 907 <p/> 908 Sun, Sun Microsystems, the Sun logo, Java, and JVM 909 are trademarks or registered trademarks of Oracle 910 and/or its affiliates, in the U.S. and other countries. 911 </intro> 912 913 914 <functionsection label="Functions"> 915 <intro id="jvmtiEnvAccess" label="Accessing Functions"> 916 Native code accesses <jvmti/> features 917 by calling <jvmti/> functions. 918 Access to <jvmti/> functions is by use of an interface pointer 919 in the same manner as 920 <externallink id="jni/design.html">Java 921 Native Interface (JNI) functions</externallink> are accessed. 922 The <jvmti/> interface pointer is called the 923 <i>environment pointer</i>. 924 <p/> 925 An environment pointer is a pointer to an environment and has 926 the type <code>jvmtiEnv*</code>. 927 An environment has information about its <jvmti/> connection. 928 The first value in the environment is a pointer to the function table. 929 The function table is an array of pointers to <jvmti/> functions. 930 Every function pointer is at a predefined offset inside the 931 array. 932 <p/> 933 When used from the C language: 934 double indirection is used to access the functions; 935 the environment pointer provides context and is the first 936 parameter of each function call; for example: 937 <example> 938 jvmtiEnv *jvmti; 939 ... 940 jvmtiError err = (*jvmti)->GetLoadedClasses(jvmti, &class_count, &classes); 941 </example> 942 <p/> 943 When used from the C++ language: 944 functions are accessed as member functions of <code>jvmtiEnv</code>; 945 the environment pointer is not passed to the function call; for example: 946 <example> 947 jvmtiEnv *jvmti; 948 ... 949 jvmtiError err = jvmti->GetLoadedClasses(&class_count, &classes); 950 </example> 951 Unless otherwise stated, all examples and declarations in this 952 specification use the C language. 953 <p/> 954 A <jvmti/> environment can be obtained through the JNI Invocation API 955 <code>GetEnv</code> function: 956 <example> 957 jvmtiEnv *jvmti; 958 ... 959 (*jvm)->GetEnv(jvm, &jvmti, JVMTI_VERSION_1_0); 960 </example> 961 Each call to <code>GetEnv</code> 962 creates a new <jvmti/> connection and thus 963 a new <jvmti/> environment. 964 The <code>version</code> argument of <code>GetEnv</code> must be 965 a <jvmti/> version. 966 The returned environment may have a different version than the 967 requested version but the returned environment must be compatible. 968 <code>GetEnv</code> will return <code>JNI_EVERSION</code> if a 969 compatible version is not available, if <jvmti/> is not supported or 970 <jvmti/> is not supported in the current VM configuration. 971 Other interfaces may be added for creating <jvmti/> environments 972 in specific contexts. 973 Each environment has its own state (for example, 974 <functionlink id="SetEventNotificationMode">desired events</functionlink>, 975 <functionlink id="SetEventCallbacks">event handling functions</functionlink>, and 976 <functionlink id="AddCapabilities">capabilities</functionlink>). 977 An environment is released with 978 <functionlink id="DisposeEnvironment"></functionlink>. 979 Thus, unlike JNI which has one environment per thread, <jvmti/> environments work 980 across threads and are created dynamically. 981 </intro> 982 983 <intro id="functionReturn" label="Function Return Values"> 984 <jvmti/> functions always return an 985 <internallink id="ErrorSection">error code</internallink> via the 986 <datalink id="jvmtiError"/> function return value. 987 Some functions can return additional 988 values through pointers provided by the calling function. 989 In some cases, <jvmti/> functions allocate memory that your program must 990 explicitly deallocate. This is indicated in the individual <jvmti/> 991 function descriptions. Empty lists, arrays, sequences, etc are 992 returned as <code>NULL</code>. 993 <p/> 994 In the event that the <jvmti/> function encounters 995 an error (any return value other than <code>JVMTI_ERROR_NONE</code>) the values 996 of memory referenced by argument pointers is undefined, but no memory 997 will have been allocated and no global references will have been allocated. 998 If the error occurs because of invalid input, no action will have occurred. 999 </intro> 1000 1001 <intro id="refs" label="Managing JNI Object References"> 1002 <jvmti/> functions identify objects with JNI references 1003 (<datalink id="jobject"/> and <datalink id="jclass"/>) 1004 and their derivatives 1005 (<datalink id="jthread"/> and <datalink id="jthreadGroup"/>). 1006 References passed to 1007 <jvmti/> functions can be either global or local, but they must be 1008 strong references. All references returned by <jvmti/> functions are 1009 local references--these local references are created 1010 during the <jvmti/> call. 1011 Local references are a resource that must be managed (see the 1012 <externallink id="jni/functions.html#local-references"> 1013 JNI Documentation</externallink>). 1014 When threads return from native code all local references 1015 are freed. Note that some threads, including typical 1016 agent threads, will never return from native code. 1017 A thread is ensured the ability to create sixteen local 1018 references without the need for any explicit management. 1019 For threads executing a limited number of <jvmti/> calls before 1020 returning from native code 1021 (for example, threads processing events), 1022 it may be determined that no explicit management 1023 is needed. 1024 However, long running agent threads will need explicit 1025 local reference management--usually with the JNI functions 1026 <code>PushLocalFrame</code> and <code>PopLocalFrame</code>. 1027 Conversely, to preserve references beyond the 1028 return from native code, they must be converted to global references. 1029 These rules do not apply to <datalink id="jmethodID"/> and <datalink id="jfieldID"/> 1030 as they are not <datalink id="jobject"/>s. 1031 </intro> 1032 1033 <intro id="prereqState" label="Prerequisite State for Calling Functions"> 1034 Unless the function explicitly states that the agent must bring 1035 a thread or the VM to a particular state (for example, suspended), 1036 the <jvmti/> implementation is responsible for bringing the VM to a 1037 safe and consistent state for performing the function. 1038 </intro> 1039 1040 <intro id="functionsExceptions" label="Exceptions and Functions"> 1041 <jvmti/> functions never throw exceptions; error conditions are 1042 communicated via the 1043 <internallink id="functionReturn">function return value</internallink>. 1044 Any existing exception state is preserved across a call to a 1045 <jvmti/> function. 1046 See the 1047 <externallink 1048 id="jni/design.html#java-exceptions" 1049 >Java Exceptions</externallink> 1050 section of the JNI specification for information on handling exceptions. 1051 </intro> 1052 1053 <category id="memory" label="Memory Management"> 1054 <intro> 1055 These functions provide for the allocation and deallocation of 1056 memory used by <jvmti/> functionality and can be used to provide 1057 working memory for agents. 1058 Memory managed by <jvmti/> is not compatible with other memory 1059 allocation libraries and mechanisms. 1060 </intro> 1061 1062 <function id="Allocate" jkernel="yes" phase="any" callbacksafe="safe" impl="notrace" num="46"> 1063 <synopsis>Allocate</synopsis> 1064 <description> 1065 Allocate an area of memory through the <jvmti/> allocator. 1066 The allocated 1067 memory should be freed with <functionlink id="Deallocate"></functionlink>. 1068 </description> 1069 <origin>jvmdi</origin> 1070 <capabilities> 1071 </capabilities> 1072 <parameters> 1073 <param id="size"> 1074 <jlong/> 1075 <description> 1076 The number of bytes to allocate. 1077 <rationale> 1078 <code>jlong</code> is used for compatibility with JVMDI. 1079 </rationale> 1080 </description> 1081 </param> 1082 <param id="mem_ptr"> 1083 <allocbuf incount="size"><uchar/></allocbuf> 1084 <description> 1085 On return, a pointer to the beginning of the allocated memory. 1086 If <code>size</code> is zero, <code>NULL</code> is returned. 1087 </description> 1088 </param> 1089 </parameters> 1090 <errors> 1091 <error id="JVMTI_ERROR_OUT_OF_MEMORY"> 1092 Memory request cannot be honored. 1093 </error> 1094 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 1095 <paramlink id="size"></paramlink> is less than zero. 1096 </error> 1097 </errors> 1098 </function> 1099 1100 <function id="Deallocate" jkernel="yes" phase="any" callbacksafe="safe" impl="notrace" num="47"> 1101 <synopsis>Deallocate</synopsis> 1102 <description> 1103 Deallocate <code>mem</code> using the <jvmti/> allocator. 1104 This function should 1105 be used to deallocate any memory allocated and returned 1106 by a <jvmti/> function 1107 (including memory allocated with <functionlink id="Allocate"></functionlink>). 1108 All allocated memory must be deallocated 1109 or the memory cannot be reclaimed. 1110 </description> 1111 <origin>jvmdi</origin> 1112 <capabilities> 1113 </capabilities> 1114 <parameters> 1115 <param id="mem"> 1116 <outbuf> 1117 <uchar/> 1118 <nullok>the call is ignored</nullok> 1119 </outbuf> 1120 <description> 1121 A pointer to the beginning of the allocated memory. 1122 Please ignore "On return, the elements are set." 1123 <todo>keep it from generating "On return, the elements are set"</todo> 1124 </description> 1125 </param> 1126 </parameters> 1127 <errors> 1128 </errors> 1129 </function> 1130 </category> 1131 1132 <category id="threadCategory" label="Thread"> 1133 <intro> 1134 </intro> 1135 1136 <function id="GetThreadState" num="17"> 1137 <synopsis>Get Thread State</synopsis> 1138 <description> 1139 Get the state of a thread. The state of the thread is represented by the 1140 answers to the hierarchical set of questions below: 1141 <ul type="circle"> 1142 <li><i>Alive?</i> 1143 <ul> 1144 <li>Not alive. 1145 <ul type="circle"> 1146 <li><i>Why not alive?</i> 1147 <ul> 1148 <li>New.</li> 1149 <li>Terminated (<datalink 1150 id="JVMTI_THREAD_STATE_TERMINATED"><code>JVMTI_THREAD_STATE_TERMINATED</code></datalink>)</li> 1151 </ul> 1152 </li> 1153 </ul> 1154 </li> 1155 <li>Alive (<datalink 1156 id="JVMTI_THREAD_STATE_ALIVE"><code>JVMTI_THREAD_STATE_ALIVE</code></datalink>) 1157 <ul type="circle"> 1158 <li><i>Suspended?</i> 1159 <ul> 1160 <li>Suspended (<datalink 1161 id="JVMTI_THREAD_STATE_SUSPENDED"><code>JVMTI_THREAD_STATE_SUSPENDED</code></datalink>)</li> 1162 <li>Not suspended</li> 1163 </ul> 1164 </li> 1165 <li><i>Interrupted?</i> 1166 <ul> 1167 <li>Interrupted (<datalink 1168 id="JVMTI_THREAD_STATE_INTERRUPTED"><code>JVMTI_THREAD_STATE_INTERRUPTED</code></datalink>)</li> 1169 <li>Not interrupted.</li> 1170 </ul> 1171 </li> 1172 <li><i>In native?</i> 1173 <ul> 1174 <li>In native code (<datalink 1175 id="JVMTI_THREAD_STATE_IN_NATIVE"><code>JVMTI_THREAD_STATE_IN_NATIVE</code></datalink>)</li> 1176 <li>In Java programming language code</li> 1177 </ul> 1178 </li> 1179 <li><i>What alive state?</i> 1180 <ul> 1181 <li>Runnable (<datalink 1182 id="JVMTI_THREAD_STATE_RUNNABLE"><code>JVMTI_THREAD_STATE_RUNNABLE</code></datalink>)</li> 1183 <li>Blocked (<datalink 1184 id="JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER"><code>JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER</code></datalink>)</li> 1185 <li>Waiting (<datalink 1186 id="JVMTI_THREAD_STATE_WAITING"><code>JVMTI_THREAD_STATE_WAITING</code></datalink>) 1187 <ul type="circle"> 1188 <li><i>Timed wait?</i> 1189 <ul> 1190 <li>Indefinite (<datalink 1191 id="JVMTI_THREAD_STATE_WAITING_INDEFINITELY"><code>JVMTI_THREAD_STATE_WAITING_INDEFINITELY</code></datalink></li> 1192 <li>Timed (<datalink 1193 id="JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT"><code>JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT</code></datalink>)</li> 1194 </ul> 1195 </li> 1196 <li><i>Why waiting?</i> 1197 <ul> 1198 <li>Object.wait (<datalink 1199 id="JVMTI_THREAD_STATE_IN_OBJECT_WAIT"><code>JVMTI_THREAD_STATE_IN_OBJECT_WAIT</code></datalink>)</li> 1200 <li>LockSupport.park (<datalink 1201 id="JVMTI_THREAD_STATE_PARKED"><code>JVMTI_THREAD_STATE_PARKED</code></datalink>)</li> 1202 <li>Sleeping (<datalink 1203 id="JVMTI_THREAD_STATE_SLEEPING"><code>JVMTI_THREAD_STATE_SLEEPING</code></datalink>)</li> 1204 </ul> 1205 </li> 1206 </ul> 1207 </li> 1208 </ul> 1209 </li> 1210 </ul> 1211 </li> 1212 </ul> 1213 </li> 1214 </ul> 1215 <p/> 1216 The answers are represented by the following bit vector. 1217 <constants id="jvmtiThreadState" label="Thread State Flags" kind="bits"> 1218 <constant id="JVMTI_THREAD_STATE_ALIVE" num="0x0001"> 1219 Thread is alive. Zero if thread is new (not started) or terminated. 1220 </constant> 1221 <constant id="JVMTI_THREAD_STATE_TERMINATED" num="0x0002"> 1222 Thread has completed execution. 1223 </constant> 1224 <constant id="JVMTI_THREAD_STATE_RUNNABLE" num="0x0004"> 1225 Thread is runnable. 1226 </constant> 1227 <constant id="JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER" num="0x0400"> 1228 Thread is waiting to enter a synchronization block/method or, 1229 after an <code>Object.wait()</code>, waiting to re-enter a 1230 synchronization block/method. 1231 </constant> 1232 <constant id="JVMTI_THREAD_STATE_WAITING" num="0x0080"> 1233 Thread is waiting. 1234 </constant> 1235 <constant id="JVMTI_THREAD_STATE_WAITING_INDEFINITELY" num="0x0010"> 1236 Thread is waiting without a timeout. 1237 For example, <code>Object.wait()</code>. 1238 </constant> 1239 <constant id="JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT" num="0x0020"> 1240 Thread is waiting with a maximum time to wait specified. 1241 For example, <code>Object.wait(long)</code>. 1242 </constant> 1243 <constant id="JVMTI_THREAD_STATE_SLEEPING" num="0x0040"> 1244 Thread is sleeping -- <code>Thread.sleep(long)</code>. 1245 </constant> 1246 <constant id="JVMTI_THREAD_STATE_IN_OBJECT_WAIT" num="0x0100"> 1247 Thread is waiting on an object monitor -- <code>Object.wait</code>. 1248 </constant> 1249 <constant id="JVMTI_THREAD_STATE_PARKED" num="0x0200"> 1250 Thread is parked, for example: <code>LockSupport.park</code>, 1251 <code>LockSupport.parkUtil</code> and <code>LockSupport.parkNanos</code>. 1252 </constant> 1253 <constant id="JVMTI_THREAD_STATE_SUSPENDED" num="0x100000"> 1254 Thread suspended. 1255 <code>java.lang.Thread.suspend()</code> 1256 or a <jvmti/> suspend function 1257 (such as <functionlink id="SuspendThread"></functionlink>) 1258 has been called on the thread. If this bit 1259 is set, the other bits refer to the thread state before suspension. 1260 </constant> 1261 <constant id="JVMTI_THREAD_STATE_INTERRUPTED" num="0x200000"> 1262 Thread has been interrupted. 1263 </constant> 1264 <constant id="JVMTI_THREAD_STATE_IN_NATIVE" num="0x400000"> 1265 Thread is in native code--that is, a native method is running 1266 which has not called back into the VM or Java programming 1267 language code. 1268 <p/> 1269 This flag is not set when running VM compiled Java programming 1270 language code nor is it set when running VM code or 1271 VM support code. Native VM interface functions, such as JNI and 1272 <jvmti/> functions, may be implemented as VM code. 1273 </constant> 1274 <constant id="JVMTI_THREAD_STATE_VENDOR_1" num="0x10000000"> 1275 Defined by VM vendor. 1276 </constant> 1277 <constant id="JVMTI_THREAD_STATE_VENDOR_2" num="0x20000000"> 1278 Defined by VM vendor. 1279 </constant> 1280 <constant id="JVMTI_THREAD_STATE_VENDOR_3" num="0x40000000"> 1281 Defined by VM vendor. 1282 </constant> 1283 </constants> 1284 The following definitions are used to convert <jvmti/> thread state 1285 to <code>java.lang.Thread.State</code> style states. 1286 <constants id="jvmtiJavaLangThreadState" label="java.lang.Thread.State Conversion Masks" kind="bits"> 1287 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_MASK" 1288 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"> 1289 Mask the state with this before comparison 1290 </constant> 1291 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_NEW" 1292 num="0"> 1293 <code>java.lang.Thread.State.NEW</code> 1294 </constant> 1295 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_TERMINATED" 1296 num="JVMTI_THREAD_STATE_TERMINATED"> 1297 <code>java.lang.Thread.State.TERMINATED</code> 1298 </constant> 1299 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_RUNNABLE" 1300 num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_RUNNABLE"> 1301 <code>java.lang.Thread.State.RUNNABLE</code> 1302 </constant> 1303 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_BLOCKED" 1304 num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER"> 1305 <code>java.lang.Thread.State.BLOCKED</code> 1306 </constant> 1307 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_WAITING" 1308 num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_INDEFINITELY"> 1309 <code>java.lang.Thread.State.WAITING</code> 1310 </constant> 1311 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_TIMED_WAITING" 1312 num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT"> 1313 <code>java.lang.Thread.State.TIMED_WAITING</code> 1314 </constant> 1315 </constants> 1316 <b>Rules</b> 1317 <p/> 1318 There can be no more than one answer to a question, although there can be no 1319 answer (because the answer is unknown, does not apply, or none of the answers is 1320 correct). An answer is set only when the enclosing answers match. 1321 That is, no more than one of 1322 <ul type="circle"> 1323 <li><code>JVMTI_THREAD_STATE_RUNNABLE</code></li> 1324 <li><code>JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER</code></li> 1325 <li><code>JVMTI_THREAD_STATE_WAITING</code></li> 1326 </ul> 1327 can be set (a <tm>J2SE</tm> compliant implementation will always set 1328 one of these if <code>JVMTI_THREAD_STATE_ALIVE</code> is set). 1329 And if any of these are set, the enclosing answer 1330 <code>JVMTI_THREAD_STATE_ALIVE</code> is set. 1331 No more than one of 1332 <ul type="circle"> 1333 <li><code>JVMTI_THREAD_STATE_WAITING_INDEFINITELY</code></li> 1334 <li><code>JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT</code></li> 1335 </ul> 1336 can be set (a <tm>J2SE</tm> compliant implementation will always set 1337 one of these if <code>JVMTI_THREAD_STATE_WAITING</code> is set). 1338 And if either is set, the enclosing answers 1339 <code>JVMTI_THREAD_STATE_ALIVE</code> and 1340 <code>JVMTI_THREAD_STATE_WAITING</code> are set. 1341 No more than one of 1342 <ul type="circle"> 1343 <li><code>JVMTI_THREAD_STATE_IN_OBJECT_WAIT</code></li> 1344 <li><code>JVMTI_THREAD_STATE_PARKED</code></li> 1345 <li><code>JVMTI_THREAD_STATE_SLEEPING</code></li> 1346 </ul> 1347 can be set. And if any of these is set, the enclosing answers 1348 <code>JVMTI_THREAD_STATE_ALIVE</code> and 1349 <code>JVMTI_THREAD_STATE_WAITING</code> are set. 1350 Also, if <code>JVMTI_THREAD_STATE_SLEEPING</code> is set, 1351 then <code>JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT</code> is set. 1352 If a state <i>A</i> is implemented using the mechanism of 1353 state <i>B</i> then it is state <i>A</i> which 1354 is returned by this function. 1355 For example, if <code>Thread.sleep(long)</code> 1356 is implemented using <code>Object.wait(long)</code> 1357 then it is still <code>JVMTI_THREAD_STATE_SLEEPING</code> 1358 which is returned. 1359 More than one of 1360 <ul type="circle"> 1361 <li><code>JVMTI_THREAD_STATE_SUSPENDED</code></li> 1362 <li><code>JVMTI_THREAD_STATE_INTERRUPTED</code></li> 1363 <li><code>JVMTI_THREAD_STATE_IN_NATIVE</code></li> 1364 </ul> 1365 can be set, but if any is set, 1366 <code>JVMTI_THREAD_STATE_ALIVE</code> is set. 1367 <p/> 1368 And finally, 1369 <code>JVMTI_THREAD_STATE_TERMINATED</code> cannot be set unless 1370 <code>JVMTI_THREAD_STATE_ALIVE</code> is not set. 1371 <p/> 1372 The thread state representation is designed for extension in future versions 1373 of the specification; thread state values should be used accordingly, that is 1374 they should not be used as ordinals. 1375 Most queries can be made by testing a single bit, if use in a switch statement is desired, 1376 the state bits should be masked with the interesting bits. 1377 All bits not defined above are reserved for future use. 1378 A VM, compliant to the current specification, must set reserved bits to zero. 1379 An agent should ignore reserved bits -- 1380 they should not be assumed to be zero and thus should not be included in comparisons. 1381 <p/> 1382 <b>Examples</b> 1383 <p/> 1384 Note that the values below exclude reserved and vendor bits. 1385 <p/> 1386 The state of a thread blocked at a <code>synchronized</code>-statement would be: 1387 <example> 1388 JVMTI_THREAD_STATE_ALIVE + JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER 1389 </example> 1390 The state of a thread which hasn't started yet would be: 1391 <example> 1392 0 1393 </example> 1394 The state of a thread at a <code>Object.wait(3000)</code> would be: 1395 <example> 1396 JVMTI_THREAD_STATE_ALIVE + JVMTI_THREAD_STATE_WAITING + 1397 JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT + 1398 JVMTI_THREAD_STATE_MONITOR_WAITING 1399 </example> 1400 The state of a thread suspended while runnable would be: 1401 <example> 1402 JVMTI_THREAD_STATE_ALIVE + JVMTI_THREAD_STATE_RUNNABLE + JVMTI_THREAD_STATE_SUSPENDED 1403 </example> 1404 <p/> 1405 <b>Testing the State</b> 1406 <p/> 1407 In most cases, the thread state can be determined by testing the one bit corresponding 1408 to that question. For example, the code to test if a thread is sleeping: 1409 <example> 1410 jint state; 1411 jvmtiError err; 1412 1413 err = (*jvmti)->GetThreadState(jvmti, thread, &state); 1414 if (err == JVMTI_ERROR_NONE) { 1415 if (state & JVMTI_THREAD_STATE_SLEEPING) { ... 1416 </example> 1417 <p/> 1418 For waiting (that is, in <code>Object.wait</code>, parked, or sleeping) it would be: 1419 <example> 1420 if (state & JVMTI_THREAD_STATE_WAITING) { ... 1421 </example> 1422 For some states, more than one bit will need to be tested as is the case 1423 when testing if a thread has not yet been started: 1424 <example> 1425 if ((state & (JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_TERMINATED)) == 0) { ... 1426 </example> 1427 To distinguish timed from untimed <code>Object.wait</code>: 1428 <example> 1429 if (state & JVMTI_THREAD_STATE_IN_OBJECT_WAIT) { 1430 if (state & JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT) { 1431 printf("in Object.wait(long timeout)\n"); 1432 } else { 1433 printf("in Object.wait()\n"); 1434 } 1435 } 1436 </example> 1437 <p/> 1438 <b>Relationship to <code>java.lang.Thread.State</code></b> 1439 <p/> 1440 The thread state represented by <code>java.lang.Thread.State</code> 1441 returned from <code>java.lang.Thread.getState()</code> is a subset of the 1442 information returned from this function. 1443 The corresponding <code>java.lang.Thread.State</code> can be determined 1444 by using the provided conversion masks. 1445 For example, this returns the name of the <code>java.lang.Thread.State</code> thread state: 1446 <example> 1447 err = (*jvmti)->GetThreadState(jvmti, thread, &state); 1448 abortOnError(err); 1449 switch (state & JVMTI_JAVA_LANG_THREAD_STATE_MASK) { 1450 case JVMTI_JAVA_LANG_THREAD_STATE_NEW: 1451 return "NEW"; 1452 case JVMTI_JAVA_LANG_THREAD_STATE_TERMINATED: 1453 return "TERMINATED"; 1454 case JVMTI_JAVA_LANG_THREAD_STATE_RUNNABLE: 1455 return "RUNNABLE"; 1456 case JVMTI_JAVA_LANG_THREAD_STATE_BLOCKED: 1457 return "BLOCKED"; 1458 case JVMTI_JAVA_LANG_THREAD_STATE_WAITING: 1459 return "WAITING"; 1460 case JVMTI_JAVA_LANG_THREAD_STATE_TIMED_WAITING: 1461 return "TIMED_WAITING"; 1462 } 1463 </example> 1464 </description> 1465 <origin>new</origin> 1466 <capabilities> 1467 </capabilities> 1468 <parameters> 1469 <param id="thread"> 1470 <jthread null="current" started="maybe" impl="noconvert"/> 1471 <description> 1472 The thread to query. 1473 </description> 1474 </param> 1475 <param id="thread_state_ptr"> 1476 <outptr><jint/></outptr> 1477 <description> 1478 On return, points to state flags, 1479 as defined by the <internallink id="jvmtiThreadState">Thread State Flags</internallink>. 1480 </description> 1481 </param> 1482 </parameters> 1483 <errors> 1484 </errors> 1485 </function> 1486 1487 <function id="GetCurrentThread" phase="start" num="18" since="1.1"> 1488 <synopsis>Get Current Thread</synopsis> 1489 <description> 1490 Get the current thread. 1491 The current thread is the Java programming language thread which has called the function. 1492 The function may return <code>NULL</code> in the start phase if the 1493 <internallink id="jvmtiCapabilities.can_generate_early_vmstart"> 1494 <code>can_generate_early_vmstart</code></internallink> capability is enabled 1495 and the <code>java.lang.Thread</code> class has not been initialized yet. 1496 <p/> 1497 Note that most <jvmti/> functions that take a thread 1498 as an argument will accept <code>NULL</code> to mean 1499 the current thread. 1500 </description> 1501 <origin>new</origin> 1502 <capabilities> 1503 </capabilities> 1504 <parameters> 1505 <param id="thread_ptr"> 1506 <outptr><jthread/></outptr> 1507 <description> 1508 On return, points to the current thread, or <code>NULL</code>. 1509 </description> 1510 </param> 1511 </parameters> 1512 <errors> 1513 </errors> 1514 </function> 1515 1516 <function id="GetAllThreads" num="4"> 1517 <synopsis>Get All Threads</synopsis> 1518 <description> 1519 Get all live threads. 1520 The threads are Java programming language threads; 1521 that is, threads that are attached to the VM. 1522 A thread is live if <code>java.lang.Thread.isAlive()</code> 1523 would return <code>true</code>, that is, the thread has 1524 been started and has not yet died. 1525 The universe of threads is determined by the context of the <jvmti/> 1526 environment, which typically is all threads attached to the VM. 1527 Note that this includes <jvmti/> agent threads 1528 (see <functionlink id="RunAgentThread"/>). 1529 </description> 1530 <origin>jvmdi</origin> 1531 <capabilities> 1532 </capabilities> 1533 <parameters> 1534 <param id="threads_count_ptr"> 1535 <outptr><jint/></outptr> 1536 <description> 1537 On return, points to the number of running threads. 1538 </description> 1539 </param> 1540 <param id="threads_ptr"> 1541 <allocbuf outcount="threads_count_ptr"><jthread/></allocbuf> 1542 <description> 1543 On return, points to an array of references, one 1544 for each running thread. 1545 </description> 1546 </param> 1547 </parameters> 1548 <errors> 1549 </errors> 1550 </function> 1551 1552 <function id="SuspendThread" num="5"> 1553 <synopsis>Suspend Thread</synopsis> 1554 <description> 1555 Suspend the specified thread. If the calling thread is specified, 1556 this function will not return until some other thread calls 1557 <functionlink id="ResumeThread"></functionlink>. 1558 If the thread is currently suspended, this function 1559 does nothing and returns an error. 1560 </description> 1561 <origin>jvmdi</origin> 1562 <capabilities> 1563 <required id="can_suspend"></required> 1564 </capabilities> 1565 <parameters> 1566 <param id="thread"> 1567 <jthread null="current"/> 1568 <description> 1569 The thread to suspend. 1570 </description> 1571 </param> 1572 </parameters> 1573 <errors> 1574 <error id="JVMTI_ERROR_THREAD_SUSPENDED"> 1575 Thread already suspended. 1576 </error> 1577 </errors> 1578 </function> 1579 1580 <elide> 1581 <function id="SuspendAllThreads" num="101"> 1582 <synopsis>Suspend All Threads</synopsis> 1583 <description> 1584 <issue> 1585 There has been no explicit call for this function, and it will 1586 thus be removed if there is no interest. 1587 </issue> 1588 Suspend all live threads except: 1589 <ul> 1590 <li>already suspended threads</li> 1591 <li>those listed in <paramlink id="except_list"></paramlink></li> 1592 <li>certain system (non application) threads, as determined 1593 by the VM implementation</li> 1594 </ul> 1595 The threads are Java programming language threads; 1596 native threads which are not attached to the VM are not 1597 Java programming language threads. 1598 A thread is live if <code>java.lang.Thread.isAlive()</code> 1599 would return <code>true</code>, that is, the thread has 1600 been started and has not yet died. 1601 The universe of threads is determined 1602 by the context of the <jvmti/> 1603 environment, which, typically, is all threads attached to the VM, 1604 except critical VM internal threads and <jvmti/> agent threads 1605 (see <functionlink id="RunAgentThread"/>). 1606 <p/> 1607 If the calling thread is specified, 1608 all other threads are suspended first then the caller thread is suspended - 1609 this function will not return until some other thread calls 1610 <functionlink id="ResumeThread"></functionlink>. 1611 <p/> 1612 The list of actually 1613 suspended threads is returned in 1614 <paramlink id="suspended_list_ptr"></paramlink>. 1615 Suspension is as defined in <functionlink id="SuspendThread"></functionlink>. 1616 <functionlink id="ResumeThreadList"></functionlink> 1617 can be used to resume the suspended threads. 1618 </description> 1619 <origin>new</origin> 1620 <capabilities> 1621 <required id="can_suspend"></required> 1622 </capabilities> 1623 <parameters> 1624 <param id="except_count"> 1625 <jint min="0"/> 1626 <description> 1627 The number of threads in the list of threads not to be suspended. 1628 </description> 1629 </param> 1630 <param id="except_list"> 1631 <inbuf incount="except_count"> 1632 <jthread/> 1633 <nullok>not an error if <code>except_count == 0</code></nullok> 1634 </inbuf> 1635 <description> 1636 The list of threads not to be suspended. 1637 </description> 1638 </param> 1639 <param id="suspended_count_ptr"> 1640 <outptr><jint/></outptr> 1641 <description> 1642 On return, points to the number of threads suspended by this call. 1643 </description> 1644 </param> 1645 <param id="suspended_list_ptr"> 1646 <allocbuf outcount="suspended_count_ptr"><jthread/></allocbuf> 1647 <description> 1648 On return, points to an array of references, one 1649 for each thread suspended. 1650 </description> 1651 </param> 1652 </parameters> 1653 <errors> 1654 <error id="JVMTI_ERROR_INVALID_THREAD"> 1655 A thread in <paramlink id="except_list"></paramlink> was invalid. 1656 </error> 1657 <error id="JVMTI_ERROR_NULL_POINTER"> 1658 Both <paramlink id="except_list"></paramlink> was <code>NULL</code> 1659 and <paramlink id="except_count"></paramlink> was non-zero. 1660 </error> 1661 </errors> 1662 </function> 1663 </elide> 1664 1665 <function id="SuspendThreadList" num="92"> 1666 <synopsis>Suspend Thread List</synopsis> 1667 <description> 1668 Suspend the <paramlink id="request_count"></paramlink> 1669 threads specified in the 1670 <paramlink id="request_list"></paramlink> array. 1671 Threads may be resumed with 1672 <functionlink id="ResumeThreadList"></functionlink> or 1673 <functionlink id="ResumeThread"></functionlink>. 1674 If the calling thread is specified in the 1675 <paramlink id="request_list"></paramlink> array, this function will 1676 not return until some other thread resumes it. 1677 Errors encountered in the suspension of a thread 1678 are returned in the <paramlink id="results"></paramlink> 1679 array, <b>not</b> in the return value of this function. 1680 Threads that are currently suspended do not change state. 1681 </description> 1682 <origin>jvmdi</origin> 1683 <capabilities> 1684 <required id="can_suspend"></required> 1685 </capabilities> 1686 <parameters> 1687 <param id="request_count"> 1688 <jint min="0"/> 1689 <description> 1690 The number of threads to suspend. 1691 </description> 1692 </param> 1693 <param id="request_list"> 1694 <inbuf incount="request_count"><jthread/></inbuf> 1695 <description> 1696 The list of threads to suspend. 1697 </description> 1698 </param> 1699 <param id="results"> 1700 <outbuf incount="request_count"><enum>jvmtiError</enum></outbuf> 1701 <description> 1702 An agent supplied array of 1703 <paramlink id="request_count"></paramlink> elements. 1704 On return, filled with the error code for 1705 the suspend of the corresponding thread. 1706 The error code will be 1707 <errorlink id="JVMTI_ERROR_NONE"></errorlink> 1708 if the thread was suspended by this call. 1709 Possible error codes are those specified 1710 for <functionlink id="SuspendThread"></functionlink>. 1711 </description> 1712 </param> 1713 </parameters> 1714 <errors> 1715 </errors> 1716 </function> 1717 1718 <function id="ResumeThread" num="6"> 1719 <synopsis>Resume Thread</synopsis> 1720 <description> 1721 Resume a suspended thread. 1722 Any threads currently suspended through 1723 a <jvmti/> suspend function (eg. 1724 <functionlink id="SuspendThread"></functionlink>) 1725 or <code>java.lang.Thread.suspend()</code> 1726 will resume execution; 1727 all other threads are unaffected. 1728 </description> 1729 <origin>jvmdi</origin> 1730 <capabilities> 1731 <required id="can_suspend"></required> 1732 </capabilities> 1733 <parameters> 1734 <param id="thread"> 1735 <jthread/> 1736 <description> 1737 The thread to resume. 1738 </description> 1739 </param> 1740 </parameters> 1741 <errors> 1742 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 1743 Thread was not suspended. 1744 </error> 1745 <error id="JVMTI_ERROR_INVALID_TYPESTATE"> 1746 The state of the thread has been modified, and is now inconsistent. 1747 </error> 1748 </errors> 1749 </function> 1750 1751 <function id="ResumeThreadList" num="93"> 1752 <synopsis>Resume Thread List</synopsis> 1753 <description> 1754 Resume the <paramlink id="request_count"></paramlink> 1755 threads specified in the 1756 <paramlink id="request_list"></paramlink> array. 1757 Any thread suspended through 1758 a <jvmti/> suspend function (eg. 1759 <functionlink id="SuspendThreadList"></functionlink>) 1760 or <code>java.lang.Thread.suspend()</code> 1761 will resume execution. 1762 </description> 1763 <origin>jvmdi</origin> 1764 <capabilities> 1765 <required id="can_suspend"></required> 1766 </capabilities> 1767 <parameters> 1768 <param id="request_count"> 1769 <jint min="0"/> 1770 <description> 1771 The number of threads to resume. 1772 </description> 1773 </param> 1774 <param id="request_list"> 1775 <inbuf incount="request_count"><jthread/></inbuf> 1776 <description> 1777 The threads to resume. 1778 </description> 1779 </param> 1780 <param id="results"> 1781 <outbuf incount="request_count"><enum>jvmtiError</enum></outbuf> 1782 <description> 1783 An agent supplied array of 1784 <paramlink id="request_count"></paramlink> elements. 1785 On return, filled with the error code for 1786 the resume of the corresponding thread. 1787 The error code will be 1788 <errorlink id="JVMTI_ERROR_NONE"></errorlink> 1789 if the thread was suspended by this call. 1790 Possible error codes are those specified 1791 for <functionlink id="ResumeThread"></functionlink>. 1792 </description> 1793 </param> 1794 </parameters> 1795 <errors> 1796 </errors> 1797 </function> 1798 1799 <function id="StopThread" num="7"> 1800 <synopsis>Stop Thread</synopsis> 1801 <description> 1802 Send the specified asynchronous exception to the specified thread 1803 (similar to <code>java.lang.Thread.stop</code>). 1804 Normally, this function is used to kill the specified thread with an 1805 instance of the exception <code>ThreadDeath</code>. 1806 </description> 1807 <origin>jvmdi</origin> 1808 <capabilities> 1809 <required id="can_signal_thread"></required> 1810 </capabilities> 1811 <parameters> 1812 <param id="thread"> 1813 <jthread/> 1814 <description> 1815 The thread to stop. 1816 </description> 1817 </param> 1818 <param id="exception"> 1819 <jobject/> 1820 <description> 1821 The asynchronous exception object. 1822 </description> 1823 </param> 1824 </parameters> 1825 <errors> 1826 </errors> 1827 </function> 1828 1829 <function id="InterruptThread" num="8"> 1830 <synopsis>Interrupt Thread</synopsis> 1831 <description> 1832 Interrupt the specified thread 1833 (similar to <code>java.lang.Thread.interrupt</code>). 1834 </description> 1835 <origin>jvmdi</origin> 1836 <capabilities> 1837 <required id="can_signal_thread"></required> 1838 </capabilities> 1839 <parameters> 1840 <param id="thread"> 1841 <jthread impl="noconvert"/> 1842 <description> 1843 The thread to interrupt. 1844 </description> 1845 </param> 1846 </parameters> 1847 <errors> 1848 </errors> 1849 </function> 1850 1851 <function id="GetThreadInfo" num="9"> 1852 <synopsis>Get Thread Info</synopsis> 1853 <typedef id="jvmtiThreadInfo" label="Thread information structure"> 1854 <field id="name"> 1855 <allocfieldbuf><char/></allocfieldbuf> 1856 <description> 1857 The thread name, encoded as a 1858 <internallink id="mUTF">modified UTF-8</internallink> string. 1859 </description> 1860 </field> 1861 <field id="priority"> 1862 <jint/> 1863 <description> 1864 The thread priority. See the thread priority constants: 1865 <datalink id="jvmtiThreadPriority"></datalink>. 1866 </description> 1867 </field> 1868 <field id="is_daemon"> 1869 <jboolean/> 1870 <description> 1871 Is this a daemon thread? 1872 </description> 1873 </field> 1874 <field id="thread_group"> 1875 <jthreadGroup/> 1876 <description> 1877 The thread group to which this thread belongs. 1878 <code>NULL</code> if the thread has died. 1879 </description> 1880 </field> 1881 <field id="context_class_loader"> 1882 <jobject/> 1883 <description> 1884 The context class loader associated with this thread. 1885 </description> 1886 </field> 1887 </typedef> 1888 <description> 1889 Get thread information. The fields of the <datalink id="jvmtiThreadInfo"/> structure 1890 are filled in with details of the specified thread. 1891 </description> 1892 <origin>jvmdi</origin> 1893 <capabilities> 1894 </capabilities> 1895 <parameters> 1896 <param id="thread"> 1897 <jthread null="current" impl="noconvert" started="maybe"/> 1898 <description> 1899 The thread to query. 1900 </description> 1901 </param> 1902 <param id="info_ptr"> 1903 <outptr><struct>jvmtiThreadInfo</struct></outptr> 1904 <description> 1905 On return, filled with information describing the specified thread. 1906 </description> 1907 </param> 1908 </parameters> 1909 <errors> 1910 </errors> 1911 </function> 1912 1913 <function id="GetOwnedMonitorInfo" num="10"> 1914 <synopsis>Get Owned Monitor Info</synopsis> 1915 <description> 1916 Get information about the monitors owned by the 1917 specified thread. 1918 </description> 1919 <origin>jvmdiClone</origin> 1920 <capabilities> 1921 <required id="can_get_owned_monitor_info"></required> 1922 </capabilities> 1923 <parameters> 1924 <param id="thread"> 1925 <jthread null="current"/> 1926 <description> 1927 The thread to query. 1928 </description> 1929 </param> 1930 <param id="owned_monitor_count_ptr"> 1931 <outptr><jint/></outptr> 1932 <description> 1933 The number of monitors returned. 1934 </description> 1935 </param> 1936 <param id="owned_monitors_ptr"> 1937 <allocbuf outcount="owned_monitor_count_ptr"><jobject/></allocbuf> 1938 <description> 1939 The array of owned monitors. 1940 </description> 1941 </param> 1942 </parameters> 1943 <errors> 1944 </errors> 1945 </function> 1946 1947 <function id="GetOwnedMonitorStackDepthInfo" num="153" since="1.1"> 1948 <synopsis>Get Owned Monitor Stack Depth Info</synopsis> 1949 <typedef id="jvmtiMonitorStackDepthInfo" 1950 label="Monitor stack depth information structure"> 1951 <field id="monitor"> 1952 <jobject/> 1953 <description> 1954 The owned monitor. 1955 </description> 1956 </field> 1957 <field id="stack_depth"> 1958 <jint/> 1959 <description> 1960 The stack depth. Corresponds to the stack depth used in the 1961 <internallink id="stack">Stack Frame functions</internallink>. 1962 That is, zero is the current frame, one is the frame which 1963 called the current frame. And it is negative one if the 1964 implementation cannot determine the stack depth (e.g., for 1965 monitors acquired by JNI <code>MonitorEnter</code>). 1966 </description> 1967 </field> 1968 </typedef> 1969 <description> 1970 Get information about the monitors owned by the 1971 specified thread and the depth of the stack frame which locked them. 1972 </description> 1973 <origin>new</origin> 1974 <capabilities> 1975 <required id="can_get_owned_monitor_stack_depth_info"></required> 1976 </capabilities> 1977 <parameters> 1978 <param id="thread"> 1979 <jthread null="current"/> 1980 <description> 1981 The thread to query. 1982 </description> 1983 </param> 1984 <param id="monitor_info_count_ptr"> 1985 <outptr><jint/></outptr> 1986 <description> 1987 The number of monitors returned. 1988 </description> 1989 </param> 1990 <param id="monitor_info_ptr"> 1991 <allocbuf outcount="monitor_info_count_ptr"> 1992 <struct>jvmtiMonitorStackDepthInfo</struct> 1993 </allocbuf> 1994 <description> 1995 The array of owned monitor depth information. 1996 </description> 1997 </param> 1998 </parameters> 1999 <errors> 2000 </errors> 2001 </function> 2002 2003 <function id="GetCurrentContendedMonitor" num="11"> 2004 <synopsis>Get Current Contended Monitor</synopsis> 2005 <description> 2006 Get the object, if any, whose monitor the specified thread is waiting to 2007 enter or waiting to regain through <code>java.lang.Object.wait</code>. 2008 </description> 2009 <origin>jvmdi</origin> 2010 <capabilities> 2011 <required id="can_get_current_contended_monitor"></required> 2012 </capabilities> 2013 <parameters> 2014 <param id="thread"> 2015 <jthread null="current"/> 2016 <description> 2017 The thread to query. 2018 </description> 2019 </param> 2020 <param id="monitor_ptr"> 2021 <outptr><jobject/></outptr> 2022 <description> 2023 On return, filled with the current contended monitor, or 2024 NULL if there is none. 2025 </description> 2026 </param> 2027 </parameters> 2028 <errors> 2029 </errors> 2030 </function> 2031 2032 <callback id="jvmtiStartFunction"> 2033 <void/> 2034 <synopsis>Agent Start Function</synopsis> 2035 <description> 2036 Agent supplied callback function. 2037 This function is the entry point for an agent thread 2038 started with 2039 <functionlink id="RunAgentThread"></functionlink>. 2040 </description> 2041 <parameters> 2042 <param id="jvmti_env"> 2043 <outptr> 2044 <struct>jvmtiEnv</struct> 2045 </outptr> 2046 <description> 2047 The <jvmti/> environment. 2048 </description> 2049 </param> 2050 <param id="jni_env"> 2051 <outptr> 2052 <struct>JNIEnv</struct> 2053 </outptr> 2054 <description> 2055 The JNI environment. 2056 </description> 2057 </param> 2058 <param id="arg"> 2059 <outptr> 2060 <void/> 2061 </outptr> 2062 <description> 2063 The <code>arg</code> parameter passed to 2064 <functionlink id="RunAgentThread"></functionlink>. 2065 </description> 2066 </param> 2067 </parameters> 2068 </callback> 2069 2070 <function id="RunAgentThread" num="12"> 2071 <synopsis>Run Agent Thread</synopsis> 2072 <description> 2073 Starts the execution of an agent thread. with the specified native function. 2074 The parameter <paramlink id="arg"></paramlink> is forwarded on to the 2075 <functionlink id="jvmtiStartFunction">start function</functionlink> 2076 (specified with <paramlink id="proc"></paramlink>) as its single argument. 2077 This function allows the creation of agent threads 2078 for handling communication with another process or for handling events 2079 without the need to load a special subclass of <code>java.lang.Thread</code> or 2080 implementer of <code>java.lang.Runnable</code>. 2081 Instead, the created thread can run entirely in native code. 2082 However, the created thread does require a newly created instance 2083 of <code>java.lang.Thread</code> (referenced by the argument <code>thread</code>) to 2084 which it will be associated. 2085 The thread object can be created with JNI calls. 2086 <p/> 2087 The following common thread priorities are provided for your convenience: 2088 <constants id="jvmtiThreadPriority" label="Thread Priority Constants" kind="const"> 2089 <constant id="JVMTI_THREAD_MIN_PRIORITY" num="1"> 2090 Minimum possible thread priority 2091 </constant> 2092 <constant id="JVMTI_THREAD_NORM_PRIORITY" num="5"> 2093 Normal thread priority 2094 </constant> 2095 <constant id="JVMTI_THREAD_MAX_PRIORITY" num="10"> 2096 Maximum possible thread priority 2097 </constant> 2098 </constants> 2099 <p/> 2100 The new thread is started as a daemon thread with the specified 2101 <paramlink id="priority"></paramlink>. 2102 If enabled, a <eventlink id="ThreadStart"/> event will be sent. 2103 <p/> 2104 Since the thread has been started, the thread will be live when this function 2105 returns, unless the thread has died immediately. 2106 <p/> 2107 The thread group of the thread is ignored -- specifically, the thread is not 2108 added to the thread group and the thread is not seen on queries of the thread 2109 group at either the Java programming language or <jvmti/> levels. 2110 <p/> 2111 The thread is not visible to Java programming language queries but is 2112 included in <jvmti/> queries (for example, 2113 <functionlink id="GetAllThreads"/> and 2114 <functionlink id="GetAllStackTraces"/>). 2115 <p/> 2116 Upon execution of <code>proc</code>, the new thread will be attached to the 2117 VM -- see the JNI documentation on 2118 <externallink id="jni/invocation.html#attaching-to-the-vm" 2119 >Attaching to the VM</externallink>. 2120 </description> 2121 <origin>jvmdiClone</origin> 2122 <capabilities> 2123 </capabilities> 2124 <parameters> 2125 <param id="thread"> 2126 <jthread impl="noconvert" started="no"/> 2127 <description> 2128 The thread to run. 2129 </description> 2130 </param> 2131 <param id="proc"> 2132 <ptrtype> 2133 <struct>jvmtiStartFunction</struct> 2134 </ptrtype> 2135 <description> 2136 The start function. 2137 </description> 2138 </param> 2139 <param id="arg"> 2140 <inbuf> 2141 <void/> 2142 <nullok><code>NULL</code> is passed to the start function</nullok> 2143 </inbuf> 2144 <description> 2145 The argument to the start function. 2146 </description> 2147 </param> 2148 <param id="priority"> 2149 <jint/> 2150 <description> 2151 The priority of the started thread. Any thread 2152 priority allowed by <code>java.lang.Thread.setPriority</code> can be used including 2153 those in <datalink id="jvmtiThreadPriority"></datalink>. 2154 </description> 2155 </param> 2156 </parameters> 2157 <errors> 2158 <error id="JVMTI_ERROR_INVALID_PRIORITY"> 2159 <paramlink id="priority"/> is less than 2160 <datalink id="JVMTI_THREAD_MIN_PRIORITY"/> 2161 or greater than 2162 <datalink id="JVMTI_THREAD_MAX_PRIORITY"/> 2163 </error> 2164 </errors> 2165 </function> 2166 2167 <function id="SetThreadLocalStorage" jkernel="yes" impl="notrace" phase="start" num="103"> 2168 <synopsis>Set Thread Local Storage</synopsis> 2169 <description> 2170 The VM stores a pointer value associated with each environment-thread 2171 pair. This pointer value is called <i>thread-local storage</i>. 2172 This value is <code>NULL</code> unless set with this function. 2173 Agents can allocate memory in which they store thread specific 2174 information. By setting thread-local storage it can then be 2175 accessed with 2176 <functionlink id="GetThreadLocalStorage"></functionlink>. 2177 <p/> 2178 This function is called by the agent to set the value of the <jvmti/> 2179 thread-local storage. <jvmti/> supplies to the agent a pointer-size 2180 thread-local storage that can be used to record per-thread 2181 information. 2182 </description> 2183 <origin>jvmpi</origin> 2184 <capabilities> 2185 </capabilities> 2186 <parameters> 2187 <param id="thread"> 2188 <jthread null="current"/> 2189 <description> 2190 Store to this thread. 2191 </description> 2192 </param> 2193 <param id="data"> 2194 <inbuf> 2195 <void/> 2196 <nullok>value is set to <code>NULL</code></nullok> 2197 </inbuf> 2198 <description> 2199 The value to be entered into the thread-local storage. 2200 </description> 2201 </param> 2202 </parameters> 2203 <errors> 2204 </errors> 2205 </function> 2206 2207 <function id="GetThreadLocalStorage" jkernel="yes" impl="innative notrace" phase="start" num="102"> 2208 <synopsis>Get Thread Local Storage</synopsis> 2209 <description> 2210 Called by the agent to get the value of the <jvmti/> thread-local 2211 storage. 2212 </description> 2213 <origin>jvmpi</origin> 2214 <capabilities> 2215 </capabilities> 2216 <parameters> 2217 <param id="thread"> 2218 <jthread null="current" impl="noconvert"/> 2219 <description> 2220 Retrieve from this thread. 2221 </description> 2222 </param> 2223 <param id="data_ptr"> 2224 <agentbuf><void/></agentbuf> 2225 <description> 2226 Pointer through which the value of the thread local 2227 storage is returned. 2228 If thread-local storage has not been set with 2229 <functionlink id="SetThreadLocalStorage"></functionlink> the returned 2230 pointer is <code>NULL</code>. 2231 </description> 2232 </param> 2233 </parameters> 2234 <errors> 2235 </errors> 2236 </function> 2237 2238 </category> 2239 2240 <category id="thread_groups" label="Thread Group"> 2241 <intro> 2242 </intro> 2243 2244 <function id="GetTopThreadGroups" num="13"> 2245 <synopsis>Get Top Thread Groups</synopsis> 2246 <description> 2247 Return all top-level (parentless) thread groups in the VM. 2248 </description> 2249 <origin>jvmdi</origin> 2250 <capabilities> 2251 </capabilities> 2252 <parameters> 2253 <param id="group_count_ptr"> 2254 <outptr><jint/></outptr> 2255 <description> 2256 On return, points to the number of top-level thread groups. 2257 </description> 2258 </param> 2259 <param id="groups_ptr"> 2260 <allocbuf outcount="group_count_ptr"><jthreadGroup/></allocbuf> 2261 <description> 2262 On return, refers to a pointer to the top-level thread group array. 2263 </description> 2264 </param> 2265 </parameters> 2266 <errors> 2267 </errors> 2268 </function> 2269 2270 <function id="GetThreadGroupInfo" num="14"> 2271 <synopsis>Get Thread Group Info</synopsis> 2272 <typedef id="jvmtiThreadGroupInfo" label="Thread group information structure"> 2273 <field id="parent"> 2274 <jthreadGroup/> 2275 <description> 2276 The parent thread group. 2277 </description> 2278 </field> 2279 <field id="name"> 2280 <allocfieldbuf><char/></allocfieldbuf> 2281 <description> 2282 The thread group's name, encoded as a 2283 <internallink id="mUTF">modified UTF-8</internallink> string. 2284 </description> 2285 </field> 2286 <field id="max_priority"> 2287 <jint/> 2288 <description> 2289 The maximum priority for this thread group. 2290 </description> 2291 </field> 2292 <field id="is_daemon"> 2293 <jboolean/> 2294 <description> 2295 Is this a daemon thread group? 2296 </description> 2297 </field> 2298 </typedef> 2299 <description> 2300 Get information about the thread group. The fields of the 2301 <functionlink id="jvmtiThreadGroupInfo"></functionlink> structure 2302 are filled in with details of the specified thread group. 2303 </description> 2304 <origin>jvmdi</origin> 2305 <capabilities> 2306 </capabilities> 2307 <parameters> 2308 <param id="group"> 2309 <jthreadGroup/> 2310 <description> 2311 The thread group to query. 2312 </description> 2313 </param> 2314 <param id="info_ptr"> 2315 <outptr><struct>jvmtiThreadGroupInfo</struct></outptr> 2316 <description> 2317 On return, filled with information describing the specified 2318 thread group. 2319 </description> 2320 </param> 2321 </parameters> 2322 <errors> 2323 </errors> 2324 </function> 2325 2326 <function id="GetThreadGroupChildren" num="15"> 2327 <synopsis>Get Thread Group Children</synopsis> 2328 <description> 2329 Get the live threads and active subgroups in this thread group. 2330 </description> 2331 <origin>jvmdi</origin> 2332 <capabilities> 2333 </capabilities> 2334 <parameters> 2335 <param id="group"> 2336 <jthreadGroup/> 2337 <description> 2338 The group to query. 2339 </description> 2340 </param> 2341 <param id="thread_count_ptr"> 2342 <outptr><jint/></outptr> 2343 <description> 2344 On return, points to the number of live threads in this thread group. 2345 </description> 2346 </param> 2347 <param id="threads_ptr"> 2348 <allocbuf outcount="thread_count_ptr"><jthread/></allocbuf> 2349 <description> 2350 On return, points to an array of the live threads in this thread group. 2351 </description> 2352 </param> 2353 <param id="group_count_ptr"> 2354 <outptr><jint/></outptr> 2355 <description> 2356 On return, points to the number of active child thread groups 2357 </description> 2358 </param> 2359 <param id="groups_ptr"> 2360 <allocbuf outcount="group_count_ptr"><jthreadGroup/></allocbuf> 2361 <description> 2362 On return, points to an array of the active child thread groups. 2363 </description> 2364 </param> 2365 </parameters> 2366 <errors> 2367 </errors> 2368 </function> 2369 </category> 2370 2371 <category id="stack" label="Stack Frame"> 2372 <intro> 2373 These functions provide information about the stack of a thread. 2374 Stack frames are referenced by depth. 2375 The frame at depth zero is the current frame. 2376 <p/> 2377 Stack frames are as described in 2378 <vmspec chapter="3.6"/>, 2379 That is, they correspond to method 2380 invocations (including native methods) but do not correspond to platform native or 2381 VM internal frames. 2382 <p/> 2383 A <jvmti/> implementation may use method invocations to launch a thread and 2384 the corresponding frames may be included in the stack as presented by these functions -- 2385 that is, there may be frames shown 2386 deeper than <code>main()</code> and <code>run()</code>. 2387 However this presentation must be consistent across all <jvmti/> functionality which 2388 uses stack frames or stack depth. 2389 </intro> 2390 2391 <typedef id="jvmtiFrameInfo" label="Stack frame information structure"> 2392 <description> 2393 Information about a stack frame is returned in this structure. 2394 </description> 2395 <field id="method"> 2396 <jmethodID/> 2397 <description> 2398 The method executing in this frame. 2399 </description> 2400 </field> 2401 <field id="location"> 2402 <jlocation/> 2403 <description> 2404 The index of the instruction executing in this frame. 2405 <code>-1</code> if the frame is executing a native method. 2406 </description> 2407 </field> 2408 </typedef> 2409 2410 <typedef id="jvmtiStackInfo" label="Stack information structure"> 2411 <description> 2412 Information about a set of stack frames is returned in this structure. 2413 </description> 2414 <field id="thread"> 2415 <jthread/> 2416 <description> 2417 On return, the thread traced. 2418 </description> 2419 </field> 2420 <field id="state"> 2421 <jint/> 2422 <description> 2423 On return, the thread state. See <functionlink id="GetThreadState"></functionlink>. 2424 </description> 2425 </field> 2426 <field id="frame_buffer"> 2427 <outbuf incount="max_frame_count"> 2428 <struct>jvmtiFrameInfo</struct> 2429 </outbuf> 2430 <description> 2431 On return, this agent allocated buffer is filled 2432 with stack frame information. 2433 </description> 2434 </field> 2435 <field id="frame_count"> 2436 <jint/> 2437 <description> 2438 On return, the number of records filled into 2439 <code>frame_buffer</code>. 2440 This will be 2441 min(<code>max_frame_count</code>, <i>stackDepth</i>). 2442 </description> 2443 </field> 2444 </typedef> 2445 2446 <function id="GetStackTrace" num="104"> 2447 <synopsis>Get Stack Trace</synopsis> 2448 <description> 2449 Get information about the stack of a thread. 2450 If <paramlink id="max_frame_count"></paramlink> is less than the depth of the stack, 2451 the <paramlink id="max_frame_count"></paramlink> topmost frames are returned, 2452 otherwise the entire stack is returned. 2453 The topmost frames, those most recently invoked, are at the beginning of the returned buffer. 2454 <p/> 2455 The following example causes up to five of the topmost frames 2456 to be returned and (if there are any frames) the currently 2457 executing method name to be printed. 2458 <example> 2459 jvmtiFrameInfo frames[5]; 2460 jint count; 2461 jvmtiError err; 2462 2463 err = (*jvmti)->GetStackTrace(jvmti, aThread, 0, 5, 2464 frames, &count); 2465 if (err == JVMTI_ERROR_NONE && count >= 1) { 2466 char *methodName; 2467 err = (*jvmti)->GetMethodName(jvmti, frames[0].method, 2468 &methodName, NULL, NULL); 2469 if (err == JVMTI_ERROR_NONE) { 2470 printf("Executing method: %s", methodName); 2471 } 2472 } 2473 </example> 2474 <todo> 2475 check example code. 2476 </todo> 2477 <p/> 2478 The <paramlink id="thread"></paramlink> need not be suspended 2479 to call this function. 2480 <p/> 2481 The <functionlink id="GetLineNumberTable"></functionlink> 2482 function can be used to map locations to line numbers. Note that 2483 this mapping can be done lazily. 2484 </description> 2485 <origin>jvmpi</origin> 2486 <capabilities> 2487 </capabilities> 2488 <parameters> 2489 <param id="thread"> 2490 <jthread null="current"/> 2491 <description> 2492 Fetch the stack trace of this thread. 2493 </description> 2494 </param> 2495 <param id="start_depth"> 2496 <jint/> 2497 <description> 2498 Begin retrieving frames at this depth. 2499 If non-negative, count from the current frame, 2500 the first frame retrieved is at depth <code>start_depth</code>. 2501 For example, if zero, start from the current frame; if one, start from the 2502 caller of the current frame; if two, start from the caller of the 2503 caller of the current frame; and so on. 2504 If negative, count from below the oldest frame, 2505 the first frame retrieved is at depth <i>stackDepth</i><code> + start_depth</code>, 2506 where <i>stackDepth</i> is the count of frames on the stack. 2507 For example, if negative one, only the oldest frame is retrieved; 2508 if negative two, start from the frame called by the oldest frame. 2509 </description> 2510 </param> 2511 <param id="max_frame_count"> 2512 <jint min="0"/> 2513 <description> 2514 The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve. 2515 </description> 2516 </param> 2517 <param id="frame_buffer"> 2518 <outbuf incount="max_frame_count" outcount="count_ptr"> 2519 <struct>jvmtiFrameInfo</struct> 2520 </outbuf> 2521 <description> 2522 On return, this agent allocated buffer is filled 2523 with stack frame information. 2524 </description> 2525 </param> 2526 <param id="count_ptr"> 2527 <outptr><jint/></outptr> 2528 <description> 2529 On return, points to the number of records filled in. 2530 For non-negative <code>start_depth</code>, this will be 2531 min(<code>max_frame_count</code>, <i>stackDepth</i><code> - start_depth</code>). 2532 For negative <code>start_depth</code>, this will be 2533 min(<code>max_frame_count</code>, <code>-start_depth</code>). 2534 </description> 2535 </param> 2536 </parameters> 2537 <errors> 2538 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 2539 <paramlink id="start_depth"/> is positive and greater than or equal to <i>stackDepth</i>. 2540 Or <paramlink id="start_depth"/> is negative and less than <i>-stackDepth</i>. 2541 </error> 2542 </errors> 2543 </function> 2544 2545 2546 <function id="GetAllStackTraces" num="100"> 2547 <synopsis>Get All Stack Traces</synopsis> 2548 <description> 2549 Get information about the stacks of all live threads 2550 (including <internallink id="RunAgentThread">agent threads</internallink>). 2551 If <paramlink id="max_frame_count"/> is less than the depth of a stack, 2552 the <paramlink id="max_frame_count"/> topmost frames are returned for that thread, 2553 otherwise the entire stack is returned. 2554 The topmost frames, those most recently invoked, are at the beginning of the returned buffer. 2555 <p/> 2556 All stacks are collected simultaneously, that is, no changes will occur to the 2557 thread state or stacks between the sampling of one thread and the next. 2558 The threads need not be suspended. 2559 2560 <example> 2561 jvmtiStackInfo *stack_info; 2562 jint thread_count; 2563 int ti; 2564 jvmtiError err; 2565 2566 err = (*jvmti)->GetAllStackTraces(jvmti, MAX_FRAMES, &stack_info, &thread_count); 2567 if (err != JVMTI_ERROR_NONE) { 2568 ... 2569 } 2570 for (ti = 0; ti < thread_count; ++ti) { 2571 jvmtiStackInfo *infop = &stack_info[ti]; 2572 jthread thread = infop->thread; 2573 jint state = infop->state; 2574 jvmtiFrameInfo *frames = infop->frame_buffer; 2575 int fi; 2576 2577 myThreadAndStatePrinter(thread, state); 2578 for (fi = 0; fi < infop->frame_count; fi++) { 2579 myFramePrinter(frames[fi].method, frames[fi].location); 2580 } 2581 } 2582 /* this one Deallocate call frees all data allocated by GetAllStackTraces */ 2583 err = (*jvmti)->Deallocate(jvmti, stack_info); 2584 </example> 2585 <todo> 2586 check example code. 2587 </todo> 2588 2589 </description> 2590 <origin>new</origin> 2591 <capabilities> 2592 </capabilities> 2593 <parameters> 2594 <param id="max_frame_count"> 2595 <jint min="0"/> 2596 <description> 2597 The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve per thread. 2598 </description> 2599 </param> 2600 <param id="stack_info_ptr"> 2601 <allocbuf> 2602 <struct>jvmtiStackInfo</struct> 2603 </allocbuf> 2604 <description> 2605 On return, this buffer is filled 2606 with stack information for each thread. 2607 The number of <datalink id="jvmtiStackInfo"/> records is determined 2608 by <paramlink id="thread_count_ptr"/>. 2609 <p/> 2610 Note that this buffer is allocated to include the <datalink id="jvmtiFrameInfo"/> 2611 buffers pointed to by <datalink id="jvmtiStackInfo.frame_buffer"/>. 2612 These buffers must not be separately deallocated. 2613 </description> 2614 </param> 2615 <param id="thread_count_ptr"> 2616 <outptr><jint/></outptr> 2617 <description> 2618 The number of threads traced. 2619 </description> 2620 </param> 2621 </parameters> 2622 <errors> 2623 </errors> 2624 </function> 2625 2626 <function id="GetThreadListStackTraces" num="101"> 2627 <synopsis>Get Thread List Stack Traces</synopsis> 2628 <description> 2629 Get information about the stacks of the supplied threads. 2630 If <paramlink id="max_frame_count"/> is less than the depth of a stack, 2631 the <paramlink id="max_frame_count"/> topmost frames are returned for that thread, 2632 otherwise the entire stack is returned. 2633 The topmost frames, those most recently invoked, are at the beginning of the returned buffer. 2634 <p/> 2635 All stacks are collected simultaneously, that is, no changes will occur to the 2636 thread state or stacks between the sampling one thread and the next. 2637 The threads need not be suspended. 2638 <p/> 2639 If a thread has not yet started or terminates before the stack information is collected, 2640 a zero length stack (<datalink id="jvmtiStackInfo.frame_count"/> will be zero) 2641 will be returned and the thread <datalink id="jvmtiStackInfo.state"/> can be checked. 2642 <p/> 2643 See the example for the similar function 2644 <functionlink id="GetAllStackTraces"/>. 2645 </description> 2646 <origin>new</origin> 2647 <capabilities> 2648 </capabilities> 2649 <parameters> 2650 <param id="thread_count"> 2651 <jint min="0"/> 2652 <description> 2653 The number of threads to trace. 2654 </description> 2655 </param> 2656 <param id="thread_list"> 2657 <inbuf incount="thread_count"><jthread/></inbuf> 2658 <description> 2659 The list of threads to trace. 2660 </description> 2661 </param> 2662 <param id="max_frame_count"> 2663 <jint min="0"/> 2664 <description> 2665 The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve per thread. 2666 </description> 2667 </param> 2668 <param id="stack_info_ptr"> 2669 <allocbuf outcount="thread_count"> 2670 <struct>jvmtiStackInfo</struct> 2671 </allocbuf> 2672 <description> 2673 On return, this buffer is filled 2674 with stack information for each thread. 2675 The number of <datalink id="jvmtiStackInfo"/> records is determined 2676 by <paramlink id="thread_count"/>. 2677 <p/> 2678 Note that this buffer is allocated to include the <datalink id="jvmtiFrameInfo"/> 2679 buffers pointed to by <datalink id="jvmtiStackInfo.frame_buffer"/>. 2680 These buffers must not be separately deallocated. 2681 </description> 2682 </param> 2683 </parameters> 2684 <errors> 2685 <error id="JVMTI_ERROR_INVALID_THREAD"> 2686 An element in <paramlink id="thread_list"/> is not a thread object. 2687 </error> 2688 </errors> 2689 </function> 2690 2691 <elide> 2692 <function id="AsyncGetStackTrace" num="1000"> 2693 <synopsis>Get Stack Trace--Asynchronous</synopsis> 2694 <description> 2695 Get information about the entire stack of a thread (or a sub-section of it). 2696 This is the asynchronous version of <functionlink id="GetStackTrace"></functionlink> 2697 and is reentrant and safe to call 2698 from asynchronous signal handlers. 2699 The stack trace is returned only for the calling thread. 2700 <p/> 2701 The <functionlink id="GetLineNumberTable"></functionlink> 2702 function can be used to map locations to line numbers. Note that 2703 this mapping can be done lazily. 2704 </description> 2705 <origin>jvmpi</origin> 2706 <capabilities> 2707 <required id="can_get_async_stack_trace"></required> 2708 <capability id="can_show_JVM_spec_async_frames"> 2709 If <code>false</code>, 2710 <paramlink id="use_java_stack"></paramlink> 2711 must be <code>false</code>. 2712 </capability> 2713 </capabilities> 2714 <parameters> 2715 <param id="use_java_stack"> 2716 <jboolean/> 2717 <description> 2718 Return the stack showing <vmspec/> 2719 model of the stack; 2720 otherwise, show the internal representation of the stack with 2721 inlined and optimized methods missing. If the virtual machine 2722 is using the <i>Java Virtual Machine Specification</i> stack model 2723 internally, this flag is ignored. 2724 </description> 2725 </param> 2726 <param id="max_count"> 2727 <jint min="0"/> 2728 <description> 2729 The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve. 2730 Retrieve this many unless the stack depth is less than <code>max_count</code>. 2731 </description> 2732 </param> 2733 <param id="frame_buffer"> 2734 <outbuf incount="max_count" outcount="count_ptr"> 2735 <struct>jvmtiFrameInfo</struct> 2736 <nullok>this information is not returned</nullok> 2737 </outbuf> 2738 <description> 2739 The agent passes in a buffer 2740 large enough to hold <code>max_count</code> records of 2741 <datalink id="jvmtiFrameInfo"></datalink>. This buffer must be 2742 pre-allocated by the agent. 2743 </description> 2744 </param> 2745 <param id="count_ptr"> 2746 <outptr><jint/></outptr> 2747 <description> 2748 On return, points to the number of records filled in.. 2749 </description> 2750 </param> 2751 </parameters> 2752 <errors> 2753 <error id="JVMTI_ERROR_UNATTACHED_THREAD"> 2754 The thread being used to call this function is not attached 2755 to the virtual machine. Calls must be made from attached threads. 2756 </error> 2757 </errors> 2758 </function> 2759 </elide> 2760 2761 <function id="GetFrameCount" num="16"> 2762 <synopsis>Get Frame Count</synopsis> 2763 <description> 2764 Get the number of frames currently in the specified thread's call stack. 2765 <p/> 2766 If this function is called for a thread actively executing bytecodes (for example, 2767 not the current thread and not suspended), the information returned is transient. 2768 </description> 2769 <origin>jvmdi</origin> 2770 <capabilities> 2771 </capabilities> 2772 <parameters> 2773 <param id="thread"> 2774 <jthread null="current"/> 2775 <description> 2776 The thread to query. 2777 </description> 2778 </param> 2779 <param id="count_ptr"> 2780 <outptr><jint/></outptr> 2781 <description> 2782 On return, points to the number of frames in the call stack. 2783 </description> 2784 </param> 2785 </parameters> 2786 <errors> 2787 </errors> 2788 </function> 2789 2790 <function id="PopFrame" num="80"> 2791 <synopsis>Pop Frame</synopsis> 2792 <description> 2793 Pop the current frame of <code>thread</code>'s stack. 2794 Popping a frame takes you to the previous frame. 2795 When the thread is resumed, the execution 2796 state of the thread is reset to the state 2797 immediately before the called method was invoked. 2798 That is (using <vmspec/> terminology): 2799 <ul> 2800 <li>the current frame is discarded as the previous frame becomes the current one</li> 2801 <li>the operand stack is restored--the argument values are added back 2802 and if the invoke was not <code>invokestatic</code>, 2803 <code>objectref</code> is added back as well</li> 2804 <li>the Java virtual machine PC is restored to the opcode 2805 of the invoke instruction</li> 2806 </ul> 2807 Note however, that any changes to the arguments, which 2808 occurred in the called method, remain; 2809 when execution continues, the first instruction to 2810 execute will be the invoke. 2811 <p/> 2812 Between calling <code>PopFrame</code> and resuming the 2813 thread the state of the stack is undefined. 2814 To pop frames beyond the first, 2815 these three steps must be repeated: 2816 <ul> 2817 <li>suspend the thread via an event (step, breakpoint, ...)</li> 2818 <li>call <code>PopFrame</code></li> 2819 <li>resume the thread</li> 2820 </ul> 2821 <p/> 2822 A lock acquired by calling the called method 2823 (if it is a <code>synchronized</code> method) 2824 and locks acquired by entering <code>synchronized</code> 2825 blocks within the called method are released. 2826 Note: this does not apply to native locks or 2827 <code>java.util.concurrent.locks</code> locks. 2828 <p/> 2829 Finally blocks are not executed. 2830 <p/> 2831 Changes to global state are not addressed and thus remain changed. 2832 <p/> 2833 The specified thread must be suspended (which implies it cannot be the current thread). 2834 <p/> 2835 Both the called method and calling method must be non-native Java programming 2836 language methods. 2837 <p/> 2838 No <jvmti/> events are generated by this function. 2839 </description> 2840 <origin>jvmdi</origin> 2841 <capabilities> 2842 <required id="can_pop_frame"></required> 2843 </capabilities> 2844 <parameters> 2845 <param id="thread"> 2846 <jthread/> 2847 <description> 2848 The thread whose current frame is to be popped. 2849 </description> 2850 </param> 2851 </parameters> 2852 <errors> 2853 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 2854 Called or calling method is a native method. 2855 The implementation is unable to pop this frame. 2856 </error> 2857 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 2858 Thread was not suspended. 2859 </error> 2860 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 2861 There are less than two stack frames on the call stack. 2862 </error> 2863 </errors> 2864 </function> 2865 2866 <function id="GetFrameLocation" num="19"> 2867 <synopsis>Get Frame Location</synopsis> 2868 <description> 2869 <p/> 2870 For a Java programming language frame, return the location of the instruction 2871 currently executing. 2872 </description> 2873 <origin>jvmdiClone</origin> 2874 <capabilities> 2875 </capabilities> 2876 <parameters> 2877 <param id="thread"> 2878 <jthread null="current" frame="frame"/> 2879 <description> 2880 The thread of the frame to query. 2881 </description> 2882 </param> 2883 <param id="depth"> 2884 <jframeID thread="thread"/> 2885 <description> 2886 The depth of the frame to query. 2887 </description> 2888 </param> 2889 <param id="method_ptr"> 2890 <outptr><jmethodID/></outptr> 2891 <description> 2892 On return, points to the method for the current location. 2893 </description> 2894 </param> 2895 <param id="location_ptr"> 2896 <outptr><jlocation/></outptr> 2897 <description> 2898 On return, points to the index of the currently 2899 executing instruction. 2900 Is set to <code>-1</code> if the frame is executing 2901 a native method. 2902 </description> 2903 </param> 2904 </parameters> 2905 <errors> 2906 </errors> 2907 </function> 2908 2909 <function id="NotifyFramePop" num="20"> 2910 <synopsis>Notify Frame Pop</synopsis> 2911 <description> 2912 When the frame that is currently at <paramlink id="depth"></paramlink> 2913 is popped from the stack, generate a 2914 <eventlink id="FramePop"></eventlink> event. See the 2915 <eventlink id="FramePop"></eventlink> event for details. 2916 Only frames corresponding to non-native Java programming language 2917 methods can receive notification. 2918 <p/> 2919 The specified thread must either be the current thread 2920 or the thread must be suspended. 2921 </description> 2922 <origin>jvmdi</origin> 2923 <capabilities> 2924 <required id="can_generate_frame_pop_events"></required> 2925 </capabilities> 2926 <parameters> 2927 <param id="thread"> 2928 <jthread null="current" frame="depth"/> 2929 <description> 2930 The thread of the frame for which the frame pop event will be generated. 2931 </description> 2932 </param> 2933 <param id="depth"> 2934 <jframeID thread="thread"/> 2935 <description> 2936 The depth of the frame for which the frame pop event will be generated. 2937 </description> 2938 </param> 2939 </parameters> 2940 <errors> 2941 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 2942 The frame at <code>depth</code> is executing a 2943 native method. 2944 </error> 2945 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 2946 Thread was not suspended and was not the current thread. 2947 </error> 2948 </errors> 2949 </function> 2950 2951 </category> 2952 2953 <category id="ForceEarlyReturn" label="Force Early Return"> 2954 <intro> 2955 These functions allow an agent to force a method 2956 to return at any point during its execution. 2957 The method which will return early is referred to as the <i>called method</i>. 2958 The called method is the current method 2959 (as defined by 2960 <vmspec chapter="3.6"/>) 2961 for the specified thread at 2962 the time the function is called. 2963 <p/> 2964 The specified thread must be suspended or must be the current thread. 2965 The return occurs when execution of Java programming 2966 language code is resumed on this thread. 2967 Between calling one of these functions and resumption 2968 of thread execution, the state of the stack is undefined. 2969 <p/> 2970 No further instructions are executed in the called method. 2971 Specifically, finally blocks are not executed. 2972 Note: this can cause inconsistent states in the application. 2973 <p/> 2974 A lock acquired by calling the called method 2975 (if it is a <code>synchronized</code> method) 2976 and locks acquired by entering <code>synchronized</code> 2977 blocks within the called method are released. 2978 Note: this does not apply to native locks or 2979 <code>java.util.concurrent.locks</code> locks. 2980 <p/> 2981 Events, such as <eventlink id="MethodExit"></eventlink>, 2982 are generated as they would be in a normal return. 2983 <p/> 2984 The called method must be a non-native Java programming 2985 language method. 2986 Forcing return on a thread with only one frame on the 2987 stack causes the thread to exit when resumed. 2988 </intro> 2989 2990 <function id="ForceEarlyReturnObject" num="81" since="1.1"> 2991 <synopsis>Force Early Return - Object</synopsis> 2992 <description> 2993 This function can be used to return from a method whose 2994 result type is <code>Object</code> 2995 or a subclass of <code>Object</code>. 2996 </description> 2997 <origin>new</origin> 2998 <capabilities> 2999 <required id="can_force_early_return"></required> 3000 </capabilities> 3001 <parameters> 3002 <param id="thread"> 3003 <jthread null="current"/> 3004 <description> 3005 The thread whose current frame is to return early. 3006 </description> 3007 </param> 3008 <param id="value"> 3009 <jobject/> 3010 <description> 3011 The return value for the called frame. 3012 An object or <code>NULL</code>. 3013 </description> 3014 </param> 3015 </parameters> 3016 <errors> 3017 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3018 Attempted to return early from a frame 3019 corresponding to a native method. 3020 Or the implementation is unable to provide 3021 this functionality on this frame. 3022 </error> 3023 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3024 The result type of the called method is not 3025 <code>Object</code> or a subclass of <code>Object</code>. 3026 </error> 3027 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3028 The supplied <paramlink id="value"/> is not compatible with the 3029 result type of the called method. 3030 </error> 3031 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3032 Thread was not the current thread and was not suspended. 3033 </error> 3034 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3035 There are no more frames on the call stack. 3036 </error> 3037 </errors> 3038 </function> 3039 3040 <function id="ForceEarlyReturnInt" num="82" since="1.1"> 3041 <synopsis>Force Early Return - Int</synopsis> 3042 <description> 3043 This function can be used to return from a method whose 3044 result type is <code>int</code>, <code>short</code>, 3045 <code>char</code>, <code>byte</code>, or 3046 <code>boolean</code>. 3047 </description> 3048 <origin>new</origin> 3049 <capabilities> 3050 <required id="can_force_early_return"></required> 3051 </capabilities> 3052 <parameters> 3053 <param id="thread"> 3054 <jthread null="current"/> 3055 <description> 3056 The thread whose current frame is to return early. 3057 </description> 3058 </param> 3059 <param id="value"> 3060 <jint/> 3061 <description> 3062 The return value for the called frame. 3063 </description> 3064 </param> 3065 </parameters> 3066 <errors> 3067 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3068 Attempted to return early from a frame 3069 corresponding to a native method. 3070 Or the implementation is unable to provide 3071 this functionality on this frame. 3072 </error> 3073 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3074 The result type of the called method is not 3075 <code>int</code>, <code>short</code>, 3076 <code>char</code>, <code>byte</code>, or 3077 <code>boolean</code>. 3078 </error> 3079 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3080 Thread was not the current thread and was not suspended. 3081 </error> 3082 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3083 There are no frames on the call stack. 3084 </error> 3085 </errors> 3086 </function> 3087 3088 <function id="ForceEarlyReturnLong" num="83" since="1.1"> 3089 <synopsis>Force Early Return - Long</synopsis> 3090 <description> 3091 This function can be used to return from a method whose 3092 result type is <code>long</code>. 3093 </description> 3094 <origin>new</origin> 3095 <capabilities> 3096 <required id="can_force_early_return"></required> 3097 </capabilities> 3098 <parameters> 3099 <param id="thread"> 3100 <jthread null="current"/> 3101 <description> 3102 The thread whose current frame is to return early. 3103 </description> 3104 </param> 3105 <param id="value"> 3106 <jlong/> 3107 <description> 3108 The return value for the called frame. 3109 </description> 3110 </param> 3111 </parameters> 3112 <errors> 3113 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3114 Attempted to return early from a frame 3115 corresponding to a native method. 3116 Or the implementation is unable to provide 3117 this functionality on this frame. 3118 </error> 3119 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3120 The result type of the called method is not <code>long</code>. 3121 </error> 3122 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3123 Thread was not the current thread and was not suspended. 3124 </error> 3125 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3126 There are no frames on the call stack. 3127 </error> 3128 </errors> 3129 </function> 3130 3131 <function id="ForceEarlyReturnFloat" num="84" since="1.1"> 3132 <synopsis>Force Early Return - Float</synopsis> 3133 <description> 3134 This function can be used to return from a method whose 3135 result type is <code>float</code>. 3136 </description> 3137 <origin>new</origin> 3138 <capabilities> 3139 <required id="can_force_early_return"></required> 3140 </capabilities> 3141 <parameters> 3142 <param id="thread"> 3143 <jthread null="current"/> 3144 <description> 3145 The thread whose current frame is to return early. 3146 </description> 3147 </param> 3148 <param id="value"> 3149 <jfloat/> 3150 <description> 3151 The return value for the called frame. 3152 </description> 3153 </param> 3154 </parameters> 3155 <errors> 3156 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3157 Attempted to return early from a frame 3158 corresponding to a native method. 3159 Or the implementation is unable to provide 3160 this functionality on this frame. 3161 </error> 3162 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3163 The result type of the called method is not <code>float</code>. 3164 </error> 3165 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3166 Thread was not the current thread and was not suspended. 3167 </error> 3168 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3169 There are no frames on the call stack. 3170 </error> 3171 </errors> 3172 </function> 3173 3174 <function id="ForceEarlyReturnDouble" num="85" since="1.1"> 3175 <synopsis>Force Early Return - Double</synopsis> 3176 <description> 3177 This function can be used to return from a method whose 3178 result type is <code>double</code>. 3179 </description> 3180 <origin>new</origin> 3181 <capabilities> 3182 <required id="can_force_early_return"></required> 3183 </capabilities> 3184 <parameters> 3185 <param id="thread"> 3186 <jthread null="current"/> 3187 <description> 3188 The thread whose current frame is to return early. 3189 </description> 3190 </param> 3191 <param id="value"> 3192 <jdouble/> 3193 <description> 3194 The return value for the called frame. 3195 </description> 3196 </param> 3197 </parameters> 3198 <errors> 3199 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3200 Attempted to return early from a frame corresponding to a native method. 3201 Or the implementation is unable to provide this functionality on this frame. 3202 </error> 3203 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3204 The result type of the called method is not <code>double</code>. 3205 </error> 3206 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3207 Thread was not the current thread and was not suspended. 3208 </error> 3209 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3210 There are no frames on the call stack. 3211 </error> 3212 </errors> 3213 </function> 3214 3215 <function id="ForceEarlyReturnVoid" num="86" since="1.1"> 3216 <synopsis>Force Early Return - Void</synopsis> 3217 <description> 3218 This function can be used to return from a method with no result type. 3219 That is, the called method must be declared <code>void</code>. 3220 </description> 3221 <origin>new</origin> 3222 <capabilities> 3223 <required id="can_force_early_return"></required> 3224 </capabilities> 3225 <parameters> 3226 <param id="thread"> 3227 <jthread null="current"/> 3228 <description> 3229 The thread whose current frame is to return early. 3230 </description> 3231 </param> 3232 </parameters> 3233 <errors> 3234 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3235 Attempted to return early from a frame 3236 corresponding to a native method. 3237 Or the implementation is unable to provide 3238 this functionality on this frame. 3239 </error> 3240 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3241 The called method has a result type. 3242 </error> 3243 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3244 Thread was not the current thread and was not suspended. 3245 </error> 3246 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3247 There are no frames on the call stack. 3248 </error> 3249 </errors> 3250 </function> 3251 3252 </category> 3253 3254 <category id="Heap" label="Heap"> 3255 <intro> 3256 These functions are used to analyze the heap. 3257 Functionality includes the ability to view the objects in the 3258 heap and to tag these objects. 3259 </intro> 3260 3261 <intro id="objectTags" label="Object Tags"> 3262 A <i>tag</i> is a value associated with an object. 3263 Tags are explicitly set by the agent using the 3264 <functionlink id="SetTag"></functionlink> function or by 3265 callback functions such as <functionlink id="jvmtiHeapIterationCallback"/>. 3266 <p/> 3267 Tags are local to the environment; that is, the tags of one 3268 environment are not visible in another. 3269 <p/> 3270 Tags are <code>jlong</code> values which can be used 3271 simply to mark an object or to store a pointer to more detailed 3272 information. Objects which have not been tagged have a 3273 tag of zero. 3274 Setting a tag to zero makes the object untagged. 3275 </intro> 3276 3277 <intro id="heapCallbacks" label="Heap Callback Functions"> 3278 Heap functions which iterate through the heap and recursively 3279 follow object references use agent supplied callback functions 3280 to deliver the information. 3281 <p/> 3282 These heap callback functions must adhere to the following restrictions -- 3283 These callbacks must not use JNI functions. 3284 These callbacks must not use <jvmti/> functions except 3285 <i>callback safe</i> functions which 3286 specifically allow such use (see the raw monitor, memory management, 3287 and environment local storage functions). 3288 <p/> 3289 An implementation may invoke a callback on an internal thread or 3290 the thread which called the iteration function. 3291 Heap callbacks are single threaded -- no more than one callback will 3292 be invoked at a time. 3293 <p/> 3294 The Heap Filter Flags can be used to prevent reporting 3295 based on the tag status of an object or its class. 3296 If no flags are set (the <code>jint</code> is zero), objects 3297 will not be filtered out. 3298 3299 <constants id="jvmtiHeapFilter" label="Heap Filter Flags" kind="bits"> 3300 <constant id="JVMTI_HEAP_FILTER_TAGGED" num="0x4"> 3301 Filter out tagged objects. Objects which are tagged are not included. 3302 </constant> 3303 <constant id="JVMTI_HEAP_FILTER_UNTAGGED" num="0x8"> 3304 Filter out untagged objects. Objects which are not tagged are not included. 3305 </constant> 3306 <constant id="JVMTI_HEAP_FILTER_CLASS_TAGGED" num="0x10"> 3307 Filter out objects with tagged classes. Objects whose class is tagged are not included. 3308 </constant> 3309 <constant id="JVMTI_HEAP_FILTER_CLASS_UNTAGGED" num="0x20"> 3310 Filter out objects with untagged classes. Objects whose class is not tagged are not included. 3311 </constant> 3312 </constants> 3313 3314 <p/> 3315 The Heap Visit Control Flags are returned by the heap callbacks 3316 and can be used to abort the iteration. For the 3317 <functionlink id="jvmtiHeapReferenceCallback">Heap 3318 Reference Callback</functionlink>, it can also be used 3319 to prune the graph of traversed references 3320 (<code>JVMTI_VISIT_OBJECTS</code> is not set). 3321 3322 <constants id="jvmtiHeapVisitControl" 3323 label="Heap Visit Control Flags" 3324 kind="bits" 3325 since="1.1"> 3326 <constant id="JVMTI_VISIT_OBJECTS" num="0x100"> 3327 If we are visiting an object and if this callback 3328 was initiated by <functionlink id="FollowReferences"/>, 3329 traverse the references of this object. 3330 Otherwise ignored. 3331 </constant> 3332 <constant id="JVMTI_VISIT_ABORT" num="0x8000"> 3333 Abort the iteration. Ignore all other bits. 3334 </constant> 3335 </constants> 3336 3337 <p/> 3338 The Heap Reference Enumeration is provided by the 3339 <functionlink id="jvmtiHeapReferenceCallback">Heap 3340 Reference Callback</functionlink> and 3341 <functionlink id="jvmtiPrimitiveFieldCallback">Primitive Field 3342 Callback</functionlink> to 3343 describe the kind of reference 3344 being reported. 3345 3346 <constants id="jvmtiHeapReferenceKind" 3347 label="Heap Reference Enumeration" 3348 kind="enum" 3349 since="1.1"> 3350 <constant id="JVMTI_HEAP_REFERENCE_CLASS" num="1"> 3351 Reference from an object to its class. 3352 </constant> 3353 <constant id="JVMTI_HEAP_REFERENCE_FIELD" num="2"> 3354 Reference from an object to the value of one of its instance fields. 3355 </constant> 3356 <constant id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT" num="3"> 3357 Reference from an array to one of its elements. 3358 </constant> 3359 <constant id="JVMTI_HEAP_REFERENCE_CLASS_LOADER" num="4"> 3360 Reference from a class to its class loader. 3361 </constant> 3362 <constant id="JVMTI_HEAP_REFERENCE_SIGNERS" num="5"> 3363 Reference from a class to its signers array. 3364 </constant> 3365 <constant id="JVMTI_HEAP_REFERENCE_PROTECTION_DOMAIN" num="6"> 3366 Reference from a class to its protection domain. 3367 </constant> 3368 <constant id="JVMTI_HEAP_REFERENCE_INTERFACE" num="7"> 3369 Reference from a class to one of its interfaces. 3370 Note: interfaces are defined via a constant pool reference, 3371 so the referenced interfaces may also be reported with a 3372 <code>JVMTI_HEAP_REFERENCE_CONSTANT_POOL</code> reference kind. 3373 </constant> 3374 <constant id="JVMTI_HEAP_REFERENCE_STATIC_FIELD" num="8"> 3375 Reference from a class to the value of one of its static fields. 3376 </constant> 3377 <constant id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL" num="9"> 3378 Reference from a class to a resolved entry in the constant pool. 3379 </constant> 3380 <constant id="JVMTI_HEAP_REFERENCE_SUPERCLASS" num="10"> 3381 Reference from a class to its superclass. 3382 A callback is not sent if the superclass is <code>java.lang.Object</code>. 3383 Note: loaded classes define superclasses via a constant pool 3384 reference, so the referenced superclass may also be reported with 3385 a <code>JVMTI_HEAP_REFERENCE_CONSTANT_POOL</code> reference kind. 3386 </constant> 3387 <constant id="JVMTI_HEAP_REFERENCE_JNI_GLOBAL" num="21"> 3388 Heap root reference: JNI global reference. 3389 </constant> 3390 <constant id="JVMTI_HEAP_REFERENCE_SYSTEM_CLASS" num="22"> 3391 Heap root reference: System class. 3392 </constant> 3393 <constant id="JVMTI_HEAP_REFERENCE_MONITOR" num="23"> 3394 Heap root reference: monitor. 3395 </constant> 3396 <constant id="JVMTI_HEAP_REFERENCE_STACK_LOCAL" num="24"> 3397 Heap root reference: local variable on the stack. 3398 </constant> 3399 <constant id="JVMTI_HEAP_REFERENCE_JNI_LOCAL" num="25"> 3400 Heap root reference: JNI local reference. 3401 </constant> 3402 <constant id="JVMTI_HEAP_REFERENCE_THREAD" num="26"> 3403 Heap root reference: Thread. 3404 </constant> 3405 <constant id="JVMTI_HEAP_REFERENCE_OTHER" num="27"> 3406 Heap root reference: other heap root reference. 3407 </constant> 3408 </constants> 3409 3410 <p/> 3411 Definitions for the single character type descriptors of 3412 primitive types. 3413 3414 <constants id="jvmtiPrimitiveType" 3415 label="Primitive Type Enumeration" 3416 kind="enum" 3417 since="1.1"> 3418 <constant id="JVMTI_PRIMITIVE_TYPE_BOOLEAN" num="90"> 3419 'Z' - Java programming language <code>boolean</code> - JNI <code>jboolean</code> 3420 </constant> 3421 <constant id="JVMTI_PRIMITIVE_TYPE_BYTE" num="66"> 3422 'B' - Java programming language <code>byte</code> - JNI <code>jbyte</code> 3423 </constant> 3424 <constant id="JVMTI_PRIMITIVE_TYPE_CHAR" num="67"> 3425 'C' - Java programming language <code>char</code> - JNI <code>jchar</code> 3426 </constant> 3427 <constant id="JVMTI_PRIMITIVE_TYPE_SHORT" num="83"> 3428 'S' - Java programming language <code>short</code> - JNI <code>jshort</code> 3429 </constant> 3430 <constant id="JVMTI_PRIMITIVE_TYPE_INT" num="73"> 3431 'I' - Java programming language <code>int</code> - JNI <code>jint</code> 3432 </constant> 3433 <constant id="JVMTI_PRIMITIVE_TYPE_LONG" num="74"> 3434 'J' - Java programming language <code>long</code> - JNI <code>jlong</code> 3435 </constant> 3436 <constant id="JVMTI_PRIMITIVE_TYPE_FLOAT" num="70"> 3437 'F' - Java programming language <code>float</code> - JNI <code>jfloat</code> 3438 </constant> 3439 <constant id="JVMTI_PRIMITIVE_TYPE_DOUBLE" num="68"> 3440 'D' - Java programming language <code>double</code> - JNI <code>jdouble</code> 3441 </constant> 3442 </constants> 3443 </intro> 3444 3445 <typedef id="jvmtiHeapReferenceInfoField" 3446 label="Reference information structure for Field references" 3447 since="1.1"> 3448 <description> 3449 Reference information returned for 3450 <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/> and 3451 <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/> references. 3452 </description> 3453 <field id="index"> 3454 <jint/> 3455 <description> 3456 For <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/>, the 3457 referrer object is not a class or an inteface. 3458 In this case, <code>index</code> is the index of the field 3459 in the class of the referrer object. 3460 This class is referred to below as <i>C</i>. 3461 <p/> 3462 For <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/>, 3463 the referrer object is a class (referred to below as <i>C</i>) 3464 or an interface (referred to below as <i>I</i>). 3465 In this case, <code>index</code> is the index of the field in 3466 that class or interface. 3467 <p/> 3468 If the referrer object is not an interface, then the field 3469 indices are determined as follows: 3470 <ul> 3471 <li>make a list of all the fields in <i>C</i> and its 3472 superclasses, starting with all the fields in 3473 <code>java.lang.Object</code> and ending with all the 3474 fields in <i>C</i>.</li> 3475 <li>Within this list, put 3476 the fields for a given class in the order returned by 3477 <functionlink id="GetClassFields"/>.</li> 3478 <li>Assign the fields in this list indices 3479 <i>n</i>, <i>n</i>+1, ..., in order, where <i>n</i> 3480 is the count of the fields in all the interfaces 3481 implemented by <i>C</i>. 3482 Note that <i>C</i> implements all interfaces 3483 directly implemented by its superclasses; as well 3484 as all superinterfaces of these interfaces.</li> 3485 </ul> 3486 If the referrer object is an interface, then the field 3487 indices are determined as follows: 3488 <ul> 3489 <li>make a list of the fields directly declared in 3490 <i>I</i>.</li> 3491 <li>Within this list, put 3492 the fields in the order returned by 3493 <functionlink id="GetClassFields"/>.</li> 3494 <li>Assign the fields in this list indices 3495 <i>n</i>, <i>n</i>+1, ..., in order, where <i>n</i> 3496 is the count of the fields in all the superinterfaces 3497 of <i>I</i>.</li> 3498 </ul> 3499 All fields are included in this computation, regardless of 3500 field modifier (static, public, private, etc). 3501 <p/> 3502 For example, given the following classes and interfaces: 3503 <example> 3504 interface I0 { 3505 int p = 0; 3506 } 3507 3508 interface I1 extends I0 { 3509 int x = 1; 3510 } 3511 3512 interface I2 extends I0 { 3513 int y = 2; 3514 } 3515 3516 class C1 implements I1 { 3517 public static int a = 3; 3518 private int b = 4; 3519 } 3520 3521 class C2 extends C1 implements I2 { 3522 static int q = 5; 3523 final int r = 6; 3524 } 3525 </example> 3526 Assume that <functionlink id="GetClassFields"/> called on 3527 <code>C1</code> returns the fields of <code>C1</code> in the 3528 order: a, b; and that the fields of <code>C2</code> are 3529 returned in the order: q, r. 3530 An instance of class <code>C1</code> will have the 3531 following field indices: 3532 <blockquote><table> 3533 <tr> 3534 <td class="centered"> 3535 a 3536 </td> 3537 <td class="centered"> 3538 2 3539 </td> 3540 <td> 3541 The count of the fields in the interfaces 3542 implemented by <code>C1</code> is two (<i>n</i>=2): 3543 <code>p</code> of <code>I0</code> 3544 and <code>x</code> of <code>I1</code>. 3545 </td> 3546 </tr> 3547 <tr> 3548 <td class="centered"> 3549 b 3550 </td> 3551 <td class="centered"> 3552 3 3553 </td> 3554 <td> 3555 the subsequent index. 3556 </td> 3557 </tr> 3558 </table></blockquote> 3559 The class <code>C1</code> will have the same field indices. 3560 <p/> 3561 An instance of class <code>C2</code> will have the 3562 following field indices: 3563 <blockquote><table> 3564 <tr> 3565 <td class="centered"> 3566 a 3567 </td> 3568 <td class="centered"> 3569 3 3570 </td> 3571 <td> 3572 The count of the fields in the interfaces 3573 implemented by <code>C2</code> is three (<i>n</i>=3): 3574 <code>p</code> of <code>I0</code>, 3575 <code>x</code> of <code>I1</code> and <code>y</code> of <code>I2</code> 3576 (an interface of <code>C2</code>). Note that the field <code>p</code> 3577 of <code>I0</code> is only included once. 3578 </td> 3579 </tr> 3580 <tr> 3581 <td class="centered"> 3582 b 3583 </td> 3584 <td class="centered"> 3585 4 3586 </td> 3587 <td> 3588 the subsequent index to "a". 3589 </td> 3590 </tr> 3591 <tr> 3592 <td class="centered"> 3593 q 3594 </td> 3595 <td class="centered"> 3596 5 3597 </td> 3598 <td> 3599 the subsequent index to "b". 3600 </td> 3601 </tr> 3602 <tr> 3603 <td class="centered"> 3604 r 3605 </td> 3606 <td class="centered"> 3607 6 3608 </td> 3609 <td> 3610 the subsequent index to "q". 3611 </td> 3612 </tr> 3613 </table></blockquote> 3614 The class <code>C2</code> will have the same field indices. 3615 Note that a field may have a different index depending on the 3616 object that is viewing it -- for example field "a" above. 3617 Note also: not all field indices may be visible from the 3618 callbacks, but all indices are shown for illustrative purposes. 3619 <p/> 3620 The interface <code>I1</code> will have the 3621 following field indices: 3622 <blockquote><table> 3623 <tr> 3624 <td class="centered"> 3625 x 3626 </td> 3627 <td class="centered"> 3628 1 3629 </td> 3630 <td> 3631 The count of the fields in the superinterfaces 3632 of <code>I1</code> is one (<i>n</i>=1): 3633 <code>p</code> of <code>I0</code>. 3634 </td> 3635 </tr> 3636 </table></blockquote> 3637 </description> 3638 </field> 3639 </typedef> 3640 3641 <typedef id="jvmtiHeapReferenceInfoArray" 3642 label="Reference information structure for Array references" 3643 since="1.1"> 3644 <description> 3645 Reference information returned for 3646 <datalink id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT"/> references. 3647 </description> 3648 <field id="index"> 3649 <jint/> 3650 <description> 3651 The array index. 3652 </description> 3653 </field> 3654 </typedef> 3655 3656 <typedef id="jvmtiHeapReferenceInfoConstantPool" 3657 label="Reference information structure for Constant Pool references" 3658 since="1.1"> 3659 <description> 3660 Reference information returned for 3661 <datalink id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL"/> references. 3662 </description> 3663 <field id="index"> 3664 <jint/> 3665 <description> 3666 The index into the constant pool of the class. See the description in 3667 <vmspec chapter="4.4"/>. 3668 </description> 3669 </field> 3670 </typedef> 3671 3672 <typedef id="jvmtiHeapReferenceInfoStackLocal" 3673 label="Reference information structure for Local Variable references" 3674 since="1.1"> 3675 <description> 3676 Reference information returned for 3677 <datalink id="JVMTI_HEAP_REFERENCE_STACK_LOCAL"/> references. 3678 </description> 3679 <field id="thread_tag"> 3680 <jlong/> 3681 <description> 3682 The tag of the thread corresponding to this stack, zero if not tagged. 3683 </description> 3684 </field> 3685 <field id="thread_id"> 3686 <jlong/> 3687 <description> 3688 The unique thread ID of the thread corresponding to this stack. 3689 </description> 3690 </field> 3691 <field id="depth"> 3692 <jint/> 3693 <description> 3694 The depth of the frame. 3695 </description> 3696 </field> 3697 <field id="method"> 3698 <jmethodID/> 3699 <description> 3700 The method executing in this frame. 3701 </description> 3702 </field> 3703 <field id="location"> 3704 <jlocation/> 3705 <description> 3706 The currently executing location in this frame. 3707 </description> 3708 </field> 3709 <field id="slot"> 3710 <jint/> 3711 <description> 3712 The slot number of the local variable. 3713 </description> 3714 </field> 3715 </typedef> 3716 3717 <typedef id="jvmtiHeapReferenceInfoJniLocal" 3718 label="Reference information structure for JNI local references" 3719 since="1.1"> 3720 <description> 3721 Reference information returned for 3722 <datalink id="JVMTI_HEAP_REFERENCE_JNI_LOCAL"/> references. 3723 </description> 3724 <field id="thread_tag"> 3725 <jlong/> 3726 <description> 3727 The tag of the thread corresponding to this stack, zero if not tagged. 3728 </description> 3729 </field> 3730 <field id="thread_id"> 3731 <jlong/> 3732 <description> 3733 The unique thread ID of the thread corresponding to this stack. 3734 </description> 3735 </field> 3736 <field id="depth"> 3737 <jint/> 3738 <description> 3739 The depth of the frame. 3740 </description> 3741 </field> 3742 <field id="method"> 3743 <jmethodID/> 3744 <description> 3745 The method executing in this frame. 3746 </description> 3747 </field> 3748 </typedef> 3749 3750 <typedef id="jvmtiHeapReferenceInfoReserved" 3751 label="Reference information structure for Other references" 3752 since="1.1"> 3753 <description> 3754 Reference information returned for other references. 3755 </description> 3756 <field id="reserved1"> 3757 <jlong/> 3758 <description> 3759 reserved for future use. 3760 </description> 3761 </field> 3762 <field id="reserved2"> 3763 <jlong/> 3764 <description> 3765 reserved for future use. 3766 </description> 3767 </field> 3768 <field id="reserved3"> 3769 <jlong/> 3770 <description> 3771 reserved for future use. 3772 </description> 3773 </field> 3774 <field id="reserved4"> 3775 <jlong/> 3776 <description> 3777 reserved for future use. 3778 </description> 3779 </field> 3780 <field id="reserved5"> 3781 <jlong/> 3782 <description> 3783 reserved for future use. 3784 </description> 3785 </field> 3786 <field id="reserved6"> 3787 <jlong/> 3788 <description> 3789 reserved for future use. 3790 </description> 3791 </field> 3792 <field id="reserved7"> 3793 <jlong/> 3794 <description> 3795 reserved for future use. 3796 </description> 3797 </field> 3798 <field id="reserved8"> 3799 <jlong/> 3800 <description> 3801 reserved for future use. 3802 </description> 3803 </field> 3804 </typedef> 3805 3806 <uniontypedef id="jvmtiHeapReferenceInfo" 3807 label="Reference information structure" 3808 since="1.1"> 3809 <description> 3810 The information returned about referrers. 3811 Represented as a union of the various kinds of reference information. 3812 </description> 3813 <field id="field"> 3814 <struct>jvmtiHeapReferenceInfoField</struct> 3815 <description> 3816 The referrer information for 3817 <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/> 3818 and <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/> references. 3819 </description> 3820 </field> 3821 <field id="array"> 3822 <struct>jvmtiHeapReferenceInfoArray</struct> 3823 <description> 3824 The referrer information for 3825 For <datalink id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT"/> references. 3826 </description> 3827 </field> 3828 <field id="constant_pool"> 3829 <struct>jvmtiHeapReferenceInfoConstantPool</struct> 3830 <description> 3831 The referrer information for 3832 For <datalink id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL"/> references. 3833 </description> 3834 </field> 3835 <field id="stack_local"> 3836 <struct>jvmtiHeapReferenceInfoStackLocal</struct> 3837 <description> 3838 The referrer information for 3839 For <datalink id="JVMTI_HEAP_REFERENCE_STACK_LOCAL"/> references. 3840 </description> 3841 </field> 3842 <field id="jni_local"> 3843 <struct>jvmtiHeapReferenceInfoJniLocal</struct> 3844 <description> 3845 The referrer information for 3846 For <datalink id="JVMTI_HEAP_REFERENCE_JNI_LOCAL"/> references. 3847 </description> 3848 </field> 3849 <field id="other"> 3850 <struct>jvmtiHeapReferenceInfoReserved</struct> 3851 <description> 3852 reserved for future use. 3853 </description> 3854 </field> 3855 </uniontypedef> 3856 3857 <typedef id="jvmtiHeapCallbacks" 3858 label="Heap callback function structure" 3859 since="1.1"> 3860 <field id="heap_iteration_callback"> 3861 <ptrtype> 3862 <struct>jvmtiHeapIterationCallback</struct> 3863 </ptrtype> 3864 <description> 3865 The callback to be called to describe an 3866 object in the heap. Used by the 3867 <functionlink id="IterateThroughHeap"/> function, ignored by the 3868 <functionlink id="FollowReferences"/> function. 3869 </description> 3870 </field> 3871 <field id="heap_reference_callback"> 3872 <ptrtype> 3873 <struct>jvmtiHeapReferenceCallback</struct> 3874 </ptrtype> 3875 <description> 3876 The callback to be called to describe an 3877 object reference. Used by the 3878 <functionlink id="FollowReferences"/> function, ignored by the 3879 <functionlink id="IterateThroughHeap"/> function. 3880 </description> 3881 </field> 3882 <field id="primitive_field_callback"> 3883 <ptrtype> 3884 <struct>jvmtiPrimitiveFieldCallback</struct> 3885 </ptrtype> 3886 <description> 3887 The callback to be called to describe a 3888 primitive field. 3889 </description> 3890 </field> 3891 <field id="array_primitive_value_callback"> 3892 <ptrtype> 3893 <struct>jvmtiArrayPrimitiveValueCallback</struct> 3894 </ptrtype> 3895 <description> 3896 The callback to be called to describe an 3897 array of primitive values. 3898 </description> 3899 </field> 3900 <field id="string_primitive_value_callback"> 3901 <ptrtype> 3902 <struct>jvmtiStringPrimitiveValueCallback</struct> 3903 </ptrtype> 3904 <description> 3905 The callback to be called to describe a String value. 3906 </description> 3907 </field> 3908 <field id="reserved5"> 3909 <ptrtype> 3910 <struct>jvmtiReservedCallback</struct> 3911 </ptrtype> 3912 <description> 3913 Reserved for future use.. 3914 </description> 3915 </field> 3916 <field id="reserved6"> 3917 <ptrtype> 3918 <struct>jvmtiReservedCallback</struct> 3919 </ptrtype> 3920 <description> 3921 Reserved for future use.. 3922 </description> 3923 </field> 3924 <field id="reserved7"> 3925 <ptrtype> 3926 <struct>jvmtiReservedCallback</struct> 3927 </ptrtype> 3928 <description> 3929 Reserved for future use.. 3930 </description> 3931 </field> 3932 <field id="reserved8"> 3933 <ptrtype> 3934 <struct>jvmtiReservedCallback</struct> 3935 </ptrtype> 3936 <description> 3937 Reserved for future use.. 3938 </description> 3939 </field> 3940 <field id="reserved9"> 3941 <ptrtype> 3942 <struct>jvmtiReservedCallback</struct> 3943 </ptrtype> 3944 <description> 3945 Reserved for future use.. 3946 </description> 3947 </field> 3948 <field id="reserved10"> 3949 <ptrtype> 3950 <struct>jvmtiReservedCallback</struct> 3951 </ptrtype> 3952 <description> 3953 Reserved for future use.. 3954 </description> 3955 </field> 3956 <field id="reserved11"> 3957 <ptrtype> 3958 <struct>jvmtiReservedCallback</struct> 3959 </ptrtype> 3960 <description> 3961 Reserved for future use.. 3962 </description> 3963 </field> 3964 <field id="reserved12"> 3965 <ptrtype> 3966 <struct>jvmtiReservedCallback</struct> 3967 </ptrtype> 3968 <description> 3969 Reserved for future use.. 3970 </description> 3971 </field> 3972 <field id="reserved13"> 3973 <ptrtype> 3974 <struct>jvmtiReservedCallback</struct> 3975 </ptrtype> 3976 <description> 3977 Reserved for future use.. 3978 </description> 3979 </field> 3980 <field id="reserved14"> 3981 <ptrtype> 3982 <struct>jvmtiReservedCallback</struct> 3983 </ptrtype> 3984 <description> 3985 Reserved for future use.. 3986 </description> 3987 </field> 3988 <field id="reserved15"> 3989 <ptrtype> 3990 <struct>jvmtiReservedCallback</struct> 3991 </ptrtype> 3992 <description> 3993 Reserved for future use.. 3994 </description> 3995 </field> 3996 </typedef> 3997 3998 3999 <intro> 4000 <rationale> 4001 The heap dumping functionality (below) uses a callback 4002 for each object. While it would seem that a buffered approach 4003 would provide better throughput, tests do 4004 not show this to be the case--possibly due to locality of 4005 memory reference or array access overhead. 4006 </rationale> 4007 4008 <issue> 4009 Still under investigation as to if java.lang.ref references 4010 are reported as a different type of reference. 4011 </issue> 4012 4013 <issue> 4014 Should or can an indication of the cost or relative cost of 4015 these operations be included? 4016 </issue> 4017 4018 </intro> 4019 4020 <callback id="jvmtiHeapIterationCallback" since="1.1"> 4021 <jint/> 4022 <synopsis>Heap Iteration Callback</synopsis> 4023 <description> 4024 Agent supplied callback function. 4025 Describes (but does not pass in) an object in the heap. 4026 <p/> 4027 This function should return a bit vector of the desired 4028 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>. 4029 This will determine if the entire iteration should be aborted 4030 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored). 4031 <p/> 4032 See the <internallink id="heapCallbacks">heap callback 4033 function restrictions</internallink>. 4034 </description> 4035 <parameters> 4036 <param id="class_tag"> 4037 <jlong/> 4038 <description> 4039 The tag of the class of object (zero if the class is not tagged). 4040 If the object represents a runtime class, 4041 the <code>class_tag</code> is the tag 4042 associated with <code>java.lang.Class</code> 4043 (zero if <code>java.lang.Class</code> is not tagged). 4044 </description> 4045 </param> 4046 <param id="size"> 4047 <jlong/> 4048 <description> 4049 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 4050 </description> 4051 </param> 4052 <param id="tag_ptr"> 4053 <outptr><jlong/></outptr> 4054 <description> 4055 The object tag value, or zero if the object is not tagged. 4056 To set the tag value to be associated with the object 4057 the agent sets the <code>jlong</code> pointed to by the parameter. 4058 </description> 4059 </param> 4060 <param id="length"> 4061 <jint/> 4062 <description> 4063 If this object is an array, the length of the array. Otherwise negative one (-1). 4064 </description> 4065 </param> 4066 <param id="user_data"> 4067 <outptr><void/></outptr> 4068 <description> 4069 The user supplied data that was passed into the iteration function. 4070 </description> 4071 </param> 4072 </parameters> 4073 </callback> 4074 4075 <callback id="jvmtiHeapReferenceCallback" since="1.1"> 4076 <jint/> 4077 <synopsis>Heap Reference Callback</synopsis> 4078 <description> 4079 Agent supplied callback function. 4080 Describes a reference from an object or the VM (the referrer) to another object 4081 (the referree) or a heap root to a referree. 4082 <p/> 4083 This function should return a bit vector of the desired 4084 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>. 4085 This will determine if the objects referenced by the referree 4086 should be visited or if the entire iteration should be aborted. 4087 <p/> 4088 See the <internallink id="heapCallbacks">heap callback 4089 function restrictions</internallink>. 4090 </description> 4091 <parameters> 4092 <param id="reference_kind"> 4093 <enum>jvmtiHeapReferenceKind</enum> 4094 <description> 4095 The kind of reference. 4096 </description> 4097 </param> 4098 <param id="reference_info"> 4099 <inptr> 4100 <struct>jvmtiHeapReferenceInfo</struct> 4101 </inptr> 4102 <description> 4103 Details about the reference. 4104 Set when the <datalink id="jvmtiHeapReferenceCallback.reference_kind">reference_kind</datalink> is 4105 <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/>, 4106 <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/>, 4107 <datalink id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT"/>, 4108 <datalink id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL"/>, 4109 <datalink id="JVMTI_HEAP_REFERENCE_STACK_LOCAL"/>, 4110 or <datalink id="JVMTI_HEAP_REFERENCE_JNI_LOCAL"/>. 4111 Otherwise <code>NULL</code>. 4112 </description> 4113 </param> 4114 <param id="class_tag"> 4115 <jlong/> 4116 <description> 4117 The tag of the class of referree object (zero if the class is not tagged). 4118 If the referree object represents a runtime class, 4119 the <code>class_tag</code> is the tag 4120 associated with <code>java.lang.Class</code> 4121 (zero if <code>java.lang.Class</code> is not tagged). 4122 </description> 4123 </param> 4124 <param id="referrer_class_tag"> 4125 <jlong/> 4126 <description> 4127 The tag of the class of the referrer object (zero if the class is not tagged 4128 or the referree is a heap root). If the referrer object represents a runtime 4129 class, the <code>referrer_class_tag</code> is the tag associated with 4130 the <code>java.lang.Class</code> 4131 (zero if <code>java.lang.Class</code> is not tagged). 4132 </description> 4133 </param> 4134 <param id="size"> 4135 <jlong/> 4136 <description> 4137 Size of the referree object (in bytes). 4138 See <functionlink id="GetObjectSize"/>. 4139 </description> 4140 </param> 4141 <param id="tag_ptr"> 4142 <outptr><jlong/></outptr> 4143 <description> 4144 Points to the referree object tag value, or zero if the object is not 4145 tagged. 4146 To set the tag value to be associated with the object 4147 the agent sets the <code>jlong</code> pointed to by the parameter. 4148 </description> 4149 </param> 4150 <param id="referrer_tag_ptr"> 4151 <outptr><jlong/></outptr> 4152 <description> 4153 Points to the tag of the referrer object, or 4154 points to the zero if the referrer 4155 object is not tagged. 4156 <code>NULL</code> if the referrer in not an object (that is, 4157 this callback is reporting a heap root). 4158 To set the tag value to be associated with the referrer object 4159 the agent sets the <code>jlong</code> pointed to by the parameter. 4160 If this callback is reporting a reference from an object to itself, 4161 <code>referrer_tag_ptr == tag_ptr</code>. 4162 </description> 4163 </param> 4164 <param id="length"> 4165 <jint/> 4166 <description> 4167 If this object is an array, the length of the array. Otherwise negative one (-1). 4168 </description> 4169 </param> 4170 <param id="user_data"> 4171 <outptr><void/></outptr> 4172 <description> 4173 The user supplied data that was passed into the iteration function. 4174 </description> 4175 </param> 4176 </parameters> 4177 </callback> 4178 4179 <callback id="jvmtiPrimitiveFieldCallback" since="1.1"> 4180 <jint/> 4181 <synopsis>Primitive Field Callback</synopsis> 4182 <description> 4183 Agent supplied callback function which 4184 describes a primitive field of an object (<i>the object</i>). 4185 A primitive field is a field whose type is a primitive type. 4186 This callback will describe a static field if the object is a class, 4187 and otherwise will describe an instance field. 4188 <p/> 4189 This function should return a bit vector of the desired 4190 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>. 4191 This will determine if the entire iteration should be aborted 4192 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored). 4193 <p/> 4194 See the <internallink id="heapCallbacks">heap callback 4195 function restrictions</internallink>. 4196 </description> 4197 <parameters> 4198 <param id="kind"> 4199 <enum>jvmtiHeapReferenceKind</enum> 4200 <description> 4201 The kind of field -- instance or static (<datalink id="JVMTI_HEAP_REFERENCE_FIELD"/> or 4202 <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/>). 4203 </description> 4204 </param> 4205 <param id="info"> 4206 <inptr> 4207 <struct>jvmtiHeapReferenceInfo</struct> 4208 </inptr> 4209 <description> 4210 Which field (the field index). 4211 </description> 4212 </param> 4213 <param id="object_class_tag"> 4214 <jlong/> 4215 <description> 4216 The tag of the class of the object (zero if the class is not tagged). 4217 If the object represents a runtime class, the 4218 <code>object_class_tag</code> is the tag 4219 associated with <code>java.lang.Class</code> 4220 (zero if <code>java.lang.Class</code> is not tagged). 4221 </description> 4222 </param> 4223 <param id="object_tag_ptr"> 4224 <outptr><jlong/></outptr> 4225 <description> 4226 Points to the tag of the object, or zero if the object is not 4227 tagged. 4228 To set the tag value to be associated with the object 4229 the agent sets the <code>jlong</code> pointed to by the parameter. 4230 </description> 4231 </param> 4232 <param id="value"> 4233 <jvalue/> 4234 <description> 4235 The value of the field. 4236 </description> 4237 </param> 4238 <param id="value_type"> 4239 <enum>jvmtiPrimitiveType</enum> 4240 <description> 4241 The type of the field. 4242 </description> 4243 </param> 4244 <param id="user_data"> 4245 <outptr><void/></outptr> 4246 <description> 4247 The user supplied data that was passed into the iteration function. 4248 </description> 4249 </param> 4250 </parameters> 4251 </callback> 4252 4253 <callback id="jvmtiArrayPrimitiveValueCallback" since="1.1"> 4254 <jint/> 4255 <synopsis>Array Primitive Value Callback</synopsis> 4256 <description> 4257 Agent supplied callback function. 4258 Describes the values in an array of a primitive type. 4259 <p/> 4260 This function should return a bit vector of the desired 4261 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>. 4262 This will determine if the entire iteration should be aborted 4263 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored). 4264 <p/> 4265 See the <internallink id="heapCallbacks">heap callback 4266 function restrictions</internallink>. 4267 </description> 4268 <parameters> 4269 <param id="class_tag"> 4270 <jlong/> 4271 <description> 4272 The tag of the class of the array object (zero if the class is not tagged). 4273 </description> 4274 </param> 4275 <param id="size"> 4276 <jlong/> 4277 <description> 4278 Size of the array (in bytes). 4279 See <functionlink id="GetObjectSize"/>. 4280 </description> 4281 </param> 4282 <param id="tag_ptr"> 4283 <outptr><jlong/></outptr> 4284 <description> 4285 Points to the tag of the array object, or zero if the object is not 4286 tagged. 4287 To set the tag value to be associated with the object 4288 the agent sets the <code>jlong</code> pointed to by the parameter. 4289 </description> 4290 </param> 4291 <param id="element_count"> 4292 <jint/> 4293 <description> 4294 The length of the primitive array. 4295 </description> 4296 </param> 4297 <param id="element_type"> 4298 <enum>jvmtiPrimitiveType</enum> 4299 <description> 4300 The type of the elements of the array. 4301 </description> 4302 </param> 4303 <param id="elements"> 4304 <vmbuf><void/></vmbuf> 4305 <description> 4306 The elements of the array in a packed array of <code>element_count</code> 4307 items of <code>element_type</code> size each. 4308 </description> 4309 </param> 4310 <param id="user_data"> 4311 <outptr><void/></outptr> 4312 <description> 4313 The user supplied data that was passed into the iteration function. 4314 </description> 4315 </param> 4316 </parameters> 4317 </callback> 4318 4319 <callback id="jvmtiStringPrimitiveValueCallback" since="1.1"> 4320 <jint/> 4321 <synopsis>String Primitive Value Callback</synopsis> 4322 <description> 4323 Agent supplied callback function. 4324 Describes the value of a java.lang.String. 4325 <p/> 4326 This function should return a bit vector of the desired 4327 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>. 4328 This will determine if the entire iteration should be aborted 4329 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored). 4330 <p/> 4331 See the <internallink id="heapCallbacks">heap callback 4332 function restrictions</internallink>. 4333 </description> 4334 <parameters> 4335 <param id="class_tag"> 4336 <jlong/> 4337 <description> 4338 The tag of the class of the String class (zero if the class is not tagged). 4339 <issue>Is this needed?</issue> 4340 </description> 4341 </param> 4342 <param id="size"> 4343 <jlong/> 4344 <description> 4345 Size of the string (in bytes). 4346 See <functionlink id="GetObjectSize"/>. 4347 </description> 4348 </param> 4349 <param id="tag_ptr"> 4350 <outptr><jlong/></outptr> 4351 <description> 4352 Points to the tag of the String object, or zero if the object is not 4353 tagged. 4354 To set the tag value to be associated with the object 4355 the agent sets the <code>jlong</code> pointed to by the parameter. 4356 </description> 4357 </param> 4358 <param id="value"> 4359 <vmbuf><jchar/></vmbuf> 4360 <description> 4361 The value of the String, encoded as a Unicode string. 4362 </description> 4363 </param> 4364 <param id="value_length"> 4365 <jint/> 4366 <description> 4367 The length of the string. 4368 The length is equal to the number of 16-bit Unicode 4369 characters in the string. 4370 </description> 4371 </param> 4372 <param id="user_data"> 4373 <outptr><void/></outptr> 4374 <description> 4375 The user supplied data that was passed into the iteration function. 4376 </description> 4377 </param> 4378 </parameters> 4379 </callback> 4380 4381 4382 <callback id="jvmtiReservedCallback" since="1.1"> 4383 <jint/> 4384 <synopsis>reserved for future use Callback</synopsis> 4385 <description> 4386 Placeholder -- reserved for future use. 4387 </description> 4388 <parameters> 4389 </parameters> 4390 </callback> 4391 4392 <function id="FollowReferences" num="115" since="1.1"> 4393 <synopsis>Follow References</synopsis> 4394 <description> 4395 This function initiates a traversal over the objects that are 4396 directly and indirectly reachable from the specified object or, 4397 if <code>initial_object</code> is not specified, all objects 4398 reachable from the heap roots. 4399 The heap root are the set of system classes, 4400 JNI globals, references from thread stacks, and other objects used as roots 4401 for the purposes of garbage collection. 4402 <p/> 4403 This function operates by traversing the reference graph. 4404 Let <i>A</i>, <i>B</i>, ... represent objects. 4405 When a reference from <i>A</i> to <i>B</i> is traversed, 4406 when a reference from a heap root to <i>B</i> is traversed, 4407 or when <i>B</i> is specified as the <paramlink id="initial_object"/>, 4408 then <i>B</i> is said to be <i>visited</i>. 4409 A reference from <i>A</i> to <i>B</i> is not traversed until <i>A</i> 4410 is visited. 4411 References are reported in the same order that the references are traversed. 4412 Object references are reported by invoking the agent supplied 4413 callback function <functionlink id="jvmtiHeapReferenceCallback"/>. 4414 In a reference from <i>A</i> to <i>B</i>, <i>A</i> is known 4415 as the <i>referrer</i> and <i>B</i> as the <i>referree</i>. 4416 The callback is invoked exactly once for each reference from a referrer; 4417 this is true even if there are reference cycles or multiple paths to 4418 the referrer. 4419 There may be more than one reference between a referrer and a referree, 4420 each reference is reported. 4421 These references may be distinguished by examining the 4422 <datalink 4423 id="jvmtiHeapReferenceCallback.reference_kind"><code>reference_kind</code></datalink> 4424 and 4425 <datalink 4426 id="jvmtiHeapReferenceCallback.reference_info"><code>reference_info</code></datalink> 4427 parameters of the <functionlink id="jvmtiHeapReferenceCallback"/> callback. 4428 <p/> 4429 This function reports a Java programming language view of object references, 4430 not a virtual machine implementation view. The following object references 4431 are reported when they are non-null: 4432 <ul> 4433 <li>Instance objects report references to each non-primitive instance fields 4434 (including inherited fields).</li> 4435 <li>Instance objects report a reference to the object type (class).</li> 4436 <li>Classes report a reference to the superclass and directly 4437 implemented/extended interfaces.</li> 4438 <li>Classes report a reference to the class loader, protection domain, 4439 signers, and resolved entries in the constant pool.</li> 4440 <li>Classes report a reference to each directly declared non-primitive 4441 static field.</li> 4442 <li>Arrays report a reference to the array type (class) and each 4443 array element.</li> 4444 <li>Primitive arrays report a reference to the array type.</li> 4445 </ul> 4446 <p/> 4447 This function can also be used to examine primitive (non-object) values. 4448 The primitive value of an array or String 4449 is reported after the object has been visited; 4450 it is reported by invoking the agent supplied callback function 4451 <functionlink id="jvmtiArrayPrimitiveValueCallback"/> or 4452 <functionlink id="jvmtiStringPrimitiveValueCallback"/>. 4453 A primitive field 4454 is reported after the object with that field is visited; 4455 it is reported by invoking the agent supplied callback function 4456 <functionlink id="jvmtiPrimitiveFieldCallback"/>. 4457 <p/> 4458 Whether a callback is provided or is <code>NULL</code> only determines 4459 whether the callback will be invoked, it does not influence 4460 which objects are visited nor does it influence whether other callbacks 4461 will be invoked. 4462 However, the 4463 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink> 4464 returned by <functionlink id="jvmtiHeapReferenceCallback"/> 4465 do determine if the objects referenced by the 4466 current object as visited. 4467 The <datalink id="jvmtiHeapFilter">heap filter flags</datalink> 4468 and <paramlink id="klass"/> provided as parameters to this function 4469 do not control which objects are visited but they do control which 4470 objects and primitive values are reported by the callbacks. 4471 For example, if the only callback that was set is 4472 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> and <code>klass</code> 4473 is set to the array of bytes class, then only arrays of byte will be 4474 reported. 4475 The table below summarizes this: 4476 <p/> 4477 <table> 4478 <tr> 4479 <th/> 4480 <th> 4481 Controls objects visited 4482 </th> 4483 <th> 4484 Controls objects reported 4485 </th> 4486 <th> 4487 Controls primitives reported 4488 </th> 4489 </tr> 4490 <tr> 4491 <th class="leftAligned"> 4492 the 4493 <datalink id="jvmtiHeapVisitControl">Heap Visit Control Flags</datalink> 4494 returned by <functionlink id="jvmtiHeapReferenceCallback"/> 4495 </th> 4496 <td class="centered"> 4497 <b>Yes</b> 4498 </td> 4499 <td class="centered"> 4500 <b>Yes</b>, since visits are controlled 4501 </td> 4502 <td class="centered"> 4503 <b>Yes</b>, since visits are controlled 4504 </td> 4505 </tr> 4506 <tr> 4507 <th class="leftAligned"> 4508 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> 4509 in <paramlink id="callbacks"/> set 4510 </th> 4511 <td class="centered"> 4512 No 4513 </td> 4514 <td class="centered"> 4515 <b>Yes</b> 4516 </td> 4517 <td class="centered"> 4518 No 4519 </td> 4520 </tr> 4521 <tr> 4522 <th class="leftAligned"> 4523 <paramlink id="heap_filter"/> 4524 </th> 4525 <td class="centered"> 4526 No 4527 </td> 4528 <td class="centered"> 4529 <b>Yes</b> 4530 </td> 4531 <td class="centered"> 4532 <b>Yes</b> 4533 </td> 4534 </tr> 4535 <tr> 4536 <th class="leftAligned"> 4537 <paramlink id="klass"/> 4538 </th> 4539 <td class="centered"> 4540 No 4541 </td> 4542 <td class="centered"> 4543 <b>Yes</b> 4544 </td> 4545 <td class="centered"> 4546 <b>Yes</b> 4547 </td> 4548 </tr> 4549 </table> 4550 <p/> 4551 During the execution of this function the state of the heap 4552 does not change: no objects are allocated, no objects are 4553 garbage collected, and the state of objects (including 4554 held values) does not change. 4555 As a result, threads executing Java 4556 programming language code, threads attempting to resume the 4557 execution of Java programming language code, and threads 4558 attempting to execute JNI functions are typically stalled. 4559 </description> 4560 <origin>new</origin> 4561 <capabilities> 4562 <required id="can_tag_objects"></required> 4563 </capabilities> 4564 <parameters> 4565 <param id="heap_filter"> 4566 <jint/> 4567 <description> 4568 This bit vector of 4569 <datalink id="jvmtiHeapFilter">heap filter flags</datalink>. 4570 restricts the objects for which the callback function is called. 4571 This applies to both the object and primitive callbacks. 4572 </description> 4573 </param> 4574 <param id="klass"> 4575 <ptrtype> 4576 <jclass/> 4577 <nullok>callbacks are not limited to instances of a particular 4578 class</nullok> 4579 </ptrtype> 4580 <description> 4581 Callbacks are only reported when the object is an instance of 4582 this class. 4583 Objects which are instances of a subclass of <code>klass</code> 4584 are not reported. 4585 If <code>klass</code> is an interface, no objects are reported. 4586 This applies to both the object and primitive callbacks. 4587 </description> 4588 </param> 4589 <param id="initial_object"> 4590 <ptrtype> 4591 <jobject/> 4592 <nullok>references are followed from the heap roots</nullok> 4593 </ptrtype> 4594 <description> 4595 The object to follow 4596 </description> 4597 </param> 4598 <param id="callbacks"> 4599 <inptr> 4600 <struct>jvmtiHeapCallbacks</struct> 4601 </inptr> 4602 <description> 4603 Structure defining the set of callback functions. 4604 </description> 4605 </param> 4606 <param id="user_data"> 4607 <inbuf> 4608 <void/> 4609 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 4610 </inbuf> 4611 <description> 4612 User supplied data to be passed to the callback. 4613 </description> 4614 </param> 4615 </parameters> 4616 <errors> 4617 <error id="JVMTI_ERROR_INVALID_CLASS"> 4618 <paramlink id="klass"/> is not a valid class. 4619 </error> 4620 <error id="JVMTI_ERROR_INVALID_OBJECT"> 4621 <paramlink id="initial_object"/> is not a valid object. 4622 </error> 4623 </errors> 4624 </function> 4625 4626 4627 <function id="IterateThroughHeap" num="116" since="1.1"> 4628 <synopsis>Iterate Through Heap</synopsis> 4629 <description> 4630 Initiate an iteration over all objects in the heap. 4631 This includes both reachable and 4632 unreachable objects. Objects are visited in no particular order. 4633 <p/> 4634 Heap objects are reported by invoking the agent supplied 4635 callback function <functionlink id="jvmtiHeapIterationCallback"/>. 4636 References between objects are not reported. 4637 If only reachable objects are desired, or if object reference information 4638 is needed, use <functionlink id="FollowReferences"/>. 4639 <p/> 4640 This function can also be used to examine primitive (non-object) values. 4641 The primitive value of an array or String 4642 is reported after the object has been visited; 4643 it is reported by invoking the agent supplied callback function 4644 <functionlink id="jvmtiArrayPrimitiveValueCallback"/> or 4645 <functionlink id="jvmtiStringPrimitiveValueCallback"/>. 4646 A primitive field 4647 is reported after the object with that field is visited; 4648 it is reported by invoking the agent supplied 4649 callback function 4650 <functionlink id="jvmtiPrimitiveFieldCallback"/>. 4651 <p/> 4652 Unless the iteration is aborted by the 4653 <datalink id="jvmtiHeapVisitControl">Heap Visit Control Flags</datalink> 4654 returned by a callback, all objects in the heap are visited. 4655 Whether a callback is provided or is <code>NULL</code> only determines 4656 whether the callback will be invoked, it does not influence 4657 which objects are visited nor does it influence whether other callbacks 4658 will be invoked. 4659 The <datalink id="jvmtiHeapFilter">heap filter flags</datalink> 4660 and <paramlink id="klass"/> provided as parameters to this function 4661 do not control which objects are visited but they do control which 4662 objects and primitive values are reported by the callbacks. 4663 For example, if the only callback that was set is 4664 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> and <code>klass</code> 4665 is set to the array of bytes class, then only arrays of byte will be 4666 reported. The table below summarizes this (contrast this with 4667 <functionlink id="FollowReferences"/>): 4668 <p/> 4669 <table> 4670 <tr> 4671 <th/> 4672 <th> 4673 Controls objects visited 4674 </th> 4675 <th> 4676 Controls objects reported 4677 </th> 4678 <th> 4679 Controls primitives reported 4680 </th> 4681 </tr> 4682 <tr> 4683 <th class="leftAligned"> 4684 the 4685 <datalink id="jvmtiHeapVisitControl">Heap Visit Control Flags</datalink> 4686 returned by <functionlink id="jvmtiHeapIterationCallback"/> 4687 </th> 4688 <td class="centered"> 4689 No<br/>(unless they abort the iteration) 4690 </td> 4691 <td class="centered"> 4692 No<br/>(unless they abort the iteration) 4693 </td> 4694 <td class="centered"> 4695 No<br/>(unless they abort the iteration) 4696 </td> 4697 </tr> 4698 <tr> 4699 <th class="leftAligned"> 4700 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> 4701 in <paramlink id="callbacks"/> set 4702 </th> 4703 <td class="centered"> 4704 No 4705 </td> 4706 <td class="centered"> 4707 <b>Yes</b> 4708 </td> 4709 <td class="centered"> 4710 No 4711 </td> 4712 </tr> 4713 <tr> 4714 <th class="leftAligned"> 4715 <paramlink id="heap_filter"/> 4716 </th> 4717 <td class="centered"> 4718 No 4719 </td> 4720 <td class="centered"> 4721 <b>Yes</b> 4722 </td> 4723 <td class="centered"> 4724 <b>Yes</b> 4725 </td> 4726 </tr> 4727 <tr> 4728 <th class="leftAligned"> 4729 <paramlink id="klass"/> 4730 </th> 4731 <td class="centered"> 4732 No 4733 </td> 4734 <td class="centered"> 4735 <b>Yes</b> 4736 </td> 4737 <td class="centered"> 4738 <b>Yes</b> 4739 </td> 4740 </tr> 4741 </table> 4742 <p/> 4743 During the execution of this function the state of the heap 4744 does not change: no objects are allocated, no objects are 4745 garbage collected, and the state of objects (including 4746 held values) does not change. 4747 As a result, threads executing Java 4748 programming language code, threads attempting to resume the 4749 execution of Java programming language code, and threads 4750 attempting to execute JNI functions are typically stalled. 4751 </description> 4752 <origin>new</origin> 4753 <capabilities> 4754 <required id="can_tag_objects"></required> 4755 </capabilities> 4756 <parameters> 4757 <param id="heap_filter"> 4758 <jint/> 4759 <description> 4760 This bit vector of 4761 <datalink id="jvmtiHeapFilter">heap filter flags</datalink>. 4762 restricts the objects for which the callback function is called. 4763 This applies to both the object and primitive callbacks. 4764 </description> 4765 </param> 4766 <param id="klass"> 4767 <ptrtype> 4768 <jclass/> 4769 <nullok>callbacks are not limited to instances of a particular class</nullok> 4770 </ptrtype> 4771 <description> 4772 Callbacks are only reported when the object is an instance of 4773 this class. 4774 Objects which are instances of a subclass of <code>klass</code> 4775 are not reported. 4776 If <code>klass</code> is an interface, no objects are reported. 4777 This applies to both the object and primitive callbacks. 4778 </description> 4779 </param> 4780 <param id="callbacks"> 4781 <inptr> 4782 <struct>jvmtiHeapCallbacks</struct> 4783 </inptr> 4784 <description> 4785 Structure defining the set callback functions. 4786 </description> 4787 </param> 4788 <param id="user_data"> 4789 <inbuf> 4790 <void/> 4791 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 4792 </inbuf> 4793 <description> 4794 User supplied data to be passed to the callback. 4795 </description> 4796 </param> 4797 </parameters> 4798 <errors> 4799 <error id="JVMTI_ERROR_INVALID_CLASS"> 4800 <paramlink id="klass"/> is not a valid class. 4801 </error> 4802 </errors> 4803 </function> 4804 4805 <function id="GetTag" phase="start" num="106"> 4806 <synopsis>Get Tag</synopsis> 4807 <description> 4808 Retrieve the tag associated with an object. 4809 The tag is a long value typically used to store a 4810 unique identifier or pointer to object information. 4811 The tag is set with 4812 <functionlink id="SetTag"></functionlink>. 4813 Objects for which no tags have been set return a 4814 tag value of zero. 4815 </description> 4816 <origin>new</origin> 4817 <capabilities> 4818 <required id="can_tag_objects"></required> 4819 </capabilities> 4820 <parameters> 4821 <param id="object"> 4822 <jobject/> 4823 <description> 4824 The object whose tag is to be retrieved. 4825 </description> 4826 </param> 4827 <param id="tag_ptr"> 4828 <outptr><jlong/></outptr> 4829 <description> 4830 On return, the referenced long is set to the value 4831 of the tag. 4832 </description> 4833 </param> 4834 </parameters> 4835 <errors> 4836 </errors> 4837 </function> 4838 4839 <function id="SetTag" phase="start" num="107"> 4840 <synopsis>Set Tag</synopsis> 4841 <description> 4842 Set the tag associated with an object. 4843 The tag is a long value typically used to store a 4844 unique identifier or pointer to object information. 4845 The tag is visible with 4846 <functionlink id="GetTag"></functionlink>. 4847 </description> 4848 <origin>new</origin> 4849 <capabilities> 4850 <required id="can_tag_objects"></required> 4851 </capabilities> 4852 <parameters> 4853 <param id="object"> 4854 <jobject/> 4855 <description> 4856 The object whose tag is to be set. 4857 </description> 4858 </param> 4859 <param id="tag"> 4860 <jlong/> 4861 <description> 4862 The new value of the tag. 4863 </description> 4864 </param> 4865 </parameters> 4866 <errors> 4867 </errors> 4868 </function> 4869 4870 <function id="GetObjectsWithTags" num="114"> 4871 <synopsis>Get Objects With Tags</synopsis> 4872 <description> 4873 Return objects in the heap with the specified tags. 4874 The format is parallel arrays of objects and tags. 4875 </description> 4876 <origin>new</origin> 4877 <capabilities> 4878 <required id="can_tag_objects"></required> 4879 </capabilities> 4880 <parameters> 4881 <param id="tag_count"> 4882 <jint min="0"/> 4883 <description> 4884 Number of tags to scan for. 4885 </description> 4886 </param> 4887 <param id="tags"> 4888 <inbuf incount="tag_count"> 4889 <jlong/> 4890 </inbuf> 4891 <description> 4892 Scan for objects with these tags. 4893 Zero is not permitted in this array. 4894 </description> 4895 </param> 4896 <param id="count_ptr"> 4897 <outptr> 4898 <jint/> 4899 </outptr> 4900 <description> 4901 Return the number of objects with any of the tags 4902 in <paramlink id="tags"/>. 4903 </description> 4904 </param> 4905 <param id="object_result_ptr"> 4906 <allocbuf outcount="count_ptr"> 4907 <jobject/> 4908 <nullok>this information is not returned</nullok> 4909 </allocbuf> 4910 <description> 4911 Returns the array of objects with any of the tags 4912 in <paramlink id="tags"/>. 4913 </description> 4914 </param> 4915 <param id="tag_result_ptr"> 4916 <allocbuf outcount="count_ptr"> 4917 <jlong/> 4918 <nullok>this information is not returned</nullok> 4919 </allocbuf> 4920 <description> 4921 For each object in <paramlink id="object_result_ptr"/>, 4922 return the tag at the corresponding index. 4923 </description> 4924 </param> 4925 </parameters> 4926 <errors> 4927 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 4928 Zero is present in <paramlink id="tags"></paramlink>. 4929 </error> 4930 </errors> 4931 </function> 4932 4933 <function id="ForceGarbageCollection" num="108"> 4934 <synopsis>Force Garbage Collection</synopsis> 4935 <description> 4936 Force the VM to perform a garbage collection. 4937 The garbage collection is as complete as possible. 4938 This function does not cause finalizers to be run. 4939 This function does not return until the garbage collection 4940 is finished. 4941 <p/> 4942 Although garbage collection is as complete 4943 as possible there is no guarantee that all 4944 <eventlink id="ObjectFree"/> 4945 events will have been 4946 sent by the time that this function 4947 returns. In particular, an object may be 4948 prevented from being freed because it 4949 is awaiting finalization. 4950 </description> 4951 <origin>new</origin> 4952 <capabilities> 4953 </capabilities> 4954 <parameters> 4955 </parameters> 4956 <errors> 4957 </errors> 4958 </function> 4959 4960 4961 </category> 4962 4963 <category id="Heap_1_0" label="Heap (1.0)"> 4964 <intro> 4965 <b> 4966 These functions and data types were introduced in the original 4967 <jvmti/> version 1.0 and have been superseded by more 4968 </b> 4969 <internallink id="Heap"><b>powerful and flexible versions</b></internallink> 4970 <b> 4971 which: 4972 </b> 4973 <ul> 4974 <li> 4975 <b> 4976 Allow access to primitive values (the value of Strings, arrays, 4977 and primitive fields) 4978 </b> 4979 </li> 4980 <li> 4981 <b> 4982 Allow the tag of the referrer to be set, thus enabling more 4983 efficient localized reference graph building 4984 </b> 4985 </li> 4986 <li> 4987 <b> 4988 Provide more extensive filtering abilities 4989 </b> 4990 </li> 4991 <li> 4992 <b> 4993 Are extensible, allowing their abilities to grow in future versions of <jvmti/> 4994 </b> 4995 </li> 4996 </ul> 4997 <p/> 4998 <b>Please use the </b> 4999 <internallink id="Heap"><b>current Heap functions</b></internallink>. 5000 <p/> 5001 <constants id="jvmtiHeapObjectFilter" label="Heap Object Filter Enumeration" kind="enum"> 5002 <constant id="JVMTI_HEAP_OBJECT_TAGGED" num="1"> 5003 Tagged objects only. 5004 </constant> 5005 <constant id="JVMTI_HEAP_OBJECT_UNTAGGED" num="2"> 5006 Untagged objects only. 5007 </constant> 5008 <constant id="JVMTI_HEAP_OBJECT_EITHER" num="3"> 5009 Either tagged or untagged objects. 5010 </constant> 5011 </constants> 5012 5013 <constants id="jvmtiHeapRootKind" label="Heap Root Kind Enumeration" kind="enum"> 5014 <constant id="JVMTI_HEAP_ROOT_JNI_GLOBAL" num="1"> 5015 JNI global reference. 5016 </constant> 5017 <constant id="JVMTI_HEAP_ROOT_SYSTEM_CLASS" num="2"> 5018 System class. 5019 </constant> 5020 <constant id="JVMTI_HEAP_ROOT_MONITOR" num="3"> 5021 Monitor. 5022 </constant> 5023 <constant id="JVMTI_HEAP_ROOT_STACK_LOCAL" num="4"> 5024 Stack local. 5025 </constant> 5026 <constant id="JVMTI_HEAP_ROOT_JNI_LOCAL" num="5"> 5027 JNI local reference. 5028 </constant> 5029 <constant id="JVMTI_HEAP_ROOT_THREAD" num="6"> 5030 Thread. 5031 </constant> 5032 <constant id="JVMTI_HEAP_ROOT_OTHER" num="7"> 5033 Other. 5034 </constant> 5035 </constants> 5036 5037 <constants id="jvmtiObjectReferenceKind" label="Object Reference Enumeration" kind="enum"> 5038 <constant id="JVMTI_REFERENCE_CLASS" num="1"> 5039 Reference from an object to its class. 5040 </constant> 5041 <constant id="JVMTI_REFERENCE_FIELD" num="2"> 5042 Reference from an object to the value of one of its instance fields. 5043 For references of this kind the <code>referrer_index</code> 5044 parameter to the <internallink id="jvmtiObjectReferenceCallback"> 5045 jvmtiObjectReferenceCallback</internallink> is the index of the 5046 the instance field. The index is based on the order of all the 5047 object's fields. This includes all fields of the directly declared 5048 static and instance fields in the class, and includes all fields (both 5049 public and private) fields declared in superclasses and superinterfaces. 5050 The index is thus calculated by summing the index of the field in the directly 5051 declared class (see <functionlink id="GetClassFields"/>), with the total 5052 number of fields (both public and private) declared in all superclasses 5053 and superinterfaces. The index starts at zero. 5054 </constant> 5055 <constant id="JVMTI_REFERENCE_ARRAY_ELEMENT" num="3"> 5056 Reference from an array to one of its elements. 5057 For references of this kind the <code>referrer_index</code> 5058 parameter to the <internallink id="jvmtiObjectReferenceCallback"> 5059 jvmtiObjectReferenceCallback</internallink> is the array index. 5060 </constant> 5061 <constant id="JVMTI_REFERENCE_CLASS_LOADER" num="4"> 5062 Reference from a class to its class loader. 5063 </constant> 5064 <constant id="JVMTI_REFERENCE_SIGNERS" num="5"> 5065 Reference from a class to its signers array. 5066 </constant> 5067 <constant id="JVMTI_REFERENCE_PROTECTION_DOMAIN" num="6"> 5068 Reference from a class to its protection domain. 5069 </constant> 5070 <constant id="JVMTI_REFERENCE_INTERFACE" num="7"> 5071 Reference from a class to one of its interfaces. 5072 </constant> 5073 <constant id="JVMTI_REFERENCE_STATIC_FIELD" num="8"> 5074 Reference from a class to the value of one of its static fields. 5075 For references of this kind the <code>referrer_index</code> 5076 parameter to the <internallink id="jvmtiObjectReferenceCallback"> 5077 jvmtiObjectReferenceCallback</internallink> is the index of the 5078 the static field. The index is based on the order of all the 5079 object's fields. This includes all fields of the directly declared 5080 static and instance fields in the class, and includes all fields (both 5081 public and private) fields declared in superclasses and superinterfaces. 5082 The index is thus calculated by summing the index of the field in the directly 5083 declared class (see <functionlink id="GetClassFields"/>), with the total 5084 number of fields (both public and private) declared in all superclasses 5085 and superinterfaces. The index starts at zero. 5086 Note: this definition differs from that in the <jvmti/> 1.0 Specification. 5087 <rationale>No known implementations used the 1.0 definition.</rationale> 5088 </constant> 5089 <constant id="JVMTI_REFERENCE_CONSTANT_POOL" num="9"> 5090 Reference from a class to a resolved entry in the constant pool. 5091 For references of this kind the <code>referrer_index</code> 5092 parameter to the <internallink id="jvmtiObjectReferenceCallback"> 5093 jvmtiObjectReferenceCallback</internallink> is the index into 5094 constant pool table of the class, starting at 1. See 5095 <vmspec chapter="4.4"/>. 5096 </constant> 5097 </constants> 5098 5099 <constants id="jvmtiIterationControl" label="Iteration Control Enumeration" kind="enum"> 5100 <constant id="JVMTI_ITERATION_CONTINUE" num="1"> 5101 Continue the iteration. 5102 If this is a reference iteration, follow the references of this object. 5103 </constant> 5104 <constant id="JVMTI_ITERATION_IGNORE" num="2"> 5105 Continue the iteration. 5106 If this is a reference iteration, ignore the references of this object. 5107 </constant> 5108 <constant id="JVMTI_ITERATION_ABORT" num="0"> 5109 Abort the iteration. 5110 </constant> 5111 </constants> 5112 </intro> 5113 5114 <callback id="jvmtiHeapObjectCallback"> 5115 <enum>jvmtiIterationControl</enum> 5116 <synopsis>Heap Object Callback</synopsis> 5117 <description> 5118 Agent supplied callback function. 5119 Describes (but does not pass in) an object in the heap. 5120 <p/> 5121 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration, 5122 or <code>JVMTI_ITERATION_ABORT</code> to stop iteration. 5123 <p/> 5124 See the <internallink id="heapCallbacks">heap callback 5125 function restrictions</internallink>. 5126 </description> 5127 <parameters> 5128 <param id="class_tag"> 5129 <jlong/> 5130 <description> 5131 The tag of the class of object (zero if the class is not tagged). 5132 If the object represents a runtime class, 5133 the <code>class_tag</code> is the tag 5134 associated with <code>java.lang.Class</code> 5135 (zero if <code>java.lang.Class</code> is not tagged). 5136 </description> 5137 </param> 5138 <param id="size"> 5139 <jlong/> 5140 <description> 5141 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 5142 </description> 5143 </param> 5144 <param id="tag_ptr"> 5145 <outptr><jlong/></outptr> 5146 <description> 5147 The object tag value, or zero if the object is not tagged. 5148 To set the tag value to be associated with the object 5149 the agent sets the <code>jlong</code> pointed to by the parameter. 5150 </description> 5151 </param> 5152 <param id="user_data"> 5153 <outptr><void/></outptr> 5154 <description> 5155 The user supplied data that was passed into the iteration function. 5156 </description> 5157 </param> 5158 </parameters> 5159 </callback> 5160 5161 <callback id="jvmtiHeapRootCallback"> 5162 <enum>jvmtiIterationControl</enum> 5163 <synopsis>Heap Root Object Callback</synopsis> 5164 <description> 5165 Agent supplied callback function. 5166 Describes (but does not pass in) an object that is a root for the purposes 5167 of garbage collection. 5168 <p/> 5169 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration, 5170 <code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing 5171 references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration. 5172 <p/> 5173 See the <internallink id="heapCallbacks">heap callback 5174 function restrictions</internallink>. 5175 </description> 5176 <parameters> 5177 <param id="root_kind"> 5178 <enum>jvmtiHeapRootKind</enum> 5179 <description> 5180 The kind of heap root. 5181 </description> 5182 </param> 5183 <param id="class_tag"> 5184 <jlong/> 5185 <description> 5186 The tag of the class of object (zero if the class is not tagged). 5187 If the object represents a runtime class, the <code>class_tag</code> is the tag 5188 associated with <code>java.lang.Class</code> 5189 (zero if <code>java.lang.Class</code> is not tagged). 5190 </description> 5191 </param> 5192 <param id="size"> 5193 <jlong/> 5194 <description> 5195 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 5196 </description> 5197 </param> 5198 <param id="tag_ptr"> 5199 <outptr><jlong/></outptr> 5200 <description> 5201 The object tag value, or zero if the object is not tagged. 5202 To set the tag value to be associated with the object 5203 the agent sets the <code>jlong</code> pointed to by the parameter. 5204 </description> 5205 </param> 5206 <param id="user_data"> 5207 <outptr><void/></outptr> 5208 <description> 5209 The user supplied data that was passed into the iteration function. 5210 </description> 5211 </param> 5212 </parameters> 5213 </callback> 5214 5215 <callback id="jvmtiStackReferenceCallback"> 5216 <enum>jvmtiIterationControl</enum> 5217 <synopsis>Stack Reference Object Callback</synopsis> 5218 <description> 5219 Agent supplied callback function. 5220 Describes (but does not pass in) an object on the stack that is a root for 5221 the purposes of garbage collection. 5222 <p/> 5223 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration, 5224 <code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing 5225 references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration. 5226 <p/> 5227 See the <internallink id="heapCallbacks">heap callback 5228 function restrictions</internallink>. 5229 </description> 5230 <parameters> 5231 <param id="root_kind"> 5232 <enum>jvmtiHeapRootKind</enum> 5233 <description> 5234 The kind of root (either <code>JVMTI_HEAP_ROOT_STACK_LOCAL</code> or 5235 <code>JVMTI_HEAP_ROOT_JNI_LOCAL</code>). 5236 </description> 5237 </param> 5238 <param id="class_tag"> 5239 <jlong/> 5240 <description> 5241 The tag of the class of object (zero if the class is not tagged). 5242 If the object represents a runtime class, the <code>class_tag</code> is the tag 5243 associated with <code>java.lang.Class</code> 5244 (zero if <code>java.lang.Class</code> is not tagged). 5245 </description> 5246 </param> 5247 <param id="size"> 5248 <jlong/> 5249 <description> 5250 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 5251 </description> 5252 </param> 5253 <param id="tag_ptr"> 5254 <outptr><jlong/></outptr> 5255 <description> 5256 The object tag value, or zero if the object is not tagged. 5257 To set the tag value to be associated with the object 5258 the agent sets the <code>jlong</code> pointed to by the parameter. 5259 </description> 5260 </param> 5261 <param id="thread_tag"> 5262 <jlong/> 5263 <description> 5264 The tag of the thread corresponding to this stack, zero if not tagged. 5265 </description> 5266 </param> 5267 <param id="depth"> 5268 <jint/> 5269 <description> 5270 The depth of the frame. 5271 </description> 5272 </param> 5273 <param id="method"> 5274 <jmethodID/> 5275 <description> 5276 The method executing in this frame. 5277 </description> 5278 </param> 5279 <param id="slot"> 5280 <jint/> 5281 <description> 5282 The slot number. 5283 </description> 5284 </param> 5285 <param id="user_data"> 5286 <outptr><void/></outptr> 5287 <description> 5288 The user supplied data that was passed into the iteration function. 5289 </description> 5290 </param> 5291 </parameters> 5292 </callback> 5293 5294 <callback id="jvmtiObjectReferenceCallback"> 5295 <enum>jvmtiIterationControl</enum> 5296 <synopsis>Object Reference Callback</synopsis> 5297 <description> 5298 Agent supplied callback function. 5299 Describes a reference from an object (the referrer) to another object 5300 (the referree). 5301 <p/> 5302 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration, 5303 <code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing 5304 references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration. 5305 <p/> 5306 See the <internallink id="heapCallbacks">heap callback 5307 function restrictions</internallink>. 5308 </description> 5309 <parameters> 5310 <param id="reference_kind"> 5311 <enum>jvmtiObjectReferenceKind</enum> 5312 <description> 5313 The type of reference. 5314 </description> 5315 </param> 5316 <param id="class_tag"> 5317 <jlong/> 5318 <description> 5319 The tag of the class of referree object (zero if the class is not tagged). 5320 If the referree object represents a runtime class, 5321 the <code>class_tag</code> is the tag 5322 associated with <code>java.lang.Class</code> 5323 (zero if <code>java.lang.Class</code> is not tagged). 5324 </description> 5325 </param> 5326 <param id="size"> 5327 <jlong/> 5328 <description> 5329 Size of the referree object (in bytes). 5330 See <functionlink id="GetObjectSize"/>. 5331 </description> 5332 </param> 5333 <param id="tag_ptr"> 5334 <outptr><jlong/></outptr> 5335 <description> 5336 The referree object tag value, or zero if the object is not 5337 tagged. 5338 To set the tag value to be associated with the object 5339 the agent sets the <code>jlong</code> pointed to by the parameter. 5340 </description> 5341 </param> 5342 <param id="referrer_tag"> 5343 <jlong/> 5344 <description> 5345 The tag of the referrer object, or zero if the referrer 5346 object is not tagged. 5347 </description> 5348 </param> 5349 <param id="referrer_index"> 5350 <jint/> 5351 <description> 5352 For references of type <code>JVMTI_REFERENCE_FIELD</code> or 5353 <code>JVMTI_REFERENCE_STATIC_FIELD</code> the index 5354 of the field in the referrer object. The index is based on the 5355 order of all the object's fields - see <internallink 5356 id="JVMTI_REFERENCE_FIELD">JVMTI_REFERENCE_FIELD</internallink> 5357 or <internallink 5358 id="JVMTI_REFERENCE_STATIC_FIELD">JVMTI_REFERENCE_STATIC_FIELD 5359 </internallink> for further description. 5360 <p/> 5361 For references of type <code>JVMTI_REFERENCE_ARRAY_ELEMENT</code> 5362 the array index - see <internallink id="JVMTI_REFERENCE_ARRAY_ELEMENT"> 5363 JVMTI_REFERENCE_ARRAY_ELEMENT</internallink> for further description. 5364 <p/> 5365 For references of type <code>JVMTI_REFERENCE_CONSTANT_POOL</code> 5366 the index into the constant pool of the class - see 5367 <internallink id="JVMTI_REFERENCE_CONSTANT_POOL"> 5368 JVMTI_REFERENCE_CONSTANT_POOL</internallink> for further 5369 description. 5370 <p/> 5371 For references of other kinds the <code>referrer_index</code> is 5372 <code>-1</code>. 5373 </description> 5374 </param> 5375 <param id="user_data"> 5376 <outptr><void/></outptr> 5377 <description> 5378 The user supplied data that was passed into the iteration function. 5379 </description> 5380 </param> 5381 </parameters> 5382 </callback> 5383 5384 <function id="IterateOverObjectsReachableFromObject" num="109"> 5385 <synopsis>Iterate Over Objects Reachable From Object</synopsis> 5386 <description> 5387 This function iterates over all objects that are directly 5388 and indirectly reachable from the specified object. 5389 For each object <i>A</i> (known 5390 as the referrer) with a reference to object <i>B</i> the specified 5391 callback function is called to describe the object reference. 5392 The callback is called exactly once for each reference from a referrer; 5393 this is true even if there are reference cycles or multiple paths to 5394 the referrer. 5395 There may be more than one reference between a referrer and a referree, 5396 These may be distinguished by the 5397 <datalink id="jvmtiObjectReferenceCallback.reference_kind"></datalink> and 5398 <datalink id="jvmtiObjectReferenceCallback.referrer_index"></datalink>. 5399 The callback for an object will always occur after the callback for 5400 its referrer. 5401 <p/> 5402 See <functionlink id="FollowReferences"/> for the object 5403 references which are reported. 5404 <p/> 5405 During the execution of this function the state of the heap 5406 does not change: no objects are allocated, no objects are 5407 garbage collected, and the state of objects (including 5408 held values) does not change. 5409 As a result, threads executing Java 5410 programming language code, threads attempting to resume the 5411 execution of Java programming language code, and threads 5412 attempting to execute JNI functions are typically stalled. 5413 </description> 5414 <origin>new</origin> 5415 <capabilities> 5416 <required id="can_tag_objects"></required> 5417 </capabilities> 5418 <parameters> 5419 <param id="object"> 5420 <jobject/> 5421 <description> 5422 The object 5423 </description> 5424 </param> 5425 <param id="object_reference_callback"> 5426 <ptrtype> 5427 <struct>jvmtiObjectReferenceCallback</struct> 5428 </ptrtype> 5429 <description> 5430 The callback to be called to describe each 5431 object reference. 5432 </description> 5433 </param> 5434 <param id="user_data"> 5435 <inbuf> 5436 <void/> 5437 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 5438 </inbuf> 5439 <description> 5440 User supplied data to be passed to the callback. 5441 </description> 5442 </param> 5443 </parameters> 5444 <errors> 5445 </errors> 5446 </function> 5447 5448 <function id="IterateOverReachableObjects" num="110"> 5449 <synopsis>Iterate Over Reachable Objects</synopsis> 5450 <description> 5451 This function iterates over the root objects and all objects that 5452 are directly and indirectly reachable from the root objects. 5453 The root objects comprise the set of system classes, 5454 JNI globals, references from thread stacks, and other objects used as roots 5455 for the purposes of garbage collection. 5456 <p/> 5457 For each root the <paramlink id="heap_root_callback"></paramlink> 5458 or <paramlink id="stack_ref_callback"></paramlink> callback is called. 5459 An object can be a root object for more than one reason and in that case 5460 the appropriate callback is called for each reason. 5461 <p/> 5462 For each object reference the <paramlink id="object_ref_callback"></paramlink> 5463 callback function is called to describe the object reference. 5464 The callback is called exactly once for each reference from a referrer; 5465 this is true even if there are reference cycles or multiple paths to 5466 the referrer. 5467 There may be more than one reference between a referrer and a referree, 5468 These may be distinguished by the 5469 <datalink id="jvmtiObjectReferenceCallback.reference_kind"></datalink> and 5470 <datalink id="jvmtiObjectReferenceCallback.referrer_index"></datalink>. 5471 The callback for an object will always occur after the callback for 5472 its referrer. 5473 <p/> 5474 See <functionlink id="FollowReferences"/> for the object 5475 references which are reported. 5476 <p/> 5477 Roots are always reported to the profiler before any object references 5478 are reported. In other words, the <paramlink id="object_ref_callback"></paramlink> 5479 callback will not be called until the appropriate callback has been called 5480 for all roots. If the <paramlink id="object_ref_callback"></paramlink> callback is 5481 specified as <code>NULL</code> then this function returns after 5482 reporting the root objects to the profiler. 5483 <p/> 5484 During the execution of this function the state of the heap 5485 does not change: no objects are allocated, no objects are 5486 garbage collected, and the state of objects (including 5487 held values) does not change. 5488 As a result, threads executing Java 5489 programming language code, threads attempting to resume the 5490 execution of Java programming language code, and threads 5491 attempting to execute JNI functions are typically stalled. 5492 </description> 5493 <origin>new</origin> 5494 <capabilities> 5495 <required id="can_tag_objects"></required> 5496 </capabilities> 5497 <parameters> 5498 <param id="heap_root_callback"> 5499 <ptrtype> 5500 <struct>jvmtiHeapRootCallback</struct> 5501 <nullok>do not report heap roots</nullok> 5502 </ptrtype> 5503 <description> 5504 The callback function to be called for each heap root of type 5505 <code>JVMTI_HEAP_ROOT_JNI_GLOBAL</code>, 5506 <code>JVMTI_HEAP_ROOT_SYSTEM_CLASS</code>, 5507 <code>JVMTI_HEAP_ROOT_MONITOR</code>, 5508 <code>JVMTI_HEAP_ROOT_THREAD</code>, or 5509 <code>JVMTI_HEAP_ROOT_OTHER</code>. 5510 </description> 5511 </param> 5512 <param id="stack_ref_callback"> 5513 <ptrtype> 5514 <struct>jvmtiStackReferenceCallback</struct> 5515 <nullok>do not report stack references</nullok> 5516 </ptrtype> 5517 <description> 5518 The callback function to be called for each heap root of 5519 <code>JVMTI_HEAP_ROOT_STACK_LOCAL</code> or 5520 <code>JVMTI_HEAP_ROOT_JNI_LOCAL</code>. 5521 </description> 5522 </param> 5523 <param id="object_ref_callback"> 5524 <ptrtype> 5525 <struct>jvmtiObjectReferenceCallback</struct> 5526 <nullok>do not follow references from the root objects</nullok> 5527 </ptrtype> 5528 <description> 5529 The callback function to be called for each object reference. 5530 </description> 5531 </param> 5532 <param id="user_data"> 5533 <inbuf> 5534 <void/> 5535 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 5536 </inbuf> 5537 <description> 5538 User supplied data to be passed to the callback. 5539 </description> 5540 </param> 5541 </parameters> 5542 <errors> 5543 </errors> 5544 </function> 5545 5546 <function id="IterateOverHeap" num="111"> 5547 <synopsis>Iterate Over Heap</synopsis> 5548 <description> 5549 Iterate over all objects in the heap. This includes both reachable and 5550 unreachable objects. 5551 <p/> 5552 The <paramlink id="object_filter"></paramlink> parameter indicates the 5553 objects for which the callback function is called. If this parameter 5554 is <code>JVMTI_HEAP_OBJECT_TAGGED</code> then the callback will only be 5555 called for every object that is tagged. If the parameter is 5556 <code>JVMTI_HEAP_OBJECT_UNTAGGED</code> then the callback will only be 5557 for objects that are not tagged. If the parameter 5558 is <code>JVMTI_HEAP_OBJECT_EITHER</code> then the callback will be 5559 called for every object in the heap, irrespective of whether it is 5560 tagged or not. 5561 <p/> 5562 During the execution of this function the state of the heap 5563 does not change: no objects are allocated, no objects are 5564 garbage collected, and the state of objects (including 5565 held values) does not change. 5566 As a result, threads executing Java 5567 programming language code, threads attempting to resume the 5568 execution of Java programming language code, and threads 5569 attempting to execute JNI functions are typically stalled. 5570 </description> 5571 <origin>new</origin> 5572 <capabilities> 5573 <required id="can_tag_objects"></required> 5574 </capabilities> 5575 <parameters> 5576 <param id="object_filter"> 5577 <enum>jvmtiHeapObjectFilter</enum> 5578 <description> 5579 Indicates the objects for which the callback function is called. 5580 </description> 5581 </param> 5582 <param id="heap_object_callback"> 5583 <ptrtype> 5584 <struct>jvmtiHeapObjectCallback</struct> 5585 </ptrtype> 5586 <description> 5587 The iterator function to be called for each 5588 object matching the <paramlink id="object_filter"/>. 5589 </description> 5590 </param> 5591 <param id="user_data"> 5592 <inbuf> 5593 <void/> 5594 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 5595 </inbuf> 5596 <description> 5597 User supplied data to be passed to the callback. 5598 </description> 5599 </param> 5600 </parameters> 5601 <errors> 5602 </errors> 5603 </function> 5604 5605 <function id="IterateOverInstancesOfClass" num="112"> 5606 <synopsis>Iterate Over Instances Of Class</synopsis> 5607 <description> 5608 Iterate over all objects in the heap that are instances of the specified class. 5609 This includes direct instances of the specified class and 5610 instances of all subclasses of the specified class. 5611 This includes both reachable and unreachable objects. 5612 <p/> 5613 The <paramlink id="object_filter"></paramlink> parameter indicates the 5614 objects for which the callback function is called. If this parameter 5615 is <code>JVMTI_HEAP_OBJECT_TAGGED</code> then the callback will only be 5616 called for every object that is tagged. If the parameter is 5617 <code>JVMTI_HEAP_OBJECT_UNTAGGED</code> then the callback will only be 5618 called for objects that are not tagged. If the parameter 5619 is <code>JVMTI_HEAP_OBJECT_EITHER</code> then the callback will be 5620 called for every object in the heap, irrespective of whether it is 5621 tagged or not. 5622 <p/> 5623 During the execution of this function the state of the heap 5624 does not change: no objects are allocated, no objects are 5625 garbage collected, and the state of objects (including 5626 held values) does not change. 5627 As a result, threads executing Java 5628 programming language code, threads attempting to resume the 5629 execution of Java programming language code, and threads 5630 attempting to execute JNI functions are typically stalled. 5631 </description> 5632 <origin>new</origin> 5633 <capabilities> 5634 <required id="can_tag_objects"></required> 5635 </capabilities> 5636 <parameters> 5637 <param id="klass"> 5638 <jclass/> 5639 <description> 5640 Iterate over objects of this class only. 5641 </description> 5642 </param> 5643 <param id="object_filter"> 5644 <enum>jvmtiHeapObjectFilter</enum> 5645 <description> 5646 Indicates the objects for which the callback function is called. 5647 </description> 5648 </param> 5649 <param id="heap_object_callback"> 5650 <ptrtype> 5651 <struct>jvmtiHeapObjectCallback</struct> 5652 </ptrtype> 5653 <description> 5654 The iterator function to be called for each 5655 <paramlink id="klass"/> instance matching 5656 the <paramlink id="object_filter"/>. 5657 </description> 5658 </param> 5659 <param id="user_data"> 5660 <inbuf> 5661 <void/> 5662 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 5663 </inbuf> 5664 <description> 5665 User supplied data to be passed to the callback. 5666 </description> 5667 </param> 5668 </parameters> 5669 <errors> 5670 </errors> 5671 </function> 5672 5673 </category> 5674 5675 <category id="local" label="Local Variable"> 5676 5677 <intro> 5678 These functions are used to retrieve or set the value of a local variable. 5679 The variable is identified by the depth of the frame containing its 5680 value and the variable's slot number within that frame. 5681 The mapping of variables to 5682 slot numbers can be obtained with the function 5683 <functionlink id="GetLocalVariableTable"></functionlink>. 5684 </intro> 5685 5686 <function id="GetLocalObject" num="21"> 5687 <synopsis>Get Local Variable - Object</synopsis> 5688 <description> 5689 This function can be used to retrieve the value of a local 5690 variable whose type is <code>Object</code> or a subclass of <code>Object</code>. 5691 </description> 5692 <origin>jvmdi</origin> 5693 <capabilities> 5694 <required id="can_access_local_variables"></required> 5695 </capabilities> 5696 <parameters> 5697 <param id="thread"> 5698 <jthread null="current" frame="frame"/> 5699 <description> 5700 The thread of the frame containing the variable's value. 5701 </description> 5702 </param> 5703 <param id="depth"> 5704 <jframeID thread="thread"/> 5705 <description> 5706 The depth of the frame containing the variable's value. 5707 </description> 5708 </param> 5709 <param id="slot"> 5710 <jint/> 5711 <description> 5712 The variable's slot number. 5713 </description> 5714 </param> 5715 <param id="value_ptr"> 5716 <outptr><jobject/></outptr> 5717 <description> 5718 On return, points to the variable's value. 5719 </description> 5720 </param> 5721 </parameters> 5722 <errors> 5723 <error id="JVMTI_ERROR_INVALID_SLOT"> 5724 Invalid <code>slot</code>. 5725 </error> 5726 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 5727 The variable type is not 5728 <code>Object</code> or a subclass of <code>Object</code>. 5729 </error> 5730 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 5731 Not a visible frame 5732 </error> 5733 </errors> 5734 </function> 5735 5736 <function id="GetLocalInstance" num="155" since="1.2"> 5737 <synopsis>Get Local Instance</synopsis> 5738 <description> 5739 This function can be used to retrieve the value of the local object 5740 variable at slot 0 (the "<code>this</code>" object) from non-static 5741 frames. This function can retrieve the "<code>this</code>" object from 5742 native method frames, whereas <code>GetLocalObject()</code> would 5743 return <code>JVMTI_ERROR_OPAQUE_FRAME</code> in those cases. 5744 </description> 5745 <origin>new</origin> 5746 <capabilities> 5747 <required id="can_access_local_variables"></required> 5748 </capabilities> 5749 <parameters> 5750 <param id="thread"> 5751 <jthread null="current" frame="frame"/> 5752 <description> 5753 The thread of the frame containing the variable's value. 5754 </description> 5755 </param> 5756 <param id="depth"> 5757 <jframeID thread="thread"/> 5758 <description> 5759 The depth of the frame containing the variable's value. 5760 </description> 5761 </param> 5762 <param id="value_ptr"> 5763 <outptr><jobject/></outptr> 5764 <description> 5765 On return, points to the variable's value. 5766 </description> 5767 </param> 5768 </parameters> 5769 <errors> 5770 <error id="JVMTI_ERROR_INVALID_SLOT"> 5771 If the specified frame is a static method frame. 5772 </error> 5773 </errors> 5774 </function> 5775 <function id="GetLocalInt" num="22"> 5776 <synopsis>Get Local Variable - Int</synopsis> 5777 <description> 5778 This function can be used to retrieve the value of a local 5779 variable whose type is <code>int</code>, 5780 <code>short</code>, <code>char</code>, <code>byte</code>, or 5781 <code>boolean</code>. 5782 </description> 5783 <origin>jvmdi</origin> 5784 <capabilities> 5785 <required id="can_access_local_variables"></required> 5786 </capabilities> 5787 <parameters> 5788 <param id="thread"> 5789 <jthread null="current" frame="frame"/> 5790 <description> 5791 The thread of the frame containing the variable's value. 5792 </description> 5793 </param> 5794 <param id="depth"> 5795 <jframeID thread="thread"/> 5796 <description> 5797 The depth of the frame containing the variable's value. 5798 </description> 5799 </param> 5800 <param id="slot"> 5801 <jint/> 5802 <description> 5803 The variable's slot number. 5804 </description> 5805 </param> 5806 <param id="value_ptr"> 5807 <outptr><jint/></outptr> 5808 <description> 5809 On return, points to the variable's value. 5810 </description> 5811 </param> 5812 </parameters> 5813 <errors> 5814 <error id="JVMTI_ERROR_INVALID_SLOT"> 5815 Invalid <code>slot</code>. 5816 </error> 5817 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 5818 The variable type is not 5819 <code>int</code>, <code>short</code>, 5820 <code>char</code>, <code>byte</code>, or 5821 <code>boolean</code>. 5822 </error> 5823 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 5824 Not a visible frame 5825 </error> 5826 </errors> 5827 </function> 5828 5829 <function id="GetLocalLong" num="23"> 5830 <synopsis>Get Local Variable - Long</synopsis> 5831 <description> 5832 This function can be used to retrieve the value of a local 5833 variable whose type is <code>long</code>. 5834 </description> 5835 <origin>jvmdi</origin> 5836 <capabilities> 5837 <required id="can_access_local_variables"></required> 5838 </capabilities> 5839 <parameters> 5840 <param id="thread"> 5841 <jthread null="current" frame="frame"/> 5842 <description> 5843 The thread of the frame containing the variable's value. 5844 </description> 5845 </param> 5846 <param id="depth"> 5847 <jframeID thread="thread"/> 5848 <description> 5849 The depth of the frame containing the variable's value. 5850 </description> 5851 </param> 5852 <param id="slot"> 5853 <jint/> 5854 <description> 5855 The variable's slot number. 5856 </description> 5857 </param> 5858 <param id="value_ptr"> 5859 <outptr><jlong/></outptr> 5860 <description> 5861 On return, points to the variable's value. 5862 </description> 5863 </param> 5864 </parameters> 5865 <errors> 5866 <error id="JVMTI_ERROR_INVALID_SLOT"> 5867 Invalid <code>slot</code>. 5868 </error> 5869 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 5870 The variable type is not <code>long</code>. 5871 </error> 5872 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 5873 Not a visible frame 5874 </error> 5875 </errors> 5876 </function> 5877 5878 <function id="GetLocalFloat" num="24"> 5879 <synopsis>Get Local Variable - Float</synopsis> 5880 <description> 5881 This function can be used to retrieve the value of a local 5882 variable whose type is <code>float</code>. 5883 </description> 5884 <origin>jvmdi</origin> 5885 <capabilities> 5886 <required id="can_access_local_variables"></required> 5887 </capabilities> 5888 <parameters> 5889 <param id="thread"> 5890 <jthread null="current" frame="frame"/> 5891 <description> 5892 The thread of the frame containing the variable's value. 5893 </description> 5894 </param> 5895 <param id="depth"> 5896 <jframeID thread="thread"/> 5897 <description> 5898 The depth of the frame containing the variable's value. 5899 </description> 5900 </param> 5901 <param id="slot"> 5902 <jint/> 5903 <description> 5904 The variable's slot number. 5905 </description> 5906 </param> 5907 <param id="value_ptr"> 5908 <outptr><jfloat/></outptr> 5909 <description> 5910 On return, points to the variable's value. 5911 </description> 5912 </param> 5913 </parameters> 5914 <errors> 5915 <error id="JVMTI_ERROR_INVALID_SLOT"> 5916 Invalid <code>slot</code>. 5917 </error> 5918 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 5919 The variable type is not <code>float</code>. 5920 </error> 5921 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 5922 Not a visible frame 5923 </error> 5924 </errors> 5925 </function> 5926 5927 <function id="GetLocalDouble" num="25"> 5928 <synopsis>Get Local Variable - Double</synopsis> 5929 <description> 5930 This function can be used to retrieve the value of a local 5931 variable whose type is <code>long</code>. 5932 </description> 5933 <origin>jvmdi</origin> 5934 <capabilities> 5935 <required id="can_access_local_variables"></required> 5936 </capabilities> 5937 <parameters> 5938 <param id="thread"> 5939 <jthread null="current" frame="frame"/> 5940 <description> 5941 The thread of the frame containing the variable's value. 5942 </description> 5943 </param> 5944 <param id="depth"> 5945 <jframeID thread="thread"/> 5946 <description> 5947 The depth of the frame containing the variable's value. 5948 </description> 5949 </param> 5950 <param id="slot"> 5951 <jint/> 5952 <description> 5953 The variable's slot number. 5954 </description> 5955 </param> 5956 <param id="value_ptr"> 5957 <outptr><jdouble/></outptr> 5958 <description> 5959 On return, points to the variable's value. 5960 </description> 5961 </param> 5962 </parameters> 5963 <errors> 5964 <error id="JVMTI_ERROR_INVALID_SLOT"> 5965 Invalid <code>slot</code>. 5966 </error> 5967 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 5968 The variable type is not <code>double</code>. 5969 </error> 5970 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 5971 Not a visible frame 5972 </error> 5973 </errors> 5974 </function> 5975 5976 <function id="SetLocalObject" num="26"> 5977 <synopsis>Set Local Variable - Object</synopsis> 5978 <description> 5979 This function can be used to set the value of a local 5980 variable whose type is <code>Object</code> or a subclass of <code>Object</code>. 5981 </description> 5982 <origin>jvmdi</origin> 5983 <capabilities> 5984 <required id="can_access_local_variables"></required> 5985 </capabilities> 5986 <parameters> 5987 <param id="thread"> 5988 <jthread null="current" frame="frame"/> 5989 <description> 5990 The thread of the frame containing the variable's value. 5991 </description> 5992 </param> 5993 <param id="depth"> 5994 <jframeID thread="thread"/> 5995 <description> 5996 The depth of the frame containing the variable's value. 5997 </description> 5998 </param> 5999 <param id="slot"> 6000 <jint/> 6001 <description> 6002 The variable's slot number. 6003 </description> 6004 </param> 6005 <param id="value"> 6006 <jobject/> 6007 <description> 6008 The new value for the variable. 6009 </description> 6010 </param> 6011 </parameters> 6012 <errors> 6013 <error id="JVMTI_ERROR_INVALID_SLOT"> 6014 Invalid <code>slot</code>. 6015 </error> 6016 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6017 The variable type is not 6018 <code>Object</code> or a subclass of <code>Object</code>. 6019 </error> 6020 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6021 The supplied <paramlink id="value"/> is not compatible 6022 with the variable type. 6023 </error> 6024 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6025 Not a visible frame 6026 </error> 6027 </errors> 6028 </function> 6029 6030 <function id="SetLocalInt" num="27"> 6031 <synopsis>Set Local Variable - Int</synopsis> 6032 <description> 6033 This function can be used to set the value of a local 6034 variable whose type is <code>int</code>, 6035 <code>short</code>, <code>char</code>, <code>byte</code>, or 6036 <code>boolean</code>. 6037 </description> 6038 <origin>jvmdi</origin> 6039 <capabilities> 6040 <required id="can_access_local_variables"></required> 6041 </capabilities> 6042 <parameters> 6043 <param id="thread"> 6044 <jthread null="current" frame="frame"/> 6045 <description> 6046 The thread of the frame containing the variable's value. 6047 </description> 6048 </param> 6049 <param id="depth"> 6050 <jframeID thread="thread"/> 6051 <description> 6052 The depth of the frame containing the variable's value. 6053 </description> 6054 </param> 6055 <param id="slot"> 6056 <jint/> 6057 <description> 6058 The variable's slot number. 6059 </description> 6060 </param> 6061 <param id="value"> 6062 <jint/> 6063 <description> 6064 The new value for the variable. 6065 </description> 6066 </param> 6067 </parameters> 6068 <errors> 6069 <error id="JVMTI_ERROR_INVALID_SLOT"> 6070 Invalid <code>slot</code>. 6071 </error> 6072 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6073 The variable type is not 6074 <code>int</code>, <code>short</code>, 6075 <code>char</code>, <code>byte</code>, or 6076 <code>boolean</code>. 6077 </error> 6078 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6079 Not a visible frame 6080 </error> 6081 </errors> 6082 </function> 6083 6084 <function id="SetLocalLong" num="28"> 6085 <synopsis>Set Local Variable - Long</synopsis> 6086 <description> 6087 This function can be used to set the value of a local 6088 variable whose type is <code>long</code>. 6089 </description> 6090 <origin>jvmdi</origin> 6091 <capabilities> 6092 <required id="can_access_local_variables"></required> 6093 </capabilities> 6094 <parameters> 6095 <param id="thread"> 6096 <jthread null="current" frame="frame"/> 6097 <description> 6098 The thread of the frame containing the variable's value. 6099 </description> 6100 </param> 6101 <param id="depth"> 6102 <jframeID thread="thread"/> 6103 <description> 6104 The depth of the frame containing the variable's value. 6105 </description> 6106 </param> 6107 <param id="slot"> 6108 <jint/> 6109 <description> 6110 The variable's slot number. 6111 </description> 6112 </param> 6113 <param id="value"> 6114 <jlong/> 6115 <description> 6116 The new value for the variable. 6117 </description> 6118 </param> 6119 </parameters> 6120 <errors> 6121 <error id="JVMTI_ERROR_INVALID_SLOT"> 6122 Invalid <code>slot</code>. 6123 </error> 6124 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6125 The variable type is not <code>long</code>. 6126 </error> 6127 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6128 Not a visible frame 6129 </error> 6130 </errors> 6131 </function> 6132 6133 <function id="SetLocalFloat" num="29"> 6134 <synopsis>Set Local Variable - Float</synopsis> 6135 <description> 6136 This function can be used to set the value of a local 6137 variable whose type is <code>float</code>. 6138 </description> 6139 <origin>jvmdi</origin> 6140 <capabilities> 6141 <required id="can_access_local_variables"></required> 6142 </capabilities> 6143 <parameters> 6144 <param id="thread"> 6145 <jthread null="current" frame="frame"/> 6146 <description> 6147 The thread of the frame containing the variable's value. 6148 </description> 6149 </param> 6150 <param id="depth"> 6151 <jframeID thread="thread"/> 6152 <description> 6153 The depth of the frame containing the variable's value. 6154 </description> 6155 </param> 6156 <param id="slot"> 6157 <jint/> 6158 <description> 6159 The variable's slot number. 6160 </description> 6161 </param> 6162 <param id="value"> 6163 <jfloat/> 6164 <description> 6165 The new value for the variable. 6166 </description> 6167 </param> 6168 </parameters> 6169 <errors> 6170 <error id="JVMTI_ERROR_INVALID_SLOT"> 6171 Invalid <code>slot</code>. 6172 </error> 6173 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6174 The variable type is not <code>float</code>. 6175 </error> 6176 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6177 Not a visible frame 6178 </error> 6179 </errors> 6180 </function> 6181 6182 <function id="SetLocalDouble" num="30"> 6183 <synopsis>Set Local Variable - Double</synopsis> 6184 <description> 6185 This function can be used to set the value of a local 6186 variable whose type is <code>double</code>. 6187 </description> 6188 <origin>jvmdi</origin> 6189 <capabilities> 6190 <required id="can_access_local_variables"></required> 6191 </capabilities> 6192 <parameters> 6193 <param id="thread"> 6194 <jthread null="current" frame="frame"/> 6195 <description> 6196 The thread of the frame containing the variable's value. 6197 </description> 6198 </param> 6199 <param id="depth"> 6200 <jframeID thread="thread"/> 6201 <description> 6202 The depth of the frame containing the variable's value. 6203 </description> 6204 </param> 6205 <param id="slot"> 6206 <jint/> 6207 <description> 6208 The variable's slot number. 6209 </description> 6210 </param> 6211 <param id="value"> 6212 <jdouble/> 6213 <description> 6214 The new value for the variable. 6215 </description> 6216 </param> 6217 </parameters> 6218 <errors> 6219 <error id="JVMTI_ERROR_INVALID_SLOT"> 6220 Invalid <code>slot</code>. 6221 </error> 6222 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6223 The variable type is not <code>double</code>. 6224 </error> 6225 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6226 Not a visible frame 6227 </error> 6228 </errors> 6229 </function> 6230 </category> 6231 6232 <category id="breakpointCategory" label="Breakpoint"> 6233 6234 <intro> 6235 </intro> 6236 6237 <function id="SetBreakpoint" num="38"> 6238 <synopsis>Set Breakpoint</synopsis> 6239 <description> 6240 Set a breakpoint at the instruction indicated by 6241 <code>method</code> and <code>location</code>. 6242 An instruction can only have one breakpoint. 6243 <p/> 6244 Whenever the designated instruction is about to be executed, a 6245 <eventlink id="Breakpoint"></eventlink> event is generated. 6246 </description> 6247 <origin>jvmdi</origin> 6248 <capabilities> 6249 <required id="can_generate_breakpoint_events"></required> 6250 </capabilities> 6251 <parameters> 6252 <param id="klass"> 6253 <jclass method="method"/> 6254 <description> 6255 The class in which to set the breakpoint 6256 </description> 6257 </param> 6258 <param id="method"> 6259 <jmethodID class="klass"/> 6260 <description> 6261 The method in which to set the breakpoint 6262 </description> 6263 </param> 6264 <param id="location"> 6265 <jlocation/> 6266 <description> 6267 the index of the instruction at which to set the breakpoint 6268 6269 </description> 6270 </param> 6271 </parameters> 6272 <errors> 6273 <error id="JVMTI_ERROR_DUPLICATE"> 6274 The designated bytecode already has a breakpoint. 6275 </error> 6276 </errors> 6277 </function> 6278 6279 <function id="ClearBreakpoint" num="39"> 6280 <synopsis>Clear Breakpoint</synopsis> 6281 <description> 6282 Clear the breakpoint at the bytecode indicated by 6283 <code>method</code> and <code>location</code>. 6284 </description> 6285 <origin>jvmdi</origin> 6286 <capabilities> 6287 <required id="can_generate_breakpoint_events"></required> 6288 </capabilities> 6289 <parameters> 6290 <param id="klass"> 6291 <jclass method="method"/> 6292 <description> 6293 The class in which to clear the breakpoint 6294 </description> 6295 </param> 6296 <param id="method"> 6297 <jmethodID class="klass"/> 6298 <description> 6299 The method in which to clear the breakpoint 6300 </description> 6301 </param> 6302 <param id="location"> 6303 <jlocation/> 6304 <description> 6305 the index of the instruction at which to clear the breakpoint 6306 </description> 6307 </param> 6308 </parameters> 6309 <errors> 6310 <error id="JVMTI_ERROR_NOT_FOUND"> 6311 There's no breakpoint at the designated bytecode. 6312 </error> 6313 </errors> 6314 </function> 6315 6316 </category> 6317 6318 <category id="fieldWatch" label="Watched Field"> 6319 6320 <intro> 6321 </intro> 6322 6323 <function id="SetFieldAccessWatch" num="41"> 6324 <synopsis>Set Field Access Watch</synopsis> 6325 <description> 6326 Generate a <eventlink id="FieldAccess"></eventlink> event 6327 when the field specified 6328 by <code>klass</code> and 6329 <code>field</code> is about to be accessed. 6330 An event will be generated for each access of the field 6331 until it is canceled with 6332 <functionlink id="ClearFieldAccessWatch"></functionlink>. 6333 Field accesses from Java programming language code or from JNI code are watched, 6334 fields modified by other means are not watched. 6335 Note that <jvmti/> users should be aware that their own field accesses 6336 will trigger the watch. 6337 A field can only have one field access watch set. 6338 Modification of a field is not considered an access--use 6339 <functionlink id="SetFieldModificationWatch"></functionlink> 6340 to monitor modifications. 6341 </description> 6342 <origin>jvmdi</origin> 6343 <capabilities> 6344 <required id="can_generate_field_access_events"></required> 6345 </capabilities> 6346 <parameters> 6347 <param id="klass"> 6348 <jclass field="field"/> 6349 <description> 6350 The class containing the field to watch 6351 </description> 6352 </param> 6353 <param id="field"> 6354 <jfieldID class="klass"/> 6355 <description> 6356 The field to watch 6357 6358 </description> 6359 </param> 6360 </parameters> 6361 <errors> 6362 <error id="JVMTI_ERROR_DUPLICATE"> 6363 The designated field is already being watched for accesses. 6364 </error> 6365 </errors> 6366 </function> 6367 6368 <function id="ClearFieldAccessWatch" num="42"> 6369 <synopsis>Clear Field Access Watch</synopsis> 6370 <description> 6371 Cancel a field access watch previously set by 6372 <functionlink id="SetFieldAccessWatch"></functionlink>, on the 6373 field specified 6374 by <code>klass</code> and 6375 <code>field</code>. 6376 </description> 6377 <origin>jvmdi</origin> 6378 <capabilities> 6379 <required id="can_generate_field_access_events"></required> 6380 </capabilities> 6381 <parameters> 6382 <param id="klass"> 6383 <jclass field="field"/> 6384 <description> 6385 The class containing the field to watch 6386 </description> 6387 </param> 6388 <param id="field"> 6389 <jfieldID class="klass"/> 6390 <description> 6391 The field to watch 6392 6393 </description> 6394 </param> 6395 </parameters> 6396 <errors> 6397 <error id="JVMTI_ERROR_NOT_FOUND"> 6398 The designated field is not being watched for accesses. 6399 </error> 6400 </errors> 6401 </function> 6402 6403 <function id="SetFieldModificationWatch" num="43"> 6404 <synopsis>Set Field Modification Watch</synopsis> 6405 <description> 6406 Generate a <eventlink id="FieldModification"></eventlink> event 6407 when the field specified 6408 by <code>klass</code> and 6409 <code>field</code> is about to be modified. 6410 An event will be generated for each modification of the field 6411 until it is canceled with 6412 <functionlink id="ClearFieldModificationWatch"></functionlink>. 6413 Field modifications from Java programming language code or from JNI code are watched, 6414 fields modified by other means are not watched. 6415 Note that <jvmti/> users should be aware that their own field modifications 6416 will trigger the watch. 6417 A field can only have one field modification watch set. 6418 </description> 6419 <origin>jvmdi</origin> 6420 <capabilities> 6421 <required id="can_generate_field_modification_events"></required> 6422 </capabilities> 6423 <parameters> 6424 <param id="klass"> 6425 <jclass field="field"/> 6426 <description> 6427 The class containing the field to watch 6428 </description> 6429 </param> 6430 <param id="field"> 6431 <jfieldID class="klass"/> 6432 <description> 6433 The field to watch 6434 6435 </description> 6436 </param> 6437 </parameters> 6438 <errors> 6439 <error id="JVMTI_ERROR_DUPLICATE"> 6440 The designated field is already being watched for modifications. 6441 </error> 6442 </errors> 6443 </function> 6444 6445 <function id="ClearFieldModificationWatch" num="44"> 6446 <synopsis>Clear Field Modification Watch</synopsis> 6447 <description> 6448 6449 Cancel a field modification watch previously set by 6450 <functionlink id="SetFieldModificationWatch"></functionlink>, on the 6451 field specified 6452 by <code>klass</code> and 6453 <code>field</code>. 6454 </description> 6455 <origin>jvmdi</origin> 6456 <capabilities> 6457 <required id="can_generate_field_modification_events"></required> 6458 </capabilities> 6459 <parameters> 6460 <param id="klass"> 6461 <jclass field="field"/> 6462 <description> 6463 The class containing the field to watch 6464 </description> 6465 </param> 6466 <param id="field"> 6467 <jfieldID class="klass"/> 6468 <description> 6469 The field to watch 6470 6471 </description> 6472 </param> 6473 </parameters> 6474 <errors> 6475 <error id="JVMTI_ERROR_NOT_FOUND"> 6476 The designated field is not being watched for modifications. 6477 </error> 6478 </errors> 6479 </function> 6480 </category> 6481 6482 <category id="module" label="Module"> 6483 6484 <intro> 6485 </intro> 6486 6487 <function id="GetAllModules" num="3" since="9"> 6488 <synopsis>Get All Modules</synopsis> 6489 <description> 6490 Return an array of all modules loaded in the virtual machine. 6491 The array includes the unnamed module for each class loader. 6492 The number of modules in the array is returned via 6493 <code>module_count_ptr</code>, and the array itself via 6494 <code>modules_ptr</code>. 6495 <p/> 6496 </description> 6497 <origin>new</origin> 6498 <capabilities> 6499 </capabilities> 6500 <parameters> 6501 <param id="module_count_ptr"> 6502 <outptr><jint/></outptr> 6503 <description> 6504 On return, points to the number of returned modules. 6505 </description> 6506 </param> 6507 <param id="modules_ptr"> 6508 <allocbuf outcount="module_count_ptr"><jobject/></allocbuf> 6509 <description> 6510 On return, points to an array of references, one 6511 for each module. 6512 </description> 6513 </param> 6514 </parameters> 6515 <errors> 6516 </errors> 6517 </function> 6518 6519 <function id="GetNamedModule" num="40" since="9"> 6520 <synopsis>Get Named Module</synopsis> 6521 <description> 6522 Return the <code>java.lang.Module</code> object for a named 6523 module defined to a class loader that contains a given package. 6524 The module is returned via <code>module_ptr</code>. 6525 <p/> 6526 If a named module is defined to the class loader and it 6527 contains the package then that named module is returned, 6528 otherwise <code>NULL</code> is returned. 6529 <p/> 6530 </description> 6531 <origin>new</origin> 6532 <capabilities> 6533 </capabilities> 6534 <parameters> 6535 <param id="class_loader"> 6536 <ptrtype> 6537 <jobject/> 6538 <nullok>the bootstrap loader is assumed</nullok> 6539 </ptrtype> 6540 <description> 6541 A class loader. 6542 If the <code>class_loader</code> is not <code>NULL</code> 6543 or a subclass of <code>java.lang.ClassLoader</code> 6544 this function returns 6545 <errorlink id="JVMTI_ERROR_ILLEGAL_ARGUMENT"></errorlink>. 6546 </description> 6547 </param> 6548 <param id="package_name"> 6549 <inbuf><char/></inbuf> 6550 <description> 6551 The name of the package, encoded as a 6552 <internallink id="mUTF">modified UTF-8</internallink> string. 6553 The package name is in internal form (JVMS 4.2.1); 6554 identifiers are separated by forward slashes rather than periods. 6555 </description> 6556 </param> 6557 <param id="module_ptr"> 6558 <outptr><jobject/></outptr> 6559 <description> 6560 On return, points to a <code>java.lang.Module</code> object 6561 or points to <code>NULL</code>. 6562 </description> 6563 </param> 6564 </parameters> 6565 <errors> 6566 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 6567 If class loader is not <code>NULL</code> and is not a class loader object. 6568 </error> 6569 </errors> 6570 </function> 6571 6572 <function id="AddModuleReads" num="94" since="9"> 6573 <synopsis>Add Module Reads</synopsis> 6574 <description> 6575 Update a module to read another module. This function is a no-op 6576 when <paramlink id="module"></paramlink> is an unnamed module. 6577 This function facilitates the instrumentation of code 6578 in named modules where that instrumentation requires 6579 expanding the set of modules that a module reads. 6580 </description> 6581 <origin>new</origin> 6582 <capabilities> 6583 </capabilities> 6584 <parameters> 6585 <param id="module"> 6586 <ptrtype><jobject/></ptrtype> 6587 <description> 6588 The module to update. 6589 </description> 6590 </param> 6591 <param id="to_module"> 6592 <ptrtype><jobject/></ptrtype> 6593 <description> 6594 The additional module to read. 6595 </description> 6596 </param> 6597 </parameters> 6598 <errors> 6599 <error id="JVMTI_ERROR_INVALID_MODULE"> 6600 If <paramlink id="module"></paramlink> is not a module object. 6601 </error> 6602 <error id="JVMTI_ERROR_INVALID_MODULE"> 6603 If <paramlink id="to_module"></paramlink> is not a module object. 6604 </error> 6605 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE"> 6606 if the module cannot be modified. 6607 See <functionlink id="IsModifiableModule"/>. 6608 </error> 6609 </errors> 6610 </function> 6611 6612 <function id="AddModuleExports" num="95" since="9"> 6613 <synopsis>Add Module Exports</synopsis> 6614 <description> 6615 Update a module to export a package to another module. 6616 This function is a no-op when <paramlink id="module"></paramlink> 6617 is an unnamed module or an open module. 6618 This function facilitates the instrumentation of code 6619 in named modules where that instrumentation requires 6620 expanding the set of packages that a module exports. 6621 </description> 6622 <origin>new</origin> 6623 <capabilities> 6624 </capabilities> 6625 <parameters> 6626 <param id="module"> 6627 <ptrtype><jobject/></ptrtype> 6628 <description> 6629 The module to update. 6630 </description> 6631 </param> 6632 <param id="pkg_name"> 6633 <inbuf><char/></inbuf> 6634 <description> 6635 The exported package name. 6636 </description> 6637 </param> 6638 <param id="to_module"> 6639 <ptrtype><jobject/></ptrtype> 6640 <description> 6641 The module the package is exported to. 6642 If the <code>to_module</code> is not a subclass of 6643 <code>java.lang.Module</code> this function returns 6644 <errorlink id="JVMTI_ERROR_INVALID_MODULE"></errorlink>. 6645 </description> 6646 </param> 6647 </parameters> 6648 <errors> 6649 <error id="JVMTI_ERROR_INVALID_MODULE"> 6650 If <paramlink id="module"></paramlink> is not a module object. 6651 </error> 6652 <error id="JVMTI_ERROR_INVALID_MODULE"> 6653 If <paramlink id="to_module"></paramlink> is not a module object. 6654 </error> 6655 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 6656 If the package <paramlink id="pkg_name"></paramlink> 6657 does not belong to the module. 6658 </error> 6659 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE"> 6660 if the module cannot be modified. 6661 See <functionlink id="IsModifiableModule"/>. 6662 </error> 6663 </errors> 6664 </function> 6665 6666 <function id="AddModuleOpens" num="96" since="9"> 6667 <synopsis>Add Module Opens</synopsis> 6668 <description> 6669 Update a module to open a package to another module. 6670 This function is a no-op when <paramlink id="module"></paramlink> 6671 is an unnamed module or an open module. 6672 This function facilitates the instrumentation of code 6673 in modules where that instrumentation requires 6674 expanding the set of packages that a module opens to 6675 other modules. 6676 </description> 6677 <origin>new</origin> 6678 <capabilities> 6679 </capabilities> 6680 <parameters> 6681 <param id="module"> 6682 <ptrtype><jobject/></ptrtype> 6683 <description> 6684 The module to update. 6685 </description> 6686 </param> 6687 <param id="pkg_name"> 6688 <inbuf><char/></inbuf> 6689 <description> 6690 The package name of the package to open. 6691 </description> 6692 </param> 6693 <param id="to_module"> 6694 <ptrtype><jobject/></ptrtype> 6695 <description> 6696 The module with the package to open. 6697 If the <code>to_module</code> is not a subclass of 6698 <code>java.lang.Module</code> this function returns 6699 <errorlink id="JVMTI_ERROR_INVALID_MODULE"></errorlink>. 6700 </description> 6701 </param> 6702 </parameters> 6703 <errors> 6704 <error id="JVMTI_ERROR_INVALID_MODULE"> 6705 If <paramlink id="module"></paramlink> is not a module object. 6706 </error> 6707 <error id="JVMTI_ERROR_INVALID_MODULE"> 6708 If <paramlink id="to_module"></paramlink> is not a module object. 6709 </error> 6710 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 6711 If the package <paramlink id="pkg_name"></paramlink> 6712 does not belong to the module. 6713 </error> 6714 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE"> 6715 if the module cannot be modified. 6716 See <functionlink id="IsModifiableModule"/>. 6717 </error> 6718 </errors> 6719 </function> 6720 6721 <function id="AddModuleUses" num="97" since="9"> 6722 <synopsis>Add Module Uses</synopsis> 6723 <description> 6724 Updates a module to add a service to the set of services that 6725 a module uses. This function is a no-op when the module 6726 is an unnamed module. 6727 This function facilitates the instrumentation of code 6728 in named modules where that instrumentation requires 6729 expanding the set of services that a module is using. 6730 </description> 6731 <origin>new</origin> 6732 <capabilities> 6733 </capabilities> 6734 <parameters> 6735 <param id="module"> 6736 <ptrtype><jobject/></ptrtype> 6737 <description> 6738 The module to update. 6739 </description> 6740 </param> 6741 <param id="service"> 6742 <ptrtype><jclass/></ptrtype> 6743 <description> 6744 The service to use. 6745 </description> 6746 </param> 6747 </parameters> 6748 <errors> 6749 <error id="JVMTI_ERROR_INVALID_MODULE"> 6750 If <paramlink id="module"></paramlink> is not a module object. 6751 </error> 6752 <error id="JVMTI_ERROR_INVALID_CLASS"> 6753 If <paramlink id="service"></paramlink> is not a class object. 6754 </error> 6755 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE"> 6756 if the module cannot be modified. 6757 See <functionlink id="IsModifiableModule"/>. 6758 </error> 6759 </errors> 6760 </function> 6761 6762 <function id="AddModuleProvides" num="98" since="9"> 6763 <synopsis>Add Module Provides</synopsis> 6764 <description> 6765 Updates a module to add a service to the set of services that 6766 a module provides. This function is a no-op when the module 6767 is an unnamed module. 6768 This function facilitates the instrumentation of code 6769 in named modules where that instrumentation requires 6770 changes to the services that are provided. 6771 </description> 6772 <origin>new</origin> 6773 <capabilities> 6774 </capabilities> 6775 <parameters> 6776 <param id="module"> 6777 <ptrtype><jobject/></ptrtype> 6778 <description> 6779 The module to update. 6780 </description> 6781 </param> 6782 <param id="service"> 6783 <ptrtype><jclass/></ptrtype> 6784 <description> 6785 The service to provide. 6786 </description> 6787 </param> 6788 <param id="impl_class"> 6789 <ptrtype><jclass/></ptrtype> 6790 <description> 6791 The implementation class for the provided service. 6792 </description> 6793 </param> 6794 </parameters> 6795 <errors> 6796 <error id="JVMTI_ERROR_INVALID_MODULE"> 6797 If <paramlink id="module"></paramlink> is not a module object. 6798 </error> 6799 <error id="JVMTI_ERROR_INVALID_CLASS"> 6800 If <paramlink id="service"></paramlink> is not a class object. 6801 </error> 6802 <error id="JVMTI_ERROR_INVALID_CLASS"> 6803 If <paramlink id="impl_class"></paramlink> is not a class object. 6804 </error> 6805 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE"> 6806 if the module cannot be modified. 6807 See <functionlink id="IsModifiableModule"/>. 6808 </error> 6809 </errors> 6810 </function> 6811 6812 <function id="IsModifiableModule" num="99" since="9"> 6813 <synopsis>Is Modifiable Module</synopsis> 6814 <description> 6815 Determines whether a module is modifiable. 6816 If a module is modifiable then this module can be updated with 6817 <functionlink id="AddModuleReads"/>, <functionlink id="AddModuleExports"/>, 6818 <functionlink id="AddModuleOpens"/>, <functionlink id="AddModuleUses"/>, 6819 and <functionlink id="AddModuleProvides"/>. If a module is not modifiable 6820 then the module can not be updated with these functions. The result of 6821 this function is always <code>JNI_TRUE</code> when called to determine 6822 if an unnamed module is modifiable. 6823 </description> 6824 <origin>new</origin> 6825 <capabilities> 6826 </capabilities> 6827 <parameters> 6828 <param id="module"> 6829 <ptrtype><jobject/></ptrtype> 6830 <description> 6831 The module to query. 6832 </description> 6833 </param> 6834 <param id="is_modifiable_module_ptr"> 6835 <outptr><jboolean/></outptr> 6836 <description> 6837 On return, points to the boolean result of this function. 6838 </description> 6839 </param> 6840 </parameters> 6841 <errors> 6842 <error id="JVMTI_ERROR_INVALID_MODULE"> 6843 If <paramlink id="module"></paramlink> is not a module object. 6844 </error> 6845 </errors> 6846 </function> 6847 6848 </category> 6849 6850 <category id="class" label="Class"> 6851 6852 <intro> 6853 </intro> 6854 6855 <function id="GetLoadedClasses" jkernel="yes" num="78"> 6856 <synopsis>Get Loaded Classes</synopsis> 6857 <description> 6858 Return an array of all classes loaded in the virtual machine. 6859 The number of classes in the array is returned via 6860 <code>class_count_ptr</code>, and the array itself via 6861 <code>classes_ptr</code>. 6862 <p/> 6863 Array classes of all types (including arrays of primitive types) are 6864 included in the returned list. Primitive classes (for example, 6865 <code>java.lang.Integer.TYPE</code>) are <i>not</i> included in this list. 6866 </description> 6867 <origin>jvmdi</origin> 6868 <capabilities> 6869 </capabilities> 6870 <parameters> 6871 <param id="class_count_ptr"> 6872 <outptr><jint/></outptr> 6873 <description> 6874 On return, points to the number of classes. 6875 </description> 6876 </param> 6877 <param id="classes_ptr"> 6878 <allocbuf outcount="class_count_ptr"><jclass/></allocbuf> 6879 <description> 6880 On return, points to an array of references, one 6881 for each class. 6882 </description> 6883 </param> 6884 </parameters> 6885 <errors> 6886 </errors> 6887 </function> 6888 6889 <function id="GetClassLoaderClasses" jkernel="yes" num="79"> 6890 <synopsis>Get Classloader Classes</synopsis> 6891 <description> 6892 Returns an array of those classes for which this class loader has 6893 been recorded as an initiating loader. Each 6894 class in the returned array was created by this class loader, 6895 either by defining it directly or by delegation to another class loader. 6896 See <vmspec chapter="5.3"/>. 6897 <p/> 6898 The number of classes in the array is returned via 6899 <code>class_count_ptr</code>, and the array itself via 6900 <code>classes_ptr</code>. 6901 </description> 6902 <origin>jvmdi</origin> 6903 <capabilities> 6904 </capabilities> 6905 <parameters> 6906 <param id="initiating_loader"> 6907 <ptrtype> 6908 <jobject/> 6909 <nullok>the classes initiated by the bootstrap loader will be returned</nullok> 6910 </ptrtype> 6911 <description> 6912 An initiating class loader. 6913 </description> 6914 </param> 6915 <param id="class_count_ptr"> 6916 <outptr><jint/></outptr> 6917 <description> 6918 On return, points to the number of classes. 6919 </description> 6920 </param> 6921 <param id="classes_ptr"> 6922 <allocbuf outcount="class_count_ptr"><jclass/></allocbuf> 6923 <description> 6924 On return, points to an array of references, one 6925 for each class. 6926 </description> 6927 </param> 6928 </parameters> 6929 <errors> 6930 </errors> 6931 </function> 6932 6933 <function id="GetClassSignature" phase="start" num="48"> 6934 <synopsis>Get Class Signature</synopsis> 6935 <description> 6936 For the class indicated by <code>klass</code>, return the 6937 <externallink id="jni/types.html#type-signatures">JNI 6938 type signature</externallink> 6939 and the generic signature of the class. 6940 For example, <code>java.util.List</code> is <code>"Ljava/util/List;"</code> 6941 and <code>int[]</code> is <code>"[I"</code> 6942 The returned name for primitive classes 6943 is the type signature character of the corresponding primitive type. 6944 For example, <code>java.lang.Integer.TYPE</code> is <code>"I"</code>. 6945 </description> 6946 <origin>jvmdiClone</origin> 6947 <capabilities> 6948 </capabilities> 6949 <parameters> 6950 <param id="klass"> 6951 <jclass/> 6952 <description> 6953 The class to query. 6954 </description> 6955 </param> 6956 <param id="signature_ptr"> 6957 <allocbuf> 6958 <char/> 6959 <nullok>the signature is not returned</nullok> 6960 </allocbuf> 6961 <description> 6962 On return, points to the JNI type signature of the class, encoded as a 6963 <internallink id="mUTF">modified UTF-8</internallink> string. 6964 </description> 6965 </param> 6966 <param id="generic_ptr"> 6967 <allocbuf> 6968 <char/> 6969 <nullok>the generic signature is not returned</nullok> 6970 </allocbuf> 6971 <description> 6972 On return, points to the generic signature of the class, encoded as a 6973 <internallink id="mUTF">modified UTF-8</internallink> string. 6974 If there is no generic signature attribute for the class, then, 6975 on return, points to <code>NULL</code>. 6976 </description> 6977 </param> 6978 </parameters> 6979 <errors> 6980 </errors> 6981 </function> 6982 6983 <function id="GetClassStatus" phase="start" num="49"> 6984 <synopsis>Get Class Status</synopsis> 6985 <description> 6986 Get the status of the class. Zero or more of the following bits can be 6987 set. 6988 <constants id="jvmtiClassStatus" label="Class Status Flags" kind="bits"> 6989 <constant id="JVMTI_CLASS_STATUS_VERIFIED" num="1"> 6990 Class bytecodes have been verified 6991 </constant> 6992 <constant id="JVMTI_CLASS_STATUS_PREPARED" num="2"> 6993 Class preparation is complete 6994 </constant> 6995 <constant id="JVMTI_CLASS_STATUS_INITIALIZED" num="4"> 6996 Class initialization is complete. Static initializer has been run. 6997 </constant> 6998 <constant id="JVMTI_CLASS_STATUS_ERROR" num="8"> 6999 Error during initialization makes class unusable 7000 </constant> 7001 <constant id="JVMTI_CLASS_STATUS_ARRAY" num="16"> 7002 Class is an array. If set, all other bits are zero. 7003 </constant> 7004 <constant id="JVMTI_CLASS_STATUS_PRIMITIVE" num="32"> 7005 Class is a primitive class (for example, <code>java.lang.Integer.TYPE</code>). 7006 If set, all other bits are zero. 7007 </constant> 7008 </constants> 7009 </description> 7010 <origin>jvmdi</origin> 7011 <capabilities> 7012 </capabilities> 7013 <parameters> 7014 <param id="klass"> 7015 <jclass/> 7016 <description> 7017 The class to query. 7018 </description> 7019 </param> 7020 <param id="status_ptr"> 7021 <outptr><jint/></outptr> 7022 <description> 7023 On return, points to the current state of this class as one or 7024 more of the <internallink id="jvmtiClassStatus">class status flags</internallink>. 7025 </description> 7026 </param> 7027 </parameters> 7028 <errors> 7029 </errors> 7030 </function> 7031 7032 <function id="GetSourceFileName" phase="start" num="50"> 7033 <synopsis>Get Source File Name</synopsis> 7034 <description> 7035 For the class indicated by <code>klass</code>, return the source file 7036 name via <code>source_name_ptr</code>. The returned string 7037 is a file name only and never contains a directory name. 7038 <p/> 7039 For primitive classes (for example, <code>java.lang.Integer.TYPE</code>) 7040 and for arrays this function returns 7041 <errorlink id="JVMTI_ERROR_ABSENT_INFORMATION"></errorlink>. 7042 </description> 7043 <origin>jvmdi</origin> 7044 <capabilities> 7045 <required id="can_get_source_file_name"></required> 7046 </capabilities> 7047 <parameters> 7048 <param id="klass"> 7049 <jclass/> 7050 <description> 7051 The class to query. 7052 </description> 7053 </param> 7054 <param id="source_name_ptr"> 7055 <allocbuf><char/></allocbuf> 7056 <description> 7057 On return, points to the class's source file name, encoded as a 7058 <internallink id="mUTF">modified UTF-8</internallink> string. 7059 </description> 7060 </param> 7061 </parameters> 7062 <errors> 7063 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 7064 Class information does not include a source file name. This includes 7065 cases where the class is an array class or primitive class. 7066 </error> 7067 </errors> 7068 </function> 7069 7070 <function id="GetClassModifiers" phase="start" num="51"> 7071 <synopsis>Get Class Modifiers</synopsis> 7072 <description> 7073 For the class indicated by <code>klass</code>, return the access 7074 flags 7075 via <code>modifiers_ptr</code>. 7076 Access flags are defined in <vmspec chapter="4"/>. 7077 <p/> 7078 If the class is an array class, then its public, private, and protected 7079 modifiers are the same as those of its component type. For arrays of 7080 primitives, this component type is represented by one of the primitive 7081 classes (for example, <code>java.lang.Integer.TYPE</code>). 7082 <p/> 7083 If the class is a primitive class, its public modifier is always true, 7084 and its protected and private modifiers are always false. 7085 <p/> 7086 If the class is an array class or a primitive class then its final 7087 modifier is always true and its interface modifier is always false. 7088 The values of its other modifiers are not determined by this specification. 7089 7090 </description> 7091 <origin>jvmdi</origin> 7092 <capabilities> 7093 </capabilities> 7094 <parameters> 7095 <param id="klass"> 7096 <jclass/> 7097 <description> 7098 The class to query. 7099 </description> 7100 </param> 7101 <param id="modifiers_ptr"> 7102 <outptr><jint/></outptr> 7103 <description> 7104 On return, points to the current access flags of this class. 7105 7106 </description> 7107 </param> 7108 </parameters> 7109 <errors> 7110 </errors> 7111 </function> 7112 7113 <function id="GetClassMethods" phase="start" num="52"> 7114 <synopsis>Get Class Methods</synopsis> 7115 <description> 7116 For the class indicated by <code>klass</code>, return a count of 7117 methods via <code>method_count_ptr</code> and a list of 7118 method IDs via <code>methods_ptr</code>. The method list contains 7119 constructors and static initializers as well as true methods. 7120 Only directly declared methods are returned (not inherited methods). 7121 An empty method list is returned for array classes and primitive classes 7122 (for example, <code>java.lang.Integer.TYPE</code>). 7123 </description> 7124 <origin>jvmdi</origin> 7125 <capabilities> 7126 <capability id="can_maintain_original_method_order"/> 7127 </capabilities> 7128 <parameters> 7129 <param id="klass"> 7130 <jclass/> 7131 <description> 7132 The class to query. 7133 </description> 7134 </param> 7135 <param id="method_count_ptr"> 7136 <outptr><jint/></outptr> 7137 <description> 7138 On return, points to the number of methods declared in this class. 7139 </description> 7140 </param> 7141 <param id="methods_ptr"> 7142 <allocbuf outcount="method_count_ptr"><jmethodID class="klass"/></allocbuf> 7143 <description> 7144 On return, points to the method ID array. 7145 </description> 7146 </param> 7147 </parameters> 7148 <errors> 7149 <error id="JVMTI_ERROR_CLASS_NOT_PREPARED"> 7150 <paramlink id="klass"></paramlink> is not prepared. 7151 </error> 7152 </errors> 7153 </function> 7154 7155 <function id="GetClassFields" phase="start" num="53"> 7156 <synopsis>Get Class Fields</synopsis> 7157 <description> 7158 For the class indicated by <code>klass</code>, return a count of fields 7159 via <code>field_count_ptr</code> and a list of field IDs via 7160 <code>fields_ptr</code>. 7161 Only directly declared fields are returned (not inherited fields). 7162 Fields are returned in the order they occur in the class file. 7163 An empty field list is returned for array classes and primitive classes 7164 (for example, <code>java.lang.Integer.TYPE</code>). 7165 Use JNI to determine the length of an array. 7166 </description> 7167 <origin>jvmdi</origin> 7168 <capabilities> 7169 </capabilities> 7170 <parameters> 7171 <param id="klass"> 7172 <jclass/> 7173 <description> 7174 The class to query. 7175 </description> 7176 </param> 7177 <param id="field_count_ptr"> 7178 <outptr><jint/></outptr> 7179 <description> 7180 On return, points to the number of fields declared in this class. 7181 </description> 7182 </param> 7183 <param id="fields_ptr"> 7184 <allocbuf outcount="field_count_ptr"><jfieldID/></allocbuf> 7185 <description> 7186 On return, points to the field ID array. 7187 </description> 7188 </param> 7189 </parameters> 7190 <errors> 7191 <error id="JVMTI_ERROR_CLASS_NOT_PREPARED"> 7192 <paramlink id="klass"></paramlink> is not prepared. 7193 </error> 7194 </errors> 7195 </function> 7196 7197 <function id="GetImplementedInterfaces" phase="start" num="54"> 7198 <synopsis>Get Implemented Interfaces</synopsis> 7199 <description> 7200 Return the direct super-interfaces of this class. For a class, this 7201 function returns the interfaces declared in its <code>implements</code> 7202 clause. For an interface, this function returns the interfaces declared in 7203 its <code>extends</code> clause. 7204 An empty interface list is returned for array classes and primitive classes 7205 (for example, <code>java.lang.Integer.TYPE</code>). 7206 </description> 7207 <origin>jvmdi</origin> 7208 <capabilities> 7209 </capabilities> 7210 <parameters> 7211 <param id="klass"> 7212 <jclass/> 7213 <description> 7214 The class to query. 7215 </description> 7216 </param> 7217 <param id="interface_count_ptr"> 7218 <outptr><jint/></outptr> 7219 <description> 7220 On return, points to the number of interfaces. 7221 </description> 7222 </param> 7223 <param id="interfaces_ptr"> 7224 <allocbuf outcount="interface_count_ptr"><jclass/></allocbuf> 7225 <description> 7226 On return, points to the interface array. 7227 </description> 7228 </param> 7229 </parameters> 7230 <errors> 7231 <error id="JVMTI_ERROR_CLASS_NOT_PREPARED"> 7232 <paramlink id="klass"></paramlink> is not prepared. 7233 </error> 7234 </errors> 7235 </function> 7236 7237 <function id="GetClassVersionNumbers" phase="start" num="145" since="1.1"> 7238 <synopsis>Get Class Version Numbers</synopsis> 7239 <description> 7240 For the class indicated by <code>klass</code>, 7241 return the minor and major version numbers, 7242 as defined in 7243 <vmspec chapter="4"/>. 7244 </description> 7245 <origin>new</origin> 7246 <capabilities> 7247 </capabilities> 7248 <parameters> 7249 <param id="klass"> 7250 <jclass/> 7251 <description> 7252 The class to query. 7253 </description> 7254 </param> 7255 <param id="minor_version_ptr"> 7256 <outptr><jint/></outptr> 7257 <description> 7258 On return, points to the value of the 7259 <code>minor_version</code> item of the 7260 Class File Format. 7261 Note: to be consistent with the Class File Format, 7262 the minor version number is the first parameter. 7263 </description> 7264 </param> 7265 <param id="major_version_ptr"> 7266 <outptr><jint/></outptr> 7267 <description> 7268 On return, points to the value of the 7269 <code>major_version</code> item of the 7270 Class File Format. 7271 </description> 7272 </param> 7273 </parameters> 7274 <errors> 7275 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 7276 The class is a primitive or array class. 7277 </error> 7278 </errors> 7279 </function> 7280 7281 <function id="GetConstantPool" phase="start" num="146" since="1.1"> 7282 <synopsis>Get Constant Pool</synopsis> 7283 <description> 7284 For the class indicated by <code>klass</code>, 7285 return the raw bytes of the constant pool in the format of the 7286 <code>constant_pool</code> item of 7287 <vmspec chapter="4"/>. 7288 The format of the constant pool may differ between versions 7289 of the Class File Format, so, the 7290 <functionlink id="GetClassVersionNumbers">minor and major 7291 class version numbers</functionlink> should be checked for 7292 compatibility. 7293 <p/> 7294 The returned constant pool might not have the same layout or 7295 contents as the constant pool in the defining class file. 7296 The constant pool returned by GetConstantPool() may have 7297 more or fewer entries than the defining constant pool. 7298 Entries may be in a different order. 7299 The constant pool returned by GetConstantPool() will match the 7300 constant pool used by 7301 <functionlink id="GetBytecodes">GetBytecodes()</functionlink>. 7302 That is, the bytecodes returned by GetBytecodes() will have 7303 constant pool indices which refer to constant pool entries returned 7304 by GetConstantPool(). 7305 Note that since <functionlink id="RetransformClasses"/> 7306 and <functionlink id="RedefineClasses"/> can change 7307 the constant pool, the constant pool returned by this function 7308 can change accordingly. Thus, the correspondence between 7309 GetConstantPool() and GetBytecodes() does not hold if there 7310 is an intervening class retransformation or redefinition. 7311 The value of a constant pool entry used by a given bytecode will 7312 match that of the defining class file (even if the indices don't match). 7313 Constant pool entries which are not used directly or indirectly by 7314 bytecodes (for example, UTF-8 strings associated with annotations) are 7315 not required to exist in the returned constant pool. 7316 </description> 7317 <origin>new</origin> 7318 <capabilities> 7319 <required id="can_get_constant_pool"></required> 7320 </capabilities> 7321 <parameters> 7322 <param id="klass"> 7323 <jclass/> 7324 <description> 7325 The class to query. 7326 </description> 7327 </param> 7328 <param id="constant_pool_count_ptr"> 7329 <outptr><jint/></outptr> 7330 <description> 7331 On return, points to the number of entries 7332 in the constant pool table plus one. 7333 This corresponds to the <code>constant_pool_count</code> 7334 item of the Class File Format. 7335 </description> 7336 </param> 7337 <param id="constant_pool_byte_count_ptr"> 7338 <outptr><jint/></outptr> 7339 <description> 7340 On return, points to the number of bytes 7341 in the returned raw constant pool. 7342 </description> 7343 </param> 7344 <param id="constant_pool_bytes_ptr"> 7345 <allocbuf outcount="constant_pool_byte_count_ptr"><uchar/></allocbuf> 7346 <description> 7347 On return, points to the raw constant pool, that is the bytes 7348 defined by the <code>constant_pool</code> item of the 7349 Class File Format 7350 </description> 7351 </param> 7352 </parameters> 7353 <errors> 7354 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 7355 The class is a primitive or array class. 7356 </error> 7357 </errors> 7358 </function> 7359 7360 <function id="IsInterface" phase="start" num="55"> 7361 <synopsis>Is Interface</synopsis> 7362 <description> 7363 Determines whether a class object reference represents an interface. 7364 The <code>jboolean</code> result is 7365 <code>JNI_TRUE</code> if the "class" is actually an interface, 7366 <code>JNI_FALSE</code> otherwise. 7367 </description> 7368 <origin>jvmdi</origin> 7369 <capabilities> 7370 </capabilities> 7371 <parameters> 7372 <param id="klass"> 7373 <jclass/> 7374 <description> 7375 The class to query. 7376 </description> 7377 </param> 7378 <param id="is_interface_ptr"> 7379 <outptr><jboolean/></outptr> 7380 <description> 7381 On return, points to the boolean result of this function. 7382 7383 </description> 7384 </param> 7385 </parameters> 7386 <errors> 7387 </errors> 7388 </function> 7389 7390 <function id="IsArrayClass" phase="start" num="56"> 7391 <synopsis>Is Array Class</synopsis> 7392 <description> 7393 Determines whether a class object reference represents an array. 7394 The <code>jboolean</code> result is 7395 <code>JNI_TRUE</code> if the class is an array, 7396 <code>JNI_FALSE</code> otherwise. 7397 </description> 7398 <origin>jvmdi</origin> 7399 <capabilities> 7400 </capabilities> 7401 <parameters> 7402 <param id="klass"> 7403 <jclass/> 7404 <description> 7405 The class to query. 7406 </description> 7407 </param> 7408 <param id="is_array_class_ptr"> 7409 <outptr><jboolean/></outptr> 7410 <description> 7411 On return, points to the boolean result of this function. 7412 7413 </description> 7414 </param> 7415 </parameters> 7416 <errors> 7417 </errors> 7418 </function> 7419 7420 <function id="IsModifiableClass" jkernel="yes" phase="start" num="45" since="1.1"> 7421 <synopsis>Is Modifiable Class</synopsis> 7422 <description> 7423 Determines whether a class is modifiable. 7424 If a class is modifiable (<paramlink id="is_modifiable_class_ptr"/> 7425 returns <code>JNI_TRUE</code>) the class can be 7426 redefined with <functionlink id="RedefineClasses"/> (assuming 7427 the agent possesses the 7428 <fieldlink id="can_redefine_classes" struct="jvmtiCapabilities"/> 7429 capability) or 7430 retransformed with <functionlink id="RetransformClasses"/> (assuming 7431 the agent possesses the 7432 <fieldlink id="can_retransform_classes" struct="jvmtiCapabilities"/> 7433 capability). 7434 If a class is not modifiable (<paramlink id="is_modifiable_class_ptr"/> 7435 returns <code>JNI_FALSE</code>) the class can be neither 7436 redefined nor retransformed. 7437 <p/> 7438 Primitive classes (for example, <code>java.lang.Integer.TYPE</code>), 7439 array classes, and some implementation defined classes are never modifiable. 7440 <p/> 7441 </description> 7442 <origin>new</origin> 7443 <capabilities> 7444 <capability id="can_redefine_any_class"> 7445 If possessed then all classes (except primitive, array, and some implementation defined 7446 classes) are modifiable (redefine or retransform). 7447 </capability> 7448 <capability id="can_retransform_any_class"> 7449 If possessed then all classes (except primitive, array, and some implementation defined 7450 classes) are modifiable with <functionlink id="RetransformClasses"/>. 7451 </capability> 7452 <capability id="can_redefine_classes"> 7453 No effect on the result of the function. 7454 But must additionally be possessed to modify the class with 7455 <functionlink id="RedefineClasses"/>. 7456 </capability> 7457 <capability id="can_retransform_classes"> 7458 No effect on the result of the function. 7459 But must additionally be possessed to modify the class with 7460 <functionlink id="RetransformClasses"/>. 7461 </capability> 7462 </capabilities> 7463 <parameters> 7464 <param id="klass"> 7465 <jclass/> 7466 <description> 7467 The class to query. 7468 </description> 7469 </param> 7470 <param id="is_modifiable_class_ptr"> 7471 <outptr><jboolean/></outptr> 7472 <description> 7473 On return, points to the boolean result of this function. 7474 </description> 7475 </param> 7476 </parameters> 7477 <errors> 7478 </errors> 7479 </function> 7480 7481 <function id="GetClassLoader" phase="start" num="57"> 7482 <synopsis>Get Class Loader</synopsis> 7483 <description> 7484 For the class indicated by <code>klass</code>, return via 7485 <code>classloader_ptr</code> a reference to the class loader for the 7486 class. 7487 </description> 7488 <origin>jvmdi</origin> 7489 <capabilities> 7490 </capabilities> 7491 <parameters> 7492 <param id="klass"> 7493 <jclass/> 7494 <description> 7495 The class to query. 7496 </description> 7497 </param> 7498 <param id="classloader_ptr"> 7499 <outptr><jobject/></outptr> 7500 <description> 7501 On return, points to the class loader that loaded 7502 this class. 7503 If the class was not created by a class loader 7504 or if the class loader is the bootstrap class loader, 7505 points to <code>NULL</code>. 7506 </description> 7507 </param> 7508 </parameters> 7509 <errors> 7510 </errors> 7511 7512 </function> 7513 7514 <function id="GetSourceDebugExtension" phase="start" num="90"> 7515 <synopsis>Get Source Debug Extension</synopsis> 7516 <description> 7517 For the class indicated by <code>klass</code>, return the debug 7518 extension via <code>source_debug_extension_ptr</code>. 7519 The returned string 7520 contains exactly the debug extension information present in the 7521 class file of <code>klass</code>. 7522 </description> 7523 <origin>jvmdi</origin> 7524 <capabilities> 7525 <required id="can_get_source_debug_extension"></required> 7526 </capabilities> 7527 <parameters> 7528 <param id="klass"> 7529 <jclass/> 7530 <description> 7531 The class to query. 7532 </description> 7533 </param> 7534 <param id="source_debug_extension_ptr"> 7535 <allocbuf><char/></allocbuf> 7536 <description> 7537 On return, points to the class's debug extension, encoded as a 7538 <internallink id="mUTF">modified UTF-8</internallink> string. 7539 </description> 7540 </param> 7541 </parameters> 7542 <errors> 7543 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 7544 Class information does not include a debug extension. 7545 </error> 7546 </errors> 7547 </function> 7548 7549 <function id="RetransformClasses" jkernel="yes" num="152" since="1.1"> 7550 <synopsis>Retransform Classes</synopsis> 7551 <description> 7552 This function facilitates the 7553 <internallink id="bci">bytecode instrumentation</internallink> 7554 of already loaded classes. 7555 To replace the class definition without reference to the existing 7556 bytecodes, as one might do when recompiling from source for 7557 fix-and-continue debugging, <functionlink id="RedefineClasses"/> 7558 function should be used instead. 7559 <p/> 7560 When classes are initially loaded or when they are 7561 <functionlink id="RedefineClasses">redefined</functionlink>, 7562 the initial class file bytes can be transformed with the 7563 <eventlink id="ClassFileLoadHook"/> event. 7564 This function reruns the transformation process 7565 (whether or not a transformation has previously occurred). 7566 This retransformation follows these steps: 7567 <ul> 7568 <li>starting from the initial class file bytes 7569 </li> 7570 <li>for each <fieldlink id="can_retransform_classes" 7571 struct="jvmtiCapabilities">retransformation 7572 incapable</fieldlink> 7573 agent which received a 7574 <code>ClassFileLoadHook</code> event during the previous 7575 load or redefine, the bytes it returned 7576 (via the <code>new_class_data</code> parameter) 7577 are reused as the output of the transformation; 7578 note that this is equivalent to reapplying 7579 the previous transformation, unaltered. except that 7580 the <code>ClassFileLoadHook</code> event 7581 is <b>not</b> sent to these agents 7582 </li> 7583 <li>for each <fieldlink id="can_retransform_classes" 7584 struct="jvmtiCapabilities">retransformation 7585 capable</fieldlink> 7586 agent, the <code>ClassFileLoadHook</code> event is sent, 7587 allowing a new transformation to be applied 7588 </li> 7589 <li>the transformed class file bytes are installed as the new 7590 definition of the class 7591 </li> 7592 </ul> 7593 See the <eventlink id="ClassFileLoadHook"/> event for more details. 7594 <p/> 7595 The initial class file bytes represent the bytes passed to 7596 <code>ClassLoader.defineClass</code> 7597 or <code>RedefineClasses</code> (before any transformations 7598 were applied), however they may not exactly match them. 7599 The constant pool may differ in ways described in 7600 <functionlink id="GetConstantPool"/>. 7601 Constant pool indices in the bytecodes of methods will correspond. 7602 Some attributes may not be present. 7603 Where order is not meaningful, for example the order of methods, 7604 order may not be preserved. 7605 <p/> 7606 Retransformation can cause new versions of methods to be installed. 7607 Old method versions may become 7608 <internallink id="obsoleteMethods">obsolete</internallink> 7609 The new method version will be used on new invokes. 7610 If a method has active stack frames, those active frames continue to 7611 run the bytecodes of the original method version. 7612 <p/> 7613 This function does not cause any initialization except that which 7614 would occur under the customary JVM semantics. 7615 In other words, retransforming a class does not cause its initializers to be 7616 run. The values of static fields will remain as they were 7617 prior to the call. 7618 <p/> 7619 Threads need not be suspended. 7620 <p/> 7621 All breakpoints in the class are cleared. 7622 <p/> 7623 All attributes are updated. 7624 <p/> 7625 Instances of the retransformed class are not affected -- fields retain their 7626 previous values. 7627 <functionlink id="GetTag">Tags</functionlink> on the instances are 7628 also unaffected. 7629 <p/> 7630 In response to this call, no events other than the 7631 <eventlink id="ClassFileLoadHook"/> event 7632 will be sent. 7633 <p/> 7634 The retransformation may change method bodies, the constant pool and attributes. 7635 The retransformation must not add, remove or rename fields or methods, change the 7636 signatures of methods, change modifiers, or change inheritance. 7637 These restrictions may be lifted in future versions. 7638 See the error return description below for information on error codes 7639 returned if an unsupported retransformation is attempted. 7640 The class file bytes are not verified or installed until they have passed 7641 through the chain of <eventlink id="ClassFileLoadHook"/> events, thus the 7642 returned error code reflects the result of the transformations. 7643 If any error code is returned other than <code>JVMTI_ERROR_NONE</code>, 7644 none of the classes to be retransformed will have a new definition installed. 7645 When this function returns (with the error code of <code>JVMTI_ERROR_NONE</code>) 7646 all of the classes to be retransformed will have their new definitions installed. 7647 </description> 7648 <origin>new</origin> 7649 <capabilities> 7650 <required id="can_retransform_classes"></required> 7651 <capability id="can_retransform_any_class"></capability> 7652 </capabilities> 7653 <parameters> 7654 <param id="class_count"> 7655 <jint min="0"/> 7656 <description> 7657 The number of classes to be retransformed. 7658 </description> 7659 </param> 7660 <param id="classes"> 7661 <inbuf incount="class_count"><jclass/></inbuf> 7662 <description> 7663 The array of classes to be retransformed. 7664 </description> 7665 </param> 7666 </parameters> 7667 <errors> 7668 <error id="JVMTI_ERROR_UNMODIFIABLE_CLASS"> 7669 One of the <paramlink id="classes"/> cannot be modified. 7670 See <functionlink id="IsModifiableClass"/>. 7671 </error> 7672 <error id="JVMTI_ERROR_INVALID_CLASS"> 7673 One of the <paramlink id="classes"/> is not a valid class. 7674 </error> 7675 <error id="JVMTI_ERROR_UNSUPPORTED_VERSION"> 7676 A retransformed class file has a version number not supported by this VM. 7677 </error> 7678 <error id="JVMTI_ERROR_INVALID_CLASS_FORMAT"> 7679 A retransformed class file is malformed (The VM would return a <code>ClassFormatError</code>). 7680 </error> 7681 <error id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION"> 7682 The retransformed class file definitions would lead to a circular definition 7683 (the VM would return a <code>ClassCircularityError</code>). 7684 </error> 7685 <error id="JVMTI_ERROR_FAILS_VERIFICATION"> 7686 The retransformed class file bytes fail verification. 7687 </error> 7688 <error id="JVMTI_ERROR_NAMES_DONT_MATCH"> 7689 The class name defined in a retransformed class file is 7690 different from the name in the old class object. 7691 </error> 7692 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED"> 7693 A retransformed class file would require adding a method. 7694 </error> 7695 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED"> 7696 A retransformed class file changes a field. 7697 </error> 7698 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED"> 7699 A direct superclass is different for a retransformed class file, 7700 or the set of directly implemented 7701 interfaces is different. 7702 </error> 7703 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED"> 7704 A retransformed class file does not declare a method 7705 declared in the old class version. 7706 </error> 7707 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED"> 7708 A retransformed class file has different class modifiers. 7709 </error> 7710 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED"> 7711 A method in the retransformed class file has different modifiers 7712 than its counterpart in the old class version. 7713 </error> 7714 </errors> 7715 </function> 7716 7717 <function id="RedefineClasses" jkernel="yes" num="87"> 7718 <synopsis>Redefine Classes</synopsis> 7719 <typedef id="jvmtiClassDefinition" label="Class redefinition description"> 7720 <field id="klass"> 7721 <jclass/> 7722 <description> 7723 Class object for this class 7724 </description> 7725 </field> 7726 <field id="class_byte_count"> 7727 <jint/> 7728 <description> 7729 Number of bytes defining class (below) 7730 </description> 7731 </field> 7732 <field id="class_bytes"> 7733 <inbuf incount="class_byte_count"><uchar/></inbuf> 7734 <description> 7735 Bytes defining class (in <vmspec chapter="4"/>) 7736 </description> 7737 </field> 7738 </typedef> 7739 <description> 7740 All classes given are redefined according to the definitions 7741 supplied. 7742 This function is used to replace the definition of a class 7743 with a new definition, as might be needed in fix-and-continue 7744 debugging. 7745 Where the existing class file bytes are to be transformed, for 7746 example in 7747 <internallink id="bci">bytecode instrumentation</internallink>, 7748 <functionlink id="RetransformClasses"/> should be used. 7749 <p/> 7750 Redefinition can cause new versions of methods to be installed. 7751 Old method versions may become 7752 <internallink id="obsoleteMethods">obsolete</internallink> 7753 The new method version will be used on new invokes. 7754 If a method has active stack frames, those active frames continue to 7755 run the bytecodes of the original method version. 7756 If resetting of stack frames is desired, use 7757 <functionlink id="PopFrame"></functionlink> 7758 to pop frames with obsolete method versions. 7759 <p/> 7760 This function does not cause any initialization except that which 7761 would occur under the customary JVM semantics. 7762 In other words, redefining a class does not cause its initializers to be 7763 run. The values of static fields will remain as they were 7764 prior to the call. 7765 <p/> 7766 Threads need not be suspended. 7767 <p/> 7768 All breakpoints in the class are cleared. 7769 <p/> 7770 All attributes are updated. 7771 <p/> 7772 Instances of the redefined class are not affected -- fields retain their 7773 previous values. 7774 <functionlink id="GetTag">Tags</functionlink> on the instances are 7775 also unaffected. 7776 <p/> 7777 In response to this call, the <jvmti/> event 7778 <eventlink id="ClassFileLoadHook">Class File Load Hook</eventlink> 7779 will be sent (if enabled), but no other <jvmti/> events will be sent. 7780 <p/> 7781 The redefinition may change method bodies, the constant pool and attributes. 7782 The redefinition must not add, remove or rename fields or methods, change the 7783 signatures of methods, change modifiers, or change inheritance. 7784 These restrictions may be lifted in future versions. 7785 See the error return description below for information on error codes 7786 returned if an unsupported redefinition is attempted. 7787 The class file bytes are not verified or installed until they have passed 7788 through the chain of <eventlink id="ClassFileLoadHook"/> events, thus the 7789 returned error code reflects the result of the transformations applied 7790 to the bytes passed into <paramlink id="class_definitions"/>. 7791 If any error code is returned other than <code>JVMTI_ERROR_NONE</code>, 7792 none of the classes to be redefined will have a new definition installed. 7793 When this function returns (with the error code of <code>JVMTI_ERROR_NONE</code>) 7794 all of the classes to be redefined will have their new definitions installed. 7795 </description> 7796 <origin>jvmdi</origin> 7797 <capabilities> 7798 <required id="can_redefine_classes"></required> 7799 <capability id="can_redefine_any_class"></capability> 7800 </capabilities> 7801 <parameters> 7802 <param id="class_count"> 7803 <jint min="0"/> 7804 <description> 7805 The number of classes specified in <code>class_definitions</code> 7806 </description> 7807 </param> 7808 <param id="class_definitions"> 7809 <inbuf incount="class_count"><struct>jvmtiClassDefinition</struct></inbuf> 7810 <description> 7811 The array of new class definitions 7812 </description> 7813 </param> 7814 </parameters> 7815 <errors> 7816 <error id="JVMTI_ERROR_NULL_POINTER"> 7817 One of <code>class_bytes</code> is <code>NULL</code>. 7818 </error> 7819 <error id="JVMTI_ERROR_UNMODIFIABLE_CLASS"> 7820 An element of <code>class_definitions</code> cannot be modified. 7821 See <functionlink id="IsModifiableClass"/>. 7822 </error> 7823 <error id="JVMTI_ERROR_INVALID_CLASS"> 7824 An element of <code>class_definitions</code> is not a valid class. 7825 </error> 7826 <error id="JVMTI_ERROR_UNSUPPORTED_VERSION"> 7827 A new class file has a version number not supported by this VM. 7828 </error> 7829 <error id="JVMTI_ERROR_INVALID_CLASS_FORMAT"> 7830 A new class file is malformed (The VM would return a <code>ClassFormatError</code>). 7831 </error> 7832 <error id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION"> 7833 The new class file definitions would lead to a circular definition 7834 (the VM would return a <code>ClassCircularityError</code>). 7835 </error> 7836 <error id="JVMTI_ERROR_FAILS_VERIFICATION"> 7837 The class bytes fail verification. 7838 </error> 7839 <error id="JVMTI_ERROR_NAMES_DONT_MATCH"> 7840 The class name defined in a new class file is 7841 different from the name in the old class object. 7842 </error> 7843 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED"> 7844 A new class file would require adding a method. 7845 </error> 7846 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED"> 7847 A new class version changes a field. 7848 </error> 7849 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED"> 7850 A direct superclass is different for a new class 7851 version, or the set of directly implemented 7852 interfaces is different. 7853 </error> 7854 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED"> 7855 A new class version does not declare a method 7856 declared in the old class version. 7857 </error> 7858 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED"> 7859 A new class version has different modifiers. 7860 </error> 7861 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED"> 7862 A method in the new class version has different modifiers 7863 than its counterpart in the old class version. 7864 </error> 7865 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE"> 7866 A module cannot be modified. 7867 See <functionlink id="IsModifiableModule"/>. 7868 </error> 7869 </errors> 7870 </function> 7871 7872 </category> 7873 7874 <category id="object" label="Object"> 7875 7876 <function id="GetObjectSize" jkernel="yes" phase="start" num="154"> 7877 <synopsis>Get Object Size</synopsis> 7878 <description> 7879 For the object indicated by <code>object</code>, 7880 return via <code>size_ptr</code> the size of the object. 7881 This size is an implementation-specific approximation of 7882 the amount of storage consumed by this object. 7883 It may include some or all of the object's overhead, and thus 7884 is useful for comparison within an implementation but not 7885 between implementations. 7886 The estimate may change during a single invocation of the JVM. 7887 </description> 7888 <origin>new</origin> 7889 <capabilities> 7890 </capabilities> 7891 <parameters> 7892 <param id="object"> 7893 <jobject/> 7894 <description> 7895 The object to query. 7896 </description> 7897 </param> 7898 <param id="size_ptr"> 7899 <outptr><jlong/></outptr> 7900 <description> 7901 On return, points to the object's size in bytes. 7902 </description> 7903 </param> 7904 </parameters> 7905 <errors> 7906 </errors> 7907 </function> 7908 7909 <function id="GetObjectHashCode" phase="start" num="58"> 7910 <synopsis>Get Object Hash Code</synopsis> 7911 <description> 7912 For the object indicated by <code>object</code>, 7913 return via <code>hash_code_ptr</code> a hash code. 7914 This hash code could be used to maintain a hash table of object references, 7915 however, on some implementations this can cause significant performance 7916 impacts--in most cases 7917 <internallink id="Heap">tags</internallink> 7918 will be a more efficient means of associating information with objects. 7919 This function guarantees 7920 the same hash code value for a particular object throughout its life 7921 </description> 7922 <origin>jvmdi</origin> 7923 <capabilities> 7924 </capabilities> 7925 <parameters> 7926 <param id="object"> 7927 <jobject/> 7928 <description> 7929 The object to query. 7930 </description> 7931 </param> 7932 <param id="hash_code_ptr"> 7933 <outptr><jint/></outptr> 7934 <description> 7935 On return, points to the object's hash code. 7936 </description> 7937 </param> 7938 </parameters> 7939 <errors> 7940 </errors> 7941 </function> 7942 7943 <function id="GetObjectMonitorUsage" num="59"> 7944 <synopsis>Get Object Monitor Usage</synopsis> 7945 <typedef id="jvmtiMonitorUsage" label="Object monitor usage information"> 7946 <field id="owner"> 7947 <jthread/> 7948 <description> 7949 The thread owning this monitor, or <code>NULL</code> if unused 7950 </description> 7951 </field> 7952 <field id="entry_count"> 7953 <jint/> 7954 <description> 7955 The number of times the owning thread has entered the monitor 7956 </description> 7957 </field> 7958 <field id="waiter_count"> 7959 <jint/> 7960 <description> 7961 The number of threads waiting to own this monitor 7962 </description> 7963 </field> 7964 <field id="waiters"> 7965 <allocfieldbuf><jthread/></allocfieldbuf> 7966 <description> 7967 The <code>waiter_count</code> waiting threads 7968 </description> 7969 </field> 7970 <field id="notify_waiter_count"> 7971 <jint/> 7972 <description> 7973 The number of threads waiting to be notified by this monitor 7974 </description> 7975 </field> 7976 <field id="notify_waiters"> 7977 <allocfieldbuf><jthread/></allocfieldbuf> 7978 <description> 7979 The <code>notify_waiter_count</code> threads waiting to be notified 7980 </description> 7981 </field> 7982 </typedef> 7983 <description> 7984 Get information about the object's monitor. 7985 The fields of the <functionlink id="jvmtiMonitorUsage"></functionlink> structure 7986 are filled in with information about usage of the monitor. 7987 <todo> 7988 Decide and then clarify suspend requirements. 7989 </todo> 7990 </description> 7991 <origin>jvmdi</origin> 7992 <capabilities> 7993 <required id="can_get_monitor_info"></required> 7994 </capabilities> 7995 <parameters> 7996 <param id="object"> 7997 <jobject/> 7998 <description> 7999 The object to query. 8000 </description> 8001 </param> 8002 <param id="info_ptr"> 8003 <outptr><struct>jvmtiMonitorUsage</struct></outptr> 8004 <description> 8005 On return, filled with monitor information for the 8006 specified object. 8007 </description> 8008 </param> 8009 </parameters> 8010 <errors> 8011 </errors> 8012 </function> 8013 8014 <elide> 8015 <function id="GetObjectMonitors" num="116"> 8016 <synopsis>Get Object Monitors</synopsis> 8017 <description> 8018 Return the list of object monitors. 8019 <p/> 8020 Note: details about each monitor can be examined with 8021 <functionlink id="GetObjectMonitorUsage"></functionlink>. 8022 </description> 8023 <origin>new</origin> 8024 <capabilities> 8025 <required id="can_get_monitor_info"></required> 8026 </capabilities> 8027 <parameters> 8028 <param id="monitorCnt"> 8029 <outptr><jint/></outptr> 8030 <description> 8031 On return, pointer to the number 8032 of monitors returned in <code>monitors_ptr</code>. 8033 </description> 8034 </param> 8035 <param id="monitors_ptr"> 8036 <allocbuf outcount="monitorCnt"><jobject/></allocbuf> 8037 <description> 8038 On return, pointer to the monitor list. 8039 </description> 8040 </param> 8041 </parameters> 8042 <errors> 8043 </errors> 8044 </function> 8045 </elide> 8046 8047 </category> 8048 8049 <category id="fieldCategory" label="Field"> 8050 8051 <intro> 8052 </intro> 8053 8054 <function id="GetFieldName" phase="start" num="60"> 8055 <synopsis>Get Field Name (and Signature)</synopsis> 8056 <description> 8057 For the field indicated by <paramlink id="klass"/> and <paramlink id="field"/>, 8058 return the field name via <paramlink id="name_ptr"/> and field signature via 8059 <paramlink id="signature_ptr"/>. 8060 <p/> 8061 Field signatures are defined in the 8062 <externallink id="jni/index.html">JNI Specification</externallink> 8063 and are referred to as <code>field descriptors</code> in 8064 <vmspec chapter="4.3.2"/>. 8065 </description> 8066 <origin>jvmdiClone</origin> 8067 <capabilities> 8068 </capabilities> 8069 <parameters> 8070 <param id="klass"> 8071 <jclass field="field"/> 8072 <description> 8073 The class of the field to query. 8074 </description> 8075 </param> 8076 <param id="field"> 8077 <jfieldID class="klass"/> 8078 <description> 8079 The field to query. 8080 </description> 8081 </param> 8082 <param id="name_ptr"> 8083 <allocbuf> 8084 <char/> 8085 <nullok>the name is not returned</nullok> 8086 </allocbuf> 8087 <description> 8088 On return, points to the field name, encoded as a 8089 <internallink id="mUTF">modified UTF-8</internallink> string. 8090 </description> 8091 </param> 8092 <param id="signature_ptr"> 8093 <allocbuf> 8094 <char/> 8095 <nullok>the signature is not returned</nullok> 8096 </allocbuf> 8097 <description> 8098 On return, points to the field signature, encoded as a 8099 <internallink id="mUTF">modified UTF-8</internallink> string. 8100 </description> 8101 </param> 8102 <param id="generic_ptr"> 8103 <allocbuf> 8104 <char/> 8105 <nullok>the generic signature is not returned</nullok> 8106 </allocbuf> 8107 <description> 8108 On return, points to the generic signature of the field, encoded as a 8109 <internallink id="mUTF">modified UTF-8</internallink> string. 8110 If there is no generic signature attribute for the field, then, 8111 on return, points to <code>NULL</code>. 8112 </description> 8113 </param> 8114 </parameters> 8115 <errors> 8116 </errors> 8117 </function> 8118 8119 <function id="GetFieldDeclaringClass" phase="start" num="61"> 8120 <synopsis>Get Field Declaring Class</synopsis> 8121 <description> 8122 For the field indicated by <code>klass</code> and <code>field</code> 8123 return the class that defined it via <code>declaring_class_ptr</code>. 8124 The declaring class will either be <code>klass</code>, a superclass, or 8125 an implemented interface. 8126 </description> 8127 <origin>jvmdi</origin> 8128 <capabilities> 8129 </capabilities> 8130 <parameters> 8131 <param id="klass"> 8132 <jclass field="field"/> 8133 <description> 8134 The class to query. 8135 </description> 8136 </param> 8137 <param id="field"> 8138 <jfieldID class="klass"/> 8139 <description> 8140 The field to query. 8141 </description> 8142 </param> 8143 <param id="declaring_class_ptr"> 8144 <outptr><jclass/></outptr> 8145 <description> 8146 On return, points to the declaring class 8147 </description> 8148 </param> 8149 </parameters> 8150 <errors> 8151 </errors> 8152 </function> 8153 8154 <function id="GetFieldModifiers" phase="start" num="62"> 8155 <synopsis>Get Field Modifiers</synopsis> 8156 <description> 8157 For the field indicated by <code>klass</code> and <code>field</code> 8158 return the access flags via <code>modifiers_ptr</code>. 8159 Access flags are defined in <vmspec chapter="4"/>. 8160 </description> 8161 <origin>jvmdi</origin> 8162 <capabilities> 8163 </capabilities> 8164 <parameters> 8165 <param id="klass"> 8166 <jclass field="field"/> 8167 <description> 8168 The class to query. 8169 </description> 8170 </param> 8171 <param id="field"> 8172 <jfieldID class="klass"/> 8173 <description> 8174 The field to query. 8175 </description> 8176 </param> 8177 <param id="modifiers_ptr"> 8178 <outptr><jint/></outptr> 8179 <description> 8180 On return, points to the access flags. 8181 </description> 8182 </param> 8183 </parameters> 8184 <errors> 8185 </errors> 8186 </function> 8187 8188 <function id="IsFieldSynthetic" phase="start" num="63"> 8189 <synopsis>Is Field Synthetic</synopsis> 8190 <description> 8191 For the field indicated by <code>klass</code> and <code>field</code>, return a 8192 value indicating whether the field is synthetic via <code>is_synthetic_ptr</code>. 8193 Synthetic fields are generated by the compiler but not present in the 8194 original source code. 8195 </description> 8196 <origin>jvmdi</origin> 8197 <capabilities> 8198 <required id="can_get_synthetic_attribute"></required> 8199 </capabilities> 8200 <parameters> 8201 <param id="klass"> 8202 <jclass field="field"/> 8203 <description> 8204 The class of the field to query. 8205 </description> 8206 </param> 8207 <param id="field"> 8208 <jfieldID class="klass"/> 8209 <description> 8210 The field to query. 8211 </description> 8212 </param> 8213 <param id="is_synthetic_ptr"> 8214 <outptr><jboolean/></outptr> 8215 <description> 8216 On return, points to the boolean result of this function. 8217 </description> 8218 </param> 8219 </parameters> 8220 <errors> 8221 </errors> 8222 </function> 8223 8224 </category> 8225 8226 <category id="method" label="Method"> 8227 8228 <intro> 8229 These functions provide information about a method (represented as a 8230 <typelink id="jmethodID"/>) and set how methods are processed. 8231 </intro> 8232 8233 <intro id="obsoleteMethods" label="Obsolete Methods"> 8234 The functions <functionlink id="RetransformClasses"/> and 8235 <functionlink id="RedefineClasses"/> can cause new versions 8236 of methods to be installed. 8237 An original version of a method is considered equivalent 8238 to the new version if: 8239 <ul> 8240 <li>their bytecodes are the same except for indices into the 8241 constant pool and </li> 8242 <li>the referenced constants are equal.</li> 8243 </ul> 8244 An original method version which is not equivalent to the 8245 new method version is called obsolete and is assigned a new method ID; 8246 the original method ID now refers to the new method version. 8247 A method ID can be tested for obsolescence with 8248 <functionlink id="IsMethodObsolete"/>. 8249 </intro> 8250 8251 <function id="GetMethodName" phase="start" num="64"> 8252 <synopsis>Get Method Name (and Signature)</synopsis> 8253 <description> 8254 For the method indicated by <code>method</code>, 8255 return the method name via <code>name_ptr</code> and method signature via 8256 <code>signature_ptr</code>. 8257 <p/> 8258 Method signatures are defined in the 8259 <externallink id="jni/index.html">JNI Specification</externallink> 8260 and are referred to as <code>method descriptors</code> in 8261 <vmspec chapter="4.3.3"/>. 8262 Note this is different 8263 than method signatures as defined in the <i>Java Language Specification</i>. 8264 </description> 8265 <origin>jvmdiClone</origin> 8266 <capabilities> 8267 </capabilities> 8268 <parameters> 8269 <param id="method"> 8270 <jmethodID/> 8271 <description> 8272 The method to query. 8273 </description> 8274 </param> 8275 <param id="name_ptr"> 8276 <allocbuf> 8277 <char/> 8278 <nullok>the name is not returned</nullok> 8279 </allocbuf> 8280 <description> 8281 On return, points to the method name, encoded as a 8282 <internallink id="mUTF">modified UTF-8</internallink> string. 8283 </description> 8284 </param> 8285 <param id="signature_ptr"> 8286 <allocbuf> 8287 <char/> 8288 <nullok>the signature is not returned</nullok> 8289 </allocbuf> 8290 <description> 8291 On return, points to the method signature, encoded as a 8292 <internallink id="mUTF">modified UTF-8</internallink> string. 8293 </description> 8294 </param> 8295 <param id="generic_ptr"> 8296 <allocbuf> 8297 <char/> 8298 <nullok>the generic signature is not returned</nullok> 8299 </allocbuf> 8300 <description> 8301 On return, points to the generic signature of the method, encoded as a 8302 <internallink id="mUTF">modified UTF-8</internallink> string. 8303 If there is no generic signature attribute for the method, then, 8304 on return, points to <code>NULL</code>. 8305 </description> 8306 </param> 8307 </parameters> 8308 <errors> 8309 </errors> 8310 </function> 8311 8312 <function id="GetMethodDeclaringClass" phase="start" num="65"> 8313 <synopsis>Get Method Declaring Class</synopsis> 8314 <description> 8315 For the method indicated by <code>method</code>, 8316 return the class that defined it via <code>declaring_class_ptr</code>. 8317 </description> 8318 <origin>jvmdi</origin> 8319 <capabilities> 8320 </capabilities> 8321 <parameters> 8322 <param id="klass"> 8323 <jclass method="method"/> 8324 <description> 8325 The class to query. 8326 </description> 8327 </param> 8328 <param id="method"> 8329 <jmethodID class="klass"/> 8330 <description> 8331 The method to query. 8332 </description> 8333 </param> 8334 <param id="declaring_class_ptr"> 8335 <outptr><jclass/></outptr> 8336 <description> 8337 On return, points to the declaring class 8338 </description> 8339 </param> 8340 </parameters> 8341 <errors> 8342 </errors> 8343 </function> 8344 8345 <function id="GetMethodModifiers" phase="start" num="66"> 8346 <synopsis>Get Method Modifiers</synopsis> 8347 <description> 8348 For the method indicated by <code>method</code>, 8349 return the access flags via <code>modifiers_ptr</code>. 8350 Access flags are defined in <vmspec chapter="4"/>. 8351 </description> 8352 <origin>jvmdi</origin> 8353 <capabilities> 8354 </capabilities> 8355 <parameters> 8356 <param id="klass"> 8357 <jclass method="method"/> 8358 <description> 8359 The class to query. 8360 </description> 8361 </param> 8362 <param id="method"> 8363 <jmethodID class="klass"/> 8364 <description> 8365 The method to query. 8366 </description> 8367 </param> 8368 <param id="modifiers_ptr"> 8369 <outptr><jint/></outptr> 8370 <description> 8371 On return, points to the access flags. 8372 </description> 8373 </param> 8374 </parameters> 8375 <errors> 8376 </errors> 8377 </function> 8378 8379 <function id="GetMaxLocals" phase="start" num="68"> 8380 <synopsis>Get Max Locals</synopsis> 8381 <description> 8382 For the method indicated by <code>method</code>, 8383 return the number of local variable slots used by the method, 8384 including the local variables used to pass parameters to the 8385 method on its invocation. 8386 <p/> 8387 See <code>max_locals</code> in <vmspec chapter="4.7.3"/>. 8388 </description> 8389 <origin>jvmdi</origin> 8390 <capabilities> 8391 </capabilities> 8392 <parameters> 8393 <param id="klass"> 8394 <jclass method="method"/> 8395 <description> 8396 The class to query. 8397 </description> 8398 </param> 8399 <param id="method"> 8400 <jmethodID class="klass" native="error"/> 8401 <description> 8402 The method to query. 8403 </description> 8404 </param> 8405 <param id="max_ptr"> 8406 <outptr><jint/></outptr> 8407 <description> 8408 On return, points to the maximum number of local slots 8409 </description> 8410 </param> 8411 </parameters> 8412 <errors> 8413 </errors> 8414 </function> 8415 8416 <function id="GetArgumentsSize" phase="start" num="69"> 8417 <synopsis>Get Arguments Size</synopsis> 8418 <description> 8419 For the method indicated by <code>method</code>, 8420 return via <code>max_ptr</code> the number of local variable slots used 8421 by the method's arguments. 8422 Note that two-word arguments use two slots. 8423 </description> 8424 <origin>jvmdi</origin> 8425 <capabilities> 8426 </capabilities> 8427 <parameters> 8428 <param id="klass"> 8429 <jclass method="method"/> 8430 <description> 8431 The class to query. 8432 </description> 8433 </param> 8434 <param id="method"> 8435 <jmethodID class="klass" native="error"/> 8436 <description> 8437 The method to query. 8438 </description> 8439 </param> 8440 <param id="size_ptr"> 8441 <outptr><jint/></outptr> 8442 <description> 8443 On return, points to the number of argument slots 8444 </description> 8445 </param> 8446 </parameters> 8447 <errors> 8448 </errors> 8449 </function> 8450 8451 <function id="GetLineNumberTable" phase="start" num="70"> 8452 <synopsis>Get Line Number Table</synopsis> 8453 <typedef id="jvmtiLineNumberEntry" label="Line number table entry"> 8454 <field id="start_location"> 8455 <jlocation/> 8456 <description> 8457 the <datalink id="jlocation"></datalink> where the line begins 8458 </description> 8459 </field> 8460 <field id="line_number"> 8461 <jint/> 8462 <description> 8463 the line number 8464 </description> 8465 </field> 8466 </typedef> 8467 <description> 8468 For the method indicated by <code>method</code>, 8469 return a table of source line number entries. The size of the table is 8470 returned via <code>entry_count_ptr</code> and the table itself is 8471 returned via <code>table_ptr</code>. 8472 </description> 8473 <origin>jvmdi</origin> 8474 <capabilities> 8475 <required id="can_get_line_numbers"></required> 8476 </capabilities> 8477 <parameters> 8478 <param id="klass"> 8479 <jclass method="method"/> 8480 <description> 8481 The class to query. 8482 </description> 8483 </param> 8484 <param id="method"> 8485 <jmethodID class="klass" native="error"/> 8486 <description> 8487 The method to query. 8488 </description> 8489 </param> 8490 <param id="entry_count_ptr"> 8491 <outptr><jint/></outptr> 8492 <description> 8493 On return, points to the number of entries in the table 8494 </description> 8495 </param> 8496 <param id="table_ptr"> 8497 <allocbuf outcount="entry_count_ptr"><struct>jvmtiLineNumberEntry</struct></allocbuf> 8498 <description> 8499 On return, points to the line number table pointer. 8500 </description> 8501 </param> 8502 </parameters> 8503 <errors> 8504 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 8505 Class information does not include line numbers. 8506 </error> 8507 </errors> 8508 </function> 8509 8510 <function id="GetMethodLocation" phase="start" num="71"> 8511 <synopsis>Get Method Location</synopsis> 8512 <description> 8513 For the method indicated by <code>method</code>, 8514 return the beginning and ending addresses through 8515 <code>start_location_ptr</code> and <code>end_location_ptr</code>. In a 8516 conventional byte code indexing scheme, 8517 <code>start_location_ptr</code> will always point to zero 8518 and <code>end_location_ptr</code> 8519 will always point to the byte code count minus one. 8520 </description> 8521 <origin>jvmdi</origin> 8522 <capabilities> 8523 </capabilities> 8524 <parameters> 8525 <param id="klass"> 8526 <jclass method="method"/> 8527 <description> 8528 The class to query. 8529 </description> 8530 </param> 8531 <param id="method"> 8532 <jmethodID class="klass" native="error"/> 8533 <description> 8534 The method to query. 8535 </description> 8536 </param> 8537 <param id="start_location_ptr"> 8538 <outptr><jlocation/></outptr> 8539 <description> 8540 On return, points to the first location, or 8541 <code>-1</code> if location information is not available. 8542 If the information is available and 8543 <functionlink id="GetJLocationFormat"></functionlink> 8544 returns <datalink id="JVMTI_JLOCATION_JVMBCI"></datalink> 8545 then this will always be zero. 8546 </description> 8547 </param> 8548 <param id="end_location_ptr"> 8549 <outptr><jlocation/></outptr> 8550 <description> 8551 On return, points to the last location, 8552 or <code>-1</code> if location information is not available. 8553 </description> 8554 </param> 8555 </parameters> 8556 <errors> 8557 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 8558 Class information does not include method sizes. 8559 </error> 8560 </errors> 8561 </function> 8562 8563 <function id="GetLocalVariableTable" num="72"> 8564 <synopsis>Get Local Variable Table</synopsis> 8565 <typedef id="jvmtiLocalVariableEntry" label="Local variable table entry"> 8566 <field id="start_location"> 8567 <jlocation/> 8568 <description> 8569 The code array index where the local variable is first valid 8570 (that is, where it must have a value). 8571 </description> 8572 </field> 8573 <field id="length"> 8574 <jint/> 8575 <description> 8576 The length of the valid section for this local variable. 8577 The last code array index where the local variable is valid 8578 is <code>start_location + length</code>. 8579 </description> 8580 </field> 8581 <field id="name"> 8582 <allocfieldbuf><char/></allocfieldbuf> 8583 <description> 8584 The local variable name, encoded as a 8585 <internallink id="mUTF">modified UTF-8</internallink> string. 8586 </description> 8587 </field> 8588 <field id="signature"> 8589 <allocfieldbuf><char/></allocfieldbuf> 8590 <description> 8591 The local variable's type signature, encoded as a 8592 <internallink id="mUTF">modified UTF-8</internallink> string. 8593 The signature format is the same as that defined in 8594 <vmspec chapter="4.3.2"/>. 8595 </description> 8596 </field> 8597 <field id="generic_signature"> 8598 <allocfieldbuf><char/></allocfieldbuf> 8599 <description> 8600 The local variable's generic signature, encoded as a 8601 <internallink id="mUTF">modified UTF-8</internallink> string. 8602 The value of this field will be <code>NULL</code> for any local 8603 variable which does not have a generic type. 8604 </description> 8605 </field> 8606 <field id="slot"> 8607 <jint/> 8608 <description> 8609 The local variable's slot. See <internallink id="local">Local Variables</internallink>. 8610 </description> 8611 </field> 8612 </typedef> 8613 <description> 8614 Return local variable information. 8615 </description> 8616 <origin>jvmdiClone</origin> 8617 <capabilities> 8618 <required id="can_access_local_variables"></required> 8619 </capabilities> 8620 <parameters> 8621 <param id="method"> 8622 <jmethodID native="error"/> 8623 <description> 8624 The method to query. 8625 </description> 8626 </param> 8627 <param id="entry_count_ptr"> 8628 <outptr><jint/></outptr> 8629 <description> 8630 On return, points to the number of entries in the table 8631 </description> 8632 </param> 8633 <param id="table_ptr"> 8634 <allocbuf outcount="entry_count_ptr"><struct>jvmtiLocalVariableEntry</struct></allocbuf> 8635 <description> 8636 On return, points to an array of local variable table entries. 8637 </description> 8638 </param> 8639 </parameters> 8640 <errors> 8641 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 8642 Class information does not include local variable 8643 information. 8644 </error> 8645 </errors> 8646 </function> 8647 8648 <function id="GetBytecodes" phase="start" num="75"> 8649 <synopsis>Get Bytecodes</synopsis> 8650 <description> 8651 For the method indicated by <code>method</code>, 8652 return the byte codes that implement the method. The number of 8653 bytecodes is returned via <code>bytecode_count_ptr</code>. The byte codes 8654 themselves are returned via <code>bytecodes_ptr</code>. 8655 </description> 8656 <origin>jvmdi</origin> 8657 <capabilities> 8658 <required id="can_get_bytecodes"></required> 8659 </capabilities> 8660 <parameters> 8661 <param id="klass"> 8662 <jclass method="method"/> 8663 <description> 8664 The class to query. 8665 </description> 8666 </param> 8667 <param id="method"> 8668 <jmethodID class="klass" native="error"/> 8669 <description> 8670 The method to query. 8671 </description> 8672 </param> 8673 <param id="bytecode_count_ptr"> 8674 <outptr><jint/></outptr> 8675 <description> 8676 On return, points to the length of the byte code array 8677 </description> 8678 </param> 8679 <param id="bytecodes_ptr"> 8680 <allocbuf outcount="bytecode_count_ptr"><uchar/></allocbuf> 8681 <description> 8682 On return, points to the pointer to the byte code array 8683 </description> 8684 </param> 8685 </parameters> 8686 <errors> 8687 </errors> 8688 </function> 8689 8690 <function id="IsMethodNative" phase="start" num="76"> 8691 <synopsis>Is Method Native</synopsis> 8692 <description> 8693 For the method indicated by <code>method</code>, return a 8694 value indicating whether the method is native via <code>is_native_ptr</code> 8695 </description> 8696 <origin>jvmdi</origin> 8697 <capabilities> 8698 </capabilities> 8699 <parameters> 8700 <param id="klass"> 8701 <jclass method="method"/> 8702 <description> 8703 The class to query. 8704 </description> 8705 </param> 8706 <param id="method"> 8707 <jmethodID class="klass"/> 8708 <description> 8709 The method to query. 8710 </description> 8711 </param> 8712 <param id="is_native_ptr"> 8713 <outptr><jboolean/></outptr> 8714 <description> 8715 On return, points to the boolean result of this function. 8716 </description> 8717 </param> 8718 </parameters> 8719 <errors> 8720 </errors> 8721 </function> 8722 8723 <function id="IsMethodSynthetic" phase="start" num="77"> 8724 <synopsis>Is Method Synthetic</synopsis> 8725 <description> 8726 For the method indicated by <code>method</code>, return a 8727 value indicating whether the method is synthetic via <code>is_synthetic_ptr</code>. 8728 Synthetic methods are generated by the compiler but not present in the 8729 original source code. 8730 </description> 8731 <origin>jvmdi</origin> 8732 <capabilities> 8733 <required id="can_get_synthetic_attribute"></required> 8734 </capabilities> 8735 <parameters> 8736 <param id="klass"> 8737 <jclass method="method"/> 8738 <description> 8739 The class to query. 8740 </description> 8741 </param> 8742 <param id="method"> 8743 <jmethodID class="klass"/> 8744 <description> 8745 The method to query. 8746 </description> 8747 </param> 8748 <param id="is_synthetic_ptr"> 8749 <outptr><jboolean/></outptr> 8750 <description> 8751 On return, points to the boolean result of this function. 8752 </description> 8753 </param> 8754 </parameters> 8755 <errors> 8756 </errors> 8757 </function> 8758 8759 <function id="IsMethodObsolete" phase="start" num="91"> 8760 <synopsis>Is Method Obsolete</synopsis> 8761 <description> 8762 Determine if a method ID refers to an 8763 <internallink id="obsoleteMethods">obsolete</internallink> 8764 method version. 8765 </description> 8766 <origin>jvmdi</origin> 8767 <capabilities> 8768 </capabilities> 8769 <parameters> 8770 <param id="klass"> 8771 <jclass method="method"/> 8772 <description> 8773 The class to query. 8774 </description> 8775 </param> 8776 <param id="method"> 8777 <jmethodID class="klass"/> 8778 <description> 8779 The method ID to query. 8780 </description> 8781 </param> 8782 <param id="is_obsolete_ptr"> 8783 <outptr><jboolean/></outptr> 8784 <description> 8785 On return, points to the boolean result of this function. 8786 </description> 8787 </param> 8788 </parameters> 8789 <errors> 8790 </errors> 8791 </function> 8792 8793 <function id="SetNativeMethodPrefix" jkernel="yes" phase="any" num="73" since="1.1"> 8794 <synopsis>Set Native Method Prefix</synopsis> 8795 <description> 8796 This function modifies the failure handling of 8797 native method resolution by allowing retry 8798 with a prefix applied to the name. 8799 When used with the 8800 <eventlink id="ClassFileLoadHook">ClassFileLoadHook 8801 event</eventlink>, it enables native methods to be 8802 <internallink id="bci">instrumented</internallink>. 8803 <p/> 8804 Since native methods cannot be directly instrumented 8805 (they have no bytecodes), they must be wrapped with 8806 a non-native method which can be instrumented. 8807 For example, if we had: 8808 <example> 8809 native boolean foo(int x);</example> 8810 <p/> 8811 We could transform the class file (with the 8812 ClassFileLoadHook event) so that this becomes: 8813 <example> 8814 boolean foo(int x) { 8815 <i>... record entry to foo ...</i> 8816 return wrapped_foo(x); 8817 } 8818 8819 native boolean wrapped_foo(int x);</example> 8820 <p/> 8821 Where foo becomes a wrapper for the actual native method 8822 with the appended prefix "wrapped_". Note that 8823 "wrapped_" would be a poor choice of prefix since it 8824 might conceivably form the name of an existing method 8825 thus something like "$$$MyAgentWrapped$$$_" would be 8826 better but would make these examples less readable. 8827 <p/> 8828 The wrapper will allow data to be collected on the native 8829 method call, but now the problem becomes linking up the 8830 wrapped method with the native implementation. 8831 That is, the method <code>wrapped_foo</code> needs to be 8832 resolved to the native implementation of <code>foo</code>, 8833 which might be: 8834 <example> 8835 Java_somePackage_someClass_foo(JNIEnv* env, jint x)</example> 8836 <p/> 8837 This function allows the prefix to be specified and the 8838 proper resolution to occur. 8839 Specifically, when the standard resolution fails, the 8840 resolution is retried taking the prefix into consideration. 8841 There are two ways that resolution occurs, explicit 8842 resolution with the JNI function <code>RegisterNatives</code> 8843 and the normal automatic resolution. For 8844 <code>RegisterNatives</code>, the VM will attempt this 8845 association: 8846 <example> 8847 method(foo) -> nativeImplementation(foo)</example> 8848 <p/> 8849 When this fails, the resolution will be retried with 8850 the specified prefix prepended to the method name, 8851 yielding the correct resolution: 8852 <example> 8853 method(wrapped_foo) -> nativeImplementation(foo)</example> 8854 <p/> 8855 For automatic resolution, the VM will attempt: 8856 <example> 8857 method(wrapped_foo) -> nativeImplementation(wrapped_foo)</example> 8858 <p/> 8859 When this fails, the resolution will be retried with 8860 the specified prefix deleted from the implementation name, 8861 yielding the correct resolution: 8862 <example> 8863 method(wrapped_foo) -> nativeImplementation(foo)</example> 8864 <p/> 8865 Note that since the prefix is only used when standard 8866 resolution fails, native methods can be wrapped selectively. 8867 <p/> 8868 Since each <jvmti/> environment is independent and 8869 can do its own transformation of the bytecodes, more 8870 than one layer of wrappers may be applied. Thus each 8871 environment needs its own prefix. Since transformations 8872 are applied in order, the prefixes, if applied, will 8873 be applied in the same order. 8874 The order of transformation application is described in 8875 the <eventlink id="ClassFileLoadHook"/> event. 8876 Thus if three environments applied 8877 wrappers, <code>foo</code> might become 8878 <code>$env3_$env2_$env1_foo</code>. But if, say, 8879 the second environment did not apply a wrapper to 8880 <code>foo</code> it would be just 8881 <code>$env3_$env1_foo</code>. To be able to 8882 efficiently determine the sequence of prefixes, 8883 an intermediate prefix is only applied if its non-native 8884 wrapper exists. Thus, in the last example, even though 8885 <code>$env1_foo</code> is not a native method, the 8886 <code>$env1_</code> prefix is applied since 8887 <code>$env1_foo</code> exists. 8888 <p/> 8889 Since the prefixes are used at resolution time 8890 and since resolution may be arbitrarily delayed, a 8891 native method prefix must remain set as long as there 8892 are corresponding prefixed native methods. 8893 </description> 8894 <origin>new</origin> 8895 <capabilities> 8896 <required id="can_set_native_method_prefix"></required> 8897 </capabilities> 8898 <parameters> 8899 <param id="prefix"> 8900 <inbuf> 8901 <char/> 8902 <nullok> 8903 any existing prefix in this environment is cancelled 8904 </nullok> 8905 </inbuf> 8906 <description> 8907 The prefix to apply, encoded as a 8908 <internallink id="mUTF">modified UTF-8</internallink> string. 8909 </description> 8910 </param> 8911 </parameters> 8912 <errors> 8913 </errors> 8914 </function> 8915 8916 <function id="SetNativeMethodPrefixes" jkernel="yes" phase="any" num="74" since="1.1"> 8917 <synopsis>Set Native Method Prefixes</synopsis> 8918 <description> 8919 For a normal agent, <functionlink id="SetNativeMethodPrefix"/> 8920 will provide all needed native method prefixing. 8921 For a meta-agent that performs multiple independent class 8922 file transformations (for example as a proxy for another 8923 layer of agents) this function allows each transformation 8924 to have its own prefix. 8925 The prefixes are applied in the order supplied and are 8926 processed in the same manor as described for the 8927 application of prefixes from multiple <jvmti/> environments 8928 in <functionlink id="SetNativeMethodPrefix"/>. 8929 <p/> 8930 Any previous prefixes are replaced. Thus, calling this 8931 function with a <paramlink id="prefix_count"/> of <code>0</code> 8932 disables prefixing in this environment. 8933 <p/> 8934 <functionlink id="SetNativeMethodPrefix"/> and this function 8935 are the two ways to set the prefixes. 8936 Calling <code>SetNativeMethodPrefix</code> with 8937 a prefix is the same as calling this function with 8938 <paramlink id="prefix_count"/> of <code>1</code>. 8939 Calling <code>SetNativeMethodPrefix</code> with 8940 <code>NULL</code> is the same as calling this function with 8941 <paramlink id="prefix_count"/> of <code>0</code>. 8942 </description> 8943 <origin>new</origin> 8944 <capabilities> 8945 <required id="can_set_native_method_prefix"></required> 8946 </capabilities> 8947 <parameters> 8948 <param id="prefix_count"> 8949 <jint min="0"/> 8950 <description> 8951 The number of prefixes to apply. 8952 </description> 8953 </param> 8954 <param id="prefixes"> 8955 <agentbuf> 8956 <char/> 8957 </agentbuf> 8958 <description> 8959 The prefixes to apply for this environment, each encoded as a 8960 <internallink id="mUTF">modified UTF-8</internallink> string. 8961 </description> 8962 </param> 8963 </parameters> 8964 <errors> 8965 </errors> 8966 </function> 8967 8968 </category> 8969 8970 <category id="RawMonitors" label="Raw Monitor"> 8971 8972 <function id="CreateRawMonitor" phase="onload" callbacksafe="safe" num="31"> 8973 <synopsis>Create Raw Monitor</synopsis> 8974 <description> 8975 Create a raw monitor. 8976 </description> 8977 <origin>jvmdi</origin> 8978 <capabilities> 8979 </capabilities> 8980 <parameters> 8981 <param id="name"> 8982 <inbuf><char/></inbuf> 8983 <description> 8984 A name to identify the monitor, encoded as a 8985 <internallink id="mUTF">modified UTF-8</internallink> string. 8986 </description> 8987 </param> 8988 <param id="monitor_ptr"> 8989 <outptr><jrawMonitorID/></outptr> 8990 <description> 8991 On return, points to the created monitor. 8992 </description> 8993 </param> 8994 </parameters> 8995 <errors> 8996 </errors> 8997 </function> 8998 8999 <function id="DestroyRawMonitor" phase="onload" callbacksafe="safe" num="32"> 9000 <synopsis>Destroy Raw Monitor</synopsis> 9001 <description> 9002 Destroy the raw monitor. 9003 If the monitor being destroyed has been entered by this thread, it will be 9004 exited before it is destroyed. 9005 If the monitor being destroyed has been entered by another thread, 9006 an error will be returned and the monitor will not be destroyed. 9007 </description> 9008 <origin>jvmdi</origin> 9009 <capabilities> 9010 </capabilities> 9011 <parameters> 9012 <param id="monitor"> 9013 <jrawMonitorID/> 9014 <description> 9015 The monitor 9016 </description> 9017 </param> 9018 </parameters> 9019 <errors> 9020 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 9021 Not monitor owner 9022 </error> 9023 </errors> 9024 </function> 9025 9026 <function id="RawMonitorEnter" phase="any" callbacksafe="safe" impl="innative notrace" num="33"> 9027 <synopsis>Raw Monitor Enter</synopsis> 9028 <description> 9029 Gain exclusive ownership of a raw monitor. 9030 The same thread may enter a monitor more then once. 9031 The thread must 9032 <functionlink id="RawMonitorExit">exit</functionlink> 9033 the monitor the same number of times as it is entered. 9034 If a monitor is entered during <code>OnLoad</code> (before attached threads exist) 9035 and has not exited when attached threads come into existence, the enter 9036 is considered to have occurred on the main thread. 9037 </description> 9038 <origin>jvmdi</origin> 9039 <capabilities> 9040 </capabilities> 9041 <parameters> 9042 <param id="monitor"> 9043 <jrawMonitorID/> 9044 <description> 9045 The monitor 9046 </description> 9047 </param> 9048 </parameters> 9049 <errors> 9050 </errors> 9051 </function> 9052 9053 <function id="RawMonitorExit" phase="any" callbacksafe="safe" impl="innative notrace" num="34"> 9054 <synopsis>Raw Monitor Exit</synopsis> 9055 <description> 9056 Release exclusive ownership of a raw monitor. 9057 </description> 9058 <origin>jvmdi</origin> 9059 <capabilities> 9060 </capabilities> 9061 <parameters> 9062 <param id="monitor"> 9063 <jrawMonitorID/> 9064 <description> 9065 The monitor 9066 </description> 9067 </param> 9068 </parameters> 9069 <errors> 9070 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 9071 Not monitor owner 9072 </error> 9073 </errors> 9074 </function> 9075 9076 <function id="RawMonitorWait" phase="any" callbacksafe="safe" impl="innative notrace" num="35"> 9077 <synopsis>Raw Monitor Wait</synopsis> 9078 <description> 9079 Wait for notification of the raw monitor. 9080 <p/> 9081 Causes the current thread to wait until either another thread calls 9082 <functionlink id="RawMonitorNotify"/> or 9083 <functionlink id="RawMonitorNotifyAll"/> 9084 for the specified raw monitor, or the specified 9085 <paramlink id="millis">timeout</paramlink> 9086 has elapsed. 9087 </description> 9088 <origin>jvmdi</origin> 9089 <capabilities> 9090 </capabilities> 9091 <parameters> 9092 <param id="monitor"> 9093 <jrawMonitorID/> 9094 <description> 9095 The monitor 9096 </description> 9097 </param> 9098 <param id="millis"> 9099 <jlong/> 9100 <description> 9101 The timeout, in milliseconds. If the timeout is 9102 zero, then real time is not taken into consideration 9103 and the thread simply waits until notified. 9104 </description> 9105 </param> 9106 </parameters> 9107 <errors> 9108 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 9109 Not monitor owner 9110 </error> 9111 <error id="JVMTI_ERROR_INTERRUPT"> 9112 Wait was interrupted, try again 9113 </error> 9114 </errors> 9115 </function> 9116 9117 <function id="RawMonitorNotify" phase="any" callbacksafe="safe" impl="notrace" num="36"> 9118 <synopsis>Raw Monitor Notify</synopsis> 9119 <description> 9120 Notify a single thread waiting on the raw monitor. 9121 </description> 9122 <origin>jvmdi</origin> 9123 <capabilities> 9124 </capabilities> 9125 <parameters> 9126 <param id="monitor"> 9127 <jrawMonitorID/> 9128 <description> 9129 The monitor 9130 </description> 9131 </param> 9132 </parameters> 9133 <errors> 9134 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 9135 Not monitor owner 9136 </error> 9137 </errors> 9138 </function> 9139 9140 <function id="RawMonitorNotifyAll" phase="any" callbacksafe="safe" impl="notrace" num="37"> 9141 <synopsis>Raw Monitor Notify All</synopsis> 9142 <description> 9143 Notify all threads waiting on the raw monitor. 9144 </description> 9145 <origin>jvmdi</origin> 9146 <capabilities> 9147 </capabilities> 9148 <parameters> 9149 <param id="monitor"> 9150 <jrawMonitorID/> 9151 <description> 9152 The monitor 9153 </description> 9154 </param> 9155 </parameters> 9156 <errors> 9157 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 9158 Not monitor owner 9159 </error> 9160 </errors> 9161 </function> 9162 9163 <elide> 9164 <function id="GetRawMonitorUse" num="118"> 9165 <synopsis>Get Raw Monitor Use</synopsis> 9166 <description> 9167 The fields of the <functionlink id="jvmtiMonitorUsage"></functionlink> structure 9168 are filled in with information about usage of the raw monitor. 9169 </description> 9170 <origin>new</origin> 9171 <capabilities> 9172 <required id="can_get_raw_monitor_usage"></required> 9173 </capabilities> 9174 <parameters> 9175 <param id="monitor"> 9176 <jrawMonitorID/> 9177 <description> 9178 the raw monitor to query. 9179 </description> 9180 </param> 9181 <param id="info_ptr"> 9182 <outptr><struct>jvmtiMonitorUsage</struct></outptr> 9183 <description> 9184 On return, filled with monitor information for the 9185 specified raw monitor. 9186 </description> 9187 </param> 9188 </parameters> 9189 <errors> 9190 </errors> 9191 </function> 9192 9193 <function id="GetRawMonitors" num="119"> 9194 <synopsis>Get Raw Monitors</synopsis> 9195 <description> 9196 Return the list of raw monitors. 9197 <p/> 9198 Note: details about each monitor can be examined with 9199 <functionlink id="GetRawMonitorUse"></functionlink>. 9200 </description> 9201 <origin>new</origin> 9202 <capabilities> 9203 <required id="can_get_raw_monitor_usage"></required> 9204 </capabilities> 9205 <parameters> 9206 <param id="monitorCnt"> 9207 <outptr><jint/></outptr> 9208 <description> 9209 On return, pointer to the number 9210 of monitors returned in <code>monitors_ptr</code>. 9211 </description> 9212 </param> 9213 <param id="monitors_ptr"> 9214 <allocbuf outcount="monitorCnt"><jrawMonitorID/></allocbuf> 9215 <description> 9216 On return, pointer to the monitor list. 9217 </description> 9218 </param> 9219 </parameters> 9220 <errors> 9221 </errors> 9222 </function> 9223 </elide> 9224 </category> 9225 9226 <category id="jniIntercept" label="JNI Function Interception"> 9227 9228 <intro> 9229 Provides the ability to intercept and resend 9230 Java Native Interface (JNI) function calls 9231 by manipulating the JNI function table. 9232 See <externallink id="jni/functions.html">JNI 9233 Functions</externallink> in the <i>Java Native Interface Specification</i>. 9234 <p/> 9235 The following example illustrates intercepting the 9236 <code>NewGlobalRef</code> JNI call in order to count reference 9237 creation. 9238 <example> 9239 JNIEnv original_jni_Functions; 9240 JNIEnv redirected_jni_Functions; 9241 int my_global_ref_count = 0; 9242 9243 jobject 9244 MyNewGlobalRef(JNIEnv *jni_env, jobject lobj) { 9245 ++my_global_ref_count; 9246 return originalJNIFunctions->NewGlobalRef(env, lobj); 9247 } 9248 9249 void 9250 myInit() { 9251 jvmtiError err; 9252 9253 err = (*jvmti_env)->GetJNIFunctionTable(jvmti_env, &original_jni_Functions); 9254 if (err != JVMTI_ERROR_NONE) { 9255 die(); 9256 } 9257 err = (*jvmti_env)->GetJNIFunctionTable(jvmti_env, &redirected_jni_Functions); 9258 if (err != JVMTI_ERROR_NONE) { 9259 die(); 9260 } 9261 redirectedJNIFunctions->NewGlobalRef = MyNewGlobalRef; 9262 err = (*jvmti_env)->SetJNIFunctionTable(jvmti_env, redirected_jni_Functions); 9263 if (err != JVMTI_ERROR_NONE) { 9264 die(); 9265 } 9266 } 9267 </example> 9268 Sometime after <code>myInit</code> is called the user's JNI 9269 code is executed which makes the call to create a new global 9270 reference. Instead of going to the normal JNI implementation 9271 the call goes to <code>myNewGlobalRef</code>. Note that a 9272 copy of the original function table is kept so that the normal 9273 JNI function can be called after the data is collected. 9274 Note also that any JNI functions which are not overwritten 9275 will behave normally. 9276 <todo> 9277 check that the example compiles and executes. 9278 </todo> 9279 </intro> 9280 9281 <function id="SetJNIFunctionTable" phase="start" num="120"> 9282 <synopsis>Set JNI Function Table</synopsis> 9283 <description> 9284 Set the JNI function table 9285 in all current and future JNI environments. 9286 As a result, all future JNI calls are directed to the specified functions. 9287 Use <functionlink id="GetJNIFunctionTable"></functionlink> to get the 9288 function table to pass to this function. 9289 For this function to take effect the the updated table entries must be 9290 used by the JNI clients. 9291 Since the table is defined <code>const</code> some compilers may optimize 9292 away the access to the table, thus preventing this function from taking 9293 effect. 9294 The table is copied--changes to the local copy of the 9295 table have no effect. 9296 This function affects only the function table, all other aspects of the environment are 9297 unaffected. 9298 See the examples <internallink id="jniIntercept">above</internallink>. 9299 </description> 9300 <origin>new</origin> 9301 <capabilities> 9302 </capabilities> 9303 <parameters> 9304 <param id="function_table"> 9305 <inptr> 9306 <struct>jniNativeInterface</struct> 9307 </inptr> 9308 <description> 9309 Points to the new JNI function table. 9310 </description> 9311 </param> 9312 </parameters> 9313 <errors> 9314 </errors> 9315 </function> 9316 9317 <function id="GetJNIFunctionTable" phase="start" num="121"> 9318 <synopsis>Get JNI Function Table</synopsis> 9319 <description> 9320 Get the JNI function table. 9321 The JNI function table is copied into allocated memory. 9322 If <functionlink id="SetJNIFunctionTable"></functionlink> 9323 has been called, the modified (not the original) function 9324 table is returned. 9325 Only the function table is copied, no other aspects of the environment 9326 are copied. 9327 See the examples <internallink id="jniIntercept">above</internallink>. 9328 </description> 9329 <origin>new</origin> 9330 <capabilities> 9331 </capabilities> 9332 <parameters> 9333 <param id="function_table"> 9334 <allocbuf> 9335 <struct>jniNativeInterface</struct> 9336 </allocbuf> 9337 <description> 9338 On return, <code>*function_table</code> 9339 points a newly allocated copy of the JNI function table. 9340 </description> 9341 </param> 9342 </parameters> 9343 <errors> 9344 </errors> 9345 </function> 9346 9347 </category> 9348 9349 <category id="eventManagement" label="Event Management"> 9350 9351 <function id="SetEventCallbacks" jkernel="yes" phase="onload" num="122"> 9352 <synopsis>Set Event Callbacks</synopsis> 9353 <description> 9354 Set the functions to be called for each event. 9355 The callbacks are specified by supplying a replacement function table. 9356 The function table is copied--changes to the local copy of the 9357 table have no effect. 9358 This is an atomic action, all callbacks are set at once. 9359 No events are sent before this function is called. 9360 When an entry is <code>NULL</code> or when the event is beyond 9361 <paramlink id="size_of_callbacks"></paramlink> no event is sent. 9362 Details on events are 9363 described <internallink id="EventSection">later</internallink> in this document. 9364 An event must be enabled and have a callback in order to be 9365 sent--the order in which this function and 9366 <functionlink id="SetEventNotificationMode"></functionlink> 9367 are called does not affect the result. 9368 </description> 9369 <origin>new</origin> 9370 <capabilities> 9371 </capabilities> 9372 <parameters> 9373 <param id="callbacks"> 9374 <inptr> 9375 <struct>jvmtiEventCallbacks</struct> 9376 <nullok>remove the existing callbacks</nullok> 9377 </inptr> 9378 <description> 9379 The new event callbacks. 9380 </description> 9381 </param> 9382 <param id="size_of_callbacks"> 9383 <jint min="0"/> 9384 <description> 9385 <code>sizeof(jvmtiEventCallbacks)</code>--for version 9386 compatibility. 9387 </description> 9388 </param> 9389 </parameters> 9390 <errors> 9391 </errors> 9392 </function> 9393 9394 <function id="SetEventNotificationMode" jkernel="yes" phase="onload" num="2"> 9395 <synopsis>Set Event Notification Mode</synopsis> 9396 <description> 9397 Control the generation of events. 9398 <constants id="jvmtiEventMode" label="Event Enable/Disable" kind="enum"> 9399 <constant id="JVMTI_ENABLE" num="1"> 9400 If <paramlink id="mode"></paramlink> is <code>JVMTI_ENABLE</code>, 9401 the event <paramlink id="event_type"></paramlink> will be enabled 9402 </constant> 9403 <constant id="JVMTI_DISABLE" num="0"> 9404 If <paramlink id="mode"></paramlink> is <code>JVMTI_DISABLE</code>, 9405 the event <paramlink id="event_type"></paramlink> will be disabled 9406 </constant> 9407 </constants> 9408 If <code>event_thread</code> is <code>NULL</code>, 9409 the event is enabled or disabled globally; otherwise, it is 9410 enabled or disabled for a particular thread. 9411 An event is generated for 9412 a particular thread if it is enabled either at the thread or global 9413 levels. 9414 <p/> 9415 See <internallink id="EventIndex">below</internallink> for information on specific events. 9416 <p/> 9417 The following events cannot be controlled at the thread 9418 level through this function. 9419 <ul> 9420 <li><eventlink id="VMInit"></eventlink></li> 9421 <li><eventlink id="VMStart"></eventlink></li> 9422 <li><eventlink id="VMDeath"></eventlink></li> 9423 <li><eventlink id="ThreadStart"></eventlink></li> 9424 <li><eventlink id="CompiledMethodLoad"></eventlink></li> 9425 <li><eventlink id="CompiledMethodUnload"></eventlink></li> 9426 <li><eventlink id="DynamicCodeGenerated"></eventlink></li> 9427 <li><eventlink id="DataDumpRequest"></eventlink></li> 9428 </ul> 9429 <p/> 9430 Initially, no events are enabled at either the thread level 9431 or the global level. 9432 <p/> 9433 Any needed capabilities (see Event Enabling Capabilities below) must be possessed 9434 before calling this function. 9435 <p/> 9436 Details on events are 9437 described <internallink id="EventSection">below</internallink>. 9438 </description> 9439 <origin>jvmdiClone</origin> 9440 <eventcapabilities></eventcapabilities> 9441 <parameters> 9442 <param id="mode"> 9443 <enum>jvmtiEventMode</enum> 9444 <description> 9445 <code>JVMTI_ENABLE</code> or <code>JVMTI_DISABLE</code> 9446 </description> 9447 </param> 9448 <param id="event_type"> 9449 <enum>jvmtiEvent</enum> 9450 <description> 9451 the event to control 9452 </description> 9453 </param> 9454 <param id="event_thread"> 9455 <ptrtype> 9456 <jthread impl="noconvert"/> 9457 <nullok>event is controlled at the global level</nullok> 9458 </ptrtype> 9459 <description> 9460 The thread to control 9461 </description> 9462 </param> 9463 <param id="..."> 9464 <varargs/> 9465 <description> 9466 for future expansion 9467 </description> 9468 </param> 9469 </parameters> 9470 <errors> 9471 <error id="JVMTI_ERROR_INVALID_THREAD"> 9472 <paramlink id="event_thread"/> is non-<code>NULL</code> and is not a valid thread. 9473 </error> 9474 <error id="JVMTI_ERROR_THREAD_NOT_ALIVE"> 9475 <paramlink id="event_thread"/> is non-<code>NULL</code> and is not live (has not been started or is now dead). 9476 </error> 9477 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 9478 thread level control was attempted on events which do not 9479 permit thread level control. 9480 </error> 9481 <error id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY"> 9482 The Required Event Enabling Capability is not possessed. 9483 </error> 9484 </errors> 9485 </function> 9486 9487 <function id="GenerateEvents" num="123"> 9488 <synopsis>Generate Events</synopsis> 9489 <description> 9490 Generate events to represent the current state of the VM. 9491 For example, if <paramlink id="event_type"/> is 9492 <code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code>, 9493 a <eventlink id="CompiledMethodLoad"></eventlink> event will be 9494 sent for each currently compiled method. 9495 Methods that were loaded and now have been unloaded are not sent. 9496 The history of what events have previously been sent does not 9497 effect what events are sent by this function--for example, 9498 all currently compiled methods 9499 will be sent each time this function is called. 9500 <p/> 9501 This function is useful when 9502 events may have been missed due to the agent attaching after program 9503 execution begins; this function generates the missed events. 9504 <p/> 9505 Attempts to execute Java programming language code or 9506 JNI functions may be paused until this function returns - 9507 so neither should be called from the thread sending the event. 9508 This function returns only after the missed events have been 9509 sent, processed and have returned. 9510 The event may be sent on a different thread than the thread 9511 on which the event occurred. 9512 The callback for the event must be set with 9513 <functionlink id="SetEventCallbacks"></functionlink> 9514 and the event must be enabled with 9515 <functionlink id="SetEventNotificationMode"></functionlink> 9516 or the events will not occur. 9517 If the VM no longer has the information to generate some or 9518 all of the requested events, the events are simply not sent - 9519 no error is returned. 9520 <p/> 9521 Only the following events are supported: 9522 <ul> 9523 <li><eventlink id="CompiledMethodLoad"></eventlink></li> 9524 <li><eventlink id="DynamicCodeGenerated"></eventlink></li> 9525 </ul> 9526 </description> 9527 <origin>new</origin> 9528 <capabilities> 9529 <capability id="can_generate_compiled_method_load_events"></capability> 9530 </capabilities> 9531 <parameters> 9532 <param id="event_type"> 9533 <enum>jvmtiEvent</enum> 9534 <description> 9535 The type of event to generate. Must be one of these: 9536 <ul> 9537 <li><eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink></li> 9538 <li><eventlink id="DynamicCodeGenerated"><code>JVMTI_EVENT_DYNAMIC_CODE_GENERATED</code></eventlink></li> 9539 </ul> 9540 </description> 9541 </param> 9542 </parameters> 9543 <errors> 9544 <error id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY"> 9545 <paramlink id="event_type"/> is 9546 <eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink> 9547 and <fieldlink id="can_generate_compiled_method_load_events" struct="jvmtiCapabilities"></fieldlink> 9548 is <code>false</code>. 9549 </error> 9550 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 9551 <paramlink id="event_type"/> is other than 9552 <eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink> 9553 or <eventlink id="DynamicCodeGenerated"><code>JVMTI_EVENT_DYNAMIC_CODE_GENERATED</code></eventlink>. 9554 </error> 9555 </errors> 9556 </function> 9557 9558 </category> 9559 9560 <category id="extension" label="Extension Mechanism"> 9561 9562 <intro> 9563 These functions 9564 allow a <jvmti/> implementation to provide functions and events 9565 beyond those defined in this specification. 9566 <p/> 9567 Both extension functions and extension events have parameters 9568 each of which has a 'type' and 'kind' chosen from the following tables: 9569 9570 <constants id="jvmtiParamTypes" label="Extension Function/Event Parameter Types" kind="enum"> 9571 <constant id="JVMTI_TYPE_JBYTE" num="101"> 9572 Java programming language primitive type - <code>byte</code>. 9573 JNI type <code>jbyte</code>. 9574 </constant> 9575 <constant id="JVMTI_TYPE_JCHAR" num="102"> 9576 Java programming language primitive type - <code>char</code>. 9577 JNI type <code>jchar</code>. 9578 </constant> 9579 <constant id="JVMTI_TYPE_JSHORT" num="103"> 9580 Java programming language primitive type - <code>short</code>. 9581 JNI type <code>jshort</code>. 9582 </constant> 9583 <constant id="JVMTI_TYPE_JINT" num="104"> 9584 Java programming language primitive type - <code>int</code>. 9585 JNI type <datalink id="jint"></datalink>. 9586 </constant> 9587 <constant id="JVMTI_TYPE_JLONG" num="105"> 9588 Java programming language primitive type - <code>long</code>. 9589 JNI type <datalink id="jlong"></datalink>. 9590 </constant> 9591 <constant id="JVMTI_TYPE_JFLOAT" num="106"> 9592 Java programming language primitive type - <code>float</code>. 9593 JNI type <datalink id="jfloat"></datalink>. 9594 </constant> 9595 <constant id="JVMTI_TYPE_JDOUBLE" num="107"> 9596 Java programming language primitive type - <code>double</code>. 9597 JNI type <datalink id="jdouble"></datalink>. 9598 </constant> 9599 <constant id="JVMTI_TYPE_JBOOLEAN" num="108"> 9600 Java programming language primitive type - <code>boolean</code>. 9601 JNI type <datalink id="jboolean"></datalink>. 9602 </constant> 9603 <constant id="JVMTI_TYPE_JOBJECT" num="109"> 9604 Java programming language object type - <code>java.lang.Object</code>. 9605 JNI type <datalink id="jobject"></datalink>. 9606 Returned values are JNI local references and must be managed. 9607 </constant> 9608 <constant id="JVMTI_TYPE_JTHREAD" num="110"> 9609 Java programming language object type - <code>java.lang.Thread</code>. 9610 <jvmti/> type <datalink id="jthread"></datalink>. 9611 Returned values are JNI local references and must be managed. 9612 </constant> 9613 <constant id="JVMTI_TYPE_JCLASS" num="111"> 9614 Java programming language object type - <code>java.lang.Class</code>. 9615 JNI type <datalink id="jclass"></datalink>. 9616 Returned values are JNI local references and must be managed. 9617 </constant> 9618 <constant id="JVMTI_TYPE_JVALUE" num="112"> 9619 Union of all Java programming language primitive and object types - 9620 JNI type <datalink id="jvalue"></datalink>. 9621 Returned values which represent object types are JNI local references and must be managed. 9622 </constant> 9623 <constant id="JVMTI_TYPE_JFIELDID" num="113"> 9624 Java programming language field identifier - 9625 JNI type <datalink id="jfieldID"></datalink>. 9626 </constant> 9627 <constant id="JVMTI_TYPE_JMETHODID" num="114"> 9628 Java programming language method identifier - 9629 JNI type <datalink id="jmethodID"></datalink>. 9630 </constant> 9631 <constant id="JVMTI_TYPE_CCHAR" num="115"> 9632 C programming language type - <code>char</code>. 9633 </constant> 9634 <constant id="JVMTI_TYPE_CVOID" num="116"> 9635 C programming language type - <code>void</code>. 9636 </constant> 9637 <constant id="JVMTI_TYPE_JNIENV" num="117"> 9638 JNI environment - <code>JNIEnv</code>. 9639 Should be used with the correct <datalink id="jvmtiParamKind"/> to make it a pointer type. 9640 </constant> 9641 </constants> 9642 9643 <constants id="jvmtiParamKind" label="Extension Function/Event Parameter Kinds" kind="enum"> 9644 <constant id="JVMTI_KIND_IN" num="91"> 9645 Ingoing argument - <code>foo</code>. 9646 </constant> 9647 <constant id="JVMTI_KIND_IN_PTR" num="92"> 9648 Ingoing pointer argument - <code>const foo*</code>. 9649 </constant> 9650 <constant id="JVMTI_KIND_IN_BUF" num="93"> 9651 Ingoing array argument - <code>const foo*</code>. 9652 </constant> 9653 <constant id="JVMTI_KIND_ALLOC_BUF" num="94"> 9654 Outgoing allocated array argument - <code>foo**</code>. 9655 Free with <code>Deallocate</code>. 9656 </constant> 9657 <constant id="JVMTI_KIND_ALLOC_ALLOC_BUF" num="95"> 9658 Outgoing allocated array of allocated arrays argument - <code>foo***</code>. 9659 Free with <code>Deallocate</code>. 9660 </constant> 9661 <constant id="JVMTI_KIND_OUT" num="96"> 9662 Outgoing argument - <code>foo*</code>. 9663 </constant> 9664 <constant id="JVMTI_KIND_OUT_BUF" num="97"> 9665 Outgoing array argument (pre-allocated by agent) - <code>foo*</code>. 9666 Do not <code>Deallocate</code>. 9667 </constant> 9668 </constants> 9669 9670 </intro> 9671 9672 <typedef id="jvmtiParamInfo" label="Extension Function/Event Parameter Info"> 9673 <field id="name"> 9674 <allocfieldbuf><char/></allocfieldbuf> 9675 <description> 9676 The parameter name, encoded as a 9677 <internallink id="mUTF">modified UTF-8</internallink> string 9678 </description> 9679 </field> 9680 <field id="kind"> 9681 <enum>jvmtiParamKind</enum> 9682 <description> 9683 The kind of the parameter - type modifiers 9684 </description> 9685 </field> 9686 <field id="base_type"> 9687 <enum>jvmtiParamTypes</enum> 9688 <description> 9689 The base type of the parameter - modified by <code>kind</code> 9690 </description> 9691 </field> 9692 <field id="null_ok"> 9693 <jboolean/> 9694 <description> 9695 Is a <code>NULL</code> argument permitted? Applies only to pointer and object types. 9696 </description> 9697 </field> 9698 </typedef> 9699 9700 <callback id="jvmtiExtensionFunction"> 9701 <enum>jvmtiError</enum> 9702 <synopsis>Extension Function</synopsis> 9703 <description> 9704 This is the implementation-specific extension function. 9705 </description> 9706 <parameters> 9707 <param id="jvmti_env"> 9708 <outptr> 9709 <struct>jvmtiEnv</struct> 9710 </outptr> 9711 <description> 9712 The <jvmti/> environment is the only fixed parameter for extension functions. 9713 </description> 9714 </param> 9715 <param id="..."> 9716 <varargs/> 9717 <description> 9718 The extension function-specific parameters 9719 </description> 9720 </param> 9721 </parameters> 9722 </callback> 9723 9724 <function id="GetExtensionFunctions" phase="onload" num="124"> 9725 <synopsis>Get Extension Functions</synopsis> 9726 9727 <typedef id="jvmtiExtensionFunctionInfo" label="Extension Function Info"> 9728 <field id="func"> 9729 <ptrtype> 9730 <struct>jvmtiExtensionFunction</struct> 9731 </ptrtype> 9732 <description> 9733 The actual function to call 9734 </description> 9735 </field> 9736 <field id="id"> 9737 <allocfieldbuf><char/></allocfieldbuf> 9738 <description> 9739 The identifier for the extension function, encoded as a 9740 <internallink id="mUTF">modified UTF-8</internallink> string. 9741 Uses package name conventions. 9742 For example, <code>com.sun.hotspot.bar</code> 9743 </description> 9744 </field> 9745 <field id="short_description"> 9746 <allocfieldbuf><char/></allocfieldbuf> 9747 <description> 9748 A one sentence description of the function, encoded as a 9749 <internallink id="mUTF">modified UTF-8</internallink> string. 9750 </description> 9751 </field> 9752 <field id="param_count"> 9753 <jint/> 9754 <description> 9755 The number of parameters excluding <code>jvmtiEnv *jvmti_env</code> 9756 </description> 9757 </field> 9758 <field id="params"> 9759 <allocfieldbuf outcount="param_count"> 9760 <struct>jvmtiParamInfo</struct> 9761 </allocfieldbuf> 9762 <description> 9763 Array of 9764 <fieldlink id="param_count" struct="jvmtiExtensionFunctionInfo"></fieldlink> 9765 parameters (<code>jvmtiEnv *jvmti_env</code> excluded) 9766 </description> 9767 </field> 9768 <field id="error_count"> 9769 <jint/> 9770 <description> 9771 The number of possible error returns (excluding universal errors) 9772 </description> 9773 </field> 9774 <field id="errors"> 9775 <allocfieldbuf outcount="error_count"> 9776 <enum>jvmtiError</enum> 9777 </allocfieldbuf> 9778 <description> 9779 Array of <fieldlink id="error_count" struct="jvmtiExtensionFunctionInfo"></fieldlink> 9780 possible errors 9781 </description> 9782 </field> 9783 </typedef> 9784 9785 <description> 9786 Returns the set of extension functions. 9787 </description> 9788 <origin>new</origin> 9789 <capabilities> 9790 </capabilities> 9791 <parameters> 9792 <param id="extension_count_ptr"> 9793 <outptr><jint/></outptr> 9794 <description> 9795 On return, points to the number of extension functions 9796 </description> 9797 </param> 9798 <param id="extensions"> 9799 <allocbuf outcount="extension_count_ptr"><struct>jvmtiExtensionFunctionInfo</struct></allocbuf> 9800 <description> 9801 Returns an array of extension function info, one per function 9802 </description> 9803 </param> 9804 </parameters> 9805 <errors> 9806 </errors> 9807 </function> 9808 9809 <function id="GetExtensionEvents" phase="onload" num="125"> 9810 <synopsis>Get Extension Events</synopsis> 9811 9812 <typedef id="jvmtiExtensionEventInfo" label="Extension Event Info"> 9813 <field id="extension_event_index"> 9814 <jint/> 9815 <description> 9816 The identifying index of the event 9817 </description> 9818 </field> 9819 <field id="id"> 9820 <allocfieldbuf><char/></allocfieldbuf> 9821 <description> 9822 The identifier for the extension event, encoded as a 9823 <internallink id="mUTF">modified UTF-8</internallink> string. 9824 Uses package name conventions. 9825 For example, <code>com.sun.hotspot.bar</code> 9826 </description> 9827 </field> 9828 <field id="short_description"> 9829 <allocfieldbuf><char/></allocfieldbuf> 9830 <description> 9831 A one sentence description of the event, encoded as a 9832 <internallink id="mUTF">modified UTF-8</internallink> string. 9833 </description> 9834 </field> 9835 <field id="param_count"> 9836 <jint/> 9837 <description> 9838 The number of parameters excluding <code>jvmtiEnv *jvmti_env</code> 9839 </description> 9840 </field> 9841 <field id="params"> 9842 <allocfieldbuf outcount="param_count"> 9843 <struct>jvmtiParamInfo</struct> 9844 </allocfieldbuf> 9845 <description> 9846 Array of 9847 <fieldlink id="param_count" struct="jvmtiExtensionEventInfo"></fieldlink> 9848 parameters (<code>jvmtiEnv *jvmti_env</code> excluded) 9849 </description> 9850 </field> 9851 </typedef> 9852 9853 <description> 9854 Returns the set of extension events. 9855 </description> 9856 <origin>new</origin> 9857 <capabilities> 9858 </capabilities> 9859 <parameters> 9860 <param id="extension_count_ptr"> 9861 <outptr><jint/></outptr> 9862 <description> 9863 On return, points to the number of extension events 9864 </description> 9865 </param> 9866 <param id="extensions"> 9867 <allocbuf outcount="extension_count_ptr"><struct>jvmtiExtensionEventInfo</struct></allocbuf> 9868 <description> 9869 Returns an array of extension event info, one per event 9870 </description> 9871 </param> 9872 </parameters> 9873 <errors> 9874 </errors> 9875 </function> 9876 9877 <callback id="jvmtiExtensionEvent"> 9878 <void/> 9879 <synopsis>Extension Event</synopsis> 9880 <description> 9881 This is the implementation-specific event. 9882 The event handler is set with 9883 <functionlink id="SetExtensionEventCallback"/>. 9884 <p/> 9885 Event handlers for extension events must be declared varargs to match this definition. 9886 Failure to do so could result in calling convention mismatch and undefined behavior 9887 on some platforms. 9888 <p/> 9889 For example, if the <code>jvmtiParamInfo</code> 9890 returned by <functionlink id="GetExtensionEvents"/> indicates that 9891 there is a <code>jint</code> parameter, the event handler should be 9892 declared: 9893 <example> 9894 void JNICALL myHandler(jvmtiEnv* jvmti_env, jint myInt, ...) 9895 </example> 9896 Note the terminal "<code>...</code>" which indicates varargs. 9897 </description> 9898 <parameters> 9899 <param id="jvmti_env"> 9900 <outptr> 9901 <struct>jvmtiEnv</struct> 9902 </outptr> 9903 <description> 9904 The <jvmti/> environment is the only fixed parameter for extension events. 9905 </description> 9906 </param> 9907 <param id="..."> 9908 <varargs/> 9909 <description> 9910 The extension event-specific parameters 9911 </description> 9912 </param> 9913 </parameters> 9914 </callback> 9915 9916 <function id="SetExtensionEventCallback" phase="onload" num="126"> 9917 <synopsis>Set Extension Event Callback</synopsis> 9918 9919 <description> 9920 Sets the callback function for an extension event and 9921 enables the event. Or, if the callback is <code>NULL</code>, disables 9922 the event. Note that unlike standard events, setting 9923 the callback and enabling the event are a single operation. 9924 </description> 9925 <origin>new</origin> 9926 <capabilities> 9927 </capabilities> 9928 <parameters> 9929 <param id="extension_event_index"> 9930 <jint/> 9931 <description> 9932 Identifies which callback to set. 9933 This index is the 9934 <fieldlink id="extension_event_index" struct="jvmtiExtensionEventInfo"></fieldlink> 9935 field of 9936 <datalink id="jvmtiExtensionEventInfo"/>. 9937 </description> 9938 </param> 9939 <param id="callback"> 9940 <ptrtype> 9941 <struct>jvmtiExtensionEvent</struct> 9942 <nullok>disable the event</nullok> 9943 </ptrtype> 9944 <description> 9945 If <code>callback</code> is non-<code>NULL</code>, 9946 set <code>callback</code> to be the event callback function 9947 and enable the event. 9948 </description> 9949 </param> 9950 </parameters> 9951 <errors> 9952 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 9953 <paramlink id="extension_event_index"/> is not an 9954 <fieldlink id="extension_event_index" 9955 struct="jvmtiExtensionEventInfo"/> 9956 returned by 9957 <functionlink id="GetExtensionEvents"/> 9958 </error> 9959 </errors> 9960 </function> 9961 9962 </category> 9963 9964 <category id="capability" label="Capability"> 9965 9966 <intro> 9967 The capabilities functions allow you to change the 9968 functionality available to <jvmti/>--that is, 9969 which <jvmti/> 9970 functions can be called, what events can be generated, 9971 and what functionality these events and functions can 9972 provide. 9973 <p/> 9974 The "Capabilities" section of each function and event describe which 9975 capabilities, if any, they are associated with. "Required Functionality" 9976 means it is available for use and no capabilities must be added to use it. 9977 "Optional Functionality" means the agent must possess the capability 9978 before it can be used. 9979 To possess a capability, the agent must 9980 <functionlink id="AddCapabilities">add the capability</functionlink>. 9981 "Optional Features" describe capabilities which, 9982 if added, extend the feature set. 9983 <p/> 9984 The potentially available capabilities of each <jvmti/> implementation are different. 9985 Depending on the implementation, a capability: 9986 <ul> 9987 <li>may never be added</li> 9988 <li>may be added in either the <code>OnLoad</code> or live phase in any environment</li> 9989 <li>may be added only during the <code>OnLoad</code> phase</li> 9990 <li>may be possessed by only one environment at a time</li> 9991 <li>may be possessed by only one environment at a time, 9992 and only during the <code>OnLoad</code> phase</li> 9993 <li>and so on ...</li> 9994 </ul> 9995 Frequently, the addition of a capability may incur a cost in execution speed, start up 9996 time, and/or memory footprint. Note that the overhead of using a capability 9997 is completely different than the overhead of possessing a capability. 9998 Take single stepping as an example. When single stepping is on (that 9999 is, when the event is enabled and thus actively sending events) 10000 the overhead of sending and processing an event 10001 on each instruction is huge in any implementation. 10002 However, the overhead of possessing the capability may be small or large, 10003 depending on the implementation. Also, when and if a capability is potentially 10004 available depends on the implementation. Some examples: 10005 <ul> 10006 <li>One VM might perform all execution by compiling bytecodes into 10007 native code and be unable to generate single step instructions. 10008 In this implementation the capability can not be added.</li> 10009 <li>Another VM may be able to switch execution to a single stepping 10010 interpreter at any time. In this implementation, having the capability has no 10011 overhead and could be added at any time.</li> 10012 <li>Yet another VM might be able to choose a bytecode compiling or single stepping capable interpreted 10013 execution engine at start up, but be unable to switch between them. 10014 In this implementation the capability would need to be added 10015 during the <code>OnLoad</code> phase (before bytecode 10016 execution begins) and would have a large impact on execution speed 10017 even if single stepping was never used.</li> 10018 <li>Still another VM might be able to add an "is single stepping on" check 10019 into compiled bytecodes or a generated interpreter. Again in this implementation 10020 the capability would need to be added during the <code>OnLoad</code> phase but the overhead (a test 10021 and branch on each instruction) would be considerably less.</li> 10022 </ul> 10023 <p/> 10024 Each <jvmti/> <internallink id="environments">environment</internallink> 10025 has its own set of capabilities. 10026 Initially, that set is empty. 10027 Any desired capability must be added. 10028 If possible, capabilities should be added during the <code>OnLoad</code> phase. For most 10029 virtual machines certain capabilities require special set up for 10030 the virtual machine and this set up must happen 10031 during the <code>OnLoad</code> phase, before the virtual machine begins execution. 10032 Once a capability is added, it can 10033 only be removed if explicitly relinquished by the environment. 10034 <p/> 10035 The agent can, 10036 <functionlink id="GetPotentialCapabilities">determine what 10037 capabilities this VM can potentially provide</functionlink>, 10038 <functionlink id="AddCapabilities">add the capabilities 10039 to be used</functionlink>, 10040 <functionlink id="RelinquishCapabilities">release capabilities 10041 which are no longer needed</functionlink>, and 10042 <functionlink id="GetCapabilities">examine the currently available 10043 capabilities</functionlink>. 10044 </intro> 10045 10046 <intro id="capabilityExamples" label="Capability Examples"> 10047 For example, a freshly started agent (in the <code>OnLoad</code> function) 10048 wants to enable all possible capabilities. 10049 Note that, in general, this is not advisable as the agent may suffer 10050 a performance penalty for functionality it is not using. 10051 The code might look like this in C: 10052 <example> 10053 jvmtiCapabilities capa; 10054 jvmtiError err; 10055 10056 err = (*jvmti)->GetPotentialCapabilities(jvmti, &capa); 10057 if (err == JVMTI_ERROR_NONE) { 10058 err = (*jvmti)->AddCapabilities(jvmti, &capa); 10059 </example> 10060 For example, if an agent wants to check if it can get 10061 the bytecodes of a method (that is, it wants to check 10062 if it previously added this capability and has not 10063 relinquished it), the code might 10064 look like this in C: 10065 <example> 10066 jvmtiCapabilities capa; 10067 jvmtiError err; 10068 10069 err = (*jvmti)->GetCapabilities(jvmti, &capa); 10070 if (err == JVMTI_ERROR_NONE) { 10071 if (capa.can_get_bytecodes) { ... } } 10072 </example> 10073 </intro> 10074 10075 <capabilitiestypedef id="jvmtiCapabilities" label="The Capabilities Structure"> 10076 <description> 10077 The functions in this category use this capabilities structure 10078 which contains boolean flags corresponding to each capability: 10079 </description> 10080 <capabilityfield id="can_tag_objects"> 10081 <description> 10082 Can set and get tags, as described in the 10083 <internallink id="Heap">Heap category</internallink>. 10084 </description> 10085 </capabilityfield> 10086 <capabilityfield id="can_generate_field_modification_events"> 10087 <description> 10088 Can set watchpoints on field modification - 10089 <functionlink id="SetFieldModificationWatch"></functionlink> 10090 </description> 10091 </capabilityfield> 10092 <capabilityfield id="can_generate_field_access_events"> 10093 <description> 10094 Can set watchpoints on field access - 10095 <functionlink id="SetFieldAccessWatch"></functionlink> 10096 </description> 10097 </capabilityfield> 10098 <capabilityfield id="can_get_bytecodes"> 10099 <description> 10100 Can get bytecodes of a method <functionlink id="GetBytecodes"></functionlink> 10101 </description> 10102 </capabilityfield> 10103 <capabilityfield id="can_get_synthetic_attribute"> 10104 <description> 10105 Can test if a field or method is synthetic - 10106 <functionlink id="IsFieldSynthetic"></functionlink> and 10107 <functionlink id="IsMethodSynthetic"></functionlink> 10108 </description> 10109 </capabilityfield> 10110 <capabilityfield id="can_get_owned_monitor_info"> 10111 <description> 10112 Can get information about ownership of monitors - 10113 <functionlink id="GetOwnedMonitorInfo"></functionlink> 10114 </description> 10115 </capabilityfield> 10116 <capabilityfield id="can_get_current_contended_monitor"> 10117 <description> 10118 Can <functionlink id="GetCurrentContendedMonitor"></functionlink> 10119 </description> 10120 </capabilityfield> 10121 <capabilityfield id="can_get_monitor_info"> 10122 <description> 10123 Can <functionlink id="GetObjectMonitorUsage"></functionlink> 10124 </description> 10125 </capabilityfield> 10126 <capabilityfield id="can_pop_frame"> 10127 <description> 10128 Can pop frames off the stack - <functionlink id="PopFrame"></functionlink> 10129 </description> 10130 </capabilityfield> 10131 <capabilityfield id="can_redefine_classes"> 10132 <description> 10133 Can redefine classes with <functionlink id="RedefineClasses"/>. 10134 </description> 10135 </capabilityfield> 10136 <capabilityfield id="can_signal_thread"> 10137 <description> 10138 Can send stop or interrupt to threads 10139 </description> 10140 </capabilityfield> 10141 <capabilityfield id="can_get_source_file_name"> 10142 <description> 10143 Can get the source file name of a class 10144 </description> 10145 </capabilityfield> 10146 <capabilityfield id="can_get_line_numbers"> 10147 <description> 10148 Can get the line number table of a method 10149 </description> 10150 </capabilityfield> 10151 <capabilityfield id="can_get_source_debug_extension"> 10152 <description> 10153 Can get the source debug extension of a class 10154 </description> 10155 </capabilityfield> 10156 <capabilityfield id="can_access_local_variables"> 10157 <description> 10158 Can set and get local variables 10159 </description> 10160 </capabilityfield> 10161 <capabilityfield id="can_maintain_original_method_order"> 10162 <description> 10163 Can return methods in the order they occur in the class file 10164 </description> 10165 </capabilityfield> 10166 <capabilityfield id="can_generate_single_step_events"> 10167 <description> 10168 Can get <eventlink id="SingleStep">single step</eventlink> events 10169 </description> 10170 </capabilityfield> 10171 <capabilityfield id="can_generate_exception_events"> 10172 <description> 10173 Can get <eventlink id="Exception">exception thrown</eventlink> and 10174 <eventlink id="ExceptionCatch">exception catch</eventlink> events 10175 </description> 10176 </capabilityfield> 10177 <capabilityfield id="can_generate_frame_pop_events"> 10178 <description> 10179 Can <functionlink id="NotifyFramePop">set</functionlink> and thus get 10180 <eventlink id="FramePop"></eventlink> events 10181 </description> 10182 </capabilityfield> 10183 <capabilityfield id="can_generate_breakpoint_events"> 10184 <description> 10185 Can <functionlink id="SetBreakpoint">set</functionlink> and thus get 10186 <eventlink id="Breakpoint"></eventlink> events 10187 </description> 10188 </capabilityfield> 10189 <capabilityfield id="can_suspend"> 10190 <description> 10191 Can suspend and resume threads 10192 </description> 10193 </capabilityfield> 10194 <capabilityfield id="can_redefine_any_class"> 10195 <description> 10196 Can modify (retransform or redefine) any modifiable class. 10197 See <functionlink id="IsModifiableClass"/>. 10198 </description> 10199 </capabilityfield> 10200 <capabilityfield id="can_get_current_thread_cpu_time"> 10201 <description> 10202 Can <functionlink id="GetCurrentThreadCpuTime">get</functionlink> 10203 current thread CPU time 10204 </description> 10205 </capabilityfield> 10206 <capabilityfield id="can_get_thread_cpu_time"> 10207 <description> 10208 Can <functionlink id="GetThreadCpuTime">get</functionlink> 10209 thread CPU time 10210 </description> 10211 </capabilityfield> 10212 <capabilityfield id="can_generate_method_entry_events" 10213 disp1="can_generate" disp2="_method_entry_events" 10214 > 10215 <description> 10216 Can generate method entry events on entering a method 10217 </description> 10218 </capabilityfield> 10219 <capabilityfield id="can_generate_method_exit_events" 10220 disp1="can_generate" disp2="_method_exit_events" 10221 > 10222 <description> 10223 Can generate method exit events on leaving a method 10224 </description> 10225 </capabilityfield> 10226 <capabilityfield id="can_generate_all_class_hook_events" 10227 disp1="can_generate" disp2="_all_class_hook_events" 10228 > 10229 <description> 10230 Can generate ClassFileLoadHook events for every loaded class. 10231 </description> 10232 </capabilityfield> 10233 <capabilityfield id="can_generate_compiled_method_load_events" 10234 disp1="can_generate" disp2="_compiled_method_load_events" 10235 > 10236 <description> 10237 Can generate events when a method is compiled or unloaded 10238 </description> 10239 </capabilityfield> 10240 <capabilityfield id="can_generate_monitor_events" 10241 disp1="can_generate" disp2="_monitor_events" 10242 > 10243 <description> 10244 Can generate events on monitor activity 10245 </description> 10246 </capabilityfield> 10247 <capabilityfield id="can_generate_vm_object_alloc_events" 10248 disp1="can_generate" disp2="_vm_object_alloc_events" 10249 > 10250 <description> 10251 Can generate events on VM allocation of an object 10252 </description> 10253 </capabilityfield> 10254 <capabilityfield id="can_generate_native_method_bind_events" 10255 disp1="can_generate" disp2="_native_method_bind_events" 10256 > 10257 <description> 10258 Can generate events when a native method is bound to its 10259 implementation 10260 </description> 10261 </capabilityfield> 10262 <capabilityfield id="can_generate_garbage_collection_events" 10263 disp1="can_generate" disp2="_garbage_collection_events" 10264 > 10265 <description> 10266 Can generate events when garbage collection begins or ends 10267 </description> 10268 </capabilityfield> 10269 <capabilityfield id="can_generate_object_free_events" 10270 disp1="can_generate" disp2="_object_free_events" 10271 > 10272 <description> 10273 Can generate events when the garbage collector frees an object 10274 </description> 10275 </capabilityfield> 10276 <capabilityfield id="can_force_early_return" since="1.1"> 10277 <description> 10278 Can return early from a method, as described in the 10279 <internallink id="ForceEarlyReturn">Force Early Return category</internallink>. 10280 </description> 10281 </capabilityfield> 10282 <capabilityfield id="can_get_owned_monitor_stack_depth_info" since="1.1"> 10283 <description> 10284 Can get information about owned monitors with stack depth - 10285 <functionlink id="GetOwnedMonitorStackDepthInfo"></functionlink> 10286 </description> 10287 </capabilityfield> 10288 <capabilityfield id="can_get_constant_pool" since="1.1"> 10289 <description> 10290 Can get the constant pool of a class - 10291 <functionlink id="GetConstantPool"></functionlink> 10292 </description> 10293 </capabilityfield> 10294 <capabilityfield id="can_set_native_method_prefix" since="1.1"> 10295 <description> 10296 Can set prefix to be applied when native method cannot be resolved - 10297 <functionlink id="SetNativeMethodPrefix"/> and 10298 <functionlink id="SetNativeMethodPrefixes"/> 10299 </description> 10300 </capabilityfield> 10301 <capabilityfield id="can_retransform_classes" since="1.1"> 10302 <description> 10303 Can retransform classes with <functionlink id="RetransformClasses"/>. 10304 In addition to the restrictions imposed by the specific 10305 implementation on this capability (see the 10306 <internallink id="capability">Capability</internallink> section), 10307 this capability must be set before the 10308 <eventlink id="ClassFileLoadHook"/> event is enabled for the 10309 first time in this environment. 10310 An environment that possesses this capability at the time that 10311 <code>ClassFileLoadHook</code> is enabled for the first time is 10312 said to be <i>retransformation capable</i>. 10313 An environment that does not possess this capability at the time that 10314 <code>ClassFileLoadHook</code> is enabled for the first time is 10315 said to be <i>retransformation incapable</i>. 10316 </description> 10317 </capabilityfield> 10318 <capabilityfield id="can_retransform_any_class" since="1.1"> 10319 <description> 10320 <functionlink id="RetransformClasses"/> can be called on any modifiable class. 10321 See <functionlink id="IsModifiableClass"/>. 10322 (<fieldlink id="can_retransform_classes" struct="jvmtiCapabilities"/> 10323 must also be set) 10324 </description> 10325 </capabilityfield> 10326 <capabilityfield id="can_generate_resource_exhaustion_heap_events" since="1.1"> 10327 <description> 10328 Can generate events when the VM is unable to allocate memory from 10329 the <tm>Java</tm> platform heap. 10330 See <eventlink id="ResourceExhausted"/>. 10331 </description> 10332 </capabilityfield> 10333 <capabilityfield id="can_generate_resource_exhaustion_threads_events" since="1.1"> 10334 <description> 10335 Can generate events when the VM is unable to create a thread. 10336 See <eventlink id="ResourceExhausted"/>. 10337 </description> 10338 </capabilityfield> 10339 <capabilityfield id="can_generate_early_vmstart" since="9"> 10340 <description> 10341 Can generate the <code>VMStart</code> event early. 10342 See <eventlink id="VMStart"/>. 10343 </description> 10344 </capabilityfield> 10345 <capabilityfield id="can_generate_early_class_hook_events" since="9"> 10346 <description> 10347 Can generate the <eventlink id="ClassFileLoadHook"/> events 10348 in the primordial phase. If this capability and 10349 <internallink id="jvmtiCapabilities.can_generate_all_class_hook_events"> 10350 <code>can_generate_all_class_hook_events</code></internallink> 10351 are enabled then the <eventlink id="ClassFileLoadHook"/> events 10352 can be posted for classes loaded in the primordial phase. 10353 See <eventlink id="ClassFileLoadHook"/>. 10354 </description> 10355 </capabilityfield> 10356 </capabilitiestypedef> 10357 10358 <function id="GetPotentialCapabilities" jkernel="yes" phase="onload" num="140"> 10359 <synopsis>Get Potential Capabilities</synopsis> 10360 <description> 10361 Returns via <paramlink id="capabilities_ptr"></paramlink> the <jvmti/> 10362 features that can potentially be possessed by this environment 10363 at this time. 10364 The returned capabilities differ from the complete set of capabilities 10365 implemented by the VM in two cases: another environment possesses 10366 capabilities that can only be possessed by one environment, or the 10367 current <functionlink id="GetPhase">phase</functionlink> is live, 10368 and certain capabilities can only be added during the <code>OnLoad</code> phase. 10369 The <functionlink id="AddCapabilities"></functionlink> function 10370 may be used to set any or all or these capabilities. 10371 Currently possessed capabilities are included. 10372 <p/> 10373 Typically this function is used in the <code>OnLoad</code> function. 10374 Some virtual machines may allow a limited set of capabilities to be 10375 added in the live phase. 10376 In this case, the set of potentially available capabilities 10377 will likely differ from the <code>OnLoad</code> phase set. 10378 <p/> 10379 See the 10380 <internallink id="capabilityExamples">Capability Examples</internallink>. 10381 </description> 10382 <origin>new</origin> 10383 <capabilities> 10384 </capabilities> 10385 <parameters> 10386 <param id="capabilities_ptr"> 10387 <outptr><struct>jvmtiCapabilities</struct></outptr> 10388 <description> 10389 On return, points to the <jvmti/> capabilities that may be added. 10390 </description> 10391 </param> 10392 </parameters> 10393 <errors> 10394 </errors> 10395 </function> 10396 10397 <elide> 10398 <function id="EstimateCostOfCapabilities" phase="onload" num="141"> 10399 <synopsis>Estimate Cost Of Capabilities</synopsis> 10400 <description> 10401 <issue>There is strong opposition to this function. The concern is 10402 that it would be difficult or impossible to provide meaningful 10403 numbers, as the amount of impact is conditional on many factors 10404 that a single number could not represent. There is doubt that 10405 conditional implementations would be used or are even a good idea. 10406 The thought is that release documentation for the implementation 10407 would be the best means of exposing this information. 10408 Unless new arguments are presented, I intend to remove this 10409 function in the next revision. 10410 </issue> 10411 <p/> 10412 Return via the <paramlink id="time_impact_ptr"></paramlink> and 10413 <paramlink id="space_impact_ptr"></paramlink> an estimate of the impact 10414 of adding the capabilities pointed to by 10415 <paramlink id="capabilities_ptr"></paramlink>. 10416 The returned estimates are in percentage of additional overhead, thus 10417 a time impact of 100 mean the application might run 10418 at half the speed. 10419 The estimates are very rough approximations and are not guaranteed. 10420 Note also, that the estimates are of the impact of having the 10421 capability available--when and if it is used the impact may be 10422 much greater. 10423 Estimates can be for a single capability or for a set of 10424 capabilities. Note that the costs are not necessarily additive, 10425 adding support for one capability might make another available 10426 for free or conversely having two capabilities at once may 10427 have multiplicative impact. 10428 Estimates are relative to the current set of capabilities - 10429 that is, how much more impact given the currently possessed capabilities. 10430 <p/> 10431 Typically this function is used in the OnLoad function, 10432 some virtual machines may allow a limited set of capabilities to be 10433 added in the live phase. 10434 In this case, the set of potentially available capabilities 10435 will likely differ from the OnLoad phase set. 10436 <p/> 10437 See the 10438 <internallink id="capabilityExamples">Capability Examples</internallink>. 10439 </description> 10440 <origin>new</origin> 10441 <capabilities> 10442 </capabilities> 10443 <parameters> 10444 <param id="capabilities_ptr"> 10445 <inptr><struct>jvmtiCapabilities</struct></inptr> 10446 <description> 10447 points to the <jvmti/> capabilities to evaluate. 10448 </description> 10449 </param> 10450 <param id="time_impact_ptr"> 10451 <outptr><jint/></outptr> 10452 <description> 10453 On return, points to the estimated percentage increase in 10454 run time if this capability was added. 10455 </description> 10456 </param> 10457 <param id="space_impact_ptr"> 10458 <outptr><jint/></outptr> 10459 <description> 10460 On return, points to the estimated percentage increase in 10461 memory space used if this capability was added. 10462 </description> 10463 </param> 10464 </parameters> 10465 <errors> 10466 <error id="JVMTI_ERROR_NOT_AVAILABLE"> 10467 The desired capabilities are not even potentially available. 10468 </error> 10469 </errors> 10470 </function> 10471 </elide> 10472 10473 <function id="AddCapabilities" jkernel="yes" phase="onload" num="142"> 10474 <synopsis>Add Capabilities</synopsis> 10475 <description> 10476 Set new capabilities by adding the capabilities 10477 whose values are set to one (<code>1</code>) in 10478 <code>*</code><paramlink id="capabilities_ptr"></paramlink>. 10479 All previous capabilities are retained. 10480 Typically this function is used in the <code>OnLoad</code> function. 10481 Some virtual machines may allow a limited set of capabilities to be 10482 added in the live phase. 10483 <p/> 10484 See the 10485 <internallink id="capabilityExamples">Capability Examples</internallink>. 10486 </description> 10487 <origin>new</origin> 10488 <capabilities> 10489 </capabilities> 10490 <parameters> 10491 <param id="capabilities_ptr"> 10492 <inptr><struct>jvmtiCapabilities</struct></inptr> 10493 <description> 10494 Points to the <jvmti/> capabilities to add. 10495 </description> 10496 </param> 10497 </parameters> 10498 <errors> 10499 <error id="JVMTI_ERROR_NOT_AVAILABLE"> 10500 The desired capabilities are not even potentially available. 10501 </error> 10502 </errors> 10503 </function> 10504 10505 10506 <function id="RelinquishCapabilities" phase="onload" num="143"> 10507 <synopsis>Relinquish Capabilities</synopsis> 10508 <description> 10509 Relinquish the capabilities 10510 whose values are set to one (<code>1</code>) in 10511 <code>*</code><paramlink id="capabilities_ptr"></paramlink>. 10512 Some implementations may allow only one environment to have a capability 10513 (see the <internallink id="capability">capability introduction</internallink>). 10514 This function releases capabilities 10515 so that they may be used by other agents. 10516 All other capabilities are retained. 10517 The capability will no longer be present in <functionlink id="GetCapabilities"></functionlink>. 10518 Attempting to relinquish a capability that the agent does not possess is not an error. 10519 <issue> 10520 It is possible for the agent to be actively using capabilities 10521 which are being relinquished. For example, a thread is currently 10522 suspended and can_suspend is being relinquished or an event is currently 10523 enabled and can_generate_whatever is being relinquished. 10524 There are three possible ways we could spec this: 10525 <ul> 10526 <li>relinquish automatically releases them</li> 10527 <li>relinquish checks and returns some error code if held</li> 10528 <li>it is the agent's responsibility and it is not checked</li> 10529 </ul> 10530 One of these should be chosen. 10531 </issue> 10532 </description> 10533 <origin>new</origin> 10534 <capabilities> 10535 </capabilities> 10536 <parameters> 10537 <param id="capabilities_ptr"> 10538 <inptr><struct>jvmtiCapabilities</struct></inptr> 10539 <description> 10540 Points to the <jvmti/> capabilities to relinquish. 10541 </description> 10542 </param> 10543 </parameters> 10544 <errors> 10545 </errors> 10546 </function> 10547 10548 10549 10550 <function id="GetCapabilities" jkernel="yes" phase="any" num="89"> 10551 <synopsis>Get Capabilities</synopsis> 10552 <description> 10553 Returns via <paramlink id="capabilities_ptr"></paramlink> the optional <jvmti/> 10554 features which this environment currently possesses. 10555 Each possessed capability is indicated by a one (<code>1</code>) in the 10556 corresponding field of the <internallink id="jvmtiCapabilities">capabilities 10557 structure</internallink>. 10558 An environment does not possess a capability unless it has been successfully added with 10559 <functionlink id="AddCapabilities"/>. 10560 An environment only loses possession of a capability if it has been relinquished with 10561 <functionlink id="RelinquishCapabilities"/>. Thus, this function returns the net result 10562 of the <code>AddCapabilities</code> and <code>RelinquishCapabilities</code> calls which 10563 have been made. 10564 <p/> 10565 See the 10566 <internallink id="capabilityExamples">Capability Examples</internallink>. 10567 </description> 10568 <origin>jvmdiClone</origin> 10569 <capabilities> 10570 </capabilities> 10571 <parameters> 10572 <param id="capabilities_ptr"> 10573 <outptr><struct>jvmtiCapabilities</struct></outptr> 10574 <description> 10575 On return, points to the <jvmti/> capabilities. 10576 </description> 10577 </param> 10578 </parameters> 10579 <errors> 10580 </errors> 10581 </function> 10582 10583 </category> 10584 10585 10586 <category id="timers" label="Timers"> 10587 10588 <intro> 10589 These functions provide timing information. 10590 The resolution at which the time is updated is not specified. 10591 They provides nanosecond precision, but not necessarily nanosecond accuracy. 10592 Details about the timers, such as their maximum values, can be accessed with 10593 the timer information functions. 10594 </intro> 10595 10596 <typedef id="jvmtiTimerInfo" label="Timer Info"> 10597 <description> 10598 The information function for each timer returns this data structure. 10599 </description> 10600 <field id="max_value"> 10601 <jlong/> 10602 <description> 10603 The maximum value the timer can reach. 10604 After this value is reached the timer wraps back to zero. 10605 This is an unsigned value. If tested or printed as a jlong (signed value) 10606 it may appear to be a negative number. 10607 </description> 10608 </field> 10609 <field id="may_skip_forward"> 10610 <jboolean/> 10611 <description> 10612 If true, the timer can be externally adjusted and as a result skip forward. 10613 If false, the timer value will never increase faster than real time. 10614 </description> 10615 </field> 10616 <field id="may_skip_backward"> 10617 <jboolean/> 10618 <description> 10619 If true, the timer can be externally adjusted and as a result skip backward. 10620 If false, the timer value will be monotonically increasing. 10621 </description> 10622 </field> 10623 <field id="kind"> 10624 <enum>jvmtiTimerKind</enum> 10625 <description> 10626 The kind of timer. 10627 On a platform that does not distinguish between user and system time, <datalink 10628 id="JVMTI_TIMER_TOTAL_CPU"><code>JVMTI_TIMER_TOTAL_CPU</code></datalink> 10629 is returned. 10630 </description> 10631 </field> 10632 <field id="reserved1"> 10633 <jlong/> 10634 <description> 10635 Reserved for future use. 10636 </description> 10637 </field> 10638 <field id="reserved2"> 10639 <jlong/> 10640 <description> 10641 Reserved for future use. 10642 </description> 10643 </field> 10644 </typedef> 10645 10646 <intro> 10647 Where the timer kind is -- 10648 10649 <constants id="jvmtiTimerKind" label="Timer Kinds" kind="enum"> 10650 <constant id="JVMTI_TIMER_USER_CPU" num="30"> 10651 CPU time that a thread is in user mode. 10652 </constant> 10653 <constant id="JVMTI_TIMER_TOTAL_CPU" num="31"> 10654 CPU time that a thread is in user or system mode. 10655 </constant> 10656 <constant id="JVMTI_TIMER_ELAPSED" num="32"> 10657 Elapsed time. 10658 </constant> 10659 </constants> 10660 </intro> 10661 10662 <function id="GetCurrentThreadCpuTimerInfo" callbacksafe="safe" impl="innative notrace" phase="start" num="134"> 10663 <synopsis>Get Current Thread CPU Timer Information</synopsis> 10664 <description> 10665 Get information about the 10666 <functionlink id="GetCurrentThreadCpuTime"/> timer. 10667 The fields of the <datalink id="jvmtiTimerInfo"/> structure 10668 are filled in with details about the timer. 10669 This information is specific to the platform and the implementation of 10670 <functionlink id="GetCurrentThreadCpuTime"/> and thus 10671 does not vary by thread nor does it vary 10672 during a particular invocation of the VM. 10673 <p/> 10674 Note that the implementations of <functionlink id="GetCurrentThreadCpuTime"/> 10675 and <functionlink id="GetThreadCpuTime"/> may differ, and thus the values 10676 returned by <code>GetCurrentThreadCpuTimerInfo</code> 10677 and <functionlink id="GetThreadCpuTimerInfo"/> 10678 may differ -- see <functionlink id="GetCurrentThreadCpuTime"/> for more information. 10679 </description> 10680 <origin>new</origin> 10681 <capabilities> 10682 <required id="can_get_current_thread_cpu_time"> 10683 Can get current thread CPU time. 10684 </required> 10685 </capabilities> 10686 <parameters> 10687 <param id="info_ptr"> 10688 <outptr><struct>jvmtiTimerInfo</struct></outptr> 10689 <description> 10690 On return, filled with information describing the time 10691 returned by <functionlink id="GetCurrentThreadCpuTime"/>. 10692 </description> 10693 </param> 10694 </parameters> 10695 <errors> 10696 </errors> 10697 </function> 10698 10699 <function id="GetCurrentThreadCpuTime" callbacksafe="safe" impl="innative notrace" phase="start" num="135"> 10700 <synopsis>Get Current Thread CPU Time</synopsis> 10701 <description> 10702 Return the CPU time utilized by the current thread. 10703 <p/> 10704 Note that the <functionlink id="GetThreadCpuTime"/> 10705 function provides CPU time for any thread, including 10706 the current thread. <code>GetCurrentThreadCpuTime</code> 10707 exists to support platforms which cannot 10708 supply CPU time for threads other than the current 10709 thread or which have more accurate information for 10710 the current thread (see 10711 <functionlink id="GetCurrentThreadCpuTimerInfo"/> vs 10712 <functionlink id="GetThreadCpuTimerInfo"/>). 10713 On many platforms this call will be equivalent to: 10714 <example> 10715 GetThreadCpuTime(env, NULL, nanos_ptr) 10716 </example> 10717 </description> 10718 <origin>new</origin> 10719 <capabilities> 10720 <required id="can_get_current_thread_cpu_time"> 10721 Can get current thread CPU time. 10722 <p/> 10723 If this capability is enabled after threads have started, 10724 the implementation may choose any time up 10725 to and including the time that the capability is enabled 10726 as the point where CPU time collection starts. 10727 <p/> 10728 This capability must be potentially available on any 10729 platform where 10730 <internallink id="jvmtiCapabilities.can_get_thread_cpu_time"><code>can_get_thread_cpu_time</code></internallink> 10731 is potentially available. 10732 </required> 10733 </capabilities> 10734 <parameters> 10735 <param id="nanos_ptr"> 10736 <outptr><jlong/></outptr> 10737 <description> 10738 On return, points to the CPU time used by this thread 10739 in nanoseconds. 10740 This is an unsigned value. If tested or printed as a jlong (signed value) 10741 it may appear to be a negative number. 10742 </description> 10743 </param> 10744 </parameters> 10745 <errors> 10746 </errors> 10747 </function> 10748 10749 <function id="GetThreadCpuTimerInfo" num="136"> 10750 <synopsis>Get Thread CPU Timer Information</synopsis> 10751 <description> 10752 Get information about the 10753 <functionlink id="GetThreadCpuTime"/> timer. 10754 The fields of the <datalink id="jvmtiTimerInfo"/> structure 10755 are filled in with details about the timer. 10756 This information is specific to the platform and the implementation of 10757 <functionlink id="GetThreadCpuTime"/> and thus 10758 does not vary by thread nor does it vary 10759 during a particular invocation of the VM. 10760 <p/> 10761 Note that the implementations of <functionlink id="GetCurrentThreadCpuTime"/> 10762 and <functionlink id="GetThreadCpuTime"/> may differ, and thus the values 10763 returned by <functionlink id="GetCurrentThreadCpuTimerInfo"/> 10764 and <code>GetThreadCpuTimerInfo</code> 10765 may differ -- see <functionlink id="GetCurrentThreadCpuTime"/> for more information. 10766 </description> 10767 <origin>new</origin> 10768 <capabilities> 10769 <required id="can_get_thread_cpu_time"> 10770 Can get thread CPU time. 10771 </required> 10772 </capabilities> 10773 <parameters> 10774 <param id="info_ptr"> 10775 <outptr><struct>jvmtiTimerInfo</struct></outptr> 10776 <description> 10777 On return, filled with information describing the time 10778 returned by <functionlink id="GetThreadCpuTime"/>. 10779 </description> 10780 </param> 10781 </parameters> 10782 <errors> 10783 </errors> 10784 </function> 10785 10786 <function id="GetThreadCpuTime" num="137"> 10787 <synopsis>Get Thread CPU Time</synopsis> 10788 <description> 10789 Return the CPU time utilized by the specified thread. 10790 <p/> 10791 Get information about this timer with 10792 <functionlink id="GetThreadCpuTimerInfo"/>. 10793 </description> 10794 <origin>new</origin> 10795 <capabilities> 10796 <required id="can_get_thread_cpu_time"> 10797 Can get thread CPU time. 10798 <p/> 10799 If this capability is enabled after threads have started, 10800 the implementation may choose any time up 10801 to and including the time that the capability is enabled 10802 as the point where CPU time collection starts. 10803 </required> 10804 </capabilities> 10805 <parameters> 10806 <param id="thread"> 10807 <jthread null="current"/> 10808 <description> 10809 The thread to query. 10810 </description> 10811 </param> 10812 <param id="nanos_ptr"> 10813 <outptr><jlong/></outptr> 10814 <description> 10815 On return, points to the CPU time used by the specified thread 10816 in nanoseconds. 10817 This is an unsigned value. If tested or printed as a jlong (signed value) 10818 it may appear to be a negative number. 10819 </description> 10820 </param> 10821 </parameters> 10822 <errors> 10823 </errors> 10824 </function> 10825 10826 <function id="GetTimerInfo" phase="any" callbacksafe="safe" num="138"> 10827 <synopsis>Get Timer Information</synopsis> 10828 <description> 10829 Get information about the 10830 <functionlink id="GetTime"/> timer. 10831 The fields of the <datalink id="jvmtiTimerInfo"/> structure 10832 are filled in with details about the timer. 10833 This information will not change during a particular invocation of the VM. 10834 </description> 10835 <origin>new</origin> 10836 <capabilities> 10837 </capabilities> 10838 <parameters> 10839 <param id="info_ptr"> 10840 <outptr><struct>jvmtiTimerInfo</struct></outptr> 10841 <description> 10842 On return, filled with information describing the time 10843 returned by <functionlink id="GetTime"/>. 10844 </description> 10845 </param> 10846 </parameters> 10847 <errors> 10848 </errors> 10849 </function> 10850 10851 <function id="GetTime" phase="any" callbacksafe="safe" num="139"> 10852 <synopsis>Get Time</synopsis> 10853 <description> 10854 Return the current value of the system timer, in nanoseconds. 10855 <p/> 10856 The value returned represents nanoseconds since some fixed but 10857 arbitrary time (perhaps in the future, so values may be 10858 negative). This function provides nanosecond precision, but not 10859 necessarily nanosecond accuracy. No guarantees are made about 10860 how frequently values change. 10861 <p/> 10862 Get information about this timer with 10863 <functionlink id="GetTimerInfo"/>. 10864 </description> 10865 <origin>new</origin> 10866 <capabilities> 10867 </capabilities> 10868 <parameters> 10869 <param id="nanos_ptr"> 10870 <outptr><jlong/></outptr> 10871 <description> 10872 On return, points to the time in nanoseconds. 10873 This is an unsigned value. If tested or printed as a jlong (signed value) 10874 it may appear to be a negative number. 10875 </description> 10876 </param> 10877 </parameters> 10878 <errors> 10879 </errors> 10880 </function> 10881 10882 <function id="GetAvailableProcessors" phase="any" num="144"> 10883 <synopsis>Get Available Processors</synopsis> 10884 <description> 10885 Returns the number of processors available to the Java virtual machine. 10886 <p/> 10887 This value may change during a particular invocation of the virtual machine. 10888 Applications that are sensitive to the number of available processors should 10889 therefore occasionally poll this property. 10890 </description> 10891 <origin>new</origin> 10892 <capabilities> 10893 </capabilities> 10894 <parameters> 10895 <param id="processor_count_ptr"> 10896 <outptr><jint/></outptr> 10897 <description> 10898 On return, points to the maximum number of processors available to the 10899 virtual machine; never smaller than one. 10900 </description> 10901 </param> 10902 </parameters> 10903 <errors> 10904 </errors> 10905 </function> 10906 10907 </category> 10908 10909 10910 <category id="classLoaderSearch" label="Class Loader Search"> 10911 10912 <intro> 10913 These functions allow the agent to add to the locations that a class loader searches for a class. 10914 This is useful for installing instrumentation under the correct class loader. 10915 </intro> 10916 10917 <function id="AddToBootstrapClassLoaderSearch" jkernel="yes" phase="onload" num="149"> 10918 <synopsis>Add To Bootstrap Class Loader Search</synopsis> 10919 <description> 10920 This function can be used to cause instrumentation classes to be defined by the 10921 bootstrap class loader. See <vmspec chapter="5.3.1"/>. 10922 After the bootstrap 10923 class loader unsuccessfully searches for a class, the specified platform-dependent 10924 search path <paramlink id="segment"/> will be searched as well. Only one segment may be specified in 10925 the <paramlink id="segment"/>. This function may be called multiple times to add multiple segments, 10926 the segments will be searched in the order that this function was called. 10927 <p/> 10928 In the <code>OnLoad</code> phase the function may be used to specify any platform-dependent 10929 search path segment to be searched after the bootstrap class loader unsuccessfully searches 10930 for a class. The segment is typically a directory or JAR file. 10931 <p/> 10932 In the live phase the <paramlink id="segment"/> may be used to specify any platform-dependent 10933 path to a <externallink id="jar/jar.html"> 10934 JAR file</externallink>. The agent should take care that the JAR file does not 10935 contain any classes or resources other than those to be defined by the bootstrap 10936 class loader for the purposes of instrumentation. 10937 <p/> 10938 <vmspec/> specifies that a subsequent attempt to resolve a symbolic 10939 reference that the Java virtual machine has previously unsuccessfully attempted 10940 to resolve always fails with the same error that was thrown as a result of the 10941 initial resolution attempt. Consequently, if the JAR file contains an entry 10942 that corresponds to a class for which the Java virtual machine has 10943 unsuccessfully attempted to resolve a reference, then subsequent attempts to 10944 resolve that reference will fail with the same error as the initial attempt. 10945 </description> 10946 <origin>new</origin> 10947 <capabilities> 10948 </capabilities> 10949 <parameters> 10950 <param id="segment"> 10951 <inbuf><char/></inbuf> 10952 <description> 10953 The platform-dependent search path segment, encoded as a 10954 <internallink id="mUTF">modified UTF-8</internallink> string. 10955 </description> 10956 </param> 10957 </parameters> 10958 <errors> 10959 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 10960 <paramlink id="segment"/> is an invalid path. In the live phase, anything other than an 10961 existing JAR file is an invalid path. 10962 </error> 10963 </errors> 10964 </function> 10965 10966 <function id="AddToSystemClassLoaderSearch" jkernel="yes" phase="onload" num="151" since="1.1"> 10967 <synopsis>Add To System Class Loader Search</synopsis> 10968 <description> 10969 This function can be used to cause instrumentation classes to be 10970 defined by the system class loader. See <vmspec chapter="5.3.2"/>. 10971 After the class loader unsuccessfully searches for a class, the specified platform-dependent search 10972 path <paramlink id="segment"/> will be searched as well. Only one segment may be specified in the 10973 <paramlink id="segment"/>. This function may be called multiple times to add multiple segments, the 10974 segments will be searched in the order that this function was called. 10975 <p/> 10976 In the <code>OnLoad</code> phase the function may be used to specify any platform-dependent 10977 search path segment to be searched after the system class loader unsuccessfully searches 10978 for a class. The segment is typically a directory or JAR file. 10979 <p/> 10980 In the live phase the <paramlink id="segment"/> is a platform-dependent path to a 10981 <externallink id="jar/jar.html">JAR file</externallink> to be 10982 searched after the system class loader unsuccessfully searches for a class. The agent should 10983 take care that the JAR file does not contain any classes or resources other than those to be 10984 defined by the system class loader for the purposes of instrumentation. 10985 <p/> 10986 In the live phase the system class loader supports adding a JAR file to be searched if 10987 the system class loader implements a method name <code>appendToClassPathForInstrumentation</code> 10988 which takes a single parameter of type <code>java.lang.String</code>. The method is not required 10989 to have <code>public</code> access. 10990 <p/> 10991 <vmspec/> specifies that a subsequent attempt to resolve a symbolic 10992 reference that the Java virtual machine has previously unsuccessfully attempted 10993 to resolve always fails with the same error that was thrown as a result of the 10994 initial resolution attempt. Consequently, if the JAR file contains an entry 10995 that corresponds to a class for which the Java virtual machine has 10996 unsuccessfully attempted to resolve a reference, then subsequent attempts to 10997 resolve that reference will fail with the same error as the initial attempt. 10998 </description> 10999 <origin>new</origin> 11000 <capabilities> 11001 </capabilities> 11002 <parameters> 11003 <param id="segment"> 11004 <inbuf><char/></inbuf> 11005 <description> 11006 The platform-dependent search path segment, encoded as a 11007 <internallink id="mUTF">modified UTF-8</internallink> string. 11008 </description> 11009 </param> 11010 </parameters> 11011 <errors> 11012 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 11013 <paramlink id="segment"/> is an invalid path. In the live phase, anything other than an 11014 existing JAR file is an invalid path. 11015 </error> 11016 <error id="JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED"> 11017 Operation not supported by the system class loader. 11018 </error> 11019 </errors> 11020 </function> 11021 11022 </category> 11023 11024 11025 <category id="props" label="System Properties"> 11026 11027 <intro> 11028 These functions get and set system properties. 11029 </intro> 11030 11031 <function id="GetSystemProperties" phase="onload" num="130"> 11032 <synopsis>Get System Properties</synopsis> 11033 <description> 11034 The list of VM system property keys which may be used with 11035 <functionlink id="GetSystemProperty"/> is returned. 11036 It is strongly recommended that virtual machines provide the 11037 following property keys: 11038 <ul> 11039 <li><code>java.vm.vendor</code></li> 11040 <li><code>java.vm.version</code></li> 11041 <li><code>java.vm.name</code></li> 11042 <li><code>java.vm.info</code></li> 11043 <li><code>java.library.path</code></li> 11044 <li><code>java.class.path</code></li> 11045 </ul> 11046 Provides access to system properties defined by and used 11047 by the VM. 11048 Properties set on the command-line are included. 11049 This allows getting and setting of these properties 11050 before the VM even begins executing bytecodes. 11051 Since this is a VM view of system properties, the set of available 11052 properties will usually be different than that 11053 in <code>java.lang.System.getProperties</code>. 11054 JNI method invocation may be used to access 11055 <code>java.lang.System.getProperties</code>. 11056 <p/> 11057 The set of properties may grow during execution. 11058 </description> 11059 <origin>new</origin> 11060 <capabilities> 11061 </capabilities> 11062 <parameters> 11063 <param id="count_ptr"> 11064 <outptr><jint/></outptr> 11065 <description> 11066 On return, points to the number of property keys returned. 11067 </description> 11068 </param> 11069 <param id="property_ptr"> 11070 <allocallocbuf outcount="count_ptr"><char/></allocallocbuf> 11071 <description> 11072 On return, points to an array of property keys, encoded as 11073 <internallink id="mUTF">modified UTF-8</internallink> strings. 11074 </description> 11075 </param> 11076 </parameters> 11077 <errors> 11078 </errors> 11079 </function> 11080 11081 <function id="GetSystemProperty" phase="onload" num="131"> 11082 <synopsis>Get System Property</synopsis> 11083 <description> 11084 Return a VM system property value given the property key. 11085 <p/> 11086 The function <functionlink id="GetSystemProperties"/> 11087 returns the set of property keys which may be used. 11088 The properties which can be retrieved may grow during 11089 execution. 11090 <p/> 11091 Since this is a VM view of system properties, the values 11092 of properties may differ from that returned by 11093 <code>java.lang.System.getProperty(String)</code>. 11094 A typical VM might copy the values of the VM system 11095 properties into the <code>Properties</code> held by 11096 <code>java.lang.System</code> during the initialization 11097 of that class. Thereafter any changes to the VM system 11098 properties (with <functionlink id="SetSystemProperty"/>) 11099 or the <code>java.lang.System</code> system properties 11100 (with <code>java.lang.System.setProperty(String,String)</code>) 11101 would cause the values to diverge. 11102 JNI method invocation may be used to access 11103 <code>java.lang.System.getProperty(String)</code>. 11104 </description> 11105 <origin>new</origin> 11106 <capabilities> 11107 </capabilities> 11108 <parameters> 11109 <param id="property"> 11110 <inbuf><char/></inbuf> 11111 <description> 11112 The key of the property to retrieve, encoded as a 11113 <internallink id="mUTF">modified UTF-8</internallink> string. 11114 </description> 11115 </param> 11116 <param id="value_ptr"> 11117 <allocbuf><char/></allocbuf> 11118 <description> 11119 On return, points to the property value, encoded as a 11120 <internallink id="mUTF">modified UTF-8</internallink> string. 11121 </description> 11122 </param> 11123 </parameters> 11124 <errors> 11125 <error id="JVMTI_ERROR_NOT_AVAILABLE"> 11126 This property is not available. 11127 Use <functionlink id="GetSystemProperties"/> to find available properties. 11128 </error> 11129 </errors> 11130 </function> 11131 11132 <function id="SetSystemProperty" phase="onloadOnly" num="132"> 11133 <synopsis>Set System Property</synopsis> 11134 <description> 11135 Set a VM system property value. 11136 <p/> 11137 The function <functionlink id="GetSystemProperties"/> 11138 returns the set of property keys, some of these may be settable. 11139 See <functionlink id="GetSystemProperty"/>. 11140 </description> 11141 <origin>new</origin> 11142 <capabilities> 11143 </capabilities> 11144 <parameters> 11145 <param id="property"> 11146 <inbuf><char/></inbuf> 11147 <description> 11148 The key of the property, encoded as a 11149 <internallink id="mUTF">modified UTF-8</internallink> string. 11150 </description> 11151 </param> 11152 <param id="value_ptr"> 11153 <inbuf> 11154 <char/> 11155 <nullok> 11156 do not set the value, but return <errorlink id="JVMTI_ERROR_NOT_AVAILABLE"/> 11157 if the property is not writeable 11158 </nullok> 11159 </inbuf> 11160 <description> 11161 The property value to set, encoded as a 11162 <internallink id="mUTF">modified UTF-8</internallink> string. 11163 </description> 11164 </param> 11165 </parameters> 11166 <errors> 11167 <error id="JVMTI_ERROR_NOT_AVAILABLE"> 11168 This property is not available or is not writeable. 11169 </error> 11170 </errors> 11171 </function> 11172 11173 </category> 11174 11175 <category id="general" label="General"> 11176 11177 <intro> 11178 </intro> 11179 11180 <function id="GetPhase" jkernel="yes" phase="any" num="133"> 11181 <synopsis>Get Phase</synopsis> 11182 <description> 11183 Return the current phase of VM execution. 11184 The phases proceed in sequence: 11185 <constants id="jvmtiPhase" label="Phases of execution" kind="enum"> 11186 <constant id="JVMTI_PHASE_ONLOAD" num="1"> 11187 <code>OnLoad</code> phase: while in the 11188 <internallink id="onload"><code>Agent_OnLoad</code></internallink> 11189 or, for statically linked agents, the <internallink id="onload"> 11190 <code>Agent_OnLoad_<agent-lib-name> 11191 </code></internallink> function. 11192 </constant> 11193 <constant id="JVMTI_PHASE_PRIMORDIAL" num="2"> 11194 Primordial phase: between return from <code>Agent_OnLoad</code> 11195 or <code>Agent_OnLoad_<agent-lib-name></code> and the 11196 <code>VMStart</code> event. 11197 </constant> 11198 <constant id="JVMTI_PHASE_START" num="6"> 11199 Start phase: when the <eventlink id="VMStart"><code>VMStart</code></eventlink> event 11200 is sent and until the <code>VMInit</code> event is sent. 11201 </constant> 11202 <constant id="JVMTI_PHASE_LIVE" num="4"> 11203 Live phase: when the <eventlink id="VMInit"><code>VMInit</code></eventlink> event is sent 11204 and until the <eventlink id="VMDeath"></eventlink> event returns. 11205 </constant> 11206 <constant id="JVMTI_PHASE_DEAD" num="8"> 11207 Dead phase: after the <eventlink id="VMDeath"></eventlink> event returns or after 11208 start-up failure. 11209 </constant> 11210 </constants> 11211 In the case of start-up failure the VM will proceed directly to the dead 11212 phase skipping intermediate phases and neither a <code>VMInit</code> nor 11213 <code>VMDeath</code> event will be sent. 11214 <p/> 11215 Most <jvmti/> functions operate only in the live phase. 11216 The following functions operate in either the <code>OnLoad</code> or live phases: 11217 <functionphaselist phase="onload"/> 11218 The following functions operate in only the <code>OnLoad</code> phase: 11219 <functionphaselist phase="onloadOnly"/> 11220 The following functions operate in the start or live phases: 11221 <functionphaselist phase="start"/> 11222 The following functions operate in any phase: 11223 <functionphaselist phase="any"/> 11224 JNI functions (except the Invocation API) must only be used in the start or live phases. 11225 <p/> 11226 Most <jvmti/> events are sent only in the live phase. 11227 The following events operate in others phases: 11228 <eventphaselist phase="start"/> 11229 <eventphaselist phase="any"/> 11230 </description> 11231 <origin>new</origin> 11232 <capabilities> 11233 </capabilities> 11234 <parameters> 11235 <param id="phase_ptr"> 11236 <outptr><enum>jvmtiPhase</enum></outptr> 11237 <description> 11238 On return, points to the phase. 11239 </description> 11240 </param> 11241 </parameters> 11242 <errors> 11243 </errors> 11244 </function> 11245 11246 <function id="DisposeEnvironment" jkernel="yes" phase="any" num="127"> 11247 <synopsis>Dispose Environment</synopsis> 11248 <description> 11249 Shutdown a <jvmti/> connection created with JNI <code>GetEnv</code> 11250 (see <internallink id="environments"><jvmti/> Environments</internallink>). 11251 Dispose of any resources held by the environment. 11252 <issue> 11253 What resources are reclaimed? What is undone? 11254 Breakpoints,watchpoints removed? 11255 </issue> 11256 Threads suspended by this environment are not resumed by this call, 11257 this must be done explicitly by the agent. 11258 Memory allocated by this environment via calls to <jvmti/> functions 11259 is not released, this can be done explicitly by the agent 11260 by calling <functionlink id="Deallocate"/>. 11261 Raw monitors created by this environment are not destroyed, 11262 this can be done explicitly by the agent 11263 by calling <functionlink id="DestroyRawMonitor"/>. 11264 The state of threads waiting on raw monitors created by this environment 11265 are not affected. 11266 <p/> 11267 Any <functionlink id="SetNativeMethodPrefix">native method 11268 prefixes</functionlink> for this environment will be unset; 11269 the agent must remove any prefixed native methods before 11270 dispose is called. 11271 <p/> 11272 Any <internallink id="capability">capabilities</internallink> 11273 held by this environment are relinquished. 11274 <p/> 11275 Events enabled by this environment will no longer be sent, however 11276 event handlers currently running will continue to run. Caution must 11277 be exercised in the design of event handlers whose environment may 11278 be disposed and thus become invalid during their execution. 11279 <p/> 11280 This environment may not be used after this call. 11281 This call returns to the caller. 11282 </description> 11283 <origin>new</origin> 11284 <capabilities> 11285 </capabilities> 11286 <parameters> 11287 </parameters> 11288 <errors> 11289 </errors> 11290 </function> 11291 11292 <function id="SetEnvironmentLocalStorage" jkernel="yes" phase="any" callbacksafe="safe" impl="innative notrace" num="148"> 11293 <synopsis>Set Environment Local Storage</synopsis> 11294 <description> 11295 The VM stores a pointer value associated with each environment. 11296 This pointer value is called <i>environment-local storage</i>. 11297 This value is <code>NULL</code> unless set with this function. 11298 Agents can allocate memory in which they store environment specific 11299 information. By setting environment-local storage it can then be 11300 accessed with 11301 <functionlink id="GetEnvironmentLocalStorage"></functionlink>. 11302 <p/> 11303 Called by the agent to set the value of the <jvmti/> 11304 environment-local storage. <jvmti/> supplies to the agent a pointer-size 11305 environment-local storage that can be used to record per-environment 11306 information. 11307 </description> 11308 <origin>new</origin> 11309 <capabilities> 11310 </capabilities> 11311 <parameters> 11312 <param id="data"> 11313 <inbuf> 11314 <void/> 11315 <nullok>value is set to <code>NULL</code></nullok> 11316 </inbuf> 11317 <description> 11318 The value to be entered into the environment-local storage. 11319 </description> 11320 </param> 11321 </parameters> 11322 <errors> 11323 </errors> 11324 </function> 11325 11326 <function id="GetEnvironmentLocalStorage" jkernel="yes" phase="any" callbacksafe="safe" impl="innative notrace" num="147"> 11327 <synopsis>Get Environment Local Storage</synopsis> 11328 <description> 11329 Called by the agent to get the value of the <jvmti/> environment-local 11330 storage. 11331 </description> 11332 <origin>new</origin> 11333 <capabilities> 11334 </capabilities> 11335 <parameters> 11336 <param id="data_ptr"> 11337 <agentbuf><void/></agentbuf> 11338 <description> 11339 Pointer through which the value of the environment local 11340 storage is returned. 11341 If environment-local storage has not been set with 11342 <functionlink id="SetEnvironmentLocalStorage"></functionlink> returned 11343 pointer is <code>NULL</code>. 11344 </description> 11345 </param> 11346 </parameters> 11347 <errors> 11348 </errors> 11349 </function> 11350 11351 <function id="GetVersionNumber" jkernel="yes" phase="any" num="88"> 11352 <synopsis>Get Version Number</synopsis> 11353 <description> 11354 Return the <jvmti/> version via <code>version_ptr</code>. 11355 The return value is the version identifier. 11356 The version identifier includes major, minor and micro 11357 version as well as the interface type. 11358 <constants id="jvmtiVersionInterfaceTypes" label="Version Interface Types" kind="bits"> 11359 <constant id="JVMTI_VERSION_INTERFACE_JNI" num="0x00000000"> 11360 Value of <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> for JNI. 11361 </constant> 11362 <constant id="JVMTI_VERSION_INTERFACE_JVMTI" num="0x30000000"> 11363 Value of <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> for <jvmti/>. 11364 </constant> 11365 </constants> 11366 <constants id="jvmtiVersionMasks" label="Version Masks" kind="bits"> 11367 <constant id="JVMTI_VERSION_MASK_INTERFACE_TYPE" num="0x70000000"> 11368 Mask to extract interface type. 11369 The value of the version returned by this function masked with 11370 <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> is always 11371 <code>JVMTI_VERSION_INTERFACE_JVMTI</code> 11372 since this is a <jvmti/> function. 11373 </constant> 11374 <constant id="JVMTI_VERSION_MASK_MAJOR" num="0x0FFF0000"> 11375 Mask to extract major version number. 11376 </constant> 11377 <constant id="JVMTI_VERSION_MASK_MINOR" num="0x0000FF00"> 11378 Mask to extract minor version number. 11379 </constant> 11380 <constant id="JVMTI_VERSION_MASK_MICRO" num="0x000000FF"> 11381 Mask to extract micro version number. 11382 </constant> 11383 </constants> 11384 <constants id="jvmtiVersionShifts" label="Version Shifts" kind="bits"> 11385 <constant id="JVMTI_VERSION_SHIFT_MAJOR" num="16"> 11386 Shift to extract major version number. 11387 </constant> 11388 <constant id="JVMTI_VERSION_SHIFT_MINOR" num="8"> 11389 Shift to extract minor version number. 11390 </constant> 11391 <constant id="JVMTI_VERSION_SHIFT_MICRO" num="0"> 11392 Shift to extract micro version number. 11393 </constant> 11394 </constants> 11395 </description> 11396 <origin>jvmdi</origin> 11397 <capabilities> 11398 </capabilities> 11399 <parameters> 11400 <param id="version_ptr"> 11401 <outptr><jint/></outptr> 11402 <description> 11403 On return, points to the <jvmti/> version. 11404 </description> 11405 </param> 11406 </parameters> 11407 <errors> 11408 </errors> 11409 </function> 11410 11411 11412 <function id="GetErrorName" phase="any" num="128"> 11413 <synopsis>Get Error Name</synopsis> 11414 <description> 11415 Return the symbolic name for an 11416 <internallink id="ErrorSection">error code</internallink>. 11417 <p/> 11418 For example 11419 <code>GetErrorName(env, JVMTI_ERROR_NONE, &err_name)</code> 11420 would return in <code>err_name</code> the string 11421 <code>"JVMTI_ERROR_NONE"</code>. 11422 </description> 11423 <origin>new</origin> 11424 <capabilities> 11425 </capabilities> 11426 <parameters> 11427 <param id="error"> 11428 <enum>jvmtiError</enum> 11429 <description> 11430 The error code. 11431 </description> 11432 </param> 11433 <param id="name_ptr"> 11434 <allocbuf><char/></allocbuf> 11435 <description> 11436 On return, points to the error name. 11437 The name is encoded as a 11438 <internallink id="mUTF">modified UTF-8</internallink> string, 11439 but is restricted to the ASCII subset. 11440 </description> 11441 </param> 11442 </parameters> 11443 <errors> 11444 </errors> 11445 </function> 11446 11447 <function id="SetVerboseFlag" phase="any" num="150"> 11448 <synopsis>Set Verbose Flag</synopsis> 11449 <description> 11450 <constants id="jvmtiVerboseFlag" label="Verbose Flag Enumeration" kind="enum"> 11451 <constant id="JVMTI_VERBOSE_OTHER" num="0"> 11452 Verbose output other than the below. 11453 </constant> 11454 <constant id="JVMTI_VERBOSE_GC" num="1"> 11455 Verbose garbage collector output, like that specified with <code>-verbose:gc</code>. 11456 </constant> 11457 <constant id="JVMTI_VERBOSE_CLASS" num="2"> 11458 Verbose class loading output, like that specified with <code>-verbose:class</code>. 11459 </constant> 11460 <constant id="JVMTI_VERBOSE_JNI" num="4"> 11461 Verbose JNI output, like that specified with <code>-verbose:jni</code>. 11462 </constant> 11463 </constants> 11464 Control verbose output. 11465 This is the output which typically is sent to <code>stderr</code>. 11466 </description> 11467 <origin>new</origin> 11468 <capabilities> 11469 </capabilities> 11470 <parameters> 11471 <param id="flag"> 11472 <enum>jvmtiVerboseFlag</enum> 11473 <description> 11474 Which verbose flag to set. 11475 </description> 11476 </param> 11477 <param id="value"> 11478 <jboolean/> 11479 <description> 11480 New value of the flag. 11481 </description> 11482 </param> 11483 </parameters> 11484 <errors> 11485 </errors> 11486 </function> 11487 11488 11489 <function id="GetJLocationFormat" phase="any" num="129"> 11490 <synopsis>Get JLocation Format</synopsis> 11491 <description> 11492 Although the greatest functionality is achieved with location information 11493 referencing the virtual machine bytecode index, the definition of 11494 <code>jlocation</code> has intentionally been left unconstrained to allow VM 11495 implementations that do not have this information. 11496 <p/> 11497 This function describes the representation of <code>jlocation</code> used in this VM. 11498 If the returned format is <datalink id="JVMTI_JLOCATION_JVMBCI"></datalink>, 11499 <code>jlocation</code>s can 11500 be used as in indices into the array returned by 11501 <functionlink id="GetBytecodes"></functionlink>. 11502 <constants id="jvmtiJlocationFormat" label="JLocation Format Enumeration" kind="enum"> 11503 <constant id="JVMTI_JLOCATION_JVMBCI" num="1"> 11504 <code>jlocation</code> values represent virtual machine 11505 bytecode indices--that is, offsets into the 11506 virtual machine code for a method. 11507 </constant> 11508 <constant id="JVMTI_JLOCATION_MACHINEPC" num="2"> 11509 <code>jlocation</code> values represent native machine 11510 program counter values. 11511 </constant> 11512 <constant id="JVMTI_JLOCATION_OTHER" num="0"> 11513 <code>jlocation</code> values have some other representation. 11514 </constant> 11515 </constants> 11516 </description> 11517 <origin>new</origin> 11518 <capabilities> 11519 </capabilities> 11520 <parameters> 11521 <param id="format_ptr"> 11522 <outptr><enum>jvmtiJlocationFormat</enum></outptr> 11523 <description> 11524 On return, points to the format identifier for <code>jlocation</code> values. 11525 </description> 11526 </param> 11527 </parameters> 11528 <errors> 11529 </errors> 11530 </function> 11531 11532 </category> 11533 11534 </functionsection> 11535 11536 <errorsection label="Error Reference"> 11537 <intro> 11538 Every <jvmti/> function returns a <b><code>jvmtiError</code></b> error code. 11539 <p/> 11540 It is the responsibility of the agent to call <jvmti/> functions with 11541 valid parameters and in the proper context (calling thread is attached, 11542 phase is correct, etc.). 11543 Detecting some error conditions may be difficult, inefficient, or 11544 impossible for an implementation. 11545 The errors listed in 11546 <internallink id="reqerrors">Function Specific Required Errors</internallink> 11547 must be detected by the implementation. 11548 All other errors represent the recommended response to the error 11549 condition. 11550 </intro> 11551 11552 <errorcategory id="universal-error" label="Universal Errors"> 11553 <intro> 11554 The following errors may be returned by any function 11555 </intro> 11556 11557 <errorid id="JVMTI_ERROR_NONE" num="0"> 11558 No error has occurred. This is the error code that is returned 11559 on successful completion of the function. 11560 </errorid> 11561 <errorid id="JVMTI_ERROR_NULL_POINTER" num="100"> 11562 Pointer is unexpectedly <code>NULL</code>. 11563 </errorid> 11564 <errorid id="JVMTI_ERROR_OUT_OF_MEMORY" num="110"> 11565 The function attempted to allocate memory and no more memory was 11566 available for allocation. 11567 </errorid> 11568 <errorid id="JVMTI_ERROR_ACCESS_DENIED" num="111"> 11569 The desired functionality has not been enabled in this virtual machine. 11570 </errorid> 11571 <errorid id="JVMTI_ERROR_UNATTACHED_THREAD" num="115"> 11572 The thread being used to call this function is not attached 11573 to the virtual machine. Calls must be made from attached threads. 11574 See <code>AttachCurrentThread</code> in the JNI invocation API. 11575 </errorid> 11576 <errorid id="JVMTI_ERROR_INVALID_ENVIRONMENT" num="116"> 11577 The <jvmti/> environment provided is no longer connected or is 11578 not an environment. 11579 </errorid> 11580 <errorid id="JVMTI_ERROR_WRONG_PHASE" num="112"> 11581 The desired functionality is not available in the current 11582 <functionlink id="GetPhase">phase</functionlink>. 11583 Always returned if the virtual machine has completed running. 11584 </errorid> 11585 <errorid id="JVMTI_ERROR_INTERNAL" num="113"> 11586 An unexpected internal error has occurred. 11587 </errorid> 11588 </errorcategory> 11589 11590 <errorcategory id="reqerrors" label="Function Specific Required Errors"> 11591 <intro> 11592 The following errors are returned by some <jvmti/> functions and must 11593 be returned by the implementation when the condition occurs. 11594 </intro> 11595 11596 <errorid id="JVMTI_ERROR_INVALID_PRIORITY" num="12"> 11597 Invalid priority. 11598 </errorid> 11599 <errorid id="JVMTI_ERROR_THREAD_NOT_SUSPENDED" num="13"> 11600 Thread was not suspended. 11601 </errorid> 11602 <errorid id="JVMTI_ERROR_THREAD_SUSPENDED" num="14"> 11603 Thread already suspended. 11604 </errorid> 11605 <errorid id="JVMTI_ERROR_THREAD_NOT_ALIVE" num="15"> 11606 This operation requires the thread to be alive--that is, 11607 it must be started and not yet have died. 11608 </errorid> 11609 <errorid id="JVMTI_ERROR_CLASS_NOT_PREPARED" num="22"> 11610 The class has been loaded but not yet prepared. 11611 </errorid> 11612 <errorid id="JVMTI_ERROR_NO_MORE_FRAMES" num="31"> 11613 There are no Java programming language or JNI stack frames at the specified depth. 11614 </errorid> 11615 <errorid id="JVMTI_ERROR_OPAQUE_FRAME" num="32"> 11616 Information about the frame is not available (e.g. for native frames). 11617 </errorid> 11618 <errorid id="JVMTI_ERROR_DUPLICATE" num="40"> 11619 Item already set. 11620 </errorid> 11621 <errorid id="JVMTI_ERROR_NOT_FOUND" num="41"> 11622 Desired element (e.g. field or breakpoint) not found 11623 </errorid> 11624 <errorid id="JVMTI_ERROR_NOT_MONITOR_OWNER" num="51"> 11625 This thread doesn't own the raw monitor. 11626 </errorid> 11627 <errorid id="JVMTI_ERROR_INTERRUPT" num="52"> 11628 The call has been interrupted before completion. 11629 </errorid> 11630 <errorid id="JVMTI_ERROR_UNMODIFIABLE_CLASS" num="79"> 11631 The class cannot be modified. 11632 </errorid> 11633 <errorid id="JVMTI_ERROR_UNMODIFIABLE_MODULE" num="80"> 11634 The module cannot be modified. 11635 </errorid> 11636 <errorid id="JVMTI_ERROR_NOT_AVAILABLE" num="98"> 11637 The functionality is not available in this virtual machine. 11638 </errorid> 11639 <errorid id="JVMTI_ERROR_ABSENT_INFORMATION" num="101"> 11640 The requested information is not available. 11641 </errorid> 11642 <errorid id="JVMTI_ERROR_INVALID_EVENT_TYPE" num="102"> 11643 The specified event type ID is not recognized. 11644 </errorid> 11645 <errorid id="JVMTI_ERROR_NATIVE_METHOD" num="104"> 11646 The requested information is not available for native method. 11647 </errorid> 11648 <errorid id="JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED" num="106"> 11649 The class loader does not support this operation. 11650 </errorid> 11651 </errorcategory> 11652 11653 <errorcategory id="function-specific-errors" label="Function Specific Agent Errors"> 11654 <intro> 11655 The following errors are returned by some <jvmti/> functions. 11656 They are returned in the event of invalid parameters passed by the 11657 agent or usage in an invalid context. 11658 An implementation is not required to detect these errors. 11659 </intro> 11660 11661 <errorid id="JVMTI_ERROR_INVALID_THREAD" num="10"> 11662 The passed thread is not a valid thread. 11663 </errorid> 11664 <errorid id="JVMTI_ERROR_INVALID_FIELDID" num="25"> 11665 Invalid field. 11666 </errorid> 11667 <errorid id="JVMTI_ERROR_INVALID_MODULE" num="26"> 11668 Invalid module. 11669 </errorid> 11670 <errorid id="JVMTI_ERROR_INVALID_METHODID" num="23"> 11671 Invalid method. 11672 </errorid> 11673 <errorid id="JVMTI_ERROR_INVALID_LOCATION" num="24"> 11674 Invalid location. 11675 </errorid> 11676 <errorid id="JVMTI_ERROR_INVALID_OBJECT" num="20"> 11677 Invalid object. 11678 </errorid> 11679 <errorid id="JVMTI_ERROR_INVALID_CLASS" num="21"> 11680 Invalid class. 11681 </errorid> 11682 <errorid id="JVMTI_ERROR_TYPE_MISMATCH" num="34"> 11683 The variable is not an appropriate type for the function used. 11684 </errorid> 11685 <errorid id="JVMTI_ERROR_INVALID_SLOT" num="35"> 11686 Invalid slot. 11687 </errorid> 11688 <errorid id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY" num="99"> 11689 The capability being used is false in this environment. 11690 </errorid> 11691 <errorid id="JVMTI_ERROR_INVALID_THREAD_GROUP" num="11"> 11692 Thread group invalid. 11693 </errorid> 11694 <errorid id="JVMTI_ERROR_INVALID_MONITOR" num="50"> 11695 Invalid raw monitor. 11696 </errorid> 11697 <errorid id="JVMTI_ERROR_ILLEGAL_ARGUMENT" num="103"> 11698 Illegal argument. 11699 </errorid> 11700 <errorid id="JVMTI_ERROR_INVALID_TYPESTATE" num="65"> 11701 The state of the thread has been modified, and is now inconsistent. 11702 </errorid> 11703 <errorid id="JVMTI_ERROR_UNSUPPORTED_VERSION" num="68"> 11704 A new class file has a version number not supported by this VM. 11705 </errorid> 11706 <errorid id="JVMTI_ERROR_INVALID_CLASS_FORMAT" num="60"> 11707 A new class file is malformed (the VM would return a <code>ClassFormatError</code>). 11708 </errorid> 11709 <errorid id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION" num="61"> 11710 The new class file definitions would lead to a circular 11711 definition (the VM would return a <code>ClassCircularityError</code>). 11712 </errorid> 11713 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED" num="63"> 11714 A new class file would require adding a method. 11715 </errorid> 11716 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED" num="64"> 11717 A new class version changes a field. 11718 </errorid> 11719 <errorid id="JVMTI_ERROR_FAILS_VERIFICATION" num="62"> 11720 The class bytes fail verification. 11721 </errorid> 11722 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED" num="66"> 11723 A direct superclass is different for the new class 11724 version, or the set of directly implemented 11725 interfaces is different. 11726 </errorid> 11727 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED" num="67"> 11728 A new class version does not declare a method 11729 declared in the old class version. 11730 </errorid> 11731 <errorid id="JVMTI_ERROR_NAMES_DONT_MATCH" num="69"> 11732 The class name defined in the new class file is 11733 different from the name in the old class object. 11734 </errorid> 11735 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED" num="70"> 11736 A new class version has different modifiers. 11737 </errorid> 11738 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED" num="71"> 11739 A method in the new class version has different modifiers 11740 than its counterpart in the old class version. 11741 </errorid> 11742 </errorcategory> 11743 </errorsection> 11744 11745 <eventsection label="Events"> 11746 <intro label="Handling Events" id="eventIntro"> 11747 Agents can be informed of many events that occur in application 11748 programs. 11749 <p/> 11750 To handle events, designate a set of callback functions with 11751 <functionlink id="SetEventCallbacks"></functionlink>. 11752 For each event the corresponding callback function will be 11753 called. 11754 Arguments to the callback function provide additional 11755 information about the event. 11756 <p/> 11757 The callback function is usually called from within an application 11758 thread. The <jvmti/> implementation does not 11759 queue events in any way. This means 11760 that event callback functions must be written 11761 carefully. Here are some general guidelines. See 11762 the individual event descriptions for further 11763 suggestions. 11764 <p/> 11765 <ul> 11766 <li>Any exception thrown during the execution of an event callback can 11767 overwrite any current pending exception in the current application thread. 11768 Care must be taken to preserve a pending exception 11769 when an event callback makes a JNI call that might generate an exception. 11770 </li> 11771 <li>Event callback functions must be re-entrant. The <jvmti/> implementation does 11772 not queue events. If an agent needs to process events one at a time, it 11773 can use a raw monitor inside the 11774 event callback functions to serialize event processing. 11775 </li> 11776 <li>Event callback functions that execute JNI's FindClass function to load 11777 classes need to note that FindClass locates the class loader associated 11778 with the current native method. For the purposes of class loading, an 11779 event callback that includes a JNI environment as a parameter to the 11780 callback will treated as if it is a native call, where the native method 11781 is in the class of the event thread's current frame. 11782 </li> 11783 </ul> 11784 <p/> 11785 Some <jvmti/> events identify objects with JNI references. 11786 All references 11787 in <jvmti/> events are JNI local references and will become invalid 11788 after the event callback returns. 11789 Unless stated otherwise, memory referenced by pointers sent in event 11790 callbacks may not be referenced after the event callback returns. 11791 <p/> 11792 Except where stated otherwise, events are delivered on the thread 11793 that caused the event. 11794 Events are sent at the time they occur. 11795 The specification for each event includes the set of 11796 <functionlink id="GetPhase">phases</functionlink> in which it can be sent; 11797 if an event triggering activity occurs during another phase, no event 11798 is sent. 11799 <p/> 11800 A thread that generates an event does not change its execution status 11801 (for example, the event does not cause the thread to be suspended). 11802 If an agent wishes the event to result in suspension, then the agent 11803 is responsible for explicitly suspending the thread with 11804 <functionlink id="SuspendThread"></functionlink>. 11805 <p/> 11806 If an event is enabled in multiple environments, the event will be sent 11807 to each agent in the order that the environments were created. 11808 </intro> 11809 11810 <intro label="Enabling Events" id="enablingevents"> 11811 All events are initially disabled. In order to receive any 11812 event: 11813 <ul> 11814 <li> 11815 If the event requires a capability, that capability must 11816 be added with 11817 <functionlink id="AddCapabilities"></functionlink>. 11818 </li> 11819 <li> 11820 A callback for the event must be set with 11821 <functionlink id="SetEventCallbacks"></functionlink>. 11822 </li> 11823 <li> 11824 The event must be enabled with 11825 <functionlink id="SetEventNotificationMode"></functionlink>. 11826 </li> 11827 </ul> 11828 </intro> 11829 11830 <intro label="Multiple Co-located Events" id="eventorder"> 11831 In many situations it is possible for multiple events to occur 11832 at the same location in one thread. When this happens, all the events 11833 are reported through the event callbacks in the order specified in this section. 11834 <p/> 11835 If the current location is at the entry point of a method, the 11836 <eventlink id="MethodEntry"></eventlink> event is reported before 11837 any other event at the current location in the same thread. 11838 <p/> 11839 If an exception catch has been detected at the current location, 11840 either because it is the beginning of a catch clause or a native method 11841 that cleared a pending exception has returned, the 11842 <code>exceptionCatch</code> event is reported before 11843 any other event at the current location in the same thread. 11844 <p/> 11845 If a <code>singleStep</code> event or 11846 <code>breakpoint</code> event is triggered at the 11847 current location, the event is defined to occur 11848 immediately before the code at the current location is executed. 11849 These events are reported before any events which are triggered 11850 by the execution of code at the current location in the same 11851 thread (specifically: 11852 <code>exception</code>, 11853 <code>fieldAccess</code>, and 11854 <code>fieldModification</code>). 11855 If both a step and breakpoint event are triggered for the same thread and 11856 location, the step event is reported before the breakpoint event. 11857 <p/> 11858 If the current location is the exit point of a method (that is, the last 11859 location before returning to the caller), the 11860 <eventlink id="MethodExit"></eventlink> event and 11861 the <eventlink id="FramePop"></eventlink> event (if requested) 11862 are reported after all other events at the current location in the same 11863 thread. There is no specified ordering of these two events 11864 with respect to each other. 11865 <p/> 11866 Co-located events can be triggered during the processing of some other 11867 event by the agent at the same location in the same thread. 11868 If such an event, of type <i>y</i>, is triggered during the processing of 11869 an event of type <i>x</i>, and if <i>x</i> 11870 precedes <i>y</i> in the ordering specified above, the co-located event 11871 <i>y</i> is reported for the current thread and location. If <i>x</i> does not precede 11872 <i>y</i>, <i>y</i> is not reported for the current thread and location. 11873 For example, if a breakpoint is set at the current location 11874 during the processing of <eventlink id="SingleStep"></eventlink>, 11875 that breakpoint will be reported before the thread moves off the current 11876 location. 11877 <p/>The following events are never considered to be co-located with 11878 other events. 11879 <ul> 11880 <li><eventlink id="VMStart"></eventlink></li> 11881 <li><eventlink id="VMInit"></eventlink></li> 11882 <li><eventlink id="VMDeath"></eventlink></li> 11883 <li><eventlink id="ThreadStart"></eventlink></li> 11884 <li><eventlink id="ThreadEnd"></eventlink></li> 11885 <li><eventlink id="ClassLoad"></eventlink></li> 11886 <li><eventlink id="ClassPrepare"></eventlink></li> 11887 </ul> 11888 </intro> 11889 11890 <intro label="Event Callbacks" id="jvmtiEventCallbacks"> 11891 The event callback structure below is used to specify the handler function 11892 for events. It is set with the 11893 <functionlink id="SetEventCallbacks"></functionlink> function. 11894 </intro> 11895 11896 <event label="Single Step" 11897 id="SingleStep" const="JVMTI_EVENT_SINGLE_STEP" filtered="thread" num="60"> 11898 <description> 11899 Single step events allow the agent to trace thread execution 11900 at the finest granularity allowed by the VM. A single step event is 11901 generated whenever a thread reaches a new location. 11902 Typically, single step events represent the completion of one VM 11903 instruction as defined in <vmspec/>. However, some implementations 11904 may define locations differently. In any case the 11905 <code>method</code> and <code>location</code> 11906 parameters uniquely identify the current location and allow 11907 the mapping to source file and line number when that information is 11908 available. 11909 <p/> 11910 No single step events are generated from within native methods. 11911 </description> 11912 <origin>jvmdi</origin> 11913 <capabilities> 11914 <required id="can_generate_single_step_events"></required> 11915 </capabilities> 11916 <parameters> 11917 <param id="jni_env"> 11918 <outptr> 11919 <struct>JNIEnv</struct> 11920 </outptr> 11921 <description> 11922 The JNI environment of the event (current) thread 11923 </description> 11924 </param> 11925 <param id="thread"> 11926 <jthread/> 11927 <description> 11928 Thread about to execution a new instruction 11929 </description> 11930 </param> 11931 <param id="klass"> 11932 <jclass method="method"/> 11933 <description> 11934 Class of the method about to execute a new instruction 11935 </description> 11936 </param> 11937 <param id="method"> 11938 <jmethodID class="klass"/> 11939 <description> 11940 Method about to execute a new instruction 11941 </description> 11942 </param> 11943 <param id="location"> 11944 <jlocation/> 11945 <description> 11946 Location of the new instruction 11947 </description> 11948 </param> 11949 </parameters> 11950 </event> 11951 11952 <event label="Breakpoint" 11953 id="Breakpoint" const="JVMTI_EVENT_BREAKPOINT" filtered="thread" num="62"> 11954 <description> 11955 Breakpoint events are generated whenever a thread reaches a location 11956 designated as a breakpoint with <functionlink id="SetBreakpoint"></functionlink>. 11957 The <code>method</code> and <code>location</code> 11958 parameters uniquely identify the current location and allow 11959 the mapping to source file and line number when that information is 11960 available. 11961 </description> 11962 <origin>jvmdi</origin> 11963 <capabilities> 11964 <required id="can_generate_breakpoint_events"></required> 11965 </capabilities> 11966 <parameters> 11967 <param id="jni_env"> 11968 <outptr> 11969 <struct>JNIEnv</struct> 11970 </outptr> 11971 <description> 11972 The JNI environment of the event (current) thread. 11973 </description> 11974 </param> 11975 <param id="thread"> 11976 <jthread/> 11977 <description> 11978 Thread that hit the breakpoint 11979 </description> 11980 </param> 11981 <param id="klass"> 11982 <jclass method="method"/> 11983 <description> 11984 Class of the method that hit the breakpoint 11985 </description> 11986 </param> 11987 <param id="method"> 11988 <jmethodID class="klass"/> 11989 <description> 11990 Method that hit the breakpoint 11991 </description> 11992 </param> 11993 <param id="location"> 11994 <jlocation/> 11995 <description> 11996 location of the breakpoint 11997 </description> 11998 </param> 11999 </parameters> 12000 </event> 12001 12002 <event label="Field Access" 12003 id="FieldAccess" const="JVMTI_EVENT_FIELD_ACCESS" filtered="thread" num="63"> 12004 <description> 12005 Field access events are generated whenever a thread accesses 12006 a field that was designated as a watchpoint 12007 with <functionlink id="SetFieldAccessWatch"></functionlink>. 12008 The <code>method</code> and <code>location</code> 12009 parameters uniquely identify the current location and allow 12010 the mapping to source file and line number when that information is 12011 available. 12012 </description> 12013 <origin>jvmdi</origin> 12014 <capabilities> 12015 <required id="can_generate_field_access_events"></required> 12016 </capabilities> 12017 <parameters> 12018 <param id="jni_env"> 12019 <outptr> 12020 <struct>JNIEnv</struct> 12021 </outptr> 12022 <description> 12023 The JNI environment of the event (current) thread 12024 </description> 12025 </param> 12026 <param id="thread"> 12027 <jthread/> 12028 <description> 12029 Thread accessing the field 12030 </description> 12031 </param> 12032 <param id="klass"> 12033 <jclass method="method"/> 12034 <description> 12035 Class of the method where the access is occurring 12036 </description> 12037 </param> 12038 <param id="method"> 12039 <jmethodID class="klass"/> 12040 <description> 12041 Method where the access is occurring 12042 </description> 12043 </param> 12044 <param id="location"> 12045 <jlocation/> 12046 <description> 12047 Location where the access is occurring 12048 </description> 12049 </param> 12050 <param id="field_klass"> 12051 <jclass field="field"/> 12052 <description> 12053 Class of the field being accessed 12054 </description> 12055 </param> 12056 <param id="object"> 12057 <jobject/> 12058 <description> 12059 Object with the field being accessed if the field is an 12060 instance field; <code>NULL</code> otherwise 12061 </description> 12062 </param> 12063 <param id="field"> 12064 <jfieldID class="field_klass"/> 12065 <description> 12066 Field being accessed 12067 </description> 12068 </param> 12069 </parameters> 12070 </event> 12071 12072 <event label="Field Modification" 12073 id="FieldModification" const="JVMTI_EVENT_FIELD_MODIFICATION" filtered="thread" num="64"> 12074 <description> 12075 Field modification events are generated whenever a thread modifies 12076 a field that was designated as a watchpoint 12077 with <functionlink id="SetFieldModificationWatch"></functionlink>. 12078 The <code>method</code> and <code>location</code> 12079 parameters uniquely identify the current location and allow 12080 the mapping to source file and line number when that information is 12081 available. 12082 </description> 12083 <origin>jvmdi</origin> 12084 <capabilities> 12085 <required id="can_generate_field_modification_events"></required> 12086 </capabilities> 12087 <parameters> 12088 <param id="jni_env"> 12089 <outptr> 12090 <struct>JNIEnv</struct> 12091 </outptr> 12092 <description> 12093 The JNI environment of the event (current) thread 12094 </description> 12095 </param> 12096 <param id="thread"> 12097 <jthread/> 12098 <description> 12099 Thread modifying the field 12100 </description> 12101 </param> 12102 <param id="klass"> 12103 <jclass method="method"/> 12104 <description> 12105 Class of the method where the modification is occurring 12106 </description> 12107 </param> 12108 <param id="method"> 12109 <jmethodID class="klass"/> 12110 <description> 12111 Method where the modification is occurring 12112 </description> 12113 </param> 12114 <param id="location"> 12115 <jlocation/> 12116 <description> 12117 Location where the modification is occurring 12118 </description> 12119 </param> 12120 <param id="field_klass"> 12121 <jclass field="field"/> 12122 <description> 12123 Class of the field being modified 12124 </description> 12125 </param> 12126 <param id="object"> 12127 <jobject/> 12128 <description> 12129 Object with the field being modified if the field is an 12130 instance field; <code>NULL</code> otherwise 12131 </description> 12132 </param> 12133 <param id="field"> 12134 <jfieldID class="field_klass"/> 12135 <description> 12136 Field being modified 12137 </description> 12138 </param> 12139 <param id="signature_type"> 12140 <char/> 12141 <description> 12142 Signature type of the new value 12143 </description> 12144 </param> 12145 <param id="new_value"> 12146 <jvalue/> 12147 <description> 12148 The new value 12149 </description> 12150 </param> 12151 </parameters> 12152 </event> 12153 12154 <event label="Frame Pop" 12155 id="FramePop" const="JVMTI_EVENT_FRAME_POP" filtered="thread" num="61"> 12156 <description> 12157 Frame pop events are generated upon exit from a single method 12158 in a single frame as specified 12159 in a call to <functionlink id="NotifyFramePop"></functionlink>. 12160 This is true whether termination is caused by 12161 executing its return instruction 12162 or by throwing an exception to its caller 12163 (see <paramlink id="was_popped_by_exception"></paramlink>). 12164 However, frame pops caused by the <functionlink id="PopFrame"/> 12165 function are not reported. 12166 <p/> 12167 The location reported by <functionlink id="GetFrameLocation"></functionlink> 12168 identifies the executable location in the returning method, 12169 immediately prior to the return. 12170 </description> 12171 <origin>jvmdi</origin> 12172 <capabilities> 12173 <required id="can_generate_frame_pop_events"></required> 12174 </capabilities> 12175 <parameters> 12176 <param id="jni_env"> 12177 <outptr> 12178 <struct>JNIEnv</struct> 12179 </outptr> 12180 <description> 12181 The JNI environment of the event (current) thread 12182 </description> 12183 </param> 12184 <param id="thread"> 12185 <jthread/> 12186 <description> 12187 Thread that is popping the frame 12188 </description> 12189 </param> 12190 <param id="klass"> 12191 <jclass method="method"/> 12192 <description> 12193 Class of the method being popped 12194 </description> 12195 </param> 12196 <param id="method"> 12197 <jmethodID class="klass"/> 12198 <description> 12199 Method being popped 12200 </description> 12201 </param> 12202 <param id="was_popped_by_exception"> 12203 <jboolean/> 12204 <description> 12205 True if frame was popped by a thrown exception. 12206 False if method exited through its return instruction. 12207 </description> 12208 </param> 12209 </parameters> 12210 </event> 12211 12212 <event label="Method Entry" 12213 id="MethodEntry" const="JVMTI_EVENT_METHOD_ENTRY" filtered="thread" num="65"> 12214 <description> 12215 Method entry events are generated upon entry of Java 12216 programming language methods (including native methods). 12217 <p/> 12218 The location reported by <functionlink id="GetFrameLocation"></functionlink> 12219 identifies the initial executable location in 12220 the method. 12221 <p/> 12222 Enabling method 12223 entry or exit events will significantly degrade performance on many platforms and is thus 12224 not advised for performance critical usage (such as profiling). 12225 <internallink id="bci">Bytecode instrumentation</internallink> should be 12226 used in these cases. 12227 </description> 12228 <origin>jvmdi</origin> 12229 <capabilities> 12230 <required id="can_generate_method_entry_events"></required> 12231 </capabilities> 12232 <parameters> 12233 <param id="jni_env"> 12234 <outptr> 12235 <struct>JNIEnv</struct> 12236 </outptr> 12237 <description> 12238 The JNI environment of the event (current) thread 12239 </description> 12240 </param> 12241 <param id="thread"> 12242 <jthread/> 12243 <description> 12244 Thread entering the method 12245 </description> 12246 </param> 12247 <param id="klass"> 12248 <jclass method="method"/> 12249 <description> 12250 Class of the method being entered 12251 </description> 12252 </param> 12253 <param id="method"> 12254 <jmethodID class="klass"/> 12255 <description> 12256 Method being entered 12257 </description> 12258 </param> 12259 </parameters> 12260 </event> 12261 12262 <event label="Method Exit" 12263 id="MethodExit" const="JVMTI_EVENT_METHOD_EXIT" filtered="thread" num="66"> 12264 <description> 12265 Method exit events are generated upon exit from Java 12266 programming language methods (including native methods). 12267 This is true whether termination is caused by 12268 executing its return instruction 12269 or by throwing an exception to its caller 12270 (see <paramlink id="was_popped_by_exception"></paramlink>). 12271 <p/> 12272 The <code>method</code> field uniquely identifies the 12273 method being entered or exited. The <code>frame</code> field provides 12274 access to the stack frame for the method. 12275 <p/> 12276 The location reported by <functionlink id="GetFrameLocation"></functionlink> 12277 identifies the executable location in the returning method 12278 immediately prior to the return. 12279 <p/> 12280 Enabling method 12281 entry or exit events will significantly degrade performance on many platforms and is thus 12282 not advised for performance critical usage (such as profiling). 12283 <internallink id="bci">Bytecode instrumentation</internallink> should be 12284 used in these cases. 12285 </description> 12286 <origin>jvmdi</origin> 12287 <capabilities> 12288 <required id="can_generate_method_exit_events"></required> 12289 </capabilities> 12290 <parameters> 12291 <param id="jni_env"> 12292 <outptr> 12293 <struct>JNIEnv</struct> 12294 </outptr> 12295 <description> 12296 The JNI environment of the event (current) thread 12297 </description> 12298 </param> 12299 <param id="thread"> 12300 <jthread/> 12301 <description> 12302 Thread exiting the method 12303 </description> 12304 </param> 12305 <param id="klass"> 12306 <jclass method="method"/> 12307 <description> 12308 Class of the method being exited 12309 </description> 12310 </param> 12311 <param id="method"> 12312 <jmethodID class="klass"/> 12313 <description> 12314 Method being exited 12315 </description> 12316 </param> 12317 <param id="was_popped_by_exception"> 12318 <jboolean/> 12319 <description> 12320 True if frame was popped by a thrown exception. 12321 False if method exited through its return instruction. 12322 </description> 12323 </param> 12324 <param id="return_value"> 12325 <jvalue/> 12326 <description> 12327 The return value of the method being exited. 12328 Undefined and should not be used if 12329 <paramlink id="was_popped_by_exception"></paramlink> 12330 is true. 12331 </description> 12332 </param> 12333 </parameters> 12334 </event> 12335 12336 <event label="Native Method Bind" phase="any" 12337 id="NativeMethodBind" const="JVMTI_EVENT_NATIVE_METHOD_BIND" num="67"> 12338 <description> 12339 A Native Method Bind event is sent when a VM binds a 12340 Java programming language native method 12341 to the address of a function that implements the native method. 12342 This will occur when the native method is called for the first time 12343 and also occurs when the JNI function <code>RegisterNatives</code> is called. 12344 This event allows the bind to be redirected to an agent-specified 12345 proxy function. 12346 This event is not sent when the native method is unbound. 12347 Typically, this proxy function will need to be specific to a 12348 particular method or, to handle the general case, automatically 12349 generated assembly code, since after instrumentation code is 12350 executed the function at the original binding 12351 address will usually be invoked. 12352 The original binding can be restored or the redirection changed 12353 by use of the JNI function <code>RegisterNatives</code>. 12354 Some events may be sent during the primordial phase, JNI and 12355 most of <jvmti/> cannot be used at this time but the method and 12356 address can be saved for use later. 12357 </description> 12358 <origin>new</origin> 12359 <capabilities> 12360 <required id="can_generate_native_method_bind_events"></required> 12361 </capabilities> 12362 <parameters> 12363 <param id="jni_env"> 12364 <outptr> 12365 <struct>JNIEnv</struct> 12366 </outptr> 12367 <description> 12368 The JNI environment of the event (current) thread 12369 Will be <code>NULL</code> if sent during the primordial 12370 <functionlink id="GetPhase">phase</functionlink>. 12371 </description> 12372 </param> 12373 <param id="thread"> 12374 <jthread/> 12375 <description> 12376 Thread requesting the bind 12377 </description> 12378 </param> 12379 <param id="klass"> 12380 <jclass method="method"/> 12381 <description> 12382 Class of the method being bound 12383 </description> 12384 </param> 12385 <param id="method"> 12386 <jmethodID class="klass"/> 12387 <description> 12388 Native method being bound 12389 </description> 12390 </param> 12391 <param id="address"> 12392 <outptr><void/></outptr> 12393 <description> 12394 The address the VM is about to bind to--that is, the 12395 address of the implementation of the native method 12396 </description> 12397 </param> 12398 <param id="new_address_ptr"> 12399 <agentbuf><void/></agentbuf> 12400 <description> 12401 if the referenced address is changed (that is, if 12402 <code>*new_address_ptr</code> is set), the binding 12403 will instead be made to the supplied address. 12404 </description> 12405 </param> 12406 </parameters> 12407 </event> 12408 12409 <event label="Exception" 12410 id="Exception" const="JVMTI_EVENT_EXCEPTION" filtered="thread" num="58"> 12411 <description> 12412 Exception events are generated whenever an exception is first detected 12413 in a Java programming language method. 12414 Where "exception" means any <code>java.lang.Throwable</code>. 12415 The exception may have been thrown by a Java programming language or native 12416 method, but in the case of native methods, the event is not generated 12417 until the exception is first seen by a Java programming language method. If an exception is 12418 set and cleared in a native method (and thus is never visible to Java programming language code), 12419 no exception event is generated. 12420 <p/> 12421 The <code>method</code> and <code>location</code> 12422 parameters uniquely identify the current location 12423 (where the exception was detected) and allow 12424 the mapping to source file and line number when that information is 12425 available. The <code>exception</code> field identifies the thrown 12426 exception object. The <code>catch_method</code> 12427 and <code>catch_location</code> identify the location of the catch clause, 12428 if any, that handles the thrown exception. If there is no such catch clause, 12429 each field is set to 0. There is no guarantee that the thread will ever 12430 reach this catch clause. If there are native methods on the call stack 12431 between the throw location and the catch clause, the exception may 12432 be reset by one of those native methods. 12433 Similarly, exceptions that are reported as uncaught (<code>catch_klass</code> 12434 et al. set to 0) may in fact be caught by native code. 12435 Agents can check for these occurrences by monitoring 12436 <eventlink id="ExceptionCatch"></eventlink> events. 12437 Note that finally clauses are implemented as catch and re-throw. Therefore they 12438 will be reported in the catch location. 12439 </description> 12440 <origin>jvmdi</origin> 12441 <capabilities> 12442 <required id="can_generate_exception_events"></required> 12443 </capabilities> 12444 <parameters> 12445 <param id="jni_env"> 12446 <outptr> 12447 <struct>JNIEnv</struct> 12448 </outptr> 12449 <description> 12450 The JNI environment of the event (current) thread 12451 </description> 12452 </param> 12453 <param id="thread"> 12454 <jthread/> 12455 <description> 12456 Thread generating the exception 12457 </description> 12458 </param> 12459 <param id="klass"> 12460 <jclass method="method"/> 12461 <description> 12462 Class generating the exception 12463 </description> 12464 </param> 12465 <param id="method"> 12466 <jmethodID class="klass"/> 12467 <description> 12468 Method generating the exception 12469 </description> 12470 </param> 12471 <param id="location"> 12472 <jlocation/> 12473 <description> 12474 Location where exception occurred 12475 </description> 12476 </param> 12477 <param id="exception"> 12478 <jobject/> 12479 <description> 12480 The exception being thrown 12481 </description> 12482 </param> 12483 <param id="catch_klass"> 12484 <jclass method="catch_method"/> 12485 <description> 12486 Class that will catch the exception, or <code>NULL</code> if no known catch 12487 </description> 12488 </param> 12489 <param id="catch_method"> 12490 <jmethodID class="catch_klass"/> 12491 <description> 12492 Method that will catch the exception, or <code>NULL</code> if no known catch 12493 </description> 12494 </param> 12495 <param id="catch_location"> 12496 <jlocation/> 12497 <description> 12498 location which will catch the exception or zero if no known catch 12499 </description> 12500 </param> 12501 </parameters> 12502 </event> 12503 12504 <event label="Exception Catch" 12505 id="ExceptionCatch" const="JVMTI_EVENT_EXCEPTION_CATCH" filtered="thread" num="59"> 12506 <description> 12507 Exception catch events are generated whenever a thrown exception is caught. 12508 Where "exception" means any <code>java.lang.Throwable</code>. 12509 If the exception is caught in a Java programming language method, the event is generated 12510 when the catch clause is reached. If the exception is caught in a native 12511 method, the event is generated as soon as control is returned to a Java programming language 12512 method. Exception catch events are generated for any exception for which 12513 a throw was detected in a Java programming language method. 12514 Note that finally clauses are implemented as catch and re-throw. Therefore they 12515 will generate exception catch events. 12516 <p/> 12517 The <code>method</code> and <code>location</code> 12518 parameters uniquely identify the current location 12519 and allow the mapping to source file and line number when that information is 12520 available. For exceptions caught in a Java programming language method, the 12521 <code>exception</code> object identifies the exception object. Exceptions 12522 caught in native methods are not necessarily available by the time the 12523 exception catch is reported, so the <code>exception</code> field is set 12524 to <code>NULL</code>. 12525 </description> 12526 <origin>jvmdi</origin> 12527 <capabilities> 12528 <required id="can_generate_exception_events"></required> 12529 </capabilities> 12530 <parameters> 12531 <param id="jni_env"> 12532 <outptr> 12533 <struct>JNIEnv</struct> 12534 </outptr> 12535 <description> 12536 The JNI environment of the event (current) thread 12537 </description> 12538 </param> 12539 <param id="thread"> 12540 <jthread/> 12541 <description> 12542 Thread catching the exception 12543 </description> 12544 </param> 12545 <param id="klass"> 12546 <jclass method="method"/> 12547 <description> 12548 Class catching the exception 12549 </description> 12550 </param> 12551 <param id="method"> 12552 <jmethodID class="klass"/> 12553 <description> 12554 Method catching the exception 12555 </description> 12556 </param> 12557 <param id="location"> 12558 <jlocation/> 12559 <description> 12560 Location where exception is being caught 12561 </description> 12562 </param> 12563 <param id="exception"> 12564 <jobject/> 12565 <description> 12566 Exception being caught 12567 </description> 12568 </param> 12569 </parameters> 12570 </event> 12571 12572 <event label="Thread Start" 12573 id="ThreadStart" const="JVMTI_EVENT_THREAD_START" num="52" phase="start"> 12574 <description> 12575 Thread start events are generated by a new thread before its initial 12576 method executes. 12577 <p/> 12578 A thread may be listed in the array returned by 12579 <functionlink id="GetAllThreads"></functionlink> 12580 before its thread start event is generated. 12581 It is possible for other events to be generated 12582 on a thread before its thread start event. 12583 <p/> 12584 The event is sent on the newly started <paramlink id="thread"></paramlink>. 12585 </description> 12586 <origin>jvmdi</origin> 12587 <capabilities> 12588 </capabilities> 12589 <parameters> 12590 <param id="jni_env"> 12591 <outptr> 12592 <struct>JNIEnv</struct> 12593 </outptr> 12594 <description> 12595 The JNI environment of the event (current) thread. 12596 </description> 12597 </param> 12598 <param id="thread"> 12599 <jthread/> 12600 <description> 12601 Thread starting 12602 </description> 12603 </param> 12604 </parameters> 12605 </event> 12606 12607 <event label="Thread End" 12608 id="ThreadEnd" const="JVMTI_EVENT_THREAD_END" filtered="thread" num="53" phase="start"> 12609 <description> 12610 Thread end events are generated by a terminating thread 12611 after its initial method has finished execution. 12612 <p/> 12613 A thread may be listed in the array returned by 12614 <functionlink id="GetAllThreads"></functionlink> 12615 after its thread end event is generated. 12616 No events are generated on a thread 12617 after its thread end event. 12618 <p/> 12619 The event is sent on the dying <paramlink id="thread"></paramlink>. 12620 </description> 12621 <origin>jvmdi</origin> 12622 <capabilities> 12623 </capabilities> 12624 <parameters> 12625 <param id="jni_env"> 12626 <outptr> 12627 <struct>JNIEnv</struct> 12628 </outptr> 12629 <description> 12630 The JNI environment of the event (current) thread. 12631 </description> 12632 </param> 12633 <param id="thread"> 12634 <jthread/> 12635 <description> 12636 Thread ending 12637 </description> 12638 </param> 12639 </parameters> 12640 </event> 12641 12642 <event label="Class Load" 12643 id="ClassLoad" const="JVMTI_EVENT_CLASS_LOAD" filtered="thread" phase="start" num="55"> 12644 <description> 12645 A class load event is generated when a class is first loaded. The order 12646 of class load events generated by a particular thread are guaranteed 12647 to match the order of class loading within that thread. 12648 Array class creation does not generate a class load event. 12649 The creation of a primitive class (for example, java.lang.Integer.TYPE) 12650 does not generate a class load event. 12651 <p/> 12652 This event is sent at an early stage in loading the class. As 12653 a result the class should be used carefully. Note, for example, 12654 that methods and fields are not yet loaded, so queries for methods, 12655 fields, subclasses, and so on will not give correct results. 12656 See "Loading of Classes and Interfaces" in the <i>Java Language 12657 Specification</i>. For most 12658 purposes the <eventlink id="ClassPrepare"></eventlink> event will 12659 be more useful. 12660 </description> 12661 <origin>jvmdi</origin> 12662 <capabilities> 12663 </capabilities> 12664 <parameters> 12665 <param id="jni_env"> 12666 <outptr> 12667 <struct>JNIEnv</struct> 12668 </outptr> 12669 <description> 12670 The JNI environment of the event (current) thread 12671 </description> 12672 </param> 12673 <param id="thread"> 12674 <jthread/> 12675 <description> 12676 Thread loading the class 12677 </description> 12678 </param> 12679 <param id="klass"> 12680 <jclass/> 12681 <description> 12682 Class being loaded 12683 </description> 12684 </param> 12685 </parameters> 12686 </event> 12687 12688 <elide> 12689 <event label="Class Unload" 12690 id="ClassUnload" const="JVMTI_EVENT_CLASS_UNLOAD" num="57"> 12691 <description> 12692 A class unload event is generated when the class is about to be unloaded. 12693 Class unload events take place during garbage collection and must be 12694 handled extremely carefully. The garbage collector holds many locks 12695 and has suspended all other threads, so the event handler cannot depend 12696 on the ability to acquire any locks. The class unload event handler should 12697 do as little as possible, perhaps by queuing information to be processed 12698 later. In particular, the <code>jclass</code> should be used only in 12699 the JNI function <code>isSameObject</code> or in the following <jvmti/> functions: 12700 <ul> 12701 <li><functionlink id="GetClassSignature"></functionlink></li> 12702 <li><functionlink id="GetSourceFileName"></functionlink></li> 12703 <li><functionlink id="IsInterface"></functionlink></li> 12704 <li><functionlink id="IsArrayClass"></functionlink></li> 12705 </ul> 12706 </description> 12707 <origin>jvmdi</origin> 12708 <capabilities> 12709 </capabilities> 12710 <parameters> 12711 <param id="jni_env"> 12712 <outptr> 12713 <struct>JNIEnv</struct> 12714 </outptr> 12715 <description> 12716 The JNI environment of the event (current) thread 12717 </description> 12718 </param> 12719 <param id="thread"> 12720 <jthread/> 12721 <description> 12722 Thread generating the class unload 12723 </description> 12724 </param> 12725 <param id="klass"> 12726 <jclass/> 12727 <description> 12728 Class being unloaded 12729 </description> 12730 </param> 12731 </parameters> 12732 </event> 12733 </elide> 12734 12735 <event label="Class Prepare" 12736 id="ClassPrepare" const="JVMTI_EVENT_CLASS_PREPARE" filtered="thread" phase="start" num="56"> 12737 <description> 12738 A class prepare event is generated when class preparation is complete. 12739 At this point, class fields, methods, and implemented interfaces are 12740 available, and no code from the class has been executed. Since array 12741 classes never have fields or methods, class prepare events are not 12742 generated for them. Class prepare events are not generated for 12743 primitive classes (for example, <code>java.lang.Integer.TYPE</code>). 12744 </description> 12745 <origin>jvmdi</origin> 12746 <capabilities> 12747 </capabilities> 12748 <parameters> 12749 <param id="jni_env"> 12750 <outptr> 12751 <struct>JNIEnv</struct> 12752 </outptr> 12753 <description> 12754 The JNI environment of the event (current) thread 12755 </description> 12756 </param> 12757 <param id="thread"> 12758 <jthread/> 12759 <description> 12760 Thread generating the class prepare 12761 </description> 12762 </param> 12763 <param id="klass"> 12764 <jclass/> 12765 <description> 12766 Class being prepared 12767 </description> 12768 </param> 12769 </parameters> 12770 </event> 12771 12772 <event label="Class File Load Hook" phase="any" 12773 id="ClassFileLoadHook" const="JVMTI_EVENT_CLASS_FILE_LOAD_HOOK" num="54"> 12774 <description> 12775 This event is sent when the VM obtains class file data, 12776 but before it constructs 12777 the in-memory representation for that class. 12778 This event is also sent when the class is being modified by the 12779 <functionlink id="RetransformClasses"/> function or 12780 the <functionlink id="RedefineClasses"/> function, 12781 called in any <jvmti/> environment. 12782 The agent can instrument 12783 the existing class file data sent by the VM to include profiling/debugging hooks. 12784 See the description of 12785 <internallink id="bci">bytecode instrumentation</internallink> 12786 for usage information. 12787 <p/> 12788 When the capabilities 12789 <internallink id="jvmtiCapabilities.can_generate_early_class_hook_events"> 12790 <code>can_generate_early_class_hook_events</code></internallink> and 12791 <internallink id="jvmtiCapabilities.can_generate_all_class_hook_events"> 12792 <code>can_generate_all_class_hook_events</code></internallink> 12793 are enabled then this event may be sent in the primordial phase. 12794 Otherwise, this event may be sent before the VM is initialized (the start 12795 <functionlink id="GetPhase">phase</functionlink>). 12796 Some classes might not be compatible 12797 with the function (eg. ROMized classes or implementation defined classes) and this event will 12798 not be generated for these classes. 12799 <p/> 12800 The agent must allocate the space for the modified 12801 class file data buffer 12802 using the memory allocation function 12803 <functionlink id="Allocate"></functionlink> because the 12804 VM is responsible for freeing the new class file data buffer 12805 using <functionlink id="Deallocate"></functionlink>. 12806 <p/> 12807 If the agent wishes to modify the class file, it must set 12808 <code>new_class_data</code> to point 12809 to the newly instrumented class file data buffer and set 12810 <code>new_class_data_len</code> to the length of that 12811 buffer before returning 12812 from this call. If no modification is desired, the agent simply 12813 does not set <code>new_class_data</code>. If multiple agents 12814 have enabled this event the results are chained. That is, if 12815 <code>new_class_data</code> has been set, it becomes the 12816 <code>class_data</code> for the next agent. 12817 <p/> 12818 When handling a class load in the live phase, then the 12819 <functionlink id="GetNamedModule"></functionlink> 12820 function can be used to map class loader and a package name to a module. 12821 When a class is being redefined or retransformed then 12822 <code>class_being_redefined</code> is non <code>NULL</code> and so 12823 the JNI <code>GetModule</code> function can also be used 12824 to obtain the Module. 12825 <p/> 12826 The order that this event is sent to each environment differs 12827 from other events. 12828 This event is sent to environments in the following order: 12829 <ul> 12830 <li><fieldlink id="can_retransform_classes" 12831 struct="jvmtiCapabilities">retransformation 12832 incapable</fieldlink> 12833 environments, in the 12834 order in which they were created 12835 </li> 12836 <li><fieldlink id="can_retransform_classes" 12837 struct="jvmtiCapabilities">retransformation 12838 capable</fieldlink> 12839 environments, in the 12840 order in which they were created 12841 </li> 12842 </ul> 12843 When triggered by <functionlink id="RetransformClasses"/>, 12844 this event is sent only to <fieldlink id="can_retransform_classes" 12845 struct="jvmtiCapabilities">retransformation 12846 capable</fieldlink> 12847 environments. 12848 </description> 12849 <origin>jvmpi</origin> 12850 <capabilities> 12851 <capability id="can_generate_all_class_hook_events"></capability> 12852 <capability id="can_generate_early_class_hook_events"></capability> 12853 </capabilities> 12854 <parameters> 12855 <param id="jni_env"> 12856 <outptr> 12857 <struct>JNIEnv</struct> 12858 </outptr> 12859 <description> 12860 The JNI environment of the event (current) thread. 12861 </description> 12862 </param> 12863 <param id="class_being_redefined"> 12864 <jclass/> 12865 <description> 12866 The class being 12867 <functionlink id="RedefineClasses">redefined</functionlink> or 12868 <functionlink id="RetransformClasses">retransformed</functionlink>. 12869 <code>NULL</code> if sent by class load. 12870 </description> 12871 </param> 12872 <param id="loader"> 12873 <jobject/> 12874 <description> 12875 The class loader loading the class. 12876 <code>NULL</code> if the bootstrap class loader. 12877 </description> 12878 </param> 12879 <param id="name"> 12880 <vmbuf><char/></vmbuf> 12881 <description> 12882 Name of class being loaded as a VM internal qualified name 12883 (for example, "java/util/List"), encoded as a 12884 <internallink id="mUTF">modified UTF-8</internallink> string. 12885 Note: if the class is defined with a <code>NULL</code> name or 12886 without a name specified, <code>name</code> will be <code>NULL</code>. 12887 </description> 12888 </param> 12889 <param id="protection_domain"> 12890 <jobject/> 12891 <description> 12892 The <code>ProtectionDomain</code> of the class. 12893 </description> 12894 </param> 12895 <param id="class_data_len"> 12896 <jint/> 12897 <description> 12898 Length of current class file data buffer. 12899 </description> 12900 </param> 12901 <param id="class_data"> 12902 <vmbuf><uchar/></vmbuf> 12903 <description> 12904 Pointer to the current class file data buffer. 12905 </description> 12906 </param> 12907 <param id="new_class_data_len"> 12908 <outptr><jint/></outptr> 12909 <description> 12910 Pointer to the length of the new class file data buffer. 12911 </description> 12912 </param> 12913 <param id="new_class_data"> 12914 <agentbuf incount="new_class_data_len"><uchar/></agentbuf> 12915 <description> 12916 Pointer to the pointer to the instrumented class file data buffer. 12917 </description> 12918 </param> 12919 </parameters> 12920 </event> 12921 12922 <event label="VM Start Event" 12923 id="VMStart" const="JVMTI_EVENT_VM_START" num="57" phase="start"> 12924 <description> 12925 The VM start event signals the start of the VM. 12926 At this time JNI is live but the VM is not yet fully initialized. 12927 Once this event is generated, the agent is free to call any JNI function. 12928 This event signals the beginning of the start phase, 12929 <jvmti/> functions permitted in the start phase may be called. 12930 <p/> 12931 The timing of this event may depend on whether the agent has added the 12932 <internallink id="jvmtiCapabilities.can_generate_early_vmstart"> 12933 <code>can_generate_early_vmstart</code></internallink> capability or not. 12934 If the capability has been added then the VM posts the event as early 12935 as possible. The VM is capable of executing bytecode but it may not have 12936 initialized to the point where it can load classes in modules other than 12937 <code>java.base</code>, or even arbitrary classes in <code>java.base</code>. 12938 Agents that do load-time instrumentation in this 12939 phase must take great care when instrumenting code that potentially 12940 executes in this phase. Extreme care should also be taken with JNI 12941 <code>FindClass</code> as it may not be possible to load classes and attempts 12942 to do so may result in unpredictable behavior, maybe even stability issues 12943 on some VM implementations. 12944 If the capability has not been added then the VM delays posting this 12945 event until it is capable of loading classes in modules other than 12946 <code>java.base</code> or the VM has completed its initialization. 12947 Agents that create more than one JVM TI environment, where the 12948 capability is added to some but not all environments, may observe the 12949 start phase beginning earlier in the JVM TI environments that possess 12950 the capabilty. 12951 <p/> 12952 In the case of VM start-up failure, this event will not be sent. 12953 </description> 12954 <origin>jvmdi</origin> 12955 <capabilities> 12956 </capabilities> 12957 <parameters> 12958 <param id="jni_env"> 12959 <outptr> 12960 <struct>JNIEnv</struct> 12961 </outptr> 12962 <description> 12963 The JNI environment of the event (current) thread. 12964 </description> 12965 </param> 12966 </parameters> 12967 </event> 12968 12969 <event label="VM Initialization Event" 12970 id="VMInit" const="JVMTI_EVENT_VM_INIT" num="50"> 12971 <description> 12972 The VM initialization event signals the completion of VM initialization. Once 12973 this event is generated, the agent is free to call any JNI or <jvmti/> 12974 function. The VM initialization event can be preceded by or can be concurrent 12975 with other events, but 12976 the preceding events should be handled carefully, if at all, because the 12977 VM has not completed its initialization. The thread start event for the 12978 main application thread is guaranteed not to occur until after the 12979 handler for the VM initialization event returns. 12980 <p/> 12981 In the case of VM start-up failure, this event will not be sent. 12982 </description> 12983 <origin>jvmdi</origin> 12984 <capabilities> 12985 </capabilities> 12986 <parameters> 12987 <param id="jni_env"> 12988 <outptr> 12989 <struct>JNIEnv</struct> 12990 </outptr> 12991 <description> 12992 The JNI environment of the event (current) thread. 12993 </description> 12994 </param> 12995 <param id="thread"> 12996 <jthread/> 12997 <description> 12998 The initial thread 12999 </description> 13000 </param> 13001 </parameters> 13002 </event> 13003 13004 <event label="VM Death Event" 13005 id="VMDeath" const="JVMTI_EVENT_VM_DEATH" num="51"> 13006 <description> 13007 The VM death event notifies the agent of the termination of the VM. 13008 No events will occur after the VMDeath event. 13009 <p/> 13010 In the case of VM start-up failure, this event will not be sent. 13011 Note that <internallink id="onunload">Agent_OnUnload</internallink> 13012 will still be called in these cases. 13013 </description> 13014 <origin>jvmdi</origin> 13015 <capabilities> 13016 </capabilities> 13017 <parameters> 13018 <param id="jni_env"> 13019 <outptr> 13020 <struct>JNIEnv</struct> 13021 </outptr> 13022 <description> 13023 The JNI environment of the event (current) thread 13024 </description> 13025 </param> 13026 </parameters> 13027 </event> 13028 13029 <event label="Compiled Method Load" phase="start" 13030 id="CompiledMethodLoad" const="JVMTI_EVENT_COMPILED_METHOD_LOAD" num="68"> 13031 <description> 13032 Sent when a method is compiled and loaded into memory by the VM. 13033 If it is unloaded, the <eventlink id="CompiledMethodUnload"/> event is sent. 13034 If it is moved, the <eventlink id="CompiledMethodUnload"/> event is sent, 13035 followed by a new <code>CompiledMethodLoad</code> event. 13036 Note that a single method may have multiple compiled forms, and that 13037 this event will be sent for each form. 13038 Note also that several methods may be inlined into a single 13039 address range, and that this event will be sent for each method. 13040 <p/> 13041 These events can be sent after their initial occurrence with 13042 <functionlink id="GenerateEvents"></functionlink>. 13043 </description> 13044 <origin>jvmpi</origin> 13045 <typedef id="jvmtiAddrLocationMap" label="Native address to location entry"> 13046 <field id="start_address"> 13047 <vmbuf><void/></vmbuf> 13048 <description> 13049 Starting native address of code corresponding to a location 13050 </description> 13051 </field> 13052 <field id="location"> 13053 <jlocation/> 13054 <description> 13055 Corresponding location. See 13056 <functionlink id="GetJLocationFormat"></functionlink> 13057 for the meaning of location. 13058 </description> 13059 </field> 13060 </typedef> 13061 <capabilities> 13062 <required id="can_generate_compiled_method_load_events"></required> 13063 </capabilities> 13064 <parameters> 13065 <param id="klass"> 13066 <jclass method="method"/> 13067 <description> 13068 Class of the method being compiled and loaded 13069 </description> 13070 </param> 13071 <param id="method"> 13072 <jmethodID class="klass"/> 13073 <description> 13074 Method being compiled and loaded 13075 </description> 13076 </param> 13077 <param id="code_size"> 13078 <jint/> 13079 <description> 13080 Size of compiled code 13081 </description> 13082 </param> 13083 <param id="code_addr"> 13084 <vmbuf><void/></vmbuf> 13085 <description> 13086 Address where compiled method code is loaded 13087 </description> 13088 </param> 13089 <param id="map_length"> 13090 <jint/> 13091 <description> 13092 Number of <typelink id="jvmtiAddrLocationMap"></typelink> 13093 entries in the address map. 13094 Zero if mapping information cannot be supplied. 13095 </description> 13096 </param> 13097 <param id="map"> 13098 <vmbuf><struct>jvmtiAddrLocationMap</struct></vmbuf> 13099 <description> 13100 Map from native addresses to location. 13101 The native address range of each entry is from 13102 <fieldlink id="start_address" struct="jvmtiAddrLocationMap"></fieldlink> 13103 to <code>start_address-1</code> of the next entry. 13104 <code>NULL</code> if mapping information cannot be supplied. 13105 </description> 13106 </param> 13107 <param id="compile_info"> 13108 <vmbuf><void/></vmbuf> 13109 <description> 13110 VM-specific compilation information. 13111 The referenced compile information is managed by the VM 13112 and must not depend on the agent for collection. 13113 A VM implementation defines the content and lifetime 13114 of the information. 13115 </description> 13116 </param> 13117 </parameters> 13118 </event> 13119 13120 <event label="Compiled Method Unload" phase="start" 13121 id="CompiledMethodUnload" const="JVMTI_EVENT_COMPILED_METHOD_UNLOAD" num="69"> 13122 <description> 13123 Sent when a compiled method is unloaded from memory. 13124 This event might not be sent on the thread which performed the unload. 13125 This event may be sent sometime after the unload occurs, but 13126 will be sent before the memory is reused 13127 by a newly generated compiled method. This event may be sent after 13128 the class is unloaded. 13129 </description> 13130 <origin>jvmpi</origin> 13131 <capabilities> 13132 <required id="can_generate_compiled_method_load_events"></required> 13133 </capabilities> 13134 <parameters> 13135 <param id="klass"> 13136 <jclass method="method"/> 13137 <description> 13138 Class of the compiled method being unloaded. 13139 </description> 13140 </param> 13141 <param id="method"> 13142 <jmethodID class="klass"/> 13143 <description> 13144 Compiled method being unloaded. 13145 For identification of the compiled method only -- the class 13146 may be unloaded and therefore the method should not be used 13147 as an argument to further JNI or <jvmti/> functions. 13148 </description> 13149 </param> 13150 <param id="code_addr"> 13151 <vmbuf><void/></vmbuf> 13152 <description> 13153 Address where compiled method code was loaded. 13154 For identification of the compiled method only -- 13155 the space may have been reclaimed. 13156 </description> 13157 </param> 13158 </parameters> 13159 </event> 13160 13161 <event label="Dynamic Code Generated" phase="any" 13162 id="DynamicCodeGenerated" const="JVMTI_EVENT_DYNAMIC_CODE_GENERATED" num="70"> 13163 <description> 13164 Sent when a component of the virtual machine is generated dynamically. 13165 This does not correspond to Java programming language code that is 13166 compiled--see <eventlink id="CompiledMethodLoad"></eventlink>. 13167 This is for native code--for example, an interpreter that is generated 13168 differently depending on command-line options. 13169 <p/> 13170 Note that this event has no controlling capability. 13171 If a VM cannot generate these events, it simply does not send any. 13172 <p/> 13173 These events can be sent after their initial occurrence with 13174 <functionlink id="GenerateEvents"></functionlink>. 13175 </description> 13176 <origin>jvmpi</origin> 13177 <capabilities> 13178 </capabilities> 13179 <parameters> 13180 <param id="name"> 13181 <vmbuf><char/></vmbuf> 13182 <description> 13183 Name of the code, encoded as a 13184 <internallink id="mUTF">modified UTF-8</internallink> string. 13185 Intended for display to an end-user. 13186 The name might not be unique. 13187 </description> 13188 </param> 13189 <param id="address"> 13190 <vmbuf><void/></vmbuf> 13191 <description> 13192 Native address of the code 13193 </description> 13194 </param> 13195 <param id="length"> 13196 <jint/> 13197 <description> 13198 Length in bytes of the code 13199 </description> 13200 </param> 13201 </parameters> 13202 </event> 13203 13204 <event label="Data Dump Request" 13205 id="DataDumpRequest" const="JVMTI_EVENT_DATA_DUMP_REQUEST" num="71"> 13206 <description> 13207 Sent by the VM to request the agent to dump its data. This 13208 is just a hint and the agent need not react to this event. 13209 This is useful for processing command-line signals from users. For 13210 example, in the Java 2 SDK a CTRL-Break on Win32 and a CTRL-\ on Solaris 13211 causes the VM to send this event to the agent. 13212 </description> 13213 <origin>jvmpi</origin> 13214 <capabilities> 13215 </capabilities> 13216 <parameters> 13217 </parameters> 13218 </event> 13219 13220 <event label="Monitor Contended Enter" 13221 id="MonitorContendedEnter" const="JVMTI_EVENT_MONITOR_CONTENDED_ENTER" filtered="thread" num="75"> 13222 <description> 13223 Sent when a thread is attempting to enter a Java programming language 13224 monitor already acquired by another thread. 13225 </description> 13226 <origin>jvmpi</origin> 13227 <capabilities> 13228 <required id="can_generate_monitor_events"></required> 13229 </capabilities> 13230 <parameters> 13231 <param id="jni_env"> 13232 <outptr> 13233 <struct>JNIEnv</struct> 13234 </outptr> 13235 <description> 13236 The JNI environment of the event (current) thread 13237 </description> 13238 </param> 13239 <param id="thread"> 13240 <jthread/> 13241 <description> 13242 JNI local reference to the thread 13243 attempting to enter the monitor 13244 </description> 13245 </param> 13246 <param id="object"> 13247 <jobject/> 13248 <description> 13249 JNI local reference to the monitor 13250 </description> 13251 </param> 13252 </parameters> 13253 </event> 13254 13255 <event label="Monitor Contended Entered" 13256 id="MonitorContendedEntered" const="JVMTI_EVENT_MONITOR_CONTENDED_ENTERED" filtered="thread" num="76"> 13257 <description> 13258 Sent when a thread enters a Java programming language 13259 monitor after waiting for it to be released by another thread. 13260 </description> 13261 <origin>jvmpi</origin> 13262 <capabilities> 13263 <required id="can_generate_monitor_events"></required> 13264 </capabilities> 13265 <parameters> 13266 <param id="jni_env"> 13267 <outptr> 13268 <struct>JNIEnv</struct> 13269 </outptr> 13270 <description> 13271 The JNI environment of the event (current) thread 13272 </description> 13273 </param> 13274 <param id="thread"> 13275 <jthread/> 13276 <description> 13277 JNI local reference to the thread entering 13278 the monitor 13279 </description> 13280 </param> 13281 <param id="object"> 13282 <jobject/> 13283 <description> 13284 JNI local reference to the monitor 13285 </description> 13286 </param> 13287 </parameters> 13288 </event> 13289 13290 <event label="Monitor Wait" 13291 id="MonitorWait" const="JVMTI_EVENT_MONITOR_WAIT" filtered="thread" num="73"> 13292 <description> 13293 Sent when a thread is about to wait on an object. 13294 </description> 13295 <origin>jvmpi</origin> 13296 <capabilities> 13297 <required id="can_generate_monitor_events"></required> 13298 </capabilities> 13299 <parameters> 13300 <param id="jni_env"> 13301 <outptr> 13302 <struct>JNIEnv</struct> 13303 </outptr> 13304 <description> 13305 The JNI environment of the event (current) thread 13306 </description> 13307 </param> 13308 <param id="thread"> 13309 <jthread/> 13310 <description> 13311 JNI local reference to the thread about to wait 13312 </description> 13313 </param> 13314 <param id="object"> 13315 <jobject/> 13316 <description> 13317 JNI local reference to the monitor 13318 </description> 13319 </param> 13320 <param id="timeout"> 13321 <jlong/> 13322 <description> 13323 The number of milliseconds the thread will wait 13324 </description> 13325 </param> 13326 </parameters> 13327 </event> 13328 13329 <event label="Monitor Waited" 13330 id="MonitorWaited" const="JVMTI_EVENT_MONITOR_WAITED" filtered="thread" num="74"> 13331 <description> 13332 Sent when a thread finishes waiting on an object. 13333 </description> 13334 <origin>jvmpi</origin> 13335 <capabilities> 13336 <required id="can_generate_monitor_events"></required> 13337 </capabilities> 13338 <parameters> 13339 <param id="jni_env"> 13340 <outptr> 13341 <struct>JNIEnv</struct> 13342 </outptr> 13343 <description> 13344 The JNI environment of the event (current) thread 13345 </description> 13346 </param> 13347 <param id="thread"> 13348 <jthread/> 13349 <description> 13350 JNI local reference to the thread that was finished waiting 13351 </description> 13352 </param> 13353 <param id="object"> 13354 <jobject/> 13355 <description> 13356 JNI local reference to the monitor. 13357 </description> 13358 </param> 13359 <param id="timed_out"> 13360 <jboolean/> 13361 <description> 13362 True if the monitor timed out 13363 </description> 13364 </param> 13365 </parameters> 13366 </event> 13367 13368 <event label="Resource Exhausted" 13369 id="ResourceExhausted" const="JVMTI_EVENT_RESOURCE_EXHAUSTED" num="80" 13370 since="1.1"> 13371 <description> 13372 Sent when a VM resource needed by a running application has been exhausted. 13373 Except as required by the optional capabilities, the set of resources 13374 which report exhaustion is implementation dependent. 13375 <p/> 13376 The following bit flags define the properties of the resource exhaustion: 13377 <constants id="jvmtiResourceExhaustionFlags" 13378 label="Resource Exhaustion Flags" 13379 kind="bits" 13380 since="1.1"> 13381 <constant id="JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR" num="0x0001"> 13382 After this event returns, the VM will throw a 13383 <code>java.lang.OutOfMemoryError</code>. 13384 </constant> 13385 <constant id="JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP" num="0x0002"> 13386 The VM was unable to allocate memory from the <tm>Java</tm> 13387 platform <i>heap</i>. 13388 The <i>heap</i> is the runtime 13389 data area from which memory for all class instances and 13390 arrays are allocated. 13391 </constant> 13392 <constant id="JVMTI_RESOURCE_EXHAUSTED_THREADS" num="0x0004"> 13393 The VM was unable to create a thread. 13394 </constant> 13395 </constants> 13396 </description> 13397 <origin>new</origin> 13398 <capabilities> 13399 <capability id="can_generate_resource_exhaustion_heap_events"> 13400 Can generate events when the VM is unable to allocate memory from the 13401 <internallink id="JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP">heap</internallink>. 13402 </capability> 13403 <capability id="can_generate_resource_exhaustion_threads_events"> 13404 Can generate events when the VM is unable to 13405 <internallink id="JVMTI_RESOURCE_EXHAUSTED_THREADS">create 13406 a thread</internallink>. 13407 </capability> 13408 </capabilities> 13409 <parameters> 13410 <param id="jni_env"> 13411 <outptr> 13412 <struct>JNIEnv</struct> 13413 </outptr> 13414 <description> 13415 The JNI environment of the event (current) thread 13416 </description> 13417 </param> 13418 <param id="flags"> 13419 <jint/> 13420 <description> 13421 Flags defining the properties of the of resource exhaustion 13422 as specified by the 13423 <internallink id="jvmtiResourceExhaustionFlags">Resource 13424 Exhaustion Flags</internallink>. 13425 </description> 13426 </param> 13427 <param id="reserved"> 13428 <vmbuf><void/></vmbuf> 13429 <description> 13430 Reserved. 13431 </description> 13432 </param> 13433 <param id="description"> 13434 <vmbuf><char/></vmbuf> 13435 <description> 13436 Description of the resource exhaustion, encoded as a 13437 <internallink id="mUTF">modified UTF-8</internallink> string. 13438 </description> 13439 </param> 13440 </parameters> 13441 </event> 13442 13443 <event label="VM Object Allocation" 13444 id="VMObjectAlloc" const="JVMTI_EVENT_VM_OBJECT_ALLOC" num="84"> 13445 <description> 13446 Sent when a method causes the virtual machine to allocate an 13447 Object visible to Java programming language code and the 13448 allocation is not detectable by other intrumentation mechanisms. 13449 Generally object allocation should be detected by instrumenting 13450 the bytecodes of allocating methods. 13451 Object allocation generated in native code by JNI function 13452 calls should be detected using 13453 <internallink id="jniIntercept">JNI function interception</internallink>. 13454 Some methods might not have associated bytecodes and are not 13455 native methods, they instead are executed directly by the 13456 VM. These methods should send this event. 13457 Virtual machines which are incapable of bytecode instrumentation 13458 for some or all of their methods can send this event. 13459 <p/> 13460 Typical examples where this event might be sent: 13461 <ul> 13462 <li>Reflection -- for example, <code>java.lang.Class.newInstance()</code></li> 13463 <li>Methods not represented by bytecodes -- for example, VM intrinsics and 13464 J2ME preloaded classes</li> 13465 </ul> 13466 Cases where this event would not be generated: 13467 <ul> 13468 <li>Allocation due to bytecodes -- for example, the <code>new</code> 13469 and <code>newarray</code> VM instructions</li> 13470 <li>Allocation due to JNI function calls -- for example, 13471 <code>AllocObject</code></li> 13472 <li>Allocations during VM initialization</li> 13473 <li>VM internal objects</li> 13474 </ul> 13475 </description> 13476 <origin>new</origin> 13477 <capabilities> 13478 <required id="can_generate_vm_object_alloc_events"></required> 13479 </capabilities> 13480 <parameters> 13481 <param id="jni_env"> 13482 <outptr> 13483 <struct>JNIEnv</struct> 13484 </outptr> 13485 <description> 13486 The JNI environment of the event (current) thread 13487 </description> 13488 </param> 13489 <param id="thread"> 13490 <jthread/> 13491 <description> 13492 Thread allocating the object. 13493 </description> 13494 </param> 13495 <param id="object"> 13496 <jobject/> 13497 <description> 13498 JNI local reference to the object that was allocated 13499 </description> 13500 </param> 13501 <param id="object_klass"> 13502 <jclass/> 13503 <description> 13504 JNI local reference to the class of the object 13505 </description> 13506 </param> 13507 <param id="size"> 13508 <jlong/> 13509 <description> 13510 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 13511 </description> 13512 </param> 13513 </parameters> 13514 </event> 13515 13516 <event label="Object Free" 13517 id="ObjectFree" const="JVMTI_EVENT_OBJECT_FREE" num="83"> 13518 <description> 13519 An Object Free event is sent when the garbage collector frees an object. 13520 Events are only sent for tagged objects--see 13521 <internallink id="Heap">heap functions</internallink>. 13522 <p/> 13523 The event handler must not use JNI functions and 13524 must not use <jvmti/> functions except those which 13525 specifically allow such use (see the raw monitor, memory management, 13526 and environment local storage functions). 13527 </description> 13528 <origin>new</origin> 13529 <capabilities> 13530 <required id="can_generate_object_free_events"></required> 13531 </capabilities> 13532 <parameters> 13533 <param id="tag"> 13534 <jlong/> 13535 <description> 13536 The freed object's tag 13537 </description> 13538 </param> 13539 </parameters> 13540 </event> 13541 13542 <event label="Garbage Collection Start" 13543 id="GarbageCollectionStart" const="JVMTI_EVENT_GARBAGE_COLLECTION_START" num="81"> 13544 <description> 13545 A Garbage Collection Start event is sent when a 13546 garbage collection pause begins. 13547 Only stop-the-world collections are reported--that is, collections during 13548 which all threads cease to modify the state of the Java virtual machine. 13549 This means that some collectors will never generate these events. 13550 This event is sent while the VM is still stopped, thus 13551 the event handler must not use JNI functions and 13552 must not use <jvmti/> functions except those which 13553 specifically allow such use (see the raw monitor, memory management, 13554 and environment local storage functions). 13555 <p/> 13556 This event is always sent as a matched pair with 13557 <eventlink id="GarbageCollectionFinish"/> 13558 (assuming both events are enabled) and no garbage collection 13559 events will occur between them. 13560 </description> 13561 <origin>new</origin> 13562 <capabilities> 13563 <required id="can_generate_garbage_collection_events"></required> 13564 </capabilities> 13565 <parameters> 13566 </parameters> 13567 </event> 13568 13569 <event label="Garbage Collection Finish" 13570 id="GarbageCollectionFinish" const="JVMTI_EVENT_GARBAGE_COLLECTION_FINISH" num="82"> 13571 <description> 13572 A Garbage Collection Finish event is sent when a 13573 garbage collection pause ends. 13574 This event is sent while the VM is still stopped, thus 13575 the event handler must not use JNI functions and 13576 must not use <jvmti/> functions except those which 13577 specifically allow such use (see the raw monitor, memory management, 13578 and environment local storage functions). 13579 <p/> 13580 Some agents may need to do post garbage collection operations that 13581 require the use of the disallowed <jvmti/> or JNI functions. For these 13582 cases an agent thread can be created which waits on a raw monitor, 13583 and the handler for the Garbage Collection Finish event simply 13584 notifies the raw monitor 13585 <p/> 13586 This event is always sent as a matched pair with 13587 <eventlink id="GarbageCollectionStart"/> (assuming both events are enabled). 13588 <issue> 13589 The most important use of this event is to provide timing information, 13590 and thus additional information is not required. However, 13591 information about the collection which is "free" should be included - 13592 what that information is needs to be determined. 13593 </issue> 13594 </description> 13595 <origin>new</origin> 13596 <capabilities> 13597 <required id="can_generate_garbage_collection_events"></required> 13598 </capabilities> 13599 <parameters> 13600 </parameters> 13601 </event> 13602 13603 <elide> 13604 <event label="Verbose Output" phase="any" 13605 id="VerboseOutput" const="JVMTI_EVENT_VERBOSE_OUTPUT" num="85"> 13606 <description> 13607 Send verbose messages as strings. 13608 <issue> 13609 This format is extremely fragile, as it can change with each 13610 platform, collector and version. Alternatives include: 13611 <ul> 13612 <li>building off Java programming language M and M APIs</li> 13613 <li>XML</li> 13614 <li>key/value pairs</li> 13615 <li>removing it</li> 13616 </ul> 13617 </issue> 13618 <issue> 13619 Though this seemed trivial to implement. 13620 In the RI it appears this will be quite complex. 13621 </issue> 13622 </description> 13623 <origin>new</origin> 13624 <capabilities> 13625 </capabilities> 13626 <parameters> 13627 <param id="flag"> 13628 <enum>jvmtiVerboseFlag</enum> 13629 <description> 13630 Which verbose output is being sent. 13631 </description> 13632 </param> 13633 <param id="message"> 13634 <vmbuf><char/></vmbuf> 13635 <description> 13636 Message text, encoded as a 13637 <internallink id="mUTF">modified UTF-8</internallink> string. 13638 </description> 13639 </param> 13640 </parameters> 13641 </event> 13642 </elide> 13643 13644 </eventsection> 13645 13646 <datasection> 13647 <intro> 13648 <jvmti/> extends the data types defined by JNI. 13649 </intro> 13650 <basetypes id="jniTypes" label="JNI Types Used in the JVM Tool Interface"> 13651 <basetype id="jboolean"> 13652 <description> 13653 Holds a Java programming language <code>boolean</code>. 13654 Unsigned 8 bits. 13655 </description> 13656 </basetype> 13657 <basetype id="jchar"> 13658 <description> 13659 Holds a Java programming language <code>char</code>. 13660 Unsigned 16 bits. 13661 </description> 13662 </basetype> 13663 <basetype id="jint"> 13664 <description> 13665 Holds a Java programming language <code>int</code>. 13666 Signed 32 bits. 13667 </description> 13668 </basetype> 13669 <basetype id="jlong"> 13670 <description> 13671 Holds a Java programming language <code>long</code>. 13672 Signed 64 bits. 13673 </description> 13674 </basetype> 13675 <basetype id="jfloat"> 13676 <description> 13677 Holds a Java programming language <code>float</code>. 13678 32 bits. 13679 </description> 13680 </basetype> 13681 <basetype id="jdouble"> 13682 <description> 13683 Holds a Java programming language <code>double</code>. 13684 64 bits. 13685 </description> 13686 </basetype> 13687 <basetype id="jobject"> 13688 <description> 13689 Holds a Java programming language object. 13690 </description> 13691 </basetype> 13692 <basetype id="jclass"> 13693 <description> 13694 Holds a Java programming language class. 13695 </description> 13696 </basetype> 13697 <basetype id="jvalue"> 13698 <description> 13699 Is a union of all primitive types and <code>jobject</code>. Thus, holds any Java 13700 programming language value. 13701 </description> 13702 </basetype> 13703 <basetype id="jfieldID"> 13704 <description> 13705 Identifies a Java programming language field. 13706 <code>jfieldID</code>s returned by <jvmti/> functions and events may be 13707 safely stored. 13708 </description> 13709 </basetype> 13710 <basetype id="jmethodID"> 13711 <description> 13712 Identifies a Java programming language method, initializer, or constructor. 13713 <code>jmethodID</code>s returned by <jvmti/> functions and events may be 13714 safely stored. However, if the class is unloaded, they become invalid 13715 and must not be used. 13716 </description> 13717 </basetype> 13718 <basetype id="JNIEnv"> 13719 <description> 13720 Pointer to the JNI function table. Pointer to this (<code>JNIEnv *</code>) 13721 is a JNI environment. 13722 </description> 13723 </basetype> 13724 </basetypes> 13725 13726 <basetypes id="jvmtiTypes" label="JVM Tool Interface Base Types"> 13727 <basetype id="jvmtiEnv"> 13728 <description> 13729 The <jvmti/> <internallink id="environments">environment</internallink> pointer. 13730 See the <internallink id="FunctionSection">Function Section</internallink>. 13731 <code>jvmtiEnv</code> points to the 13732 <internallink id="FunctionTable">function table</internallink> pointer. 13733 </description> 13734 </basetype> 13735 <basetype id="jthread"> 13736 <definition>typedef jobject jthread;</definition> 13737 <description> 13738 Subtype of <datalink id="jobject"></datalink> that holds a thread. 13739 </description> 13740 </basetype> 13741 <basetype id="jthreadGroup"> 13742 <definition>typedef jobject jthreadGroup;</definition> 13743 <description> 13744 Subtype of <datalink id="jobject"></datalink> that holds a thread group. 13745 </description> 13746 </basetype> 13747 <basetype id="jlocation"> 13748 <definition>typedef jlong jlocation;</definition> 13749 <description> 13750 A 64 bit value, representing a monotonically increasing 13751 executable position within a method. 13752 <code>-1</code> indicates a native method. 13753 See <functionlink id="GetJLocationFormat"></functionlink> for the format on a 13754 given VM. 13755 </description> 13756 </basetype> 13757 <basetype id="jrawMonitorID"> 13758 <definition>struct _jrawMonitorID; 13759 typedef struct _jrawMonitorID *jrawMonitorID;</definition> 13760 <description> 13761 A raw monitor. 13762 </description> 13763 </basetype> 13764 <basetype id="jvmtiError"> 13765 <description> 13766 Holds an error return code. 13767 See the <internallink id="ErrorSection">Error section</internallink> for possible values. 13768 <example> 13769 typedef enum { 13770 JVMTI_ERROR_NONE = 0, 13771 JVMTI_ERROR_INVALID_THREAD = 10, 13772 ... 13773 } jvmtiError; 13774 </example> 13775 </description> 13776 </basetype> 13777 <basetype id="jvmtiEvent"> 13778 <description> 13779 An identifier for an event type. 13780 See the <internallink id="EventSection">Event section</internallink> for possible values. 13781 It is guaranteed that future versions of this specification will 13782 never assign zero as an event type identifier. 13783 <example> 13784 typedef enum { 13785 JVMTI_EVENT_SINGLE_STEP = 1, 13786 JVMTI_EVENT_BREAKPOINT = 2, 13787 ... 13788 } jvmtiEvent; 13789 </example> 13790 </description> 13791 </basetype> 13792 <basetype id="jvmtiEventCallbacks" name="eventCallbacks"> 13793 <description> 13794 The callbacks used for events. 13795 <example> 13796 typedef struct { 13797 jvmtiEventVMInit VMInit; 13798 jvmtiEventVMDeath VMDeath; 13799 ... 13800 } jvmtiEventCallbacks; 13801 </example> 13802 See <internallink id="jvmtiEventCallbacks">event callbacks</internallink> 13803 for the complete structure. 13804 <p/> 13805 Where, for example, the VM initialization callback is defined: 13806 <example> 13807 typedef void (JNICALL *jvmtiEventVMInit) 13808 (jvmtiEnv *jvmti_env, 13809 JNIEnv* jni_env, 13810 jthread thread); 13811 </example> 13812 See the individual events for the callback function definition. 13813 </description> 13814 </basetype> 13815 <basetype id="jniNativeInterface"> 13816 <definition>typedef struct JNINativeInterface_ jniNativeInterface;</definition> 13817 <description> 13818 Typedef for the JNI function table <code>JNINativeInterface</code> 13819 defined in the 13820 <externallink id="jni/functions.html#interface-function-table"> 13821 JNI Specification</externallink>. 13822 The JNI reference implementation defines this with an underscore. 13823 </description> 13824 </basetype> 13825 </basetypes> 13826 13827 </datasection> 13828 13829 <issuessection label="Issues"> 13830 <intro id="suspendRequired" label="Resolved Issue: Suspend - Required or Automatic"> 13831 JVMDI requires that the agent suspend threads before calling 13832 certain sensitive functions. JVMPI requires garbage collection to be 13833 disabled before calling certain sensitive functions. 13834 It was suggested that rather than have this requirement, that 13835 VM place itself in a suitable state before performing an 13836 operation. This makes considerable sense since each VM 13837 knows its requirements and can most easily arrange a 13838 safe state. 13839 <p/> 13840 The ability to externally suspend/resume threads will, of 13841 course, remain. The ability to enable/disable garbage collection will not. 13842 <p/> 13843 This issue is resolved--suspend will not 13844 be required. The spec has been updated to reflect this. 13845 </intro> 13846 13847 <intro id="stackSampling" label="Resolved Issue: Call Stack Sampling"> 13848 There are a variety of approaches to sampling call stacks. 13849 The biggest bifurcation is between VM controlled and agent 13850 controlled. 13851 <p/> 13852 This issue is resolved--agent controlled 13853 sampling will be the approach. 13854 </intro> 13855 13856 <intro id="threadRepresentation" label="Resolved Issue: Thread Representation"> 13857 JVMDI represents threads as jthread. JVMPI primarily 13858 uses JNIEnv* to represent threads. 13859 <p/> 13860 The Expert Group has chosen jthread as the representation 13861 for threads in <jvmti/>. 13862 JNIEnv* is sent by 13863 events since it is needed to JNI functions. JNIEnv, per the 13864 JNI spec, are not supposed to be used outside their thread. 13865 </intro> 13866 13867 <intro id="design" label="Resolved Issue: Method Representation"> 13868 The JNI spec allows an implementation to depend on jclass/jmethodID 13869 pairs, rather than simply a jmethodID, to reference a method. 13870 JVMDI, for consistency, choose the same representation. 13871 JVMPI, however, specifies that a jmethodID alone maps to a 13872 method. Both of the Sun <tm>J2SE</tm> virtual machines (Classic and <tm>HotSpot</tm>) store 13873 pointers in jmethodIDs, and as a result, a jmethodID is sufficient. 13874 In fact, any JVM implementation that supports JVMPI must have 13875 such a representation. 13876 <jvmti/> will use jmethodID as a unique representation of a method 13877 (no jclass is used). 13878 There should be efficiency gains, particularly in 13879 functionality like stack dumping, to this representation. 13880 <p/> 13881 Note that fields were not used in JVMPI and that the access profile 13882 of fields differs from methods--for implementation efficiency 13883 reasons, a jclass/jfieldID pair will still be needed for field 13884 reference. 13885 </intro> 13886 13887 <intro id="localReferenceIssue" label="Resolved Issue: Local References"> 13888 Functions return local references. 13889 </intro> 13890 13891 <intro id="frameRep" label="Resolved Issue: Representation of frames"> 13892 In JVMDI, a frame ID is used to represent a frame. Problem with this 13893 is that a VM must track when a frame becomes invalid, a far better 13894 approach, and the one used in <jvmti/>, is to reference frames by depth. 13895 </intro> 13896 13897 <intro id="requiredCapabilities" label="Issue: Required Capabilities"> 13898 Currently, having a required capabilities means that the functionality 13899 is optional. Capabilities are useful even for required functionality 13900 since they can inform the VM is needed set-up. Thus, there should be 13901 a set of capabilities that a conformant implementation must provide 13902 (if requested during Agent_OnLoad). 13903 </intro> 13904 13905 <intro id="taghint" label="Proposal: add tag hint function"> 13906 A hint of the percentage of objects that will be tagged would 13907 help the VM pick a good implementation. 13908 </intro> 13909 13910 <intro id="moreMonitorQueries" label="Request: More Monitor Quires"> 13911 How difficult or easy would be to extend the monitor_info category to include 13912 <pre> 13913 - current number of monitors 13914 - enumeration of monitors 13915 - enumeration of threads waiting on a given monitor 13916 </pre> 13917 The reason for my question is the fact that current get_monitor_info support 13918 requires the agent to specify a given thread to get the info which is probably 13919 OK in the profiling/debugging space, while in the monitoring space the agent 13920 could be watching the monitor list and then decide which thread to ask for 13921 the info. You might ask why is this important for monitoring .... I think it 13922 can aid in the detection/prediction of application contention caused by hot-locks. 13923 </intro> 13924 </issuessection> 13925 13926 <changehistory id="ChangeHistory" update="09/05/07"> 13927 <intro> 13928 The <jvmti/> specification is an evolving document with major, minor, 13929 and micro version numbers. 13930 A released version of the specification is uniquely identified 13931 by its major and minor version. 13932 The functions, events, and capabilities in this specification 13933 indicate a "Since" value which is the major and minor version in 13934 which it was introduced. 13935 The version of the specification implemented by the VM can 13936 be retrieved at runtime with the <functionlink id="GetVersionNumber"/> 13937 function. 13938 </intro> 13939 <change date="14 Nov 2002"> 13940 Converted to XML document. 13941 </change> 13942 <change date="14 Nov 2002"> 13943 Elided heap dump functions (for now) since what was there 13944 was wrong. 13945 </change> 13946 <change date="18 Nov 2002"> 13947 Added detail throughout. 13948 </change> 13949 <change date="18 Nov 2002"> 13950 Changed JVMTI_THREAD_STATUS_RUNNING to JVMTI_THREAD_STATUS_RUNNABLE. 13951 </change> 13952 <change date="19 Nov 2002"> 13953 Added AsyncGetStackTrace. 13954 </change> 13955 <change date="19 Nov 2002"> 13956 Added jframeID return to GetStackTrace. 13957 </change> 13958 <change date="19 Nov 2002"> 13959 Elided GetCurrentFrame and GetCallingFrame functions (for now) since what was there 13960 since they are redundant with GetStackTrace. 13961 </change> 13962 <change date="19 Nov 2002"> 13963 Elided ClearAllBreakpoints since it has always been redundant. 13964 </change> 13965 <change date="19 Nov 2002"> 13966 Added GetSystemProperties. 13967 </change> 13968 <change date="19 Nov 2002"> 13969 Changed the thread local storage functions to use jthread. 13970 </change> 13971 <change date="20 Nov 2002"> 13972 Added GetJLocationFormat. 13973 </change> 13974 <change date="22 Nov 2002"> 13975 Added events and introductory text. 13976 </change> 13977 <change date="22 Nov 2002"> 13978 Cross reference type and constant definitions. 13979 </change> 13980 <change date="24 Nov 2002"> 13981 Added DTD. 13982 </change> 13983 <change date="24 Nov 2002"> 13984 Added capabilities function section. 13985 </change> 13986 <change date="29 Nov 2002"> 13987 Assign capabilities to each function and event. 13988 </change> 13989 <change date="29 Nov 2002"> 13990 Add <internallink id="jniIntercept">JNI interception functions</internallink>. 13991 </change> 13992 <change date="30 Nov 2002"> 13993 Auto generate SetEventNotificationMode capabilities. 13994 </change> 13995 <change date="30 Nov 2002"> 13996 Add <eventlink id="VMObjectAlloc"></eventlink> event. 13997 </change> 13998 <change date="30 Nov 2002"> 13999 Add <eventlink id="DynamicCodeGenerated"></eventlink> event. 14000 </change> 14001 <change date="30 Nov 2002"> 14002 Add const to declarations. 14003 </change> 14004 <change date="30 Nov 2002"> 14005 Change method exit and frame pop to send on exception. 14006 </change> 14007 <change date="1 Dec 2002"> 14008 Add ForceGarbageCollection. 14009 </change> 14010 <change date="2 Dec 2002"> 14011 Redo Xrun section; clarify GetStackTrace and add example; 14012 Fix width problems; use "agent" consistently. 14013 </change> 14014 <change date="8 Dec 2002"> 14015 Remove previous start-up intro. 14016 Add <internallink id="environments"><jvmti/> Environments</internallink> 14017 section. 14018 </change> 14019 <change date="8 Dec 2002"> 14020 Add <functionlink id="DisposeEnvironment"></functionlink>. 14021 </change> 14022 <change date="9 Dec 2002"> 14023 Numerous minor updates. 14024 </change> 14025 <change date="15 Dec 2002"> 14026 Add heap profiling functions added: 14027 get/set annotation, iterate live objects/heap. 14028 Add heap profiling functions place holder added: 14029 heap roots. 14030 Heap profiling event added: object free. 14031 Heap profiling event redesigned: vm object allocation. 14032 Heap profiling event placeholders added: garbage collection start/finish. 14033 Native method bind event added. 14034 </change> 14035 <change date="19 Dec 2002"> 14036 Revamp suspend/resume functions. 14037 Add origin information with jvmdi tag. 14038 Misc fixes. 14039 </change> 14040 <change date="24 Dec 2002"> 14041 Add semantics to types. 14042 </change> 14043 <change date="27 Dec 2002"> 14044 Add local reference section. 14045 Autogenerate parameter descriptions from types. 14046 </change> 14047 <change date="28 Dec 2002"> 14048 Document that RunAgentThread sends threadStart. 14049 </change> 14050 <change date="29 Dec 2002"> 14051 Remove redundant local ref and dealloc warning. 14052 Convert GetRawMonitorName to allocated buffer. 14053 Add GenerateEvents. 14054 </change> 14055 <change date="30 Dec 2002"> 14056 Make raw monitors a type and rename to "jrawMonitorID". 14057 </change> 14058 <change date="1 Jan 2003"> 14059 Include origin information. 14060 Clean-up JVMDI issue references. 14061 Remove Deallocate warnings which are now automatically generated. 14062 </change> 14063 <change date="2 Jan 2003"> 14064 Fix representation issues for jthread. 14065 </change> 14066 <change date="3 Jan 2003"> 14067 Make capabilities buffered out to 64 bits - and do it automatically. 14068 </change> 14069 <change date="4 Jan 2003"> 14070 Make constants which are enumeration into enum types. 14071 Parameters now of enum type. 14072 Clean-up and index type section. 14073 Replace remaining datadef entities with callback. 14074 </change> 14075 <change date="7 Jan 2003"> 14076 Correct GenerateEvents description. 14077 More internal semantics work. 14078 </change> 14079 <change date="9 Jan 2003"> 14080 Replace previous GetSystemProperties with two functions 14081 which use allocated information instead fixed. 14082 Add SetSystemProperty. 14083 More internal semantics work. 14084 </change> 14085 <change date="12 Jan 2003"> 14086 Add varargs to end of SetEventNotificationMode. 14087 </change> 14088 <change date="20 Jan 2003"> 14089 Finish fixing spec to reflect that alloc sizes are jlong. 14090 </change> 14091 <change date="22 Jan 2003"> 14092 Allow NULL as RunAgentThread arg. 14093 </change> 14094 <change date="22 Jan 2003"> 14095 Fixed names to standardized naming convention 14096 Removed AsyncGetStackTrace. 14097 </change> 14098 <change date="29 Jan 2003"> 14099 Since we are using jthread, removed GetThread. 14100 </change> 14101 <change date="31 Jan 2003"> 14102 Change GetFieldName to allow NULLs like GetMethodName. 14103 </change> 14104 <change date="29 Feb 2003" version="v40"> 14105 Rewrite the introductory text, adding sections on 14106 start-up, environments and bytecode instrumentation. 14107 Change the command line arguments per EG discussions. 14108 Add an introduction to the capabilities section. 14109 Add the extension mechanism category and functions. 14110 Mark for deletion, but clarified anyhow, SuspendAllThreads. 14111 Rename IterateOverLiveObjects to IterateOverReachableObjects and 14112 change the text accordingly. 14113 Clarify IterateOverHeap. 14114 Clarify CompiledMethodLoad. 14115 Discuss prerequisite state for Calling Functions. 14116 Clarify SetAllocationHooks. 14117 Added issues ("To be resolved:") through-out. 14118 And so on... 14119 </change> 14120 <change date="6 Mar 2003" version="v41"> 14121 Remove struct from the call to GetOwnedMonitorInfo. 14122 Automatically generate most error documentation, remove 14123 (rather broken) hand written error doc. 14124 Better describe capability use (empty initial set). 14125 Add min value to jint params. 14126 Remove the capability can_access_thread_local_storage. 14127 Rename error JVMTI_ERROR_NOT_IMPLEMENTED to JVMTI_ERROR_MUST_POSSESS_CAPABILITY; 14128 same for *NOT_IMPLEMENTED. 14129 Description fixes. 14130 </change> 14131 <change date="8 Mar 2003" version="v42"> 14132 Rename GetClassSignature to GetClassName. 14133 Rename IterateOverClassObjects to IterateOverInstancesOfClass. 14134 Remove GetMaxStack (operand stack isn't used in <jvmti/>). 14135 Description fixes: define launch-time, remove native frame pop 14136 from PopFrame, and assorted clarifications. 14137 </change> 14138 <change date="8 Mar 2003" version="v43"> 14139 Fix minor editing problem. 14140 </change> 14141 <change date="10 Mar 2003" version="v44"> 14142 Add phase information. 14143 Remap (compact) event numbers. 14144 </change> 14145 <change date="11 Mar 2003" version="v45"> 14146 More phase information - allow "any". 14147 Elide raw monitor queries and events. 14148 Minor description fixes. 14149 </change> 14150 <change date="12 Mar 2003" version="v46"> 14151 Add GetPhase. 14152 Use "phase" through document. 14153 Elide GetRawMonitorName. 14154 Elide GetObjectMonitors. 14155 </change> 14156 <change date="12 Mar 2003" version="v47"> 14157 Fixes from link, XML, and spell checking. 14158 Auto-generate the callback structure. 14159 </change> 14160 <change date="13 Mar 2003" version="v48"> 14161 One character XML fix. 14162 </change> 14163 <change date="13 Mar 2003" version="v49"> 14164 Change function parameter names to be consistent with 14165 event parameters (fooBarBaz becomes foo_bar_baz). 14166 </change> 14167 <change date="14 Mar 2003" version="v50"> 14168 Fix broken link. Fix thread markers. 14169 </change> 14170 <change date="14 Mar 2003" version="v51"> 14171 Change constants so they are under 128 to workaround 14172 compiler problems. 14173 </change> 14174 <change date="23 Mar 2003" version="v52"> 14175 Overhaul capabilities. Separate GetStackTrace into 14176 GetStackTrace and GetStackFrames. 14177 </change> 14178 <change date="8 Apr 2003" version="v54"> 14179 Use depth instead of jframeID to reference frames. 14180 Remove the now irrelevant GetCurrentFrame, GetCallerFrame and GetStackFrames. 14181 Remove frame arg from events. 14182 </change> 14183 <change date="9 Apr 2003" version="v55"> 14184 Remove GetObjectWithAnnotation since tests show bufferred approach more efficient. 14185 Add missing annotation_count to GetObjectsWithAnnotations 14186 </change> 14187 <change date="10 Apr 2003" version="v56"> 14188 Remove confusing parenthetical statement in GetObjectsWithAnnotations 14189 </change> 14190 <change date="13 Apr 2003" version="v58"> 14191 Replace jclass/jmethodID representation of method with simply jmethodID; 14192 Pass JvmtiEnv* as first arg of every event; remove JNIEnv* where inappropriate. 14193 Replace can_access_frames with can_access_local_variables; remove from purely stack access. 14194 Use can_get_synthetic_attribute; fix description. 14195 Clarify that zero length arrays must be deallocated. 14196 Clarify RelinquishCapabilities. 14197 Generalize JVMTI_ERROR_VM_DEAD to JVMTI_ERROR_WRONG_PHASE. 14198 </change> 14199 <change date="27 Apr 2003" version="v59"> 14200 Remove lingering indirect references to OBSOLETE_METHOD_ID. 14201 </change> 14202 <change date="4 May 2003" version="v60"> 14203 Allow DestroyRawMonitor during OnLoad. 14204 </change> 14205 <change date="7 May 2003" version="v61"> 14206 Added not monitor owner error return to DestroyRawMonitor. 14207 </change> 14208 <change date="13 May 2003" version="v62"> 14209 Clarify semantics of raw monitors. 14210 Change flags on <code>GetThreadStatus</code>. 14211 <code>GetClassLoader</code> return NULL for the bootstrap class loader. 14212 Add <code>GetClassName</code> issue. 14213 Define local variable signature. 14214 Disallow zero in annotations array of <code>GetObjectsWithAnnotations</code>. 14215 Remove over specification in <code>GetObjectsWithAnnotations</code>. 14216 Elide <code>SetAllocationHooks</code>. 14217 Elide <code>SuspendAllThreads</code>. 14218 </change> 14219 <change date="14 May 2003" version="v63"> 14220 Define the data type <code>jvmtiEventCallbacks</code>. 14221 Zero length allocations return NULL. 14222 Keep SetAllocationHooks in JVMDI, but remove from <jvmti/>. 14223 Add JVMTI_THREAD_STATUS_FLAG_INTERRUPTED. 14224 </change> 14225 <change date="15 May 2003" version="v64"> 14226 Better wording, per review. 14227 </change> 14228 <change date="15 May 2003" version="v65"> 14229 First Alpha. 14230 Make jmethodID and jfieldID unique, jclass not used. 14231 </change> 14232 <change date="27 May 2003" version="v66"> 14233 Fix minor XSLT errors. 14234 </change> 14235 <change date="13 June 2003" version="v67"> 14236 Undo making jfieldID unique (jmethodID still is). 14237 </change> 14238 <change date="17 June 2003" version="v68"> 14239 Changes per June 11th Expert Group meeting -- 14240 Overhaul Heap functionality: single callback, 14241 remove GetHeapRoots, add reachable iterators, 14242 and rename "annotation" to "tag". 14243 NULL thread parameter on most functions is current 14244 thread. 14245 Add timers. 14246 Remove ForceExit. 14247 Add GetEnvironmentLocalStorage. 14248 Add verbose flag and event. 14249 Add AddToBootstrapClassLoaderSearch. 14250 Update ClassFileLoadHook. 14251 </change> 14252 <change date="18 June 2003" version="v69"> 14253 Clean up issues sections. 14254 Rename GetClassName back to GetClassSignature and 14255 fix description. 14256 Add generic signature to GetClassSignature, 14257 GetFieldSignature, GetMethodSignature, and 14258 GetLocalVariableTable. 14259 Elide EstimateCostOfCapabilities. 14260 Clarify that the system property functions operate 14261 on the VM view of system properties. 14262 Clarify Agent_OnLoad. 14263 Remove "const" from JNIEnv* in events. 14264 Add metadata accessors. 14265 </change> 14266 <change date="18 June 2003" version="v70"> 14267 Add start_depth to GetStackTrace. 14268 Move system properties to a new category. 14269 Add GetObjectSize. 14270 Remove "X" from command line flags. 14271 XML, HTML, and spell check corrections. 14272 </change> 14273 <change date="19 June 2003" version="v71"> 14274 Fix JVMTI_HEAP_ROOT_THREAD to be 6. 14275 Make each synopsis match the function name. 14276 Fix unclear wording. 14277 </change> 14278 <change date="26 June 2003" version="v72"> 14279 SetThreadLocalStorage and SetEnvironmentLocalStorage should allow value 14280 to be set to NULL. 14281 NotifyFramePop, GetFrameLocationm and all the local variable operations 14282 needed to have their wording about frames fixed. 14283 Grammar and clarity need to be fixed throughout. 14284 Capitalization and puntuation need to be consistent. 14285 Need micro version number and masks for accessing major, minor, and micro. 14286 The error code lists should indicate which must be returned by 14287 an implementation. 14288 The command line properties should be visible in the properties functions. 14289 Disallow popping from the current thread. 14290 Allow implementations to return opaque frame error when they cannot pop. 14291 The NativeMethodBind event should be sent during any phase. 14292 The DynamicCodeGenerated event should be sent during any phase. 14293 The following functions should be allowed to operate before VMInit: 14294 Set/GetEnvironmentLocalStorage 14295 GetMethodDeclaringClass 14296 GetClassSignature 14297 GetClassModifiers 14298 IsInterface 14299 IsArrayClass 14300 GetMethodName 14301 GetMethodModifiers 14302 GetMaxLocals 14303 GetArgumentsSize 14304 GetLineNumberTable 14305 GetMethodLocation 14306 IsMethodNative 14307 IsMethodSynthetic. 14308 Other changes (to XSL): 14309 Argument description should show asterisk after not before pointers. 14310 NotifyFramePop, GetFrameLocationm and all the local variable operations 14311 should hsve the NO_MORE_FRAMES error added. 14312 Not alive threads should have a different error return than invalid thread. 14313 </change> 14314 <change date="7 July 2003" version="v73"> 14315 VerboseOutput event was missing message parameter. 14316 Minor fix-ups. 14317 </change> 14318 <change date="14 July 2003" version="v74"> 14319 Technical Publications Department corrections. 14320 Allow thread and environment local storage to be set to NULL. 14321 </change> 14322 <change date="23 July 2003" version="v75"> 14323 Use new Agent_OnLoad rather than overloaded JVM_OnLoad. 14324 Add JNICALL to callbacks (XSL). 14325 Document JNICALL requirement for both events and callbacks (XSL). 14326 Restrict RedefineClasses to methods and attributes. 14327 Elide the VerboseOutput event. 14328 VMObjectAlloc: restrict when event is sent and remove method parameter. 14329 Finish loose ends from Tech Pubs edit. 14330 </change> 14331 <change date="24 July 2003" version="v76"> 14332 Change ClassFileLoadHook event to send the class instead of a boolean of redefine. 14333 </change> 14334 <change date="24 July 2003" version="v77"> 14335 XML fixes. 14336 Minor text clarifications and corrections. 14337 </change> 14338 <change date="24 July 2003" version="v78"> 14339 Remove GetExceptionHandlerTable and GetThrownExceptions from <jvmti/>. 14340 Clarify that stack frames are JVM Spec frames. 14341 Split can_get_source_info into can_get_source_file_name, can_get_line_numbers, 14342 and can_get_source_debug_extension. 14343 PopFrame cannot have a native calling method. 14344 Removed incorrect statement in GetClassloaderClasses 14345 (see <vmspec chapter="4.4"/>). 14346 </change> 14347 <change date="24 July 2003" version="v79"> 14348 XML and text fixes. 14349 Move stack frame description into Stack Frame category. 14350 </change> 14351 <change date="26 July 2003" version="v80"> 14352 Allow NULL (means bootstrap loader) for GetClassloaderClasses. 14353 Add new heap reference kinds for references from classes. 14354 Add timer information struct and query functions. 14355 Add AvailableProcessors. 14356 Rename GetOtherThreadCpuTime to GetThreadCpuTime. 14357 Explicitly add JVMTI_ERROR_INVALID_THREAD and JVMTI_ERROR_THREAD_NOT_ALIVE 14358 to SetEventNotification mode. 14359 Add initial thread to the VM_INIT event. 14360 Remove platform assumptions from AddToBootstrapClassLoaderSearch. 14361 </change> 14362 <change date="26 July 2003" version="v81"> 14363 Grammar and clarity changes per review. 14364 </change> 14365 <change date="27 July 2003" version="v82"> 14366 More grammar and clarity changes per review. 14367 Add Agent_OnUnload. 14368 </change> 14369 <change date="28 July 2003" version="v83"> 14370 Change return type of Agent_OnUnload to void. 14371 </change> 14372 <change date="28 July 2003" version="v84"> 14373 Rename JVMTI_REFERENCE_ARRAY to JVMTI_REFERENCE_ARRAY_ELEMENT. 14374 </change> 14375 <change date="28 July 2003" version="v85"> 14376 Steal java.lang.Runtime.availableProcessors() wording for 14377 AvailableProcessors(). 14378 Guarantee that zero will never be an event ID. 14379 Remove some issues which are no longer issues. 14380 Per review, rename and more completely document the timer 14381 information functions. 14382 </change> 14383 <change date="29 July 2003" version="v86"> 14384 Non-spec visible change to XML controlled implementation: 14385 SetThreadLocalStorage must run in VM mode. 14386 </change> 14387 <change date="5 August 2003" version="0.1.87"> 14388 Add GetErrorName. 14389 Add varargs warning to jvmtiExtensionEvent. 14390 Remove "const" on the jvmtiEnv* of jvmtiExtensionEvent. 14391 Remove unused can_get_exception_info capability. 14392 Pass jvmtiEnv* and JNIEnv* to the jvmtiStartFunction. 14393 Fix jvmtiExtensionFunctionInfo.func declared type. 14394 Extension function returns error code. 14395 Use new version numbering. 14396 </change> 14397 <change date="5 August 2003" version="0.2.88"> 14398 Remove the ClassUnload event. 14399 </change> 14400 <change date="8 August 2003" version="0.2.89"> 14401 Heap reference iterator callbacks return an enum that 14402 allows outgoing object references to be ignored. 14403 Allow JNIEnv as a param type to extension events/functions. 14404 </change> 14405 <change date="15 August 2003" version="0.2.90"> 14406 Fix a typo. 14407 </change> 14408 <change date="2 September 2003" version="0.2.91"> 14409 Remove all metadata functions: GetClassMetadata, 14410 GetFieldMetadata, and GetMethodMetadata. 14411 </change> 14412 <change date="1 October 2003" version="0.2.92"> 14413 Mark the functions Allocate. Deallocate, RawMonitor*, 14414 SetEnvironmentLocalStorage, and GetEnvironmentLocalStorage 14415 as safe for use in heap callbacks and GC events. 14416 </change> 14417 <change date="24 November 2003" version="0.2.93"> 14418 Add pass through opaque user data pointer to heap iterate 14419 functions and callbacks. 14420 In the CompiledMethodUnload event, send the code address. 14421 Add GarbageCollectionOccurred event. 14422 Add constant pool reference kind. 14423 Mark the functions CreateRawMonitor and DestroyRawMonitor 14424 as safe for use in heap callbacks and GC events. 14425 Clarify: VMDeath, GetCurrentThreadCpuTimerInfo, 14426 GetThreadCpuTimerInfo, IterateOverReachableObjects, 14427 IterateOverObjectsReachableFromObject, GetTime and 14428 JVMTI_ERROR_NULL_POINTER. 14429 Add missing errors to: GenerateEvents and 14430 AddToBootstrapClassLoaderSearch. 14431 Fix description of ClassFileLoadHook name parameter. 14432 In heap callbacks and GC/ObjectFree events, specify 14433 that only explicitly allowed functions can be called. 14434 Allow GetCurrentThreadCpuTimerInfo, GetCurrentThreadCpuTime, 14435 GetTimerInfo, and GetTime during callback. 14436 Allow calling SetTag/GetTag during the onload phase. 14437 SetEventNotificationMode, add: error attempted inappropriate 14438 thread level control. 14439 Remove jvmtiExceptionHandlerEntry. 14440 Fix handling of native methods on the stack -- 14441 location_ptr param of GetFrameLocation, remove 14442 JVMTI_ERROR_OPAQUE_FRAME from GetFrameLocation, 14443 jvmtiFrameInfo.location, and jlocation. 14444 Remove typo (from JVMPI) implying that the MonitorWaited 14445 event is sent on sleep. 14446 </change> 14447 <change date="25 November 2003" version="0.2.94"> 14448 Clarifications and typos. 14449 </change> 14450 <change date="3 December 2003" version="0.2.95"> 14451 Allow NULL user_data in heap iterators. 14452 </change> 14453 <change date="28 January 2004" version="0.2.97"> 14454 Add GetThreadState, deprecate GetThreadStatus. 14455 </change> 14456 <change date="29 January 2004" version="0.2.98"> 14457 INVALID_SLOT and TYPE_MISMATCH errors should be optional. 14458 </change> 14459 <change date="12 February 2004" version="0.2.102"> 14460 Remove MonitorContendedExit. 14461 Added JNIEnv parameter to VMObjectAlloc. 14462 Clarified definition of class_tag and referrer_index 14463 parameters to heap callbacks. 14464 </change> 14465 <change date="16 Febuary 2004" version="0.2.103"> 14466 Document JAVA_TOOL_OPTIONS. 14467 </change> 14468 <change date="17 Febuary 2004" version="0.2.105"> 14469 Divide start phase into primordial and start. 14470 Add VMStart event 14471 Change phase associations of functions and events. 14472 </change> 14473 <change date="18 Febuary 2004" version="0.3.6"> 14474 Elide deprecated GetThreadStatus. 14475 Bump minor version, subtract 100 from micro version 14476 </change> 14477 <change date="18 Febuary 2004" version="0.3.7"> 14478 Document that timer nanosecond values are unsigned. 14479 Clarify text having to do with native methods. 14480 </change> 14481 <change date="19 Febuary 2004" version="0.3.8"> 14482 Fix typos. 14483 Remove elided deprecated GetThreadStatus. 14484 </change> 14485 <change date="23 Febuary 2004" version="0.3.9"> 14486 Require NotifyFramePop to act on suspended threads. 14487 </change> 14488 <change date="24 Febuary 2004" version="0.3.10"> 14489 Add capabilities 14490 (<internallink id="jvmtiCapabilities.can_redefine_any_class" 14491 ><code>can_redefine_any_class</code></internallink> 14492 and 14493 <internallink id="jvmtiCapabilities.can_generate_all_class_hook_events" 14494 ><code>can_generate_all_class_hook_events</code></internallink>) 14495 and an error (<errorlink id="JVMTI_ERROR_UNMODIFIABLE_CLASS"></errorlink>) 14496 which allow some classes to be unmodifiable. 14497 </change> 14498 <change date="28 Febuary 2004" version="0.3.11"> 14499 Add JVMTI_ERROR_MUST_POSSESS_CAPABILITY to SetEventNotificationMode. 14500 </change> 14501 <change date="8 March 2004" version="0.3.12"> 14502 Clarified CompiledMethodUnload so that it is clear the event 14503 may be posted after the class has been unloaded. 14504 </change> 14505 <change date="5 March 2004" version="0.3.13"> 14506 Change the size parameter of VMObjectAlloc to jlong to match GetObjectSize. 14507 </change> 14508 <change date="13 March 2004" version="0.3.14"> 14509 Added guideline for the use of the JNI FindClass function in event 14510 callback functions. 14511 </change> 14512 <change date="15 March 2004" version="0.3.15"> 14513 Add GetAllStackTraces and GetThreadListStackTraces. 14514 </change> 14515 <change date="19 March 2004" version="0.3.16"> 14516 ClassLoad and ClassPrepare events can be posted during start phase. 14517 </change> 14518 <change date="25 March 2004" version="0.3.17"> 14519 Add JVMTI_ERROR_NATIVE_METHOD to GetLineNumberTable, GetLocalVariableTable, 14520 GetMaxLocals, GetArgumentsSize, GetMethodLocation, GetBytecodes. 14521 </change> 14522 <change date="29 March 2004" version="0.3.18"> 14523 Return the timer kind in the timer information structure. 14524 </change> 14525 <change date="31 March 2004" version="0.3.19"> 14526 Spec clarifications: 14527 JVMTI_THREAD_STATE_IN_NATIVE might not include JNI or <jvmti/>. 14528 ForceGarbageCollection does not run finalizers. 14529 The context of the specification is the Java platform. 14530 Warn about early instrumentation. 14531 </change> 14532 <change date="1 April 2004" version="0.3.20"> 14533 Refinements to the above clarifications and 14534 Clarify that an error returned by Agent_OnLoad terminates the VM. 14535 </change> 14536 <change date="1 April 2004" version="0.3.21"> 14537 Array class creation does not generate a class load event. 14538 </change> 14539 <change date="7 April 2004" version="0.3.22"> 14540 Align thread state hierarchy more closely with java.lang.Thread.State. 14541 </change> 14542 <change date="12 April 2004" version="0.3.23"> 14543 Clarify the documentation of thread state. 14544 </change> 14545 <change date="19 April 2004" version="0.3.24"> 14546 Remove GarbageCollectionOccurred event -- can be done by agent. 14547 </change> 14548 <change date="22 April 2004" version="0.3.25"> 14549 Define "command-line option". 14550 </change> 14551 <change date="29 April 2004" version="0.3.26"> 14552 Describe the intended use of bytecode instrumentation. 14553 Fix description of extension event first parameter. 14554 </change> 14555 <change date="30 April 2004" version="0.3.27"> 14556 Clarification and typos. 14557 </change> 14558 <change date="18 May 2004" version="0.3.28"> 14559 Remove DataDumpRequest event. 14560 </change> 14561 <change date="18 May 2004" version="0.3.29"> 14562 Clarify RawMonitorWait with zero timeout. 14563 Clarify thread state after RunAgentThread. 14564 </change> 14565 <change date="24 May 2004" version="0.3.30"> 14566 Clean-up: fix bad/old links, etc. 14567 </change> 14568 <change date="30 May 2004" version="0.3.31"> 14569 Clarifications including: 14570 All character strings are modified UTF-8. 14571 Agent thread visibiity. 14572 Meaning of obsolete method version. 14573 Thread invoking heap callbacks, 14574 </change> 14575 <change date="1 June 2004" version="1.0.32"> 14576 Bump major.minor version numbers to "1.0". 14577 </change> 14578 <change date="2 June 2004" version="1.0.33"> 14579 Clarify interaction between ForceGarbageCollection 14580 and ObjectFree. 14581 </change> 14582 <change date="6 June 2004" version="1.0.34"> 14583 Restrict AddToBootstrapClassLoaderSearch and 14584 SetSystemProperty to the OnLoad phase only. 14585 </change> 14586 <change date="11 June 2004" version="1.0.35"> 14587 Fix typo in SetTag. 14588 </change> 14589 <change date="18 June 2004" version="1.0.36"> 14590 Fix trademarks. 14591 Add missing parameter in example GetThreadState usage. 14592 </change> 14593 <change date="4 August 2004" version="1.0.37"> 14594 Copyright updates. 14595 </change> 14596 <change date="5 November 2004" version="1.0.38"> 14597 Add missing function table layout. 14598 Add missing description of C++ member function format of functions. 14599 Clarify that name in CFLH can be NULL. 14600 Released as part of <tm>J2SE</tm> 5.0. 14601 </change> 14602 <change date="24 April 2005" version="1.1.47"> 14603 Bump major.minor version numbers to "1.1". 14604 Add ForceEarlyReturn* functions. 14605 Add GetOwnedMonitorStackDepthInfo function. 14606 Add GetCurrentThread function. 14607 Add "since" version marker. 14608 Add AddToSystemClassLoaderSearch. 14609 Allow AddToBootstrapClassLoaderSearch be used in live phase. 14610 Fix historic rubbish in the descriptions of the heap_object_callback 14611 parameter of IterateOverHeap and IterateOverInstancesOfClass functions; 14612 disallow NULL for this parameter. 14613 Clarify, correct and make consistent: wording about current thread, 14614 opaque frames and insufficient number of frames in PopFrame. 14615 Consistently use "current frame" rather than "topmost". 14616 Clarify the JVMTI_ERROR_TYPE_MISMATCH errors in GetLocal* and SetLocal* 14617 by making them compatible with those in ForceEarlyReturn*. 14618 Many other clarifications and wording clean ups. 14619 </change> 14620 <change date="25 April 2005" version="1.1.48"> 14621 Add GetConstantPool. 14622 Switch references to the first edition of the VM Spec, to the seconds edition. 14623 </change> 14624 <change date="26 April 2005" version="1.1.49"> 14625 Clarify minor/major version order in GetConstantPool. 14626 </change> 14627 <change date="26 April 2005" version="1.1.50"> 14628 Add SetNativeMethodPrefix and SetNativeMethodPrefixes. 14629 Reassign GetOwnedMonitorStackDepthInfo to position 153. 14630 Break out Class Loader Search in its own documentation category. 14631 Deal with overly long lines in XML source. 14632 </change> 14633 <change date="29 April 2005" version="1.1.51"> 14634 Allow agents be started in the live phase. 14635 Added paragraph about deploying agents. 14636 </change> 14637 <change date="30 April 2005" version="1.1.52"> 14638 Add specification description to SetNativeMethodPrefix(es). 14639 Better define the conditions on GetConstantPool. 14640 </change> 14641 <change date="30 April 2005" version="1.1.53"> 14642 Break out the GetClassVersionNumber function from GetConstantPool. 14643 Clean-up the references to the VM Spec. 14644 </change> 14645 <change date="1 May 2005" version="1.1.54"> 14646 Allow SetNativeMethodPrefix(es) in any phase. 14647 Add clarifications about the impact of redefinition on GetConstantPool. 14648 </change> 14649 <change date="2 May 2005" version="1.1.56"> 14650 Various clarifications to SetNativeMethodPrefix(es). 14651 </change> 14652 <change date="2 May 2005" version="1.1.57"> 14653 Add missing performance warning to the method entry event. 14654 </change> 14655 <change date="5 May 2005" version="1.1.58"> 14656 Remove internal JVMDI support. 14657 </change> 14658 <change date="8 May 2005" version="1.1.59"> 14659 Add <functionlink id="RetransformClasses"/>. 14660 Revamp the bytecode instrumentation documentation. 14661 Change <functionlink id="IsMethodObsolete"/> to no longer 14662 require the can_redefine_classes capability. 14663 </change> 14664 <change date="11 May 2005" version="1.1.63"> 14665 Clarifications for retransformation. 14666 </change> 14667 <change date="11 May 2005" version="1.1.64"> 14668 Clarifications for retransformation, per review. 14669 Lock "retransformation (in)capable" at class load enable time. 14670 </change> 14671 <change date="4 June 2005" version="1.1.67"> 14672 Add new heap functionity which supports reporting primitive values, 14673 allows setting the referrer tag, and has more powerful filtering: 14674 FollowReferences, IterateThroughHeap, and their associated 14675 callbacks, structs, enums, and constants. 14676 </change> 14677 <change date="4 June 2005" version="1.1.68"> 14678 Clarification. 14679 </change> 14680 <change date="6 June 2005" version="1.1.69"> 14681 FollowReferences, IterateThroughHeap: Put callbacks in a struct; 14682 Add missing error codes; reduce bits in the visit control flags. 14683 </change> 14684 <change date="14 June 2005" version="1.1.70"> 14685 More on new heap functionity: spec clean-up per review. 14686 </change> 14687 <change date="15 June 2005" version="1.1.71"> 14688 More on new heap functionity: Rename old heap section to Heap (1.0). 14689 </change> 14690 <change date="21 June 2005" version="1.1.72"> 14691 Fix typos. 14692 </change> 14693 <change date="27 June 2005" version="1.1.73"> 14694 Make referrer info structure a union. 14695 </change> 14696 <change date="9 September 2005" version="1.1.74"> 14697 In new heap functions: 14698 Add missing superclass reference kind. 14699 Use a single scheme for computing field indexes. 14700 Remove outdated references to struct based referrer info. 14701 </change> 14702 <change date="12 September 2005" version="1.1.75"> 14703 Don't callback during FollowReferences on frivolous java.lang.Object superclass. 14704 </change> 14705 <change date="13 September 2005" version="1.1.76"> 14706 In string primitive callback, length now Unicode length. 14707 In array and string primitive callbacks, value now "const". 14708 Note possible compiler impacts on setting JNI function table. 14709 </change> 14710 <change date="13 September 2005" version="1.1.77"> 14711 GetClassVersionNumbers() and GetConstantPool() should return 14712 error on array or primitive class. 14713 </change> 14714 <change date="14 September 2005" version="1.1.78"> 14715 Grammar fixes. 14716 </change> 14717 <change date="26 September 2005" version="1.1.79"> 14718 Add IsModifiableClass query. 14719 </change> 14720 <change date="9 February 2006" version="1.1.81"> 14721 Add referrer_class_tag parameter to jvmtiHeapReferenceCallback. 14722 </change> 14723 <change date="13 February 2006" version="1.1.82"> 14724 Doc fixes: update can_redefine_any_class to include retransform. 14725 Clarify that exception events cover all Throwables. 14726 In GetStackTrace, no test is done for start_depth too big if start_depth is zero, 14727 Clarify fields reported in Primitive Field Callback -- static vs instance. 14728 Repair confusing names of heap types, including callback names. 14729 Require consistent usage of stack depth in the face of thread launch methods. 14730 Note incompatibility of <jvmti/> memory management with other systems. 14731 </change> 14732 <change date="14 February 2006" version="1.1.85"> 14733 Fix typos and missing renames. 14734 </change> 14735 <change date="13 March 2006" version="1.1.86"> 14736 Clarify that jmethodIDs and jfieldIDs can be saved. 14737 Clarify that Iterate Over Instances Of Class includes subclasses. 14738 </change> 14739 <change date="14 March 2006" version="1.1.87"> 14740 Better phrasing. 14741 </change> 14742 <change date="16 March 2006" version="1.1.88"> 14743 Match the referrer_index for static fields in Object Reference Callback 14744 with the Reference Implementation (and all other known implementations); 14745 that is, make it match the definition for instance fields. 14746 In GetThreadListStackTraces, add JVMTI_ERROR_INVALID_THREAD to cover 14747 an invalid thread in the list; and specify that not started threads 14748 return empty stacks. 14749 </change> 14750 <change date="17 March 2006" version="1.1.89"> 14751 Typo. 14752 </change> 14753 <change date="25 March 2006" version="1.1.90"> 14754 Typo. 14755 </change> 14756 <change date="6 April 2006" version="1.1.91"> 14757 Remove restrictions on AddToBootstrapClassLoaderSearch and 14758 AddToSystemClassLoaderSearch. 14759 </change> 14760 <change date="1 May 2006" version="1.1.93"> 14761 Changed spec to return -1 for monitor stack depth for the 14762 implementation which can not determine stack depth. 14763 </change> 14764 <change date="3 May 2006" version="1.1.94"> 14765 Corrections for readability and accuracy courtesy of Alan Pratt of IBM. 14766 List the object relationships reported in FollowReferences. 14767 </change> 14768 <change date="5 May 2006" version="1.1.95"> 14769 Clarify the object relationships reported in FollowReferences. 14770 </change> 14771 <change date="28 June 2006" version="1.1.98"> 14772 Clarify DisposeEnvironment; add warning. 14773 Fix typos in SetLocalXXX "retrieve" => "set". 14774 Clarify that native method prefixes must remain set while used. 14775 Clarify that exactly one Agent_OnXXX is called per agent. 14776 Clarify that library loading is independent from start-up. 14777 Remove ambiguous reference to Agent_OnLoad in the Agent_OnUnload spec. 14778 </change> 14779 <change date="31 July 2006" version="1.1.99"> 14780 Clarify the interaction between functions and exceptions. 14781 Clarify and give examples of field indices. 14782 Remove confusing "That is" sentence from MonitorWait and MonitorWaited events. 14783 Update links to point to Java 6. 14784 </change> 14785 <change date="6 August 2006" version="1.1.102"> 14786 Add ResourceExhaustedEvent. 14787 </change> 14788 <change date="11 October 2012" version="1.2.2"> 14789 Fixed the "HTTP" and "Missing Anchor" errors reported by the LinkCheck tool. 14790 </change> 14791 <change date="19 June 2013" version="1.2.3"> 14792 Added support for statically linked agents. 14793 </change> 14794 <change date="13 October 2016" version="9.0.0"> 14795 Support for modules: 14796 - The majorversion is 9 now 14797 - The ClassFileLoadHook events are not sent during the primordial phase anymore. 14798 - Allow CompiledMethodLoad events at start phase 14799 - Add new capabilities: 14800 - can_generate_early_vmstart 14801 - can_generate_early_class_hook_events 14802 - Add new functions: 14803 - GetAllModules 14804 - AddModuleReads, AddModuleExports, AddModuleOpens, AddModuleUses, AddModuleProvides 14805 - IsModifiableModule 14806 Clarified can_redefine_any_classes, can_retransform_any_classes and IsModifiableClass API to 14807 disallow some implementation defined classes. 14808 </change> 14809 <change date="12 February 2017" version="9.0.0"> 14810 Minor update for GetCurrentThread function: 14811 - The function may return NULL in the start phase if the 14812 can_generate_early_vmstart capability is enabled. 14813 </change> 14814 </changehistory> 14815 14816 </specification> 14817 <!-- Keep this comment at the end of the file 14818 Local variables: 14819 mode: sgml 14820 sgml-omittag:t 14821 sgml-shorttag:t 14822 sgml-namecase-general:t 14823 sgml-general-insert-case:lower 14824 sgml-minimize-attributes:nil 14825 sgml-always-quote-attributes:t 14826 sgml-indent-step:2 14827 sgml-indent-data:t 14828 sgml-parent-document:nil 14829 sgml-exposed-tags:nil 14830 sgml-local-catalogs:nil 14831 sgml-local-ecat-files:nil 14832 End: 14833 -->