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="11" 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 (unless explicitly prohibited). 7636 The retransformation must not add, remove or rename fields or methods, change the 7637 signatures of methods, change modifiers, or change inheritance. 7638 The retransformation must not change the <code>NestHost</code> or 7639 <code>NestMembers</code> attributes. 7640 These restrictions may be lifted in future versions. 7641 See the error return description below for information on error codes 7642 returned if an unsupported retransformation is attempted. 7643 The class file bytes are not verified or installed until they have passed 7644 through the chain of <eventlink id="ClassFileLoadHook"/> events, thus the 7645 returned error code reflects the result of the transformations. 7646 If any error code is returned other than <code>JVMTI_ERROR_NONE</code>, 7647 none of the classes to be retransformed will have a new definition installed. 7648 When this function returns (with the error code of <code>JVMTI_ERROR_NONE</code>) 7649 all of the classes to be retransformed will have their new definitions installed. 7650 </description> 7651 <origin>new</origin> 7652 <capabilities> 7653 <required id="can_retransform_classes"></required> 7654 <capability id="can_retransform_any_class"></capability> 7655 </capabilities> 7656 <parameters> 7657 <param id="class_count"> 7658 <jint min="0"/> 7659 <description> 7660 The number of classes to be retransformed. 7661 </description> 7662 </param> 7663 <param id="classes"> 7664 <inbuf incount="class_count"><jclass/></inbuf> 7665 <description> 7666 The array of classes to be retransformed. 7667 </description> 7668 </param> 7669 </parameters> 7670 <errors> 7671 <error id="JVMTI_ERROR_UNMODIFIABLE_CLASS"> 7672 One of the <paramlink id="classes"/> cannot be modified. 7673 See <functionlink id="IsModifiableClass"/>. 7674 </error> 7675 <error id="JVMTI_ERROR_INVALID_CLASS"> 7676 One of the <paramlink id="classes"/> is not a valid class. 7677 </error> 7678 <error id="JVMTI_ERROR_UNSUPPORTED_VERSION"> 7679 A retransformed class file has a version number not supported by this VM. 7680 </error> 7681 <error id="JVMTI_ERROR_INVALID_CLASS_FORMAT"> 7682 A retransformed class file is malformed (The VM would return a <code>ClassFormatError</code>). 7683 </error> 7684 <error id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION"> 7685 The retransformed class file definitions would lead to a circular definition 7686 (the VM would return a <code>ClassCircularityError</code>). 7687 </error> 7688 <error id="JVMTI_ERROR_FAILS_VERIFICATION"> 7689 The retransformed class file bytes fail verification. 7690 </error> 7691 <error id="JVMTI_ERROR_NAMES_DONT_MATCH"> 7692 The class name defined in a retransformed class file is 7693 different from the name in the old class object. 7694 </error> 7695 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED"> 7696 A retransformed class file would require adding a method. 7697 </error> 7698 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED"> 7699 A retransformed class file changes a field. 7700 </error> 7701 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED"> 7702 A direct superclass is different for a retransformed class file, 7703 or the set of directly implemented 7704 interfaces is different. 7705 </error> 7706 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED"> 7707 A retransformed class file does not declare a method 7708 declared in the old class version. 7709 </error> 7710 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED"> 7711 A retransformed class file has unsupported differences in class attributes. 7712 </error> 7713 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED"> 7714 A retransformed class file has different class modifiers. 7715 </error> 7716 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED"> 7717 A method in the retransformed class file has different modifiers 7718 than its counterpart in the old class version. 7719 </error> 7720 </errors> 7721 </function> 7722 7723 <function id="RedefineClasses" jkernel="yes" num="87"> 7724 <synopsis>Redefine Classes</synopsis> 7725 <typedef id="jvmtiClassDefinition" label="Class redefinition description"> 7726 <field id="klass"> 7727 <jclass/> 7728 <description> 7729 Class object for this class 7730 </description> 7731 </field> 7732 <field id="class_byte_count"> 7733 <jint/> 7734 <description> 7735 Number of bytes defining class (below) 7736 </description> 7737 </field> 7738 <field id="class_bytes"> 7739 <inbuf incount="class_byte_count"><uchar/></inbuf> 7740 <description> 7741 Bytes defining class (in <vmspec chapter="4"/>) 7742 </description> 7743 </field> 7744 </typedef> 7745 <description> 7746 All classes given are redefined according to the definitions 7747 supplied. 7748 This function is used to replace the definition of a class 7749 with a new definition, as might be needed in fix-and-continue 7750 debugging. 7751 Where the existing class file bytes are to be transformed, for 7752 example in 7753 <internallink id="bci">bytecode instrumentation</internallink>, 7754 <functionlink id="RetransformClasses"/> should be used. 7755 <p/> 7756 Redefinition can cause new versions of methods to be installed. 7757 Old method versions may become 7758 <internallink id="obsoleteMethods">obsolete</internallink> 7759 The new method version will be used on new invokes. 7760 If a method has active stack frames, those active frames continue to 7761 run the bytecodes of the original method version. 7762 If resetting of stack frames is desired, use 7763 <functionlink id="PopFrame"></functionlink> 7764 to pop frames with obsolete method versions. 7765 <p/> 7766 This function does not cause any initialization except that which 7767 would occur under the customary JVM semantics. 7768 In other words, redefining a class does not cause its initializers to be 7769 run. The values of static fields will remain as they were 7770 prior to the call. 7771 <p/> 7772 Threads need not be suspended. 7773 <p/> 7774 All breakpoints in the class are cleared. 7775 <p/> 7776 All attributes are updated. 7777 <p/> 7778 Instances of the redefined class are not affected -- fields retain their 7779 previous values. 7780 <functionlink id="GetTag">Tags</functionlink> on the instances are 7781 also unaffected. 7782 <p/> 7783 In response to this call, the <jvmti/> event 7784 <eventlink id="ClassFileLoadHook">Class File Load Hook</eventlink> 7785 will be sent (if enabled), but no other <jvmti/> events will be sent. 7786 <p/> 7787 The redefinition may change method bodies, the constant pool and attributes 7788 (unless explicitly prohibited). 7789 The redefinition must not add, remove or rename fields or methods, change the 7790 signatures of methods, change modifiers, or change inheritance. 7791 The retransformation must not change the <code>NestHost</code> or 7792 <code>NestMembers</code> attributes. 7793 These restrictions may be lifted in future versions. 7794 See the error return description below for information on error codes 7795 returned if an unsupported redefinition is attempted. 7796 The class file bytes are not verified or installed until they have passed 7797 through the chain of <eventlink id="ClassFileLoadHook"/> events, thus the 7798 returned error code reflects the result of the transformations applied 7799 to the bytes passed into <paramlink id="class_definitions"/>. 7800 If any error code is returned other than <code>JVMTI_ERROR_NONE</code>, 7801 none of the classes to be redefined will have a new definition installed. 7802 When this function returns (with the error code of <code>JVMTI_ERROR_NONE</code>) 7803 all of the classes to be redefined will have their new definitions installed. 7804 </description> 7805 <origin>jvmdi</origin> 7806 <capabilities> 7807 <required id="can_redefine_classes"></required> 7808 <capability id="can_redefine_any_class"></capability> 7809 </capabilities> 7810 <parameters> 7811 <param id="class_count"> 7812 <jint min="0"/> 7813 <description> 7814 The number of classes specified in <code>class_definitions</code> 7815 </description> 7816 </param> 7817 <param id="class_definitions"> 7818 <inbuf incount="class_count"><struct>jvmtiClassDefinition</struct></inbuf> 7819 <description> 7820 The array of new class definitions 7821 </description> 7822 </param> 7823 </parameters> 7824 <errors> 7825 <error id="JVMTI_ERROR_NULL_POINTER"> 7826 One of <code>class_bytes</code> is <code>NULL</code>. 7827 </error> 7828 <error id="JVMTI_ERROR_UNMODIFIABLE_CLASS"> 7829 An element of <code>class_definitions</code> cannot be modified. 7830 See <functionlink id="IsModifiableClass"/>. 7831 </error> 7832 <error id="JVMTI_ERROR_INVALID_CLASS"> 7833 An element of <code>class_definitions</code> is not a valid class. 7834 </error> 7835 <error id="JVMTI_ERROR_UNSUPPORTED_VERSION"> 7836 A new class file has a version number not supported by this VM. 7837 </error> 7838 <error id="JVMTI_ERROR_INVALID_CLASS_FORMAT"> 7839 A new class file is malformed (The VM would return a <code>ClassFormatError</code>). 7840 </error> 7841 <error id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION"> 7842 The new class file definitions would lead to a circular definition 7843 (the VM would return a <code>ClassCircularityError</code>). 7844 </error> 7845 <error id="JVMTI_ERROR_FAILS_VERIFICATION"> 7846 The class bytes fail verification. 7847 </error> 7848 <error id="JVMTI_ERROR_NAMES_DONT_MATCH"> 7849 The class name defined in a new class file is 7850 different from the name in the old class object. 7851 </error> 7852 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED"> 7853 A new class file would require adding a method. 7854 </error> 7855 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED"> 7856 A new class version changes a field. 7857 </error> 7858 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED"> 7859 A direct superclass is different for a new class 7860 version, or the set of directly implemented 7861 interfaces is different. 7862 </error> 7863 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED"> 7864 A new class version does not declare a method 7865 declared in the old class version. 7866 </error> 7867 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED"> 7868 A new class version has unsupported differences in class attributes. 7869 </error> 7870 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED"> 7871 A new class version has different modifiers. 7872 </error> 7873 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED"> 7874 A method in the new class version has different modifiers 7875 than its counterpart in the old class version. 7876 </error> 7877 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE"> 7878 A module cannot be modified. 7879 See <functionlink id="IsModifiableModule"/>. 7880 </error> 7881 </errors> 7882 </function> 7883 7884 </category> 7885 7886 <category id="object" label="Object"> 7887 7888 <function id="GetObjectSize" jkernel="yes" phase="start" num="154"> 7889 <synopsis>Get Object Size</synopsis> 7890 <description> 7891 For the object indicated by <code>object</code>, 7892 return via <code>size_ptr</code> the size of the object. 7893 This size is an implementation-specific approximation of 7894 the amount of storage consumed by this object. 7895 It may include some or all of the object's overhead, and thus 7896 is useful for comparison within an implementation but not 7897 between implementations. 7898 The estimate may change during a single invocation of the JVM. 7899 </description> 7900 <origin>new</origin> 7901 <capabilities> 7902 </capabilities> 7903 <parameters> 7904 <param id="object"> 7905 <jobject/> 7906 <description> 7907 The object to query. 7908 </description> 7909 </param> 7910 <param id="size_ptr"> 7911 <outptr><jlong/></outptr> 7912 <description> 7913 On return, points to the object's size in bytes. 7914 </description> 7915 </param> 7916 </parameters> 7917 <errors> 7918 </errors> 7919 </function> 7920 7921 <function id="GetObjectHashCode" phase="start" num="58"> 7922 <synopsis>Get Object Hash Code</synopsis> 7923 <description> 7924 For the object indicated by <code>object</code>, 7925 return via <code>hash_code_ptr</code> a hash code. 7926 This hash code could be used to maintain a hash table of object references, 7927 however, on some implementations this can cause significant performance 7928 impacts--in most cases 7929 <internallink id="Heap">tags</internallink> 7930 will be a more efficient means of associating information with objects. 7931 This function guarantees 7932 the same hash code value for a particular object throughout its life 7933 </description> 7934 <origin>jvmdi</origin> 7935 <capabilities> 7936 </capabilities> 7937 <parameters> 7938 <param id="object"> 7939 <jobject/> 7940 <description> 7941 The object to query. 7942 </description> 7943 </param> 7944 <param id="hash_code_ptr"> 7945 <outptr><jint/></outptr> 7946 <description> 7947 On return, points to the object's hash code. 7948 </description> 7949 </param> 7950 </parameters> 7951 <errors> 7952 </errors> 7953 </function> 7954 7955 <function id="GetObjectMonitorUsage" num="59"> 7956 <synopsis>Get Object Monitor Usage</synopsis> 7957 <typedef id="jvmtiMonitorUsage" label="Object monitor usage information"> 7958 <field id="owner"> 7959 <jthread/> 7960 <description> 7961 The thread owning this monitor, or <code>NULL</code> if unused 7962 </description> 7963 </field> 7964 <field id="entry_count"> 7965 <jint/> 7966 <description> 7967 The number of times the owning thread has entered the monitor 7968 </description> 7969 </field> 7970 <field id="waiter_count"> 7971 <jint/> 7972 <description> 7973 The number of threads waiting to own this monitor 7974 </description> 7975 </field> 7976 <field id="waiters"> 7977 <allocfieldbuf><jthread/></allocfieldbuf> 7978 <description> 7979 The <code>waiter_count</code> waiting threads 7980 </description> 7981 </field> 7982 <field id="notify_waiter_count"> 7983 <jint/> 7984 <description> 7985 The number of threads waiting to be notified by this monitor 7986 </description> 7987 </field> 7988 <field id="notify_waiters"> 7989 <allocfieldbuf><jthread/></allocfieldbuf> 7990 <description> 7991 The <code>notify_waiter_count</code> threads waiting to be notified 7992 </description> 7993 </field> 7994 </typedef> 7995 <description> 7996 Get information about the object's monitor. 7997 The fields of the <functionlink id="jvmtiMonitorUsage"></functionlink> structure 7998 are filled in with information about usage of the monitor. 7999 <todo> 8000 Decide and then clarify suspend requirements. 8001 </todo> 8002 </description> 8003 <origin>jvmdi</origin> 8004 <capabilities> 8005 <required id="can_get_monitor_info"></required> 8006 </capabilities> 8007 <parameters> 8008 <param id="object"> 8009 <jobject/> 8010 <description> 8011 The object to query. 8012 </description> 8013 </param> 8014 <param id="info_ptr"> 8015 <outptr><struct>jvmtiMonitorUsage</struct></outptr> 8016 <description> 8017 On return, filled with monitor information for the 8018 specified object. 8019 </description> 8020 </param> 8021 </parameters> 8022 <errors> 8023 </errors> 8024 </function> 8025 8026 <elide> 8027 <function id="GetObjectMonitors" num="116"> 8028 <synopsis>Get Object Monitors</synopsis> 8029 <description> 8030 Return the list of object monitors. 8031 <p/> 8032 Note: details about each monitor can be examined with 8033 <functionlink id="GetObjectMonitorUsage"></functionlink>. 8034 </description> 8035 <origin>new</origin> 8036 <capabilities> 8037 <required id="can_get_monitor_info"></required> 8038 </capabilities> 8039 <parameters> 8040 <param id="monitorCnt"> 8041 <outptr><jint/></outptr> 8042 <description> 8043 On return, pointer to the number 8044 of monitors returned in <code>monitors_ptr</code>. 8045 </description> 8046 </param> 8047 <param id="monitors_ptr"> 8048 <allocbuf outcount="monitorCnt"><jobject/></allocbuf> 8049 <description> 8050 On return, pointer to the monitor list. 8051 </description> 8052 </param> 8053 </parameters> 8054 <errors> 8055 </errors> 8056 </function> 8057 </elide> 8058 8059 </category> 8060 8061 <category id="fieldCategory" label="Field"> 8062 8063 <intro> 8064 </intro> 8065 8066 <function id="GetFieldName" phase="start" num="60"> 8067 <synopsis>Get Field Name (and Signature)</synopsis> 8068 <description> 8069 For the field indicated by <paramlink id="klass"/> and <paramlink id="field"/>, 8070 return the field name via <paramlink id="name_ptr"/> and field signature via 8071 <paramlink id="signature_ptr"/>. 8072 <p/> 8073 Field signatures are defined in the 8074 <externallink id="jni/index.html">JNI Specification</externallink> 8075 and are referred to as <code>field descriptors</code> in 8076 <vmspec chapter="4.3.2"/>. 8077 </description> 8078 <origin>jvmdiClone</origin> 8079 <capabilities> 8080 </capabilities> 8081 <parameters> 8082 <param id="klass"> 8083 <jclass field="field"/> 8084 <description> 8085 The class of the field to query. 8086 </description> 8087 </param> 8088 <param id="field"> 8089 <jfieldID class="klass"/> 8090 <description> 8091 The field to query. 8092 </description> 8093 </param> 8094 <param id="name_ptr"> 8095 <allocbuf> 8096 <char/> 8097 <nullok>the name is not returned</nullok> 8098 </allocbuf> 8099 <description> 8100 On return, points to the field name, encoded as a 8101 <internallink id="mUTF">modified UTF-8</internallink> string. 8102 </description> 8103 </param> 8104 <param id="signature_ptr"> 8105 <allocbuf> 8106 <char/> 8107 <nullok>the signature is not returned</nullok> 8108 </allocbuf> 8109 <description> 8110 On return, points to the field signature, encoded as a 8111 <internallink id="mUTF">modified UTF-8</internallink> string. 8112 </description> 8113 </param> 8114 <param id="generic_ptr"> 8115 <allocbuf> 8116 <char/> 8117 <nullok>the generic signature is not returned</nullok> 8118 </allocbuf> 8119 <description> 8120 On return, points to the generic signature of the field, encoded as a 8121 <internallink id="mUTF">modified UTF-8</internallink> string. 8122 If there is no generic signature attribute for the field, then, 8123 on return, points to <code>NULL</code>. 8124 </description> 8125 </param> 8126 </parameters> 8127 <errors> 8128 </errors> 8129 </function> 8130 8131 <function id="GetFieldDeclaringClass" phase="start" num="61"> 8132 <synopsis>Get Field Declaring Class</synopsis> 8133 <description> 8134 For the field indicated by <code>klass</code> and <code>field</code> 8135 return the class that defined it via <code>declaring_class_ptr</code>. 8136 The declaring class will either be <code>klass</code>, a superclass, or 8137 an implemented interface. 8138 </description> 8139 <origin>jvmdi</origin> 8140 <capabilities> 8141 </capabilities> 8142 <parameters> 8143 <param id="klass"> 8144 <jclass field="field"/> 8145 <description> 8146 The class to query. 8147 </description> 8148 </param> 8149 <param id="field"> 8150 <jfieldID class="klass"/> 8151 <description> 8152 The field to query. 8153 </description> 8154 </param> 8155 <param id="declaring_class_ptr"> 8156 <outptr><jclass/></outptr> 8157 <description> 8158 On return, points to the declaring class 8159 </description> 8160 </param> 8161 </parameters> 8162 <errors> 8163 </errors> 8164 </function> 8165 8166 <function id="GetFieldModifiers" phase="start" num="62"> 8167 <synopsis>Get Field Modifiers</synopsis> 8168 <description> 8169 For the field indicated by <code>klass</code> and <code>field</code> 8170 return the access flags via <code>modifiers_ptr</code>. 8171 Access flags are defined in <vmspec chapter="4"/>. 8172 </description> 8173 <origin>jvmdi</origin> 8174 <capabilities> 8175 </capabilities> 8176 <parameters> 8177 <param id="klass"> 8178 <jclass field="field"/> 8179 <description> 8180 The class to query. 8181 </description> 8182 </param> 8183 <param id="field"> 8184 <jfieldID class="klass"/> 8185 <description> 8186 The field to query. 8187 </description> 8188 </param> 8189 <param id="modifiers_ptr"> 8190 <outptr><jint/></outptr> 8191 <description> 8192 On return, points to the access flags. 8193 </description> 8194 </param> 8195 </parameters> 8196 <errors> 8197 </errors> 8198 </function> 8199 8200 <function id="IsFieldSynthetic" phase="start" num="63"> 8201 <synopsis>Is Field Synthetic</synopsis> 8202 <description> 8203 For the field indicated by <code>klass</code> and <code>field</code>, return a 8204 value indicating whether the field is synthetic via <code>is_synthetic_ptr</code>. 8205 Synthetic fields are generated by the compiler but not present in the 8206 original source code. 8207 </description> 8208 <origin>jvmdi</origin> 8209 <capabilities> 8210 <required id="can_get_synthetic_attribute"></required> 8211 </capabilities> 8212 <parameters> 8213 <param id="klass"> 8214 <jclass field="field"/> 8215 <description> 8216 The class of the field to query. 8217 </description> 8218 </param> 8219 <param id="field"> 8220 <jfieldID class="klass"/> 8221 <description> 8222 The field to query. 8223 </description> 8224 </param> 8225 <param id="is_synthetic_ptr"> 8226 <outptr><jboolean/></outptr> 8227 <description> 8228 On return, points to the boolean result of this function. 8229 </description> 8230 </param> 8231 </parameters> 8232 <errors> 8233 </errors> 8234 </function> 8235 8236 </category> 8237 8238 <category id="method" label="Method"> 8239 8240 <intro> 8241 These functions provide information about a method (represented as a 8242 <typelink id="jmethodID"/>) and set how methods are processed. 8243 </intro> 8244 8245 <intro id="obsoleteMethods" label="Obsolete Methods"> 8246 The functions <functionlink id="RetransformClasses"/> and 8247 <functionlink id="RedefineClasses"/> can cause new versions 8248 of methods to be installed. 8249 An original version of a method is considered equivalent 8250 to the new version if: 8251 <ul> 8252 <li>their bytecodes are the same except for indices into the 8253 constant pool and </li> 8254 <li>the referenced constants are equal.</li> 8255 </ul> 8256 An original method version which is not equivalent to the 8257 new method version is called obsolete and is assigned a new method ID; 8258 the original method ID now refers to the new method version. 8259 A method ID can be tested for obsolescence with 8260 <functionlink id="IsMethodObsolete"/>. 8261 </intro> 8262 8263 <function id="GetMethodName" phase="start" num="64"> 8264 <synopsis>Get Method Name (and Signature)</synopsis> 8265 <description> 8266 For the method indicated by <code>method</code>, 8267 return the method name via <code>name_ptr</code> and method signature via 8268 <code>signature_ptr</code>. 8269 <p/> 8270 Method signatures are defined in the 8271 <externallink id="jni/index.html">JNI Specification</externallink> 8272 and are referred to as <code>method descriptors</code> in 8273 <vmspec chapter="4.3.3"/>. 8274 Note this is different 8275 than method signatures as defined in the <i>Java Language Specification</i>. 8276 </description> 8277 <origin>jvmdiClone</origin> 8278 <capabilities> 8279 </capabilities> 8280 <parameters> 8281 <param id="method"> 8282 <jmethodID/> 8283 <description> 8284 The method to query. 8285 </description> 8286 </param> 8287 <param id="name_ptr"> 8288 <allocbuf> 8289 <char/> 8290 <nullok>the name is not returned</nullok> 8291 </allocbuf> 8292 <description> 8293 On return, points to the method name, encoded as a 8294 <internallink id="mUTF">modified UTF-8</internallink> string. 8295 </description> 8296 </param> 8297 <param id="signature_ptr"> 8298 <allocbuf> 8299 <char/> 8300 <nullok>the signature is not returned</nullok> 8301 </allocbuf> 8302 <description> 8303 On return, points to the method signature, encoded as a 8304 <internallink id="mUTF">modified UTF-8</internallink> string. 8305 </description> 8306 </param> 8307 <param id="generic_ptr"> 8308 <allocbuf> 8309 <char/> 8310 <nullok>the generic signature is not returned</nullok> 8311 </allocbuf> 8312 <description> 8313 On return, points to the generic signature of the method, encoded as a 8314 <internallink id="mUTF">modified UTF-8</internallink> string. 8315 If there is no generic signature attribute for the method, then, 8316 on return, points to <code>NULL</code>. 8317 </description> 8318 </param> 8319 </parameters> 8320 <errors> 8321 </errors> 8322 </function> 8323 8324 <function id="GetMethodDeclaringClass" phase="start" num="65"> 8325 <synopsis>Get Method Declaring Class</synopsis> 8326 <description> 8327 For the method indicated by <code>method</code>, 8328 return the class that defined it via <code>declaring_class_ptr</code>. 8329 </description> 8330 <origin>jvmdi</origin> 8331 <capabilities> 8332 </capabilities> 8333 <parameters> 8334 <param id="klass"> 8335 <jclass method="method"/> 8336 <description> 8337 The class to query. 8338 </description> 8339 </param> 8340 <param id="method"> 8341 <jmethodID class="klass"/> 8342 <description> 8343 The method to query. 8344 </description> 8345 </param> 8346 <param id="declaring_class_ptr"> 8347 <outptr><jclass/></outptr> 8348 <description> 8349 On return, points to the declaring class 8350 </description> 8351 </param> 8352 </parameters> 8353 <errors> 8354 </errors> 8355 </function> 8356 8357 <function id="GetMethodModifiers" phase="start" num="66"> 8358 <synopsis>Get Method Modifiers</synopsis> 8359 <description> 8360 For the method indicated by <code>method</code>, 8361 return the access flags via <code>modifiers_ptr</code>. 8362 Access flags are defined in <vmspec chapter="4"/>. 8363 </description> 8364 <origin>jvmdi</origin> 8365 <capabilities> 8366 </capabilities> 8367 <parameters> 8368 <param id="klass"> 8369 <jclass method="method"/> 8370 <description> 8371 The class to query. 8372 </description> 8373 </param> 8374 <param id="method"> 8375 <jmethodID class="klass"/> 8376 <description> 8377 The method to query. 8378 </description> 8379 </param> 8380 <param id="modifiers_ptr"> 8381 <outptr><jint/></outptr> 8382 <description> 8383 On return, points to the access flags. 8384 </description> 8385 </param> 8386 </parameters> 8387 <errors> 8388 </errors> 8389 </function> 8390 8391 <function id="GetMaxLocals" phase="start" num="68"> 8392 <synopsis>Get Max Locals</synopsis> 8393 <description> 8394 For the method indicated by <code>method</code>, 8395 return the number of local variable slots used by the method, 8396 including the local variables used to pass parameters to the 8397 method on its invocation. 8398 <p/> 8399 See <code>max_locals</code> in <vmspec chapter="4.7.3"/>. 8400 </description> 8401 <origin>jvmdi</origin> 8402 <capabilities> 8403 </capabilities> 8404 <parameters> 8405 <param id="klass"> 8406 <jclass method="method"/> 8407 <description> 8408 The class to query. 8409 </description> 8410 </param> 8411 <param id="method"> 8412 <jmethodID class="klass" native="error"/> 8413 <description> 8414 The method to query. 8415 </description> 8416 </param> 8417 <param id="max_ptr"> 8418 <outptr><jint/></outptr> 8419 <description> 8420 On return, points to the maximum number of local slots 8421 </description> 8422 </param> 8423 </parameters> 8424 <errors> 8425 </errors> 8426 </function> 8427 8428 <function id="GetArgumentsSize" phase="start" num="69"> 8429 <synopsis>Get Arguments Size</synopsis> 8430 <description> 8431 For the method indicated by <code>method</code>, 8432 return via <code>max_ptr</code> the number of local variable slots used 8433 by the method's arguments. 8434 Note that two-word arguments use two slots. 8435 </description> 8436 <origin>jvmdi</origin> 8437 <capabilities> 8438 </capabilities> 8439 <parameters> 8440 <param id="klass"> 8441 <jclass method="method"/> 8442 <description> 8443 The class to query. 8444 </description> 8445 </param> 8446 <param id="method"> 8447 <jmethodID class="klass" native="error"/> 8448 <description> 8449 The method to query. 8450 </description> 8451 </param> 8452 <param id="size_ptr"> 8453 <outptr><jint/></outptr> 8454 <description> 8455 On return, points to the number of argument slots 8456 </description> 8457 </param> 8458 </parameters> 8459 <errors> 8460 </errors> 8461 </function> 8462 8463 <function id="GetLineNumberTable" phase="start" num="70"> 8464 <synopsis>Get Line Number Table</synopsis> 8465 <typedef id="jvmtiLineNumberEntry" label="Line number table entry"> 8466 <field id="start_location"> 8467 <jlocation/> 8468 <description> 8469 the <datalink id="jlocation"></datalink> where the line begins 8470 </description> 8471 </field> 8472 <field id="line_number"> 8473 <jint/> 8474 <description> 8475 the line number 8476 </description> 8477 </field> 8478 </typedef> 8479 <description> 8480 For the method indicated by <code>method</code>, 8481 return a table of source line number entries. The size of the table is 8482 returned via <code>entry_count_ptr</code> and the table itself is 8483 returned via <code>table_ptr</code>. 8484 </description> 8485 <origin>jvmdi</origin> 8486 <capabilities> 8487 <required id="can_get_line_numbers"></required> 8488 </capabilities> 8489 <parameters> 8490 <param id="klass"> 8491 <jclass method="method"/> 8492 <description> 8493 The class to query. 8494 </description> 8495 </param> 8496 <param id="method"> 8497 <jmethodID class="klass" native="error"/> 8498 <description> 8499 The method to query. 8500 </description> 8501 </param> 8502 <param id="entry_count_ptr"> 8503 <outptr><jint/></outptr> 8504 <description> 8505 On return, points to the number of entries in the table 8506 </description> 8507 </param> 8508 <param id="table_ptr"> 8509 <allocbuf outcount="entry_count_ptr"><struct>jvmtiLineNumberEntry</struct></allocbuf> 8510 <description> 8511 On return, points to the line number table pointer. 8512 </description> 8513 </param> 8514 </parameters> 8515 <errors> 8516 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 8517 Class information does not include line numbers. 8518 </error> 8519 </errors> 8520 </function> 8521 8522 <function id="GetMethodLocation" phase="start" num="71"> 8523 <synopsis>Get Method Location</synopsis> 8524 <description> 8525 For the method indicated by <code>method</code>, 8526 return the beginning and ending addresses through 8527 <code>start_location_ptr</code> and <code>end_location_ptr</code>. In a 8528 conventional byte code indexing scheme, 8529 <code>start_location_ptr</code> will always point to zero 8530 and <code>end_location_ptr</code> 8531 will always point to the byte code count minus one. 8532 </description> 8533 <origin>jvmdi</origin> 8534 <capabilities> 8535 </capabilities> 8536 <parameters> 8537 <param id="klass"> 8538 <jclass method="method"/> 8539 <description> 8540 The class to query. 8541 </description> 8542 </param> 8543 <param id="method"> 8544 <jmethodID class="klass" native="error"/> 8545 <description> 8546 The method to query. 8547 </description> 8548 </param> 8549 <param id="start_location_ptr"> 8550 <outptr><jlocation/></outptr> 8551 <description> 8552 On return, points to the first location, or 8553 <code>-1</code> if location information is not available. 8554 If the information is available and 8555 <functionlink id="GetJLocationFormat"></functionlink> 8556 returns <datalink id="JVMTI_JLOCATION_JVMBCI"></datalink> 8557 then this will always be zero. 8558 </description> 8559 </param> 8560 <param id="end_location_ptr"> 8561 <outptr><jlocation/></outptr> 8562 <description> 8563 On return, points to the last location, 8564 or <code>-1</code> if location information is not available. 8565 </description> 8566 </param> 8567 </parameters> 8568 <errors> 8569 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 8570 Class information does not include method sizes. 8571 </error> 8572 </errors> 8573 </function> 8574 8575 <function id="GetLocalVariableTable" num="72"> 8576 <synopsis>Get Local Variable Table</synopsis> 8577 <typedef id="jvmtiLocalVariableEntry" label="Local variable table entry"> 8578 <field id="start_location"> 8579 <jlocation/> 8580 <description> 8581 The code array index where the local variable is first valid 8582 (that is, where it must have a value). 8583 </description> 8584 </field> 8585 <field id="length"> 8586 <jint/> 8587 <description> 8588 The length of the valid section for this local variable. 8589 The last code array index where the local variable is valid 8590 is <code>start_location + length</code>. 8591 </description> 8592 </field> 8593 <field id="name"> 8594 <allocfieldbuf><char/></allocfieldbuf> 8595 <description> 8596 The local variable name, encoded as a 8597 <internallink id="mUTF">modified UTF-8</internallink> string. 8598 </description> 8599 </field> 8600 <field id="signature"> 8601 <allocfieldbuf><char/></allocfieldbuf> 8602 <description> 8603 The local variable's type signature, encoded as a 8604 <internallink id="mUTF">modified UTF-8</internallink> string. 8605 The signature format is the same as that defined in 8606 <vmspec chapter="4.3.2"/>. 8607 </description> 8608 </field> 8609 <field id="generic_signature"> 8610 <allocfieldbuf><char/></allocfieldbuf> 8611 <description> 8612 The local variable's generic signature, encoded as a 8613 <internallink id="mUTF">modified UTF-8</internallink> string. 8614 The value of this field will be <code>NULL</code> for any local 8615 variable which does not have a generic type. 8616 </description> 8617 </field> 8618 <field id="slot"> 8619 <jint/> 8620 <description> 8621 The local variable's slot. See <internallink id="local">Local Variables</internallink>. 8622 </description> 8623 </field> 8624 </typedef> 8625 <description> 8626 Return local variable information. 8627 </description> 8628 <origin>jvmdiClone</origin> 8629 <capabilities> 8630 <required id="can_access_local_variables"></required> 8631 </capabilities> 8632 <parameters> 8633 <param id="method"> 8634 <jmethodID native="error"/> 8635 <description> 8636 The method to query. 8637 </description> 8638 </param> 8639 <param id="entry_count_ptr"> 8640 <outptr><jint/></outptr> 8641 <description> 8642 On return, points to the number of entries in the table 8643 </description> 8644 </param> 8645 <param id="table_ptr"> 8646 <allocbuf outcount="entry_count_ptr"><struct>jvmtiLocalVariableEntry</struct></allocbuf> 8647 <description> 8648 On return, points to an array of local variable table entries. 8649 </description> 8650 </param> 8651 </parameters> 8652 <errors> 8653 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 8654 Class information does not include local variable 8655 information. 8656 </error> 8657 </errors> 8658 </function> 8659 8660 <function id="GetBytecodes" phase="start" num="75"> 8661 <synopsis>Get Bytecodes</synopsis> 8662 <description> 8663 For the method indicated by <code>method</code>, 8664 return the byte codes that implement the method. The number of 8665 bytecodes is returned via <code>bytecode_count_ptr</code>. The byte codes 8666 themselves are returned via <code>bytecodes_ptr</code>. 8667 </description> 8668 <origin>jvmdi</origin> 8669 <capabilities> 8670 <required id="can_get_bytecodes"></required> 8671 </capabilities> 8672 <parameters> 8673 <param id="klass"> 8674 <jclass method="method"/> 8675 <description> 8676 The class to query. 8677 </description> 8678 </param> 8679 <param id="method"> 8680 <jmethodID class="klass" native="error"/> 8681 <description> 8682 The method to query. 8683 </description> 8684 </param> 8685 <param id="bytecode_count_ptr"> 8686 <outptr><jint/></outptr> 8687 <description> 8688 On return, points to the length of the byte code array 8689 </description> 8690 </param> 8691 <param id="bytecodes_ptr"> 8692 <allocbuf outcount="bytecode_count_ptr"><uchar/></allocbuf> 8693 <description> 8694 On return, points to the pointer to the byte code array 8695 </description> 8696 </param> 8697 </parameters> 8698 <errors> 8699 </errors> 8700 </function> 8701 8702 <function id="IsMethodNative" phase="start" num="76"> 8703 <synopsis>Is Method Native</synopsis> 8704 <description> 8705 For the method indicated by <code>method</code>, return a 8706 value indicating whether the method is native via <code>is_native_ptr</code> 8707 </description> 8708 <origin>jvmdi</origin> 8709 <capabilities> 8710 </capabilities> 8711 <parameters> 8712 <param id="klass"> 8713 <jclass method="method"/> 8714 <description> 8715 The class to query. 8716 </description> 8717 </param> 8718 <param id="method"> 8719 <jmethodID class="klass"/> 8720 <description> 8721 The method to query. 8722 </description> 8723 </param> 8724 <param id="is_native_ptr"> 8725 <outptr><jboolean/></outptr> 8726 <description> 8727 On return, points to the boolean result of this function. 8728 </description> 8729 </param> 8730 </parameters> 8731 <errors> 8732 </errors> 8733 </function> 8734 8735 <function id="IsMethodSynthetic" phase="start" num="77"> 8736 <synopsis>Is Method Synthetic</synopsis> 8737 <description> 8738 For the method indicated by <code>method</code>, return a 8739 value indicating whether the method is synthetic via <code>is_synthetic_ptr</code>. 8740 Synthetic methods are generated by the compiler but not present in the 8741 original source code. 8742 </description> 8743 <origin>jvmdi</origin> 8744 <capabilities> 8745 <required id="can_get_synthetic_attribute"></required> 8746 </capabilities> 8747 <parameters> 8748 <param id="klass"> 8749 <jclass method="method"/> 8750 <description> 8751 The class to query. 8752 </description> 8753 </param> 8754 <param id="method"> 8755 <jmethodID class="klass"/> 8756 <description> 8757 The method to query. 8758 </description> 8759 </param> 8760 <param id="is_synthetic_ptr"> 8761 <outptr><jboolean/></outptr> 8762 <description> 8763 On return, points to the boolean result of this function. 8764 </description> 8765 </param> 8766 </parameters> 8767 <errors> 8768 </errors> 8769 </function> 8770 8771 <function id="IsMethodObsolete" phase="start" num="91"> 8772 <synopsis>Is Method Obsolete</synopsis> 8773 <description> 8774 Determine if a method ID refers to an 8775 <internallink id="obsoleteMethods">obsolete</internallink> 8776 method version. 8777 </description> 8778 <origin>jvmdi</origin> 8779 <capabilities> 8780 </capabilities> 8781 <parameters> 8782 <param id="klass"> 8783 <jclass method="method"/> 8784 <description> 8785 The class to query. 8786 </description> 8787 </param> 8788 <param id="method"> 8789 <jmethodID class="klass"/> 8790 <description> 8791 The method ID to query. 8792 </description> 8793 </param> 8794 <param id="is_obsolete_ptr"> 8795 <outptr><jboolean/></outptr> 8796 <description> 8797 On return, points to the boolean result of this function. 8798 </description> 8799 </param> 8800 </parameters> 8801 <errors> 8802 </errors> 8803 </function> 8804 8805 <function id="SetNativeMethodPrefix" jkernel="yes" phase="any" num="73" since="1.1"> 8806 <synopsis>Set Native Method Prefix</synopsis> 8807 <description> 8808 This function modifies the failure handling of 8809 native method resolution by allowing retry 8810 with a prefix applied to the name. 8811 When used with the 8812 <eventlink id="ClassFileLoadHook">ClassFileLoadHook 8813 event</eventlink>, it enables native methods to be 8814 <internallink id="bci">instrumented</internallink>. 8815 <p/> 8816 Since native methods cannot be directly instrumented 8817 (they have no bytecodes), they must be wrapped with 8818 a non-native method which can be instrumented. 8819 For example, if we had: 8820 <example> 8821 native boolean foo(int x);</example> 8822 <p/> 8823 We could transform the class file (with the 8824 ClassFileLoadHook event) so that this becomes: 8825 <example> 8826 boolean foo(int x) { 8827 <i>... record entry to foo ...</i> 8828 return wrapped_foo(x); 8829 } 8830 8831 native boolean wrapped_foo(int x);</example> 8832 <p/> 8833 Where foo becomes a wrapper for the actual native method 8834 with the appended prefix "wrapped_". Note that 8835 "wrapped_" would be a poor choice of prefix since it 8836 might conceivably form the name of an existing method 8837 thus something like "$$$MyAgentWrapped$$$_" would be 8838 better but would make these examples less readable. 8839 <p/> 8840 The wrapper will allow data to be collected on the native 8841 method call, but now the problem becomes linking up the 8842 wrapped method with the native implementation. 8843 That is, the method <code>wrapped_foo</code> needs to be 8844 resolved to the native implementation of <code>foo</code>, 8845 which might be: 8846 <example> 8847 Java_somePackage_someClass_foo(JNIEnv* env, jint x)</example> 8848 <p/> 8849 This function allows the prefix to be specified and the 8850 proper resolution to occur. 8851 Specifically, when the standard resolution fails, the 8852 resolution is retried taking the prefix into consideration. 8853 There are two ways that resolution occurs, explicit 8854 resolution with the JNI function <code>RegisterNatives</code> 8855 and the normal automatic resolution. For 8856 <code>RegisterNatives</code>, the VM will attempt this 8857 association: 8858 <example> 8859 method(foo) -> nativeImplementation(foo)</example> 8860 <p/> 8861 When this fails, the resolution will be retried with 8862 the specified prefix prepended to the method name, 8863 yielding the correct resolution: 8864 <example> 8865 method(wrapped_foo) -> nativeImplementation(foo)</example> 8866 <p/> 8867 For automatic resolution, the VM will attempt: 8868 <example> 8869 method(wrapped_foo) -> nativeImplementation(wrapped_foo)</example> 8870 <p/> 8871 When this fails, the resolution will be retried with 8872 the specified prefix deleted from the implementation name, 8873 yielding the correct resolution: 8874 <example> 8875 method(wrapped_foo) -> nativeImplementation(foo)</example> 8876 <p/> 8877 Note that since the prefix is only used when standard 8878 resolution fails, native methods can be wrapped selectively. 8879 <p/> 8880 Since each <jvmti/> environment is independent and 8881 can do its own transformation of the bytecodes, more 8882 than one layer of wrappers may be applied. Thus each 8883 environment needs its own prefix. Since transformations 8884 are applied in order, the prefixes, if applied, will 8885 be applied in the same order. 8886 The order of transformation application is described in 8887 the <eventlink id="ClassFileLoadHook"/> event. 8888 Thus if three environments applied 8889 wrappers, <code>foo</code> might become 8890 <code>$env3_$env2_$env1_foo</code>. But if, say, 8891 the second environment did not apply a wrapper to 8892 <code>foo</code> it would be just 8893 <code>$env3_$env1_foo</code>. To be able to 8894 efficiently determine the sequence of prefixes, 8895 an intermediate prefix is only applied if its non-native 8896 wrapper exists. Thus, in the last example, even though 8897 <code>$env1_foo</code> is not a native method, the 8898 <code>$env1_</code> prefix is applied since 8899 <code>$env1_foo</code> exists. 8900 <p/> 8901 Since the prefixes are used at resolution time 8902 and since resolution may be arbitrarily delayed, a 8903 native method prefix must remain set as long as there 8904 are corresponding prefixed native methods. 8905 </description> 8906 <origin>new</origin> 8907 <capabilities> 8908 <required id="can_set_native_method_prefix"></required> 8909 </capabilities> 8910 <parameters> 8911 <param id="prefix"> 8912 <inbuf> 8913 <char/> 8914 <nullok> 8915 any existing prefix in this environment is cancelled 8916 </nullok> 8917 </inbuf> 8918 <description> 8919 The prefix to apply, encoded as a 8920 <internallink id="mUTF">modified UTF-8</internallink> string. 8921 </description> 8922 </param> 8923 </parameters> 8924 <errors> 8925 </errors> 8926 </function> 8927 8928 <function id="SetNativeMethodPrefixes" jkernel="yes" phase="any" num="74" since="1.1"> 8929 <synopsis>Set Native Method Prefixes</synopsis> 8930 <description> 8931 For a normal agent, <functionlink id="SetNativeMethodPrefix"/> 8932 will provide all needed native method prefixing. 8933 For a meta-agent that performs multiple independent class 8934 file transformations (for example as a proxy for another 8935 layer of agents) this function allows each transformation 8936 to have its own prefix. 8937 The prefixes are applied in the order supplied and are 8938 processed in the same manor as described for the 8939 application of prefixes from multiple <jvmti/> environments 8940 in <functionlink id="SetNativeMethodPrefix"/>. 8941 <p/> 8942 Any previous prefixes are replaced. Thus, calling this 8943 function with a <paramlink id="prefix_count"/> of <code>0</code> 8944 disables prefixing in this environment. 8945 <p/> 8946 <functionlink id="SetNativeMethodPrefix"/> and this function 8947 are the two ways to set the prefixes. 8948 Calling <code>SetNativeMethodPrefix</code> with 8949 a prefix is the same as calling this function with 8950 <paramlink id="prefix_count"/> of <code>1</code>. 8951 Calling <code>SetNativeMethodPrefix</code> with 8952 <code>NULL</code> is the same as calling this function with 8953 <paramlink id="prefix_count"/> of <code>0</code>. 8954 </description> 8955 <origin>new</origin> 8956 <capabilities> 8957 <required id="can_set_native_method_prefix"></required> 8958 </capabilities> 8959 <parameters> 8960 <param id="prefix_count"> 8961 <jint min="0"/> 8962 <description> 8963 The number of prefixes to apply. 8964 </description> 8965 </param> 8966 <param id="prefixes"> 8967 <agentbuf> 8968 <char/> 8969 </agentbuf> 8970 <description> 8971 The prefixes to apply for this environment, each encoded as a 8972 <internallink id="mUTF">modified UTF-8</internallink> string. 8973 </description> 8974 </param> 8975 </parameters> 8976 <errors> 8977 </errors> 8978 </function> 8979 8980 </category> 8981 8982 <category id="RawMonitors" label="Raw Monitor"> 8983 8984 <function id="CreateRawMonitor" phase="onload" callbacksafe="safe" num="31"> 8985 <synopsis>Create Raw Monitor</synopsis> 8986 <description> 8987 Create a raw monitor. 8988 </description> 8989 <origin>jvmdi</origin> 8990 <capabilities> 8991 </capabilities> 8992 <parameters> 8993 <param id="name"> 8994 <inbuf><char/></inbuf> 8995 <description> 8996 A name to identify the monitor, encoded as a 8997 <internallink id="mUTF">modified UTF-8</internallink> string. 8998 </description> 8999 </param> 9000 <param id="monitor_ptr"> 9001 <outptr><jrawMonitorID/></outptr> 9002 <description> 9003 On return, points to the created monitor. 9004 </description> 9005 </param> 9006 </parameters> 9007 <errors> 9008 </errors> 9009 </function> 9010 9011 <function id="DestroyRawMonitor" phase="onload" callbacksafe="safe" num="32"> 9012 <synopsis>Destroy Raw Monitor</synopsis> 9013 <description> 9014 Destroy the raw monitor. 9015 If the monitor being destroyed has been entered by this thread, it will be 9016 exited before it is destroyed. 9017 If the monitor being destroyed has been entered by another thread, 9018 an error will be returned and the monitor will not be destroyed. 9019 </description> 9020 <origin>jvmdi</origin> 9021 <capabilities> 9022 </capabilities> 9023 <parameters> 9024 <param id="monitor"> 9025 <jrawMonitorID/> 9026 <description> 9027 The monitor 9028 </description> 9029 </param> 9030 </parameters> 9031 <errors> 9032 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 9033 Not monitor owner 9034 </error> 9035 </errors> 9036 </function> 9037 9038 <function id="RawMonitorEnter" phase="any" callbacksafe="safe" impl="innative notrace" num="33"> 9039 <synopsis>Raw Monitor Enter</synopsis> 9040 <description> 9041 Gain exclusive ownership of a raw monitor. 9042 The same thread may enter a monitor more then once. 9043 The thread must 9044 <functionlink id="RawMonitorExit">exit</functionlink> 9045 the monitor the same number of times as it is entered. 9046 If a monitor is entered during <code>OnLoad</code> (before attached threads exist) 9047 and has not exited when attached threads come into existence, the enter 9048 is considered to have occurred on the main thread. 9049 </description> 9050 <origin>jvmdi</origin> 9051 <capabilities> 9052 </capabilities> 9053 <parameters> 9054 <param id="monitor"> 9055 <jrawMonitorID/> 9056 <description> 9057 The monitor 9058 </description> 9059 </param> 9060 </parameters> 9061 <errors> 9062 </errors> 9063 </function> 9064 9065 <function id="RawMonitorExit" phase="any" callbacksafe="safe" impl="innative notrace" num="34"> 9066 <synopsis>Raw Monitor Exit</synopsis> 9067 <description> 9068 Release exclusive ownership of a raw monitor. 9069 </description> 9070 <origin>jvmdi</origin> 9071 <capabilities> 9072 </capabilities> 9073 <parameters> 9074 <param id="monitor"> 9075 <jrawMonitorID/> 9076 <description> 9077 The monitor 9078 </description> 9079 </param> 9080 </parameters> 9081 <errors> 9082 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 9083 Not monitor owner 9084 </error> 9085 </errors> 9086 </function> 9087 9088 <function id="RawMonitorWait" phase="any" callbacksafe="safe" impl="innative notrace" num="35"> 9089 <synopsis>Raw Monitor Wait</synopsis> 9090 <description> 9091 Wait for notification of the raw monitor. 9092 <p/> 9093 Causes the current thread to wait until either another thread calls 9094 <functionlink id="RawMonitorNotify"/> or 9095 <functionlink id="RawMonitorNotifyAll"/> 9096 for the specified raw monitor, or the specified 9097 <paramlink id="millis">timeout</paramlink> 9098 has elapsed. 9099 </description> 9100 <origin>jvmdi</origin> 9101 <capabilities> 9102 </capabilities> 9103 <parameters> 9104 <param id="monitor"> 9105 <jrawMonitorID/> 9106 <description> 9107 The monitor 9108 </description> 9109 </param> 9110 <param id="millis"> 9111 <jlong/> 9112 <description> 9113 The timeout, in milliseconds. If the timeout is 9114 zero, then real time is not taken into consideration 9115 and the thread simply waits until notified. 9116 </description> 9117 </param> 9118 </parameters> 9119 <errors> 9120 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 9121 Not monitor owner 9122 </error> 9123 <error id="JVMTI_ERROR_INTERRUPT"> 9124 Wait was interrupted, try again 9125 </error> 9126 </errors> 9127 </function> 9128 9129 <function id="RawMonitorNotify" phase="any" callbacksafe="safe" impl="notrace" num="36"> 9130 <synopsis>Raw Monitor Notify</synopsis> 9131 <description> 9132 Notify a single thread waiting on the raw monitor. 9133 </description> 9134 <origin>jvmdi</origin> 9135 <capabilities> 9136 </capabilities> 9137 <parameters> 9138 <param id="monitor"> 9139 <jrawMonitorID/> 9140 <description> 9141 The monitor 9142 </description> 9143 </param> 9144 </parameters> 9145 <errors> 9146 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 9147 Not monitor owner 9148 </error> 9149 </errors> 9150 </function> 9151 9152 <function id="RawMonitorNotifyAll" phase="any" callbacksafe="safe" impl="notrace" num="37"> 9153 <synopsis>Raw Monitor Notify All</synopsis> 9154 <description> 9155 Notify all threads waiting on the raw monitor. 9156 </description> 9157 <origin>jvmdi</origin> 9158 <capabilities> 9159 </capabilities> 9160 <parameters> 9161 <param id="monitor"> 9162 <jrawMonitorID/> 9163 <description> 9164 The monitor 9165 </description> 9166 </param> 9167 </parameters> 9168 <errors> 9169 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 9170 Not monitor owner 9171 </error> 9172 </errors> 9173 </function> 9174 9175 <elide> 9176 <function id="GetRawMonitorUse" num="118"> 9177 <synopsis>Get Raw Monitor Use</synopsis> 9178 <description> 9179 The fields of the <functionlink id="jvmtiMonitorUsage"></functionlink> structure 9180 are filled in with information about usage of the raw monitor. 9181 </description> 9182 <origin>new</origin> 9183 <capabilities> 9184 <required id="can_get_raw_monitor_usage"></required> 9185 </capabilities> 9186 <parameters> 9187 <param id="monitor"> 9188 <jrawMonitorID/> 9189 <description> 9190 the raw monitor to query. 9191 </description> 9192 </param> 9193 <param id="info_ptr"> 9194 <outptr><struct>jvmtiMonitorUsage</struct></outptr> 9195 <description> 9196 On return, filled with monitor information for the 9197 specified raw monitor. 9198 </description> 9199 </param> 9200 </parameters> 9201 <errors> 9202 </errors> 9203 </function> 9204 9205 <function id="GetRawMonitors" num="119"> 9206 <synopsis>Get Raw Monitors</synopsis> 9207 <description> 9208 Return the list of raw monitors. 9209 <p/> 9210 Note: details about each monitor can be examined with 9211 <functionlink id="GetRawMonitorUse"></functionlink>. 9212 </description> 9213 <origin>new</origin> 9214 <capabilities> 9215 <required id="can_get_raw_monitor_usage"></required> 9216 </capabilities> 9217 <parameters> 9218 <param id="monitorCnt"> 9219 <outptr><jint/></outptr> 9220 <description> 9221 On return, pointer to the number 9222 of monitors returned in <code>monitors_ptr</code>. 9223 </description> 9224 </param> 9225 <param id="monitors_ptr"> 9226 <allocbuf outcount="monitorCnt"><jrawMonitorID/></allocbuf> 9227 <description> 9228 On return, pointer to the monitor list. 9229 </description> 9230 </param> 9231 </parameters> 9232 <errors> 9233 </errors> 9234 </function> 9235 </elide> 9236 </category> 9237 9238 <category id="jniIntercept" label="JNI Function Interception"> 9239 9240 <intro> 9241 Provides the ability to intercept and resend 9242 Java Native Interface (JNI) function calls 9243 by manipulating the JNI function table. 9244 See <externallink id="jni/functions.html">JNI 9245 Functions</externallink> in the <i>Java Native Interface Specification</i>. 9246 <p/> 9247 The following example illustrates intercepting the 9248 <code>NewGlobalRef</code> JNI call in order to count reference 9249 creation. 9250 <example> 9251 JNIEnv original_jni_Functions; 9252 JNIEnv redirected_jni_Functions; 9253 int my_global_ref_count = 0; 9254 9255 jobject 9256 MyNewGlobalRef(JNIEnv *jni_env, jobject lobj) { 9257 ++my_global_ref_count; 9258 return originalJNIFunctions->NewGlobalRef(env, lobj); 9259 } 9260 9261 void 9262 myInit() { 9263 jvmtiError err; 9264 9265 err = (*jvmti_env)->GetJNIFunctionTable(jvmti_env, &original_jni_Functions); 9266 if (err != JVMTI_ERROR_NONE) { 9267 die(); 9268 } 9269 err = (*jvmti_env)->GetJNIFunctionTable(jvmti_env, &redirected_jni_Functions); 9270 if (err != JVMTI_ERROR_NONE) { 9271 die(); 9272 } 9273 redirectedJNIFunctions->NewGlobalRef = MyNewGlobalRef; 9274 err = (*jvmti_env)->SetJNIFunctionTable(jvmti_env, redirected_jni_Functions); 9275 if (err != JVMTI_ERROR_NONE) { 9276 die(); 9277 } 9278 } 9279 </example> 9280 Sometime after <code>myInit</code> is called the user's JNI 9281 code is executed which makes the call to create a new global 9282 reference. Instead of going to the normal JNI implementation 9283 the call goes to <code>myNewGlobalRef</code>. Note that a 9284 copy of the original function table is kept so that the normal 9285 JNI function can be called after the data is collected. 9286 Note also that any JNI functions which are not overwritten 9287 will behave normally. 9288 <todo> 9289 check that the example compiles and executes. 9290 </todo> 9291 </intro> 9292 9293 <function id="SetJNIFunctionTable" phase="start" num="120"> 9294 <synopsis>Set JNI Function Table</synopsis> 9295 <description> 9296 Set the JNI function table 9297 in all current and future JNI environments. 9298 As a result, all future JNI calls are directed to the specified functions. 9299 Use <functionlink id="GetJNIFunctionTable"></functionlink> to get the 9300 function table to pass to this function. 9301 For this function to take effect the the updated table entries must be 9302 used by the JNI clients. 9303 Since the table is defined <code>const</code> some compilers may optimize 9304 away the access to the table, thus preventing this function from taking 9305 effect. 9306 The table is copied--changes to the local copy of the 9307 table have no effect. 9308 This function affects only the function table, all other aspects of the environment are 9309 unaffected. 9310 See the examples <internallink id="jniIntercept">above</internallink>. 9311 </description> 9312 <origin>new</origin> 9313 <capabilities> 9314 </capabilities> 9315 <parameters> 9316 <param id="function_table"> 9317 <inptr> 9318 <struct>jniNativeInterface</struct> 9319 </inptr> 9320 <description> 9321 Points to the new JNI function table. 9322 </description> 9323 </param> 9324 </parameters> 9325 <errors> 9326 </errors> 9327 </function> 9328 9329 <function id="GetJNIFunctionTable" phase="start" num="121"> 9330 <synopsis>Get JNI Function Table</synopsis> 9331 <description> 9332 Get the JNI function table. 9333 The JNI function table is copied into allocated memory. 9334 If <functionlink id="SetJNIFunctionTable"></functionlink> 9335 has been called, the modified (not the original) function 9336 table is returned. 9337 Only the function table is copied, no other aspects of the environment 9338 are copied. 9339 See the examples <internallink id="jniIntercept">above</internallink>. 9340 </description> 9341 <origin>new</origin> 9342 <capabilities> 9343 </capabilities> 9344 <parameters> 9345 <param id="function_table"> 9346 <allocbuf> 9347 <struct>jniNativeInterface</struct> 9348 </allocbuf> 9349 <description> 9350 On return, <code>*function_table</code> 9351 points a newly allocated copy of the JNI function table. 9352 </description> 9353 </param> 9354 </parameters> 9355 <errors> 9356 </errors> 9357 </function> 9358 9359 </category> 9360 9361 <category id="eventManagement" label="Event Management"> 9362 9363 <function id="SetEventCallbacks" jkernel="yes" phase="onload" num="122"> 9364 <synopsis>Set Event Callbacks</synopsis> 9365 <description> 9366 Set the functions to be called for each event. 9367 The callbacks are specified by supplying a replacement function table. 9368 The function table is copied--changes to the local copy of the 9369 table have no effect. 9370 This is an atomic action, all callbacks are set at once. 9371 No events are sent before this function is called. 9372 When an entry is <code>NULL</code> or when the event is beyond 9373 <paramlink id="size_of_callbacks"></paramlink> no event is sent. 9374 Details on events are 9375 described <internallink id="EventSection">later</internallink> in this document. 9376 An event must be enabled and have a callback in order to be 9377 sent--the order in which this function and 9378 <functionlink id="SetEventNotificationMode"></functionlink> 9379 are called does not affect the result. 9380 </description> 9381 <origin>new</origin> 9382 <capabilities> 9383 </capabilities> 9384 <parameters> 9385 <param id="callbacks"> 9386 <inptr> 9387 <struct>jvmtiEventCallbacks</struct> 9388 <nullok>remove the existing callbacks</nullok> 9389 </inptr> 9390 <description> 9391 The new event callbacks. 9392 </description> 9393 </param> 9394 <param id="size_of_callbacks"> 9395 <jint min="0"/> 9396 <description> 9397 <code>sizeof(jvmtiEventCallbacks)</code>--for version 9398 compatibility. 9399 </description> 9400 </param> 9401 </parameters> 9402 <errors> 9403 </errors> 9404 </function> 9405 9406 <function id="SetEventNotificationMode" jkernel="yes" phase="onload" num="2"> 9407 <synopsis>Set Event Notification Mode</synopsis> 9408 <description> 9409 Control the generation of events. 9410 <constants id="jvmtiEventMode" label="Event Enable/Disable" kind="enum"> 9411 <constant id="JVMTI_ENABLE" num="1"> 9412 If <paramlink id="mode"></paramlink> is <code>JVMTI_ENABLE</code>, 9413 the event <paramlink id="event_type"></paramlink> will be enabled 9414 </constant> 9415 <constant id="JVMTI_DISABLE" num="0"> 9416 If <paramlink id="mode"></paramlink> is <code>JVMTI_DISABLE</code>, 9417 the event <paramlink id="event_type"></paramlink> will be disabled 9418 </constant> 9419 </constants> 9420 If <code>event_thread</code> is <code>NULL</code>, 9421 the event is enabled or disabled globally; otherwise, it is 9422 enabled or disabled for a particular thread. 9423 An event is generated for 9424 a particular thread if it is enabled either at the thread or global 9425 levels. 9426 <p/> 9427 See <internallink id="EventIndex">below</internallink> for information on specific events. 9428 <p/> 9429 The following events cannot be controlled at the thread 9430 level through this function. 9431 <ul> 9432 <li><eventlink id="VMInit"></eventlink></li> 9433 <li><eventlink id="VMStart"></eventlink></li> 9434 <li><eventlink id="VMDeath"></eventlink></li> 9435 <li><eventlink id="ThreadStart"></eventlink></li> 9436 <li><eventlink id="CompiledMethodLoad"></eventlink></li> 9437 <li><eventlink id="CompiledMethodUnload"></eventlink></li> 9438 <li><eventlink id="DynamicCodeGenerated"></eventlink></li> 9439 <li><eventlink id="DataDumpRequest"></eventlink></li> 9440 </ul> 9441 <p/> 9442 Initially, no events are enabled at either the thread level 9443 or the global level. 9444 <p/> 9445 Any needed capabilities (see Event Enabling Capabilities below) must be possessed 9446 before calling this function. 9447 <p/> 9448 Details on events are 9449 described <internallink id="EventSection">below</internallink>. 9450 </description> 9451 <origin>jvmdiClone</origin> 9452 <eventcapabilities></eventcapabilities> 9453 <parameters> 9454 <param id="mode"> 9455 <enum>jvmtiEventMode</enum> 9456 <description> 9457 <code>JVMTI_ENABLE</code> or <code>JVMTI_DISABLE</code> 9458 </description> 9459 </param> 9460 <param id="event_type"> 9461 <enum>jvmtiEvent</enum> 9462 <description> 9463 the event to control 9464 </description> 9465 </param> 9466 <param id="event_thread"> 9467 <ptrtype> 9468 <jthread impl="noconvert"/> 9469 <nullok>event is controlled at the global level</nullok> 9470 </ptrtype> 9471 <description> 9472 The thread to control 9473 </description> 9474 </param> 9475 <param id="..."> 9476 <varargs/> 9477 <description> 9478 for future expansion 9479 </description> 9480 </param> 9481 </parameters> 9482 <errors> 9483 <error id="JVMTI_ERROR_INVALID_THREAD"> 9484 <paramlink id="event_thread"/> is non-<code>NULL</code> and is not a valid thread. 9485 </error> 9486 <error id="JVMTI_ERROR_THREAD_NOT_ALIVE"> 9487 <paramlink id="event_thread"/> is non-<code>NULL</code> and is not live (has not been started or is now dead). 9488 </error> 9489 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 9490 thread level control was attempted on events which do not 9491 permit thread level control. 9492 </error> 9493 <error id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY"> 9494 The Required Event Enabling Capability is not possessed. 9495 </error> 9496 </errors> 9497 </function> 9498 9499 <function id="GenerateEvents" num="123"> 9500 <synopsis>Generate Events</synopsis> 9501 <description> 9502 Generate events to represent the current state of the VM. 9503 For example, if <paramlink id="event_type"/> is 9504 <code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code>, 9505 a <eventlink id="CompiledMethodLoad"></eventlink> event will be 9506 sent for each currently compiled method. 9507 Methods that were loaded and now have been unloaded are not sent. 9508 The history of what events have previously been sent does not 9509 effect what events are sent by this function--for example, 9510 all currently compiled methods 9511 will be sent each time this function is called. 9512 <p/> 9513 This function is useful when 9514 events may have been missed due to the agent attaching after program 9515 execution begins; this function generates the missed events. 9516 <p/> 9517 Attempts to execute Java programming language code or 9518 JNI functions may be paused until this function returns - 9519 so neither should be called from the thread sending the event. 9520 This function returns only after the missed events have been 9521 sent, processed and have returned. 9522 The event may be sent on a different thread than the thread 9523 on which the event occurred. 9524 The callback for the event must be set with 9525 <functionlink id="SetEventCallbacks"></functionlink> 9526 and the event must be enabled with 9527 <functionlink id="SetEventNotificationMode"></functionlink> 9528 or the events will not occur. 9529 If the VM no longer has the information to generate some or 9530 all of the requested events, the events are simply not sent - 9531 no error is returned. 9532 <p/> 9533 Only the following events are supported: 9534 <ul> 9535 <li><eventlink id="CompiledMethodLoad"></eventlink></li> 9536 <li><eventlink id="DynamicCodeGenerated"></eventlink></li> 9537 </ul> 9538 </description> 9539 <origin>new</origin> 9540 <capabilities> 9541 <capability id="can_generate_compiled_method_load_events"></capability> 9542 </capabilities> 9543 <parameters> 9544 <param id="event_type"> 9545 <enum>jvmtiEvent</enum> 9546 <description> 9547 The type of event to generate. Must be one of these: 9548 <ul> 9549 <li><eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink></li> 9550 <li><eventlink id="DynamicCodeGenerated"><code>JVMTI_EVENT_DYNAMIC_CODE_GENERATED</code></eventlink></li> 9551 </ul> 9552 </description> 9553 </param> 9554 </parameters> 9555 <errors> 9556 <error id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY"> 9557 <paramlink id="event_type"/> is 9558 <eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink> 9559 and <fieldlink id="can_generate_compiled_method_load_events" struct="jvmtiCapabilities"></fieldlink> 9560 is <code>false</code>. 9561 </error> 9562 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 9563 <paramlink id="event_type"/> is other than 9564 <eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink> 9565 or <eventlink id="DynamicCodeGenerated"><code>JVMTI_EVENT_DYNAMIC_CODE_GENERATED</code></eventlink>. 9566 </error> 9567 </errors> 9568 </function> 9569 9570 </category> 9571 9572 <category id="extension" label="Extension Mechanism"> 9573 9574 <intro> 9575 These functions 9576 allow a <jvmti/> implementation to provide functions and events 9577 beyond those defined in this specification. 9578 <p/> 9579 Both extension functions and extension events have parameters 9580 each of which has a 'type' and 'kind' chosen from the following tables: 9581 9582 <constants id="jvmtiParamTypes" label="Extension Function/Event Parameter Types" kind="enum"> 9583 <constant id="JVMTI_TYPE_JBYTE" num="101"> 9584 Java programming language primitive type - <code>byte</code>. 9585 JNI type <code>jbyte</code>. 9586 </constant> 9587 <constant id="JVMTI_TYPE_JCHAR" num="102"> 9588 Java programming language primitive type - <code>char</code>. 9589 JNI type <code>jchar</code>. 9590 </constant> 9591 <constant id="JVMTI_TYPE_JSHORT" num="103"> 9592 Java programming language primitive type - <code>short</code>. 9593 JNI type <code>jshort</code>. 9594 </constant> 9595 <constant id="JVMTI_TYPE_JINT" num="104"> 9596 Java programming language primitive type - <code>int</code>. 9597 JNI type <datalink id="jint"></datalink>. 9598 </constant> 9599 <constant id="JVMTI_TYPE_JLONG" num="105"> 9600 Java programming language primitive type - <code>long</code>. 9601 JNI type <datalink id="jlong"></datalink>. 9602 </constant> 9603 <constant id="JVMTI_TYPE_JFLOAT" num="106"> 9604 Java programming language primitive type - <code>float</code>. 9605 JNI type <datalink id="jfloat"></datalink>. 9606 </constant> 9607 <constant id="JVMTI_TYPE_JDOUBLE" num="107"> 9608 Java programming language primitive type - <code>double</code>. 9609 JNI type <datalink id="jdouble"></datalink>. 9610 </constant> 9611 <constant id="JVMTI_TYPE_JBOOLEAN" num="108"> 9612 Java programming language primitive type - <code>boolean</code>. 9613 JNI type <datalink id="jboolean"></datalink>. 9614 </constant> 9615 <constant id="JVMTI_TYPE_JOBJECT" num="109"> 9616 Java programming language object type - <code>java.lang.Object</code>. 9617 JNI type <datalink id="jobject"></datalink>. 9618 Returned values are JNI local references and must be managed. 9619 </constant> 9620 <constant id="JVMTI_TYPE_JTHREAD" num="110"> 9621 Java programming language object type - <code>java.lang.Thread</code>. 9622 <jvmti/> type <datalink id="jthread"></datalink>. 9623 Returned values are JNI local references and must be managed. 9624 </constant> 9625 <constant id="JVMTI_TYPE_JCLASS" num="111"> 9626 Java programming language object type - <code>java.lang.Class</code>. 9627 JNI type <datalink id="jclass"></datalink>. 9628 Returned values are JNI local references and must be managed. 9629 </constant> 9630 <constant id="JVMTI_TYPE_JVALUE" num="112"> 9631 Union of all Java programming language primitive and object types - 9632 JNI type <datalink id="jvalue"></datalink>. 9633 Returned values which represent object types are JNI local references and must be managed. 9634 </constant> 9635 <constant id="JVMTI_TYPE_JFIELDID" num="113"> 9636 Java programming language field identifier - 9637 JNI type <datalink id="jfieldID"></datalink>. 9638 </constant> 9639 <constant id="JVMTI_TYPE_JMETHODID" num="114"> 9640 Java programming language method identifier - 9641 JNI type <datalink id="jmethodID"></datalink>. 9642 </constant> 9643 <constant id="JVMTI_TYPE_CCHAR" num="115"> 9644 C programming language type - <code>char</code>. 9645 </constant> 9646 <constant id="JVMTI_TYPE_CVOID" num="116"> 9647 C programming language type - <code>void</code>. 9648 </constant> 9649 <constant id="JVMTI_TYPE_JNIENV" num="117"> 9650 JNI environment - <code>JNIEnv</code>. 9651 Should be used with the correct <datalink id="jvmtiParamKind"/> to make it a pointer type. 9652 </constant> 9653 </constants> 9654 9655 <constants id="jvmtiParamKind" label="Extension Function/Event Parameter Kinds" kind="enum"> 9656 <constant id="JVMTI_KIND_IN" num="91"> 9657 Ingoing argument - <code>foo</code>. 9658 </constant> 9659 <constant id="JVMTI_KIND_IN_PTR" num="92"> 9660 Ingoing pointer argument - <code>const foo*</code>. 9661 </constant> 9662 <constant id="JVMTI_KIND_IN_BUF" num="93"> 9663 Ingoing array argument - <code>const foo*</code>. 9664 </constant> 9665 <constant id="JVMTI_KIND_ALLOC_BUF" num="94"> 9666 Outgoing allocated array argument - <code>foo**</code>. 9667 Free with <code>Deallocate</code>. 9668 </constant> 9669 <constant id="JVMTI_KIND_ALLOC_ALLOC_BUF" num="95"> 9670 Outgoing allocated array of allocated arrays argument - <code>foo***</code>. 9671 Free with <code>Deallocate</code>. 9672 </constant> 9673 <constant id="JVMTI_KIND_OUT" num="96"> 9674 Outgoing argument - <code>foo*</code>. 9675 </constant> 9676 <constant id="JVMTI_KIND_OUT_BUF" num="97"> 9677 Outgoing array argument (pre-allocated by agent) - <code>foo*</code>. 9678 Do not <code>Deallocate</code>. 9679 </constant> 9680 </constants> 9681 9682 </intro> 9683 9684 <typedef id="jvmtiParamInfo" label="Extension Function/Event Parameter Info"> 9685 <field id="name"> 9686 <allocfieldbuf><char/></allocfieldbuf> 9687 <description> 9688 The parameter name, encoded as a 9689 <internallink id="mUTF">modified UTF-8</internallink> string 9690 </description> 9691 </field> 9692 <field id="kind"> 9693 <enum>jvmtiParamKind</enum> 9694 <description> 9695 The kind of the parameter - type modifiers 9696 </description> 9697 </field> 9698 <field id="base_type"> 9699 <enum>jvmtiParamTypes</enum> 9700 <description> 9701 The base type of the parameter - modified by <code>kind</code> 9702 </description> 9703 </field> 9704 <field id="null_ok"> 9705 <jboolean/> 9706 <description> 9707 Is a <code>NULL</code> argument permitted? Applies only to pointer and object types. 9708 </description> 9709 </field> 9710 </typedef> 9711 9712 <callback id="jvmtiExtensionFunction"> 9713 <enum>jvmtiError</enum> 9714 <synopsis>Extension Function</synopsis> 9715 <description> 9716 This is the implementation-specific extension function. 9717 </description> 9718 <parameters> 9719 <param id="jvmti_env"> 9720 <outptr> 9721 <struct>jvmtiEnv</struct> 9722 </outptr> 9723 <description> 9724 The <jvmti/> environment is the only fixed parameter for extension functions. 9725 </description> 9726 </param> 9727 <param id="..."> 9728 <varargs/> 9729 <description> 9730 The extension function-specific parameters 9731 </description> 9732 </param> 9733 </parameters> 9734 </callback> 9735 9736 <function id="GetExtensionFunctions" phase="onload" num="124"> 9737 <synopsis>Get Extension Functions</synopsis> 9738 9739 <typedef id="jvmtiExtensionFunctionInfo" label="Extension Function Info"> 9740 <field id="func"> 9741 <ptrtype> 9742 <struct>jvmtiExtensionFunction</struct> 9743 </ptrtype> 9744 <description> 9745 The actual function to call 9746 </description> 9747 </field> 9748 <field id="id"> 9749 <allocfieldbuf><char/></allocfieldbuf> 9750 <description> 9751 The identifier for the extension function, encoded as a 9752 <internallink id="mUTF">modified UTF-8</internallink> string. 9753 Uses package name conventions. 9754 For example, <code>com.sun.hotspot.bar</code> 9755 </description> 9756 </field> 9757 <field id="short_description"> 9758 <allocfieldbuf><char/></allocfieldbuf> 9759 <description> 9760 A one sentence description of the function, encoded as a 9761 <internallink id="mUTF">modified UTF-8</internallink> string. 9762 </description> 9763 </field> 9764 <field id="param_count"> 9765 <jint/> 9766 <description> 9767 The number of parameters excluding <code>jvmtiEnv *jvmti_env</code> 9768 </description> 9769 </field> 9770 <field id="params"> 9771 <allocfieldbuf outcount="param_count"> 9772 <struct>jvmtiParamInfo</struct> 9773 </allocfieldbuf> 9774 <description> 9775 Array of 9776 <fieldlink id="param_count" struct="jvmtiExtensionFunctionInfo"></fieldlink> 9777 parameters (<code>jvmtiEnv *jvmti_env</code> excluded) 9778 </description> 9779 </field> 9780 <field id="error_count"> 9781 <jint/> 9782 <description> 9783 The number of possible error returns (excluding universal errors) 9784 </description> 9785 </field> 9786 <field id="errors"> 9787 <allocfieldbuf outcount="error_count"> 9788 <enum>jvmtiError</enum> 9789 </allocfieldbuf> 9790 <description> 9791 Array of <fieldlink id="error_count" struct="jvmtiExtensionFunctionInfo"></fieldlink> 9792 possible errors 9793 </description> 9794 </field> 9795 </typedef> 9796 9797 <description> 9798 Returns the set of extension functions. 9799 </description> 9800 <origin>new</origin> 9801 <capabilities> 9802 </capabilities> 9803 <parameters> 9804 <param id="extension_count_ptr"> 9805 <outptr><jint/></outptr> 9806 <description> 9807 On return, points to the number of extension functions 9808 </description> 9809 </param> 9810 <param id="extensions"> 9811 <allocbuf outcount="extension_count_ptr"><struct>jvmtiExtensionFunctionInfo</struct></allocbuf> 9812 <description> 9813 Returns an array of extension function info, one per function 9814 </description> 9815 </param> 9816 </parameters> 9817 <errors> 9818 </errors> 9819 </function> 9820 9821 <function id="GetExtensionEvents" phase="onload" num="125"> 9822 <synopsis>Get Extension Events</synopsis> 9823 9824 <typedef id="jvmtiExtensionEventInfo" label="Extension Event Info"> 9825 <field id="extension_event_index"> 9826 <jint/> 9827 <description> 9828 The identifying index of the event 9829 </description> 9830 </field> 9831 <field id="id"> 9832 <allocfieldbuf><char/></allocfieldbuf> 9833 <description> 9834 The identifier for the extension event, encoded as a 9835 <internallink id="mUTF">modified UTF-8</internallink> string. 9836 Uses package name conventions. 9837 For example, <code>com.sun.hotspot.bar</code> 9838 </description> 9839 </field> 9840 <field id="short_description"> 9841 <allocfieldbuf><char/></allocfieldbuf> 9842 <description> 9843 A one sentence description of the event, encoded as a 9844 <internallink id="mUTF">modified UTF-8</internallink> string. 9845 </description> 9846 </field> 9847 <field id="param_count"> 9848 <jint/> 9849 <description> 9850 The number of parameters excluding <code>jvmtiEnv *jvmti_env</code> 9851 </description> 9852 </field> 9853 <field id="params"> 9854 <allocfieldbuf outcount="param_count"> 9855 <struct>jvmtiParamInfo</struct> 9856 </allocfieldbuf> 9857 <description> 9858 Array of 9859 <fieldlink id="param_count" struct="jvmtiExtensionEventInfo"></fieldlink> 9860 parameters (<code>jvmtiEnv *jvmti_env</code> excluded) 9861 </description> 9862 </field> 9863 </typedef> 9864 9865 <description> 9866 Returns the set of extension events. 9867 </description> 9868 <origin>new</origin> 9869 <capabilities> 9870 </capabilities> 9871 <parameters> 9872 <param id="extension_count_ptr"> 9873 <outptr><jint/></outptr> 9874 <description> 9875 On return, points to the number of extension events 9876 </description> 9877 </param> 9878 <param id="extensions"> 9879 <allocbuf outcount="extension_count_ptr"><struct>jvmtiExtensionEventInfo</struct></allocbuf> 9880 <description> 9881 Returns an array of extension event info, one per event 9882 </description> 9883 </param> 9884 </parameters> 9885 <errors> 9886 </errors> 9887 </function> 9888 9889 <callback id="jvmtiExtensionEvent"> 9890 <void/> 9891 <synopsis>Extension Event</synopsis> 9892 <description> 9893 This is the implementation-specific event. 9894 The event handler is set with 9895 <functionlink id="SetExtensionEventCallback"/>. 9896 <p/> 9897 Event handlers for extension events must be declared varargs to match this definition. 9898 Failure to do so could result in calling convention mismatch and undefined behavior 9899 on some platforms. 9900 <p/> 9901 For example, if the <code>jvmtiParamInfo</code> 9902 returned by <functionlink id="GetExtensionEvents"/> indicates that 9903 there is a <code>jint</code> parameter, the event handler should be 9904 declared: 9905 <example> 9906 void JNICALL myHandler(jvmtiEnv* jvmti_env, jint myInt, ...) 9907 </example> 9908 Note the terminal "<code>...</code>" which indicates varargs. 9909 </description> 9910 <parameters> 9911 <param id="jvmti_env"> 9912 <outptr> 9913 <struct>jvmtiEnv</struct> 9914 </outptr> 9915 <description> 9916 The <jvmti/> environment is the only fixed parameter for extension events. 9917 </description> 9918 </param> 9919 <param id="..."> 9920 <varargs/> 9921 <description> 9922 The extension event-specific parameters 9923 </description> 9924 </param> 9925 </parameters> 9926 </callback> 9927 9928 <function id="SetExtensionEventCallback" phase="onload" num="126"> 9929 <synopsis>Set Extension Event Callback</synopsis> 9930 9931 <description> 9932 Sets the callback function for an extension event and 9933 enables the event. Or, if the callback is <code>NULL</code>, disables 9934 the event. Note that unlike standard events, setting 9935 the callback and enabling the event are a single operation. 9936 </description> 9937 <origin>new</origin> 9938 <capabilities> 9939 </capabilities> 9940 <parameters> 9941 <param id="extension_event_index"> 9942 <jint/> 9943 <description> 9944 Identifies which callback to set. 9945 This index is the 9946 <fieldlink id="extension_event_index" struct="jvmtiExtensionEventInfo"></fieldlink> 9947 field of 9948 <datalink id="jvmtiExtensionEventInfo"/>. 9949 </description> 9950 </param> 9951 <param id="callback"> 9952 <ptrtype> 9953 <struct>jvmtiExtensionEvent</struct> 9954 <nullok>disable the event</nullok> 9955 </ptrtype> 9956 <description> 9957 If <code>callback</code> is non-<code>NULL</code>, 9958 set <code>callback</code> to be the event callback function 9959 and enable the event. 9960 </description> 9961 </param> 9962 </parameters> 9963 <errors> 9964 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 9965 <paramlink id="extension_event_index"/> is not an 9966 <fieldlink id="extension_event_index" 9967 struct="jvmtiExtensionEventInfo"/> 9968 returned by 9969 <functionlink id="GetExtensionEvents"/> 9970 </error> 9971 </errors> 9972 </function> 9973 9974 </category> 9975 9976 <category id="capability" label="Capability"> 9977 9978 <intro> 9979 The capabilities functions allow you to change the 9980 functionality available to <jvmti/>--that is, 9981 which <jvmti/> 9982 functions can be called, what events can be generated, 9983 and what functionality these events and functions can 9984 provide. 9985 <p/> 9986 The "Capabilities" section of each function and event describe which 9987 capabilities, if any, they are associated with. "Required Functionality" 9988 means it is available for use and no capabilities must be added to use it. 9989 "Optional Functionality" means the agent must possess the capability 9990 before it can be used. 9991 To possess a capability, the agent must 9992 <functionlink id="AddCapabilities">add the capability</functionlink>. 9993 "Optional Features" describe capabilities which, 9994 if added, extend the feature set. 9995 <p/> 9996 The potentially available capabilities of each <jvmti/> implementation are different. 9997 Depending on the implementation, a capability: 9998 <ul> 9999 <li>may never be added</li> 10000 <li>may be added in either the <code>OnLoad</code> or live phase in any environment</li> 10001 <li>may be added only during the <code>OnLoad</code> phase</li> 10002 <li>may be possessed by only one environment at a time</li> 10003 <li>may be possessed by only one environment at a time, 10004 and only during the <code>OnLoad</code> phase</li> 10005 <li>and so on ...</li> 10006 </ul> 10007 Frequently, the addition of a capability may incur a cost in execution speed, start up 10008 time, and/or memory footprint. Note that the overhead of using a capability 10009 is completely different than the overhead of possessing a capability. 10010 Take single stepping as an example. When single stepping is on (that 10011 is, when the event is enabled and thus actively sending events) 10012 the overhead of sending and processing an event 10013 on each instruction is huge in any implementation. 10014 However, the overhead of possessing the capability may be small or large, 10015 depending on the implementation. Also, when and if a capability is potentially 10016 available depends on the implementation. Some examples: 10017 <ul> 10018 <li>One VM might perform all execution by compiling bytecodes into 10019 native code and be unable to generate single step instructions. 10020 In this implementation the capability can not be added.</li> 10021 <li>Another VM may be able to switch execution to a single stepping 10022 interpreter at any time. In this implementation, having the capability has no 10023 overhead and could be added at any time.</li> 10024 <li>Yet another VM might be able to choose a bytecode compiling or single stepping capable interpreted 10025 execution engine at start up, but be unable to switch between them. 10026 In this implementation the capability would need to be added 10027 during the <code>OnLoad</code> phase (before bytecode 10028 execution begins) and would have a large impact on execution speed 10029 even if single stepping was never used.</li> 10030 <li>Still another VM might be able to add an "is single stepping on" check 10031 into compiled bytecodes or a generated interpreter. Again in this implementation 10032 the capability would need to be added during the <code>OnLoad</code> phase but the overhead (a test 10033 and branch on each instruction) would be considerably less.</li> 10034 </ul> 10035 <p/> 10036 Each <jvmti/> <internallink id="environments">environment</internallink> 10037 has its own set of capabilities. 10038 Initially, that set is empty. 10039 Any desired capability must be added. 10040 If possible, capabilities should be added during the <code>OnLoad</code> phase. For most 10041 virtual machines certain capabilities require special set up for 10042 the virtual machine and this set up must happen 10043 during the <code>OnLoad</code> phase, before the virtual machine begins execution. 10044 Once a capability is added, it can 10045 only be removed if explicitly relinquished by the environment. 10046 <p/> 10047 The agent can, 10048 <functionlink id="GetPotentialCapabilities">determine what 10049 capabilities this VM can potentially provide</functionlink>, 10050 <functionlink id="AddCapabilities">add the capabilities 10051 to be used</functionlink>, 10052 <functionlink id="RelinquishCapabilities">release capabilities 10053 which are no longer needed</functionlink>, and 10054 <functionlink id="GetCapabilities">examine the currently available 10055 capabilities</functionlink>. 10056 </intro> 10057 10058 <intro id="capabilityExamples" label="Capability Examples"> 10059 For example, a freshly started agent (in the <code>OnLoad</code> function) 10060 wants to enable all possible capabilities. 10061 Note that, in general, this is not advisable as the agent may suffer 10062 a performance penalty for functionality it is not using. 10063 The code might look like this in C: 10064 <example> 10065 jvmtiCapabilities capa; 10066 jvmtiError err; 10067 10068 err = (*jvmti)->GetPotentialCapabilities(jvmti, &capa); 10069 if (err == JVMTI_ERROR_NONE) { 10070 err = (*jvmti)->AddCapabilities(jvmti, &capa); 10071 </example> 10072 For example, if an agent wants to check if it can get 10073 the bytecodes of a method (that is, it wants to check 10074 if it previously added this capability and has not 10075 relinquished it), the code might 10076 look like this in C: 10077 <example> 10078 jvmtiCapabilities capa; 10079 jvmtiError err; 10080 10081 err = (*jvmti)->GetCapabilities(jvmti, &capa); 10082 if (err == JVMTI_ERROR_NONE) { 10083 if (capa.can_get_bytecodes) { ... } } 10084 </example> 10085 </intro> 10086 10087 <capabilitiestypedef id="jvmtiCapabilities" label="The Capabilities Structure"> 10088 <description> 10089 The functions in this category use this capabilities structure 10090 which contains boolean flags corresponding to each capability: 10091 </description> 10092 <capabilityfield id="can_tag_objects"> 10093 <description> 10094 Can set and get tags, as described in the 10095 <internallink id="Heap">Heap category</internallink>. 10096 </description> 10097 </capabilityfield> 10098 <capabilityfield id="can_generate_field_modification_events"> 10099 <description> 10100 Can set watchpoints on field modification - 10101 <functionlink id="SetFieldModificationWatch"></functionlink> 10102 </description> 10103 </capabilityfield> 10104 <capabilityfield id="can_generate_field_access_events"> 10105 <description> 10106 Can set watchpoints on field access - 10107 <functionlink id="SetFieldAccessWatch"></functionlink> 10108 </description> 10109 </capabilityfield> 10110 <capabilityfield id="can_get_bytecodes"> 10111 <description> 10112 Can get bytecodes of a method <functionlink id="GetBytecodes"></functionlink> 10113 </description> 10114 </capabilityfield> 10115 <capabilityfield id="can_get_synthetic_attribute"> 10116 <description> 10117 Can test if a field or method is synthetic - 10118 <functionlink id="IsFieldSynthetic"></functionlink> and 10119 <functionlink id="IsMethodSynthetic"></functionlink> 10120 </description> 10121 </capabilityfield> 10122 <capabilityfield id="can_get_owned_monitor_info"> 10123 <description> 10124 Can get information about ownership of monitors - 10125 <functionlink id="GetOwnedMonitorInfo"></functionlink> 10126 </description> 10127 </capabilityfield> 10128 <capabilityfield id="can_get_current_contended_monitor"> 10129 <description> 10130 Can <functionlink id="GetCurrentContendedMonitor"></functionlink> 10131 </description> 10132 </capabilityfield> 10133 <capabilityfield id="can_get_monitor_info"> 10134 <description> 10135 Can <functionlink id="GetObjectMonitorUsage"></functionlink> 10136 </description> 10137 </capabilityfield> 10138 <capabilityfield id="can_pop_frame"> 10139 <description> 10140 Can pop frames off the stack - <functionlink id="PopFrame"></functionlink> 10141 </description> 10142 </capabilityfield> 10143 <capabilityfield id="can_redefine_classes"> 10144 <description> 10145 Can redefine classes with <functionlink id="RedefineClasses"/>. 10146 </description> 10147 </capabilityfield> 10148 <capabilityfield id="can_signal_thread"> 10149 <description> 10150 Can send stop or interrupt to threads 10151 </description> 10152 </capabilityfield> 10153 <capabilityfield id="can_get_source_file_name"> 10154 <description> 10155 Can get the source file name of a class 10156 </description> 10157 </capabilityfield> 10158 <capabilityfield id="can_get_line_numbers"> 10159 <description> 10160 Can get the line number table of a method 10161 </description> 10162 </capabilityfield> 10163 <capabilityfield id="can_get_source_debug_extension"> 10164 <description> 10165 Can get the source debug extension of a class 10166 </description> 10167 </capabilityfield> 10168 <capabilityfield id="can_access_local_variables"> 10169 <description> 10170 Can set and get local variables 10171 </description> 10172 </capabilityfield> 10173 <capabilityfield id="can_maintain_original_method_order"> 10174 <description> 10175 Can return methods in the order they occur in the class file 10176 </description> 10177 </capabilityfield> 10178 <capabilityfield id="can_generate_single_step_events"> 10179 <description> 10180 Can get <eventlink id="SingleStep">single step</eventlink> events 10181 </description> 10182 </capabilityfield> 10183 <capabilityfield id="can_generate_exception_events"> 10184 <description> 10185 Can get <eventlink id="Exception">exception thrown</eventlink> and 10186 <eventlink id="ExceptionCatch">exception catch</eventlink> events 10187 </description> 10188 </capabilityfield> 10189 <capabilityfield id="can_generate_frame_pop_events"> 10190 <description> 10191 Can <functionlink id="NotifyFramePop">set</functionlink> and thus get 10192 <eventlink id="FramePop"></eventlink> events 10193 </description> 10194 </capabilityfield> 10195 <capabilityfield id="can_generate_breakpoint_events"> 10196 <description> 10197 Can <functionlink id="SetBreakpoint">set</functionlink> and thus get 10198 <eventlink id="Breakpoint"></eventlink> events 10199 </description> 10200 </capabilityfield> 10201 <capabilityfield id="can_suspend"> 10202 <description> 10203 Can suspend and resume threads 10204 </description> 10205 </capabilityfield> 10206 <capabilityfield id="can_redefine_any_class"> 10207 <description> 10208 Can modify (retransform or redefine) any modifiable class. 10209 See <functionlink id="IsModifiableClass"/>. 10210 </description> 10211 </capabilityfield> 10212 <capabilityfield id="can_get_current_thread_cpu_time"> 10213 <description> 10214 Can <functionlink id="GetCurrentThreadCpuTime">get</functionlink> 10215 current thread CPU time 10216 </description> 10217 </capabilityfield> 10218 <capabilityfield id="can_get_thread_cpu_time"> 10219 <description> 10220 Can <functionlink id="GetThreadCpuTime">get</functionlink> 10221 thread CPU time 10222 </description> 10223 </capabilityfield> 10224 <capabilityfield id="can_generate_method_entry_events" 10225 disp1="can_generate" disp2="_method_entry_events" 10226 > 10227 <description> 10228 Can generate method entry events on entering a method 10229 </description> 10230 </capabilityfield> 10231 <capabilityfield id="can_generate_method_exit_events" 10232 disp1="can_generate" disp2="_method_exit_events" 10233 > 10234 <description> 10235 Can generate method exit events on leaving a method 10236 </description> 10237 </capabilityfield> 10238 <capabilityfield id="can_generate_all_class_hook_events" 10239 disp1="can_generate" disp2="_all_class_hook_events" 10240 > 10241 <description> 10242 Can generate ClassFileLoadHook events for every loaded class. 10243 </description> 10244 </capabilityfield> 10245 <capabilityfield id="can_generate_compiled_method_load_events" 10246 disp1="can_generate" disp2="_compiled_method_load_events" 10247 > 10248 <description> 10249 Can generate events when a method is compiled or unloaded 10250 </description> 10251 </capabilityfield> 10252 <capabilityfield id="can_generate_monitor_events" 10253 disp1="can_generate" disp2="_monitor_events" 10254 > 10255 <description> 10256 Can generate events on monitor activity 10257 </description> 10258 </capabilityfield> 10259 <capabilityfield id="can_generate_vm_object_alloc_events" 10260 disp1="can_generate" disp2="_vm_object_alloc_events" 10261 > 10262 <description> 10263 Can generate events on VM allocation of an object 10264 </description> 10265 </capabilityfield> 10266 <capabilityfield id="can_generate_native_method_bind_events" 10267 disp1="can_generate" disp2="_native_method_bind_events" 10268 > 10269 <description> 10270 Can generate events when a native method is bound to its 10271 implementation 10272 </description> 10273 </capabilityfield> 10274 <capabilityfield id="can_generate_garbage_collection_events" 10275 disp1="can_generate" disp2="_garbage_collection_events" 10276 > 10277 <description> 10278 Can generate events when garbage collection begins or ends 10279 </description> 10280 </capabilityfield> 10281 <capabilityfield id="can_generate_object_free_events" 10282 disp1="can_generate" disp2="_object_free_events" 10283 > 10284 <description> 10285 Can generate events when the garbage collector frees an object 10286 </description> 10287 </capabilityfield> 10288 <capabilityfield id="can_force_early_return" since="1.1"> 10289 <description> 10290 Can return early from a method, as described in the 10291 <internallink id="ForceEarlyReturn">Force Early Return category</internallink>. 10292 </description> 10293 </capabilityfield> 10294 <capabilityfield id="can_get_owned_monitor_stack_depth_info" since="1.1"> 10295 <description> 10296 Can get information about owned monitors with stack depth - 10297 <functionlink id="GetOwnedMonitorStackDepthInfo"></functionlink> 10298 </description> 10299 </capabilityfield> 10300 <capabilityfield id="can_get_constant_pool" since="1.1"> 10301 <description> 10302 Can get the constant pool of a class - 10303 <functionlink id="GetConstantPool"></functionlink> 10304 </description> 10305 </capabilityfield> 10306 <capabilityfield id="can_set_native_method_prefix" since="1.1"> 10307 <description> 10308 Can set prefix to be applied when native method cannot be resolved - 10309 <functionlink id="SetNativeMethodPrefix"/> and 10310 <functionlink id="SetNativeMethodPrefixes"/> 10311 </description> 10312 </capabilityfield> 10313 <capabilityfield id="can_retransform_classes" since="1.1"> 10314 <description> 10315 Can retransform classes with <functionlink id="RetransformClasses"/>. 10316 In addition to the restrictions imposed by the specific 10317 implementation on this capability (see the 10318 <internallink id="capability">Capability</internallink> section), 10319 this capability must be set before the 10320 <eventlink id="ClassFileLoadHook"/> event is enabled for the 10321 first time in this environment. 10322 An environment that possesses this capability at the time that 10323 <code>ClassFileLoadHook</code> is enabled for the first time is 10324 said to be <i>retransformation capable</i>. 10325 An environment that does not possess this capability at the time that 10326 <code>ClassFileLoadHook</code> is enabled for the first time is 10327 said to be <i>retransformation incapable</i>. 10328 </description> 10329 </capabilityfield> 10330 <capabilityfield id="can_retransform_any_class" since="1.1"> 10331 <description> 10332 <functionlink id="RetransformClasses"/> can be called on any modifiable class. 10333 See <functionlink id="IsModifiableClass"/>. 10334 (<fieldlink id="can_retransform_classes" struct="jvmtiCapabilities"/> 10335 must also be set) 10336 </description> 10337 </capabilityfield> 10338 <capabilityfield id="can_generate_resource_exhaustion_heap_events" since="1.1"> 10339 <description> 10340 Can generate events when the VM is unable to allocate memory from 10341 the <tm>Java</tm> platform heap. 10342 See <eventlink id="ResourceExhausted"/>. 10343 </description> 10344 </capabilityfield> 10345 <capabilityfield id="can_generate_resource_exhaustion_threads_events" since="1.1"> 10346 <description> 10347 Can generate events when the VM is unable to create a thread. 10348 See <eventlink id="ResourceExhausted"/>. 10349 </description> 10350 </capabilityfield> 10351 <capabilityfield id="can_generate_early_vmstart" since="9"> 10352 <description> 10353 Can generate the <code>VMStart</code> event early. 10354 See <eventlink id="VMStart"/>. 10355 </description> 10356 </capabilityfield> 10357 <capabilityfield id="can_generate_early_class_hook_events" since="9"> 10358 <description> 10359 Can generate the <eventlink id="ClassFileLoadHook"/> events 10360 in the primordial phase. If this capability and 10361 <internallink id="jvmtiCapabilities.can_generate_all_class_hook_events"> 10362 <code>can_generate_all_class_hook_events</code></internallink> 10363 are enabled then the <eventlink id="ClassFileLoadHook"/> events 10364 can be posted for classes loaded in the primordial phase. 10365 See <eventlink id="ClassFileLoadHook"/>. 10366 </description> 10367 </capabilityfield> 10368 </capabilitiestypedef> 10369 10370 <function id="GetPotentialCapabilities" jkernel="yes" phase="onload" num="140"> 10371 <synopsis>Get Potential Capabilities</synopsis> 10372 <description> 10373 Returns via <paramlink id="capabilities_ptr"></paramlink> the <jvmti/> 10374 features that can potentially be possessed by this environment 10375 at this time. 10376 The returned capabilities differ from the complete set of capabilities 10377 implemented by the VM in two cases: another environment possesses 10378 capabilities that can only be possessed by one environment, or the 10379 current <functionlink id="GetPhase">phase</functionlink> is live, 10380 and certain capabilities can only be added during the <code>OnLoad</code> phase. 10381 The <functionlink id="AddCapabilities"></functionlink> function 10382 may be used to set any or all or these capabilities. 10383 Currently possessed capabilities are included. 10384 <p/> 10385 Typically this function is used in the <code>OnLoad</code> function. 10386 Some virtual machines may allow a limited set of capabilities to be 10387 added in the live phase. 10388 In this case, the set of potentially available capabilities 10389 will likely differ from the <code>OnLoad</code> phase set. 10390 <p/> 10391 See the 10392 <internallink id="capabilityExamples">Capability Examples</internallink>. 10393 </description> 10394 <origin>new</origin> 10395 <capabilities> 10396 </capabilities> 10397 <parameters> 10398 <param id="capabilities_ptr"> 10399 <outptr><struct>jvmtiCapabilities</struct></outptr> 10400 <description> 10401 On return, points to the <jvmti/> capabilities that may be added. 10402 </description> 10403 </param> 10404 </parameters> 10405 <errors> 10406 </errors> 10407 </function> 10408 10409 <elide> 10410 <function id="EstimateCostOfCapabilities" phase="onload" num="141"> 10411 <synopsis>Estimate Cost Of Capabilities</synopsis> 10412 <description> 10413 <issue>There is strong opposition to this function. The concern is 10414 that it would be difficult or impossible to provide meaningful 10415 numbers, as the amount of impact is conditional on many factors 10416 that a single number could not represent. There is doubt that 10417 conditional implementations would be used or are even a good idea. 10418 The thought is that release documentation for the implementation 10419 would be the best means of exposing this information. 10420 Unless new arguments are presented, I intend to remove this 10421 function in the next revision. 10422 </issue> 10423 <p/> 10424 Return via the <paramlink id="time_impact_ptr"></paramlink> and 10425 <paramlink id="space_impact_ptr"></paramlink> an estimate of the impact 10426 of adding the capabilities pointed to by 10427 <paramlink id="capabilities_ptr"></paramlink>. 10428 The returned estimates are in percentage of additional overhead, thus 10429 a time impact of 100 mean the application might run 10430 at half the speed. 10431 The estimates are very rough approximations and are not guaranteed. 10432 Note also, that the estimates are of the impact of having the 10433 capability available--when and if it is used the impact may be 10434 much greater. 10435 Estimates can be for a single capability or for a set of 10436 capabilities. Note that the costs are not necessarily additive, 10437 adding support for one capability might make another available 10438 for free or conversely having two capabilities at once may 10439 have multiplicative impact. 10440 Estimates are relative to the current set of capabilities - 10441 that is, how much more impact given the currently possessed capabilities. 10442 <p/> 10443 Typically this function is used in the OnLoad function, 10444 some virtual machines may allow a limited set of capabilities to be 10445 added in the live phase. 10446 In this case, the set of potentially available capabilities 10447 will likely differ from the OnLoad phase set. 10448 <p/> 10449 See the 10450 <internallink id="capabilityExamples">Capability Examples</internallink>. 10451 </description> 10452 <origin>new</origin> 10453 <capabilities> 10454 </capabilities> 10455 <parameters> 10456 <param id="capabilities_ptr"> 10457 <inptr><struct>jvmtiCapabilities</struct></inptr> 10458 <description> 10459 points to the <jvmti/> capabilities to evaluate. 10460 </description> 10461 </param> 10462 <param id="time_impact_ptr"> 10463 <outptr><jint/></outptr> 10464 <description> 10465 On return, points to the estimated percentage increase in 10466 run time if this capability was added. 10467 </description> 10468 </param> 10469 <param id="space_impact_ptr"> 10470 <outptr><jint/></outptr> 10471 <description> 10472 On return, points to the estimated percentage increase in 10473 memory space used if this capability was added. 10474 </description> 10475 </param> 10476 </parameters> 10477 <errors> 10478 <error id="JVMTI_ERROR_NOT_AVAILABLE"> 10479 The desired capabilities are not even potentially available. 10480 </error> 10481 </errors> 10482 </function> 10483 </elide> 10484 10485 <function id="AddCapabilities" jkernel="yes" phase="onload" num="142"> 10486 <synopsis>Add Capabilities</synopsis> 10487 <description> 10488 Set new capabilities by adding the capabilities 10489 whose values are set to one (<code>1</code>) in 10490 <code>*</code><paramlink id="capabilities_ptr"></paramlink>. 10491 All previous capabilities are retained. 10492 Typically this function is used in the <code>OnLoad</code> function. 10493 Some virtual machines may allow a limited set of capabilities to be 10494 added in the live phase. 10495 <p/> 10496 See the 10497 <internallink id="capabilityExamples">Capability Examples</internallink>. 10498 </description> 10499 <origin>new</origin> 10500 <capabilities> 10501 </capabilities> 10502 <parameters> 10503 <param id="capabilities_ptr"> 10504 <inptr><struct>jvmtiCapabilities</struct></inptr> 10505 <description> 10506 Points to the <jvmti/> capabilities to add. 10507 </description> 10508 </param> 10509 </parameters> 10510 <errors> 10511 <error id="JVMTI_ERROR_NOT_AVAILABLE"> 10512 The desired capabilities are not even potentially available. 10513 </error> 10514 </errors> 10515 </function> 10516 10517 10518 <function id="RelinquishCapabilities" phase="onload" num="143"> 10519 <synopsis>Relinquish Capabilities</synopsis> 10520 <description> 10521 Relinquish the capabilities 10522 whose values are set to one (<code>1</code>) in 10523 <code>*</code><paramlink id="capabilities_ptr"></paramlink>. 10524 Some implementations may allow only one environment to have a capability 10525 (see the <internallink id="capability">capability introduction</internallink>). 10526 This function releases capabilities 10527 so that they may be used by other agents. 10528 All other capabilities are retained. 10529 The capability will no longer be present in <functionlink id="GetCapabilities"></functionlink>. 10530 Attempting to relinquish a capability that the agent does not possess is not an error. 10531 <issue> 10532 It is possible for the agent to be actively using capabilities 10533 which are being relinquished. For example, a thread is currently 10534 suspended and can_suspend is being relinquished or an event is currently 10535 enabled and can_generate_whatever is being relinquished. 10536 There are three possible ways we could spec this: 10537 <ul> 10538 <li>relinquish automatically releases them</li> 10539 <li>relinquish checks and returns some error code if held</li> 10540 <li>it is the agent's responsibility and it is not checked</li> 10541 </ul> 10542 One of these should be chosen. 10543 </issue> 10544 </description> 10545 <origin>new</origin> 10546 <capabilities> 10547 </capabilities> 10548 <parameters> 10549 <param id="capabilities_ptr"> 10550 <inptr><struct>jvmtiCapabilities</struct></inptr> 10551 <description> 10552 Points to the <jvmti/> capabilities to relinquish. 10553 </description> 10554 </param> 10555 </parameters> 10556 <errors> 10557 </errors> 10558 </function> 10559 10560 10561 10562 <function id="GetCapabilities" jkernel="yes" phase="any" num="89"> 10563 <synopsis>Get Capabilities</synopsis> 10564 <description> 10565 Returns via <paramlink id="capabilities_ptr"></paramlink> the optional <jvmti/> 10566 features which this environment currently possesses. 10567 Each possessed capability is indicated by a one (<code>1</code>) in the 10568 corresponding field of the <internallink id="jvmtiCapabilities">capabilities 10569 structure</internallink>. 10570 An environment does not possess a capability unless it has been successfully added with 10571 <functionlink id="AddCapabilities"/>. 10572 An environment only loses possession of a capability if it has been relinquished with 10573 <functionlink id="RelinquishCapabilities"/>. Thus, this function returns the net result 10574 of the <code>AddCapabilities</code> and <code>RelinquishCapabilities</code> calls which 10575 have been made. 10576 <p/> 10577 See the 10578 <internallink id="capabilityExamples">Capability Examples</internallink>. 10579 </description> 10580 <origin>jvmdiClone</origin> 10581 <capabilities> 10582 </capabilities> 10583 <parameters> 10584 <param id="capabilities_ptr"> 10585 <outptr><struct>jvmtiCapabilities</struct></outptr> 10586 <description> 10587 On return, points to the <jvmti/> capabilities. 10588 </description> 10589 </param> 10590 </parameters> 10591 <errors> 10592 </errors> 10593 </function> 10594 10595 </category> 10596 10597 10598 <category id="timers" label="Timers"> 10599 10600 <intro> 10601 These functions provide timing information. 10602 The resolution at which the time is updated is not specified. 10603 They provides nanosecond precision, but not necessarily nanosecond accuracy. 10604 Details about the timers, such as their maximum values, can be accessed with 10605 the timer information functions. 10606 </intro> 10607 10608 <typedef id="jvmtiTimerInfo" label="Timer Info"> 10609 <description> 10610 The information function for each timer returns this data structure. 10611 </description> 10612 <field id="max_value"> 10613 <jlong/> 10614 <description> 10615 The maximum value the timer can reach. 10616 After this value is reached the timer wraps back to zero. 10617 This is an unsigned value. If tested or printed as a jlong (signed value) 10618 it may appear to be a negative number. 10619 </description> 10620 </field> 10621 <field id="may_skip_forward"> 10622 <jboolean/> 10623 <description> 10624 If true, the timer can be externally adjusted and as a result skip forward. 10625 If false, the timer value will never increase faster than real time. 10626 </description> 10627 </field> 10628 <field id="may_skip_backward"> 10629 <jboolean/> 10630 <description> 10631 If true, the timer can be externally adjusted and as a result skip backward. 10632 If false, the timer value will be monotonically increasing. 10633 </description> 10634 </field> 10635 <field id="kind"> 10636 <enum>jvmtiTimerKind</enum> 10637 <description> 10638 The kind of timer. 10639 On a platform that does not distinguish between user and system time, <datalink 10640 id="JVMTI_TIMER_TOTAL_CPU"><code>JVMTI_TIMER_TOTAL_CPU</code></datalink> 10641 is returned. 10642 </description> 10643 </field> 10644 <field id="reserved1"> 10645 <jlong/> 10646 <description> 10647 Reserved for future use. 10648 </description> 10649 </field> 10650 <field id="reserved2"> 10651 <jlong/> 10652 <description> 10653 Reserved for future use. 10654 </description> 10655 </field> 10656 </typedef> 10657 10658 <intro> 10659 Where the timer kind is -- 10660 10661 <constants id="jvmtiTimerKind" label="Timer Kinds" kind="enum"> 10662 <constant id="JVMTI_TIMER_USER_CPU" num="30"> 10663 CPU time that a thread is in user mode. 10664 </constant> 10665 <constant id="JVMTI_TIMER_TOTAL_CPU" num="31"> 10666 CPU time that a thread is in user or system mode. 10667 </constant> 10668 <constant id="JVMTI_TIMER_ELAPSED" num="32"> 10669 Elapsed time. 10670 </constant> 10671 </constants> 10672 </intro> 10673 10674 <function id="GetCurrentThreadCpuTimerInfo" callbacksafe="safe" impl="innative notrace" phase="start" num="134"> 10675 <synopsis>Get Current Thread CPU Timer Information</synopsis> 10676 <description> 10677 Get information about the 10678 <functionlink id="GetCurrentThreadCpuTime"/> timer. 10679 The fields of the <datalink id="jvmtiTimerInfo"/> structure 10680 are filled in with details about the timer. 10681 This information is specific to the platform and the implementation of 10682 <functionlink id="GetCurrentThreadCpuTime"/> and thus 10683 does not vary by thread nor does it vary 10684 during a particular invocation of the VM. 10685 <p/> 10686 Note that the implementations of <functionlink id="GetCurrentThreadCpuTime"/> 10687 and <functionlink id="GetThreadCpuTime"/> may differ, and thus the values 10688 returned by <code>GetCurrentThreadCpuTimerInfo</code> 10689 and <functionlink id="GetThreadCpuTimerInfo"/> 10690 may differ -- see <functionlink id="GetCurrentThreadCpuTime"/> for more information. 10691 </description> 10692 <origin>new</origin> 10693 <capabilities> 10694 <required id="can_get_current_thread_cpu_time"> 10695 Can get current thread CPU time. 10696 </required> 10697 </capabilities> 10698 <parameters> 10699 <param id="info_ptr"> 10700 <outptr><struct>jvmtiTimerInfo</struct></outptr> 10701 <description> 10702 On return, filled with information describing the time 10703 returned by <functionlink id="GetCurrentThreadCpuTime"/>. 10704 </description> 10705 </param> 10706 </parameters> 10707 <errors> 10708 </errors> 10709 </function> 10710 10711 <function id="GetCurrentThreadCpuTime" callbacksafe="safe" impl="innative notrace" phase="start" num="135"> 10712 <synopsis>Get Current Thread CPU Time</synopsis> 10713 <description> 10714 Return the CPU time utilized by the current thread. 10715 <p/> 10716 Note that the <functionlink id="GetThreadCpuTime"/> 10717 function provides CPU time for any thread, including 10718 the current thread. <code>GetCurrentThreadCpuTime</code> 10719 exists to support platforms which cannot 10720 supply CPU time for threads other than the current 10721 thread or which have more accurate information for 10722 the current thread (see 10723 <functionlink id="GetCurrentThreadCpuTimerInfo"/> vs 10724 <functionlink id="GetThreadCpuTimerInfo"/>). 10725 On many platforms this call will be equivalent to: 10726 <example> 10727 GetThreadCpuTime(env, NULL, nanos_ptr) 10728 </example> 10729 </description> 10730 <origin>new</origin> 10731 <capabilities> 10732 <required id="can_get_current_thread_cpu_time"> 10733 Can get current thread CPU time. 10734 <p/> 10735 If this capability is enabled after threads have started, 10736 the implementation may choose any time up 10737 to and including the time that the capability is enabled 10738 as the point where CPU time collection starts. 10739 <p/> 10740 This capability must be potentially available on any 10741 platform where 10742 <internallink id="jvmtiCapabilities.can_get_thread_cpu_time"><code>can_get_thread_cpu_time</code></internallink> 10743 is potentially available. 10744 </required> 10745 </capabilities> 10746 <parameters> 10747 <param id="nanos_ptr"> 10748 <outptr><jlong/></outptr> 10749 <description> 10750 On return, points to the CPU time used by this thread 10751 in nanoseconds. 10752 This is an unsigned value. If tested or printed as a jlong (signed value) 10753 it may appear to be a negative number. 10754 </description> 10755 </param> 10756 </parameters> 10757 <errors> 10758 </errors> 10759 </function> 10760 10761 <function id="GetThreadCpuTimerInfo" num="136"> 10762 <synopsis>Get Thread CPU Timer Information</synopsis> 10763 <description> 10764 Get information about the 10765 <functionlink id="GetThreadCpuTime"/> timer. 10766 The fields of the <datalink id="jvmtiTimerInfo"/> structure 10767 are filled in with details about the timer. 10768 This information is specific to the platform and the implementation of 10769 <functionlink id="GetThreadCpuTime"/> and thus 10770 does not vary by thread nor does it vary 10771 during a particular invocation of the VM. 10772 <p/> 10773 Note that the implementations of <functionlink id="GetCurrentThreadCpuTime"/> 10774 and <functionlink id="GetThreadCpuTime"/> may differ, and thus the values 10775 returned by <functionlink id="GetCurrentThreadCpuTimerInfo"/> 10776 and <code>GetThreadCpuTimerInfo</code> 10777 may differ -- see <functionlink id="GetCurrentThreadCpuTime"/> for more information. 10778 </description> 10779 <origin>new</origin> 10780 <capabilities> 10781 <required id="can_get_thread_cpu_time"> 10782 Can get thread CPU time. 10783 </required> 10784 </capabilities> 10785 <parameters> 10786 <param id="info_ptr"> 10787 <outptr><struct>jvmtiTimerInfo</struct></outptr> 10788 <description> 10789 On return, filled with information describing the time 10790 returned by <functionlink id="GetThreadCpuTime"/>. 10791 </description> 10792 </param> 10793 </parameters> 10794 <errors> 10795 </errors> 10796 </function> 10797 10798 <function id="GetThreadCpuTime" num="137"> 10799 <synopsis>Get Thread CPU Time</synopsis> 10800 <description> 10801 Return the CPU time utilized by the specified thread. 10802 <p/> 10803 Get information about this timer with 10804 <functionlink id="GetThreadCpuTimerInfo"/>. 10805 </description> 10806 <origin>new</origin> 10807 <capabilities> 10808 <required id="can_get_thread_cpu_time"> 10809 Can get thread CPU time. 10810 <p/> 10811 If this capability is enabled after threads have started, 10812 the implementation may choose any time up 10813 to and including the time that the capability is enabled 10814 as the point where CPU time collection starts. 10815 </required> 10816 </capabilities> 10817 <parameters> 10818 <param id="thread"> 10819 <jthread null="current"/> 10820 <description> 10821 The thread to query. 10822 </description> 10823 </param> 10824 <param id="nanos_ptr"> 10825 <outptr><jlong/></outptr> 10826 <description> 10827 On return, points to the CPU time used by the specified thread 10828 in nanoseconds. 10829 This is an unsigned value. If tested or printed as a jlong (signed value) 10830 it may appear to be a negative number. 10831 </description> 10832 </param> 10833 </parameters> 10834 <errors> 10835 </errors> 10836 </function> 10837 10838 <function id="GetTimerInfo" phase="any" callbacksafe="safe" num="138"> 10839 <synopsis>Get Timer Information</synopsis> 10840 <description> 10841 Get information about the 10842 <functionlink id="GetTime"/> timer. 10843 The fields of the <datalink id="jvmtiTimerInfo"/> structure 10844 are filled in with details about the timer. 10845 This information will not change during a particular invocation of the VM. 10846 </description> 10847 <origin>new</origin> 10848 <capabilities> 10849 </capabilities> 10850 <parameters> 10851 <param id="info_ptr"> 10852 <outptr><struct>jvmtiTimerInfo</struct></outptr> 10853 <description> 10854 On return, filled with information describing the time 10855 returned by <functionlink id="GetTime"/>. 10856 </description> 10857 </param> 10858 </parameters> 10859 <errors> 10860 </errors> 10861 </function> 10862 10863 <function id="GetTime" phase="any" callbacksafe="safe" num="139"> 10864 <synopsis>Get Time</synopsis> 10865 <description> 10866 Return the current value of the system timer, in nanoseconds. 10867 <p/> 10868 The value returned represents nanoseconds since some fixed but 10869 arbitrary time (perhaps in the future, so values may be 10870 negative). This function provides nanosecond precision, but not 10871 necessarily nanosecond accuracy. No guarantees are made about 10872 how frequently values change. 10873 <p/> 10874 Get information about this timer with 10875 <functionlink id="GetTimerInfo"/>. 10876 </description> 10877 <origin>new</origin> 10878 <capabilities> 10879 </capabilities> 10880 <parameters> 10881 <param id="nanos_ptr"> 10882 <outptr><jlong/></outptr> 10883 <description> 10884 On return, points to the time in nanoseconds. 10885 This is an unsigned value. If tested or printed as a jlong (signed value) 10886 it may appear to be a negative number. 10887 </description> 10888 </param> 10889 </parameters> 10890 <errors> 10891 </errors> 10892 </function> 10893 10894 <function id="GetAvailableProcessors" phase="any" num="144"> 10895 <synopsis>Get Available Processors</synopsis> 10896 <description> 10897 Returns the number of processors available to the Java virtual machine. 10898 <p/> 10899 This value may change during a particular invocation of the virtual machine. 10900 Applications that are sensitive to the number of available processors should 10901 therefore occasionally poll this property. 10902 </description> 10903 <origin>new</origin> 10904 <capabilities> 10905 </capabilities> 10906 <parameters> 10907 <param id="processor_count_ptr"> 10908 <outptr><jint/></outptr> 10909 <description> 10910 On return, points to the maximum number of processors available to the 10911 virtual machine; never smaller than one. 10912 </description> 10913 </param> 10914 </parameters> 10915 <errors> 10916 </errors> 10917 </function> 10918 10919 </category> 10920 10921 10922 <category id="classLoaderSearch" label="Class Loader Search"> 10923 10924 <intro> 10925 These functions allow the agent to add to the locations that a class loader searches for a class. 10926 This is useful for installing instrumentation under the correct class loader. 10927 </intro> 10928 10929 <function id="AddToBootstrapClassLoaderSearch" jkernel="yes" phase="onload" num="149"> 10930 <synopsis>Add To Bootstrap Class Loader Search</synopsis> 10931 <description> 10932 This function can be used to cause instrumentation classes to be defined by the 10933 bootstrap class loader. See <vmspec chapter="5.3.1"/>. 10934 After the bootstrap 10935 class loader unsuccessfully searches for a class, the specified platform-dependent 10936 search path <paramlink id="segment"/> will be searched as well. Only one segment may be specified in 10937 the <paramlink id="segment"/>. This function may be called multiple times to add multiple segments, 10938 the segments will be searched in the order that this function was called. 10939 <p/> 10940 In the <code>OnLoad</code> phase the function may be used to specify any platform-dependent 10941 search path segment to be searched after the bootstrap class loader unsuccessfully searches 10942 for a class. The segment is typically a directory or JAR file. 10943 <p/> 10944 In the live phase the <paramlink id="segment"/> may be used to specify any platform-dependent 10945 path to a <externallink id="jar/jar.html"> 10946 JAR file</externallink>. The agent should take care that the JAR file does not 10947 contain any classes or resources other than those to be defined by the bootstrap 10948 class loader for the purposes of instrumentation. 10949 <p/> 10950 <vmspec/> specifies that a subsequent attempt to resolve a symbolic 10951 reference that the Java virtual machine has previously unsuccessfully attempted 10952 to resolve always fails with the same error that was thrown as a result of the 10953 initial resolution attempt. Consequently, if the JAR file contains an entry 10954 that corresponds to a class for which the Java virtual machine has 10955 unsuccessfully attempted to resolve a reference, then subsequent attempts to 10956 resolve that reference will fail with the same error as the initial attempt. 10957 </description> 10958 <origin>new</origin> 10959 <capabilities> 10960 </capabilities> 10961 <parameters> 10962 <param id="segment"> 10963 <inbuf><char/></inbuf> 10964 <description> 10965 The platform-dependent search path segment, encoded as a 10966 <internallink id="mUTF">modified UTF-8</internallink> string. 10967 </description> 10968 </param> 10969 </parameters> 10970 <errors> 10971 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 10972 <paramlink id="segment"/> is an invalid path. In the live phase, anything other than an 10973 existing JAR file is an invalid path. 10974 </error> 10975 </errors> 10976 </function> 10977 10978 <function id="AddToSystemClassLoaderSearch" jkernel="yes" phase="onload" num="151" since="1.1"> 10979 <synopsis>Add To System Class Loader Search</synopsis> 10980 <description> 10981 This function can be used to cause instrumentation classes to be 10982 defined by the system class loader. See <vmspec chapter="5.3.2"/>. 10983 After the class loader unsuccessfully searches for a class, the specified platform-dependent search 10984 path <paramlink id="segment"/> will be searched as well. Only one segment may be specified in the 10985 <paramlink id="segment"/>. This function may be called multiple times to add multiple segments, the 10986 segments will be searched in the order that this function was called. 10987 <p/> 10988 In the <code>OnLoad</code> phase the function may be used to specify any platform-dependent 10989 search path segment to be searched after the system class loader unsuccessfully searches 10990 for a class. The segment is typically a directory or JAR file. 10991 <p/> 10992 In the live phase the <paramlink id="segment"/> is a platform-dependent path to a 10993 <externallink id="jar/jar.html">JAR file</externallink> to be 10994 searched after the system class loader unsuccessfully searches for a class. The agent should 10995 take care that the JAR file does not contain any classes or resources other than those to be 10996 defined by the system class loader for the purposes of instrumentation. 10997 <p/> 10998 In the live phase the system class loader supports adding a JAR file to be searched if 10999 the system class loader implements a method name <code>appendToClassPathForInstrumentation</code> 11000 which takes a single parameter of type <code>java.lang.String</code>. The method is not required 11001 to have <code>public</code> access. 11002 <p/> 11003 <vmspec/> specifies that a subsequent attempt to resolve a symbolic 11004 reference that the Java virtual machine has previously unsuccessfully attempted 11005 to resolve always fails with the same error that was thrown as a result of the 11006 initial resolution attempt. Consequently, if the JAR file contains an entry 11007 that corresponds to a class for which the Java virtual machine has 11008 unsuccessfully attempted to resolve a reference, then subsequent attempts to 11009 resolve that reference will fail with the same error as the initial attempt. 11010 </description> 11011 <origin>new</origin> 11012 <capabilities> 11013 </capabilities> 11014 <parameters> 11015 <param id="segment"> 11016 <inbuf><char/></inbuf> 11017 <description> 11018 The platform-dependent search path segment, encoded as a 11019 <internallink id="mUTF">modified UTF-8</internallink> string. 11020 </description> 11021 </param> 11022 </parameters> 11023 <errors> 11024 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 11025 <paramlink id="segment"/> is an invalid path. In the live phase, anything other than an 11026 existing JAR file is an invalid path. 11027 </error> 11028 <error id="JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED"> 11029 Operation not supported by the system class loader. 11030 </error> 11031 </errors> 11032 </function> 11033 11034 </category> 11035 11036 11037 <category id="props" label="System Properties"> 11038 11039 <intro> 11040 These functions get and set system properties. 11041 </intro> 11042 11043 <function id="GetSystemProperties" phase="onload" num="130"> 11044 <synopsis>Get System Properties</synopsis> 11045 <description> 11046 The list of VM system property keys which may be used with 11047 <functionlink id="GetSystemProperty"/> is returned. 11048 It is strongly recommended that virtual machines provide the 11049 following property keys: 11050 <ul> 11051 <li><code>java.vm.vendor</code></li> 11052 <li><code>java.vm.version</code></li> 11053 <li><code>java.vm.name</code></li> 11054 <li><code>java.vm.info</code></li> 11055 <li><code>java.library.path</code></li> 11056 <li><code>java.class.path</code></li> 11057 </ul> 11058 Provides access to system properties defined by and used 11059 by the VM. 11060 Properties set on the command-line are included. 11061 This allows getting and setting of these properties 11062 before the VM even begins executing bytecodes. 11063 Since this is a VM view of system properties, the set of available 11064 properties will usually be different than that 11065 in <code>java.lang.System.getProperties</code>. 11066 JNI method invocation may be used to access 11067 <code>java.lang.System.getProperties</code>. 11068 <p/> 11069 The set of properties may grow during execution. 11070 </description> 11071 <origin>new</origin> 11072 <capabilities> 11073 </capabilities> 11074 <parameters> 11075 <param id="count_ptr"> 11076 <outptr><jint/></outptr> 11077 <description> 11078 On return, points to the number of property keys returned. 11079 </description> 11080 </param> 11081 <param id="property_ptr"> 11082 <allocallocbuf outcount="count_ptr"><char/></allocallocbuf> 11083 <description> 11084 On return, points to an array of property keys, encoded as 11085 <internallink id="mUTF">modified UTF-8</internallink> strings. 11086 </description> 11087 </param> 11088 </parameters> 11089 <errors> 11090 </errors> 11091 </function> 11092 11093 <function id="GetSystemProperty" phase="onload" num="131"> 11094 <synopsis>Get System Property</synopsis> 11095 <description> 11096 Return a VM system property value given the property key. 11097 <p/> 11098 The function <functionlink id="GetSystemProperties"/> 11099 returns the set of property keys which may be used. 11100 The properties which can be retrieved may grow during 11101 execution. 11102 <p/> 11103 Since this is a VM view of system properties, the values 11104 of properties may differ from that returned by 11105 <code>java.lang.System.getProperty(String)</code>. 11106 A typical VM might copy the values of the VM system 11107 properties into the <code>Properties</code> held by 11108 <code>java.lang.System</code> during the initialization 11109 of that class. Thereafter any changes to the VM system 11110 properties (with <functionlink id="SetSystemProperty"/>) 11111 or the <code>java.lang.System</code> system properties 11112 (with <code>java.lang.System.setProperty(String,String)</code>) 11113 would cause the values to diverge. 11114 JNI method invocation may be used to access 11115 <code>java.lang.System.getProperty(String)</code>. 11116 </description> 11117 <origin>new</origin> 11118 <capabilities> 11119 </capabilities> 11120 <parameters> 11121 <param id="property"> 11122 <inbuf><char/></inbuf> 11123 <description> 11124 The key of the property to retrieve, encoded as a 11125 <internallink id="mUTF">modified UTF-8</internallink> string. 11126 </description> 11127 </param> 11128 <param id="value_ptr"> 11129 <allocbuf><char/></allocbuf> 11130 <description> 11131 On return, points to the property value, encoded as a 11132 <internallink id="mUTF">modified UTF-8</internallink> string. 11133 </description> 11134 </param> 11135 </parameters> 11136 <errors> 11137 <error id="JVMTI_ERROR_NOT_AVAILABLE"> 11138 This property is not available. 11139 Use <functionlink id="GetSystemProperties"/> to find available properties. 11140 </error> 11141 </errors> 11142 </function> 11143 11144 <function id="SetSystemProperty" phase="onloadOnly" num="132"> 11145 <synopsis>Set System Property</synopsis> 11146 <description> 11147 Set a VM system property value. 11148 <p/> 11149 The function <functionlink id="GetSystemProperties"/> 11150 returns the set of property keys, some of these may be settable. 11151 See <functionlink id="GetSystemProperty"/>. 11152 </description> 11153 <origin>new</origin> 11154 <capabilities> 11155 </capabilities> 11156 <parameters> 11157 <param id="property"> 11158 <inbuf><char/></inbuf> 11159 <description> 11160 The key of the property, encoded as a 11161 <internallink id="mUTF">modified UTF-8</internallink> string. 11162 </description> 11163 </param> 11164 <param id="value_ptr"> 11165 <inbuf> 11166 <char/> 11167 <nullok> 11168 do not set the value, but return <errorlink id="JVMTI_ERROR_NOT_AVAILABLE"/> 11169 if the property is not writeable 11170 </nullok> 11171 </inbuf> 11172 <description> 11173 The property value to set, encoded as a 11174 <internallink id="mUTF">modified UTF-8</internallink> string. 11175 </description> 11176 </param> 11177 </parameters> 11178 <errors> 11179 <error id="JVMTI_ERROR_NOT_AVAILABLE"> 11180 This property is not available or is not writeable. 11181 </error> 11182 </errors> 11183 </function> 11184 11185 </category> 11186 11187 <category id="general" label="General"> 11188 11189 <intro> 11190 </intro> 11191 11192 <function id="GetPhase" jkernel="yes" phase="any" num="133"> 11193 <synopsis>Get Phase</synopsis> 11194 <description> 11195 Return the current phase of VM execution. 11196 The phases proceed in sequence: 11197 <constants id="jvmtiPhase" label="Phases of execution" kind="enum"> 11198 <constant id="JVMTI_PHASE_ONLOAD" num="1"> 11199 <code>OnLoad</code> phase: while in the 11200 <internallink id="onload"><code>Agent_OnLoad</code></internallink> 11201 or, for statically linked agents, the <internallink id="onload"> 11202 <code>Agent_OnLoad_<agent-lib-name> 11203 </code></internallink> function. 11204 </constant> 11205 <constant id="JVMTI_PHASE_PRIMORDIAL" num="2"> 11206 Primordial phase: between return from <code>Agent_OnLoad</code> 11207 or <code>Agent_OnLoad_<agent-lib-name></code> and the 11208 <code>VMStart</code> event. 11209 </constant> 11210 <constant id="JVMTI_PHASE_START" num="6"> 11211 Start phase: when the <eventlink id="VMStart"><code>VMStart</code></eventlink> event 11212 is sent and until the <code>VMInit</code> event is sent. 11213 </constant> 11214 <constant id="JVMTI_PHASE_LIVE" num="4"> 11215 Live phase: when the <eventlink id="VMInit"><code>VMInit</code></eventlink> event is sent 11216 and until the <eventlink id="VMDeath"></eventlink> event returns. 11217 </constant> 11218 <constant id="JVMTI_PHASE_DEAD" num="8"> 11219 Dead phase: after the <eventlink id="VMDeath"></eventlink> event returns or after 11220 start-up failure. 11221 </constant> 11222 </constants> 11223 In the case of start-up failure the VM will proceed directly to the dead 11224 phase skipping intermediate phases and neither a <code>VMInit</code> nor 11225 <code>VMDeath</code> event will be sent. 11226 <p/> 11227 Most <jvmti/> functions operate only in the live phase. 11228 The following functions operate in either the <code>OnLoad</code> or live phases: 11229 <functionphaselist phase="onload"/> 11230 The following functions operate in only the <code>OnLoad</code> phase: 11231 <functionphaselist phase="onloadOnly"/> 11232 The following functions operate in the start or live phases: 11233 <functionphaselist phase="start"/> 11234 The following functions operate in any phase: 11235 <functionphaselist phase="any"/> 11236 JNI functions (except the Invocation API) must only be used in the start or live phases. 11237 <p/> 11238 Most <jvmti/> events are sent only in the live phase. 11239 The following events operate in others phases: 11240 <eventphaselist phase="start"/> 11241 <eventphaselist phase="any"/> 11242 </description> 11243 <origin>new</origin> 11244 <capabilities> 11245 </capabilities> 11246 <parameters> 11247 <param id="phase_ptr"> 11248 <outptr><enum>jvmtiPhase</enum></outptr> 11249 <description> 11250 On return, points to the phase. 11251 </description> 11252 </param> 11253 </parameters> 11254 <errors> 11255 </errors> 11256 </function> 11257 11258 <function id="DisposeEnvironment" jkernel="yes" phase="any" num="127"> 11259 <synopsis>Dispose Environment</synopsis> 11260 <description> 11261 Shutdown a <jvmti/> connection created with JNI <code>GetEnv</code> 11262 (see <internallink id="environments"><jvmti/> Environments</internallink>). 11263 Dispose of any resources held by the environment. 11264 <issue> 11265 What resources are reclaimed? What is undone? 11266 Breakpoints,watchpoints removed? 11267 </issue> 11268 Threads suspended by this environment are not resumed by this call, 11269 this must be done explicitly by the agent. 11270 Memory allocated by this environment via calls to <jvmti/> functions 11271 is not released, this can be done explicitly by the agent 11272 by calling <functionlink id="Deallocate"/>. 11273 Raw monitors created by this environment are not destroyed, 11274 this can be done explicitly by the agent 11275 by calling <functionlink id="DestroyRawMonitor"/>. 11276 The state of threads waiting on raw monitors created by this environment 11277 are not affected. 11278 <p/> 11279 Any <functionlink id="SetNativeMethodPrefix">native method 11280 prefixes</functionlink> for this environment will be unset; 11281 the agent must remove any prefixed native methods before 11282 dispose is called. 11283 <p/> 11284 Any <internallink id="capability">capabilities</internallink> 11285 held by this environment are relinquished. 11286 <p/> 11287 Events enabled by this environment will no longer be sent, however 11288 event handlers currently running will continue to run. Caution must 11289 be exercised in the design of event handlers whose environment may 11290 be disposed and thus become invalid during their execution. 11291 <p/> 11292 This environment may not be used after this call. 11293 This call returns to the caller. 11294 </description> 11295 <origin>new</origin> 11296 <capabilities> 11297 </capabilities> 11298 <parameters> 11299 </parameters> 11300 <errors> 11301 </errors> 11302 </function> 11303 11304 <function id="SetEnvironmentLocalStorage" jkernel="yes" phase="any" callbacksafe="safe" impl="innative notrace" num="148"> 11305 <synopsis>Set Environment Local Storage</synopsis> 11306 <description> 11307 The VM stores a pointer value associated with each environment. 11308 This pointer value is called <i>environment-local storage</i>. 11309 This value is <code>NULL</code> unless set with this function. 11310 Agents can allocate memory in which they store environment specific 11311 information. By setting environment-local storage it can then be 11312 accessed with 11313 <functionlink id="GetEnvironmentLocalStorage"></functionlink>. 11314 <p/> 11315 Called by the agent to set the value of the <jvmti/> 11316 environment-local storage. <jvmti/> supplies to the agent a pointer-size 11317 environment-local storage that can be used to record per-environment 11318 information. 11319 </description> 11320 <origin>new</origin> 11321 <capabilities> 11322 </capabilities> 11323 <parameters> 11324 <param id="data"> 11325 <inbuf> 11326 <void/> 11327 <nullok>value is set to <code>NULL</code></nullok> 11328 </inbuf> 11329 <description> 11330 The value to be entered into the environment-local storage. 11331 </description> 11332 </param> 11333 </parameters> 11334 <errors> 11335 </errors> 11336 </function> 11337 11338 <function id="GetEnvironmentLocalStorage" jkernel="yes" phase="any" callbacksafe="safe" impl="innative notrace" num="147"> 11339 <synopsis>Get Environment Local Storage</synopsis> 11340 <description> 11341 Called by the agent to get the value of the <jvmti/> environment-local 11342 storage. 11343 </description> 11344 <origin>new</origin> 11345 <capabilities> 11346 </capabilities> 11347 <parameters> 11348 <param id="data_ptr"> 11349 <agentbuf><void/></agentbuf> 11350 <description> 11351 Pointer through which the value of the environment local 11352 storage is returned. 11353 If environment-local storage has not been set with 11354 <functionlink id="SetEnvironmentLocalStorage"></functionlink> returned 11355 pointer is <code>NULL</code>. 11356 </description> 11357 </param> 11358 </parameters> 11359 <errors> 11360 </errors> 11361 </function> 11362 11363 <function id="GetVersionNumber" jkernel="yes" phase="any" num="88"> 11364 <synopsis>Get Version Number</synopsis> 11365 <description> 11366 Return the <jvmti/> version via <code>version_ptr</code>. 11367 The return value is the version identifier. 11368 The version identifier includes major, minor and micro 11369 version as well as the interface type. 11370 <constants id="jvmtiVersionInterfaceTypes" label="Version Interface Types" kind="bits"> 11371 <constant id="JVMTI_VERSION_INTERFACE_JNI" num="0x00000000"> 11372 Value of <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> for JNI. 11373 </constant> 11374 <constant id="JVMTI_VERSION_INTERFACE_JVMTI" num="0x30000000"> 11375 Value of <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> for <jvmti/>. 11376 </constant> 11377 </constants> 11378 <constants id="jvmtiVersionMasks" label="Version Masks" kind="bits"> 11379 <constant id="JVMTI_VERSION_MASK_INTERFACE_TYPE" num="0x70000000"> 11380 Mask to extract interface type. 11381 The value of the version returned by this function masked with 11382 <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> is always 11383 <code>JVMTI_VERSION_INTERFACE_JVMTI</code> 11384 since this is a <jvmti/> function. 11385 </constant> 11386 <constant id="JVMTI_VERSION_MASK_MAJOR" num="0x0FFF0000"> 11387 Mask to extract major version number. 11388 </constant> 11389 <constant id="JVMTI_VERSION_MASK_MINOR" num="0x0000FF00"> 11390 Mask to extract minor version number. 11391 </constant> 11392 <constant id="JVMTI_VERSION_MASK_MICRO" num="0x000000FF"> 11393 Mask to extract micro version number. 11394 </constant> 11395 </constants> 11396 <constants id="jvmtiVersionShifts" label="Version Shifts" kind="bits"> 11397 <constant id="JVMTI_VERSION_SHIFT_MAJOR" num="16"> 11398 Shift to extract major version number. 11399 </constant> 11400 <constant id="JVMTI_VERSION_SHIFT_MINOR" num="8"> 11401 Shift to extract minor version number. 11402 </constant> 11403 <constant id="JVMTI_VERSION_SHIFT_MICRO" num="0"> 11404 Shift to extract micro version number. 11405 </constant> 11406 </constants> 11407 </description> 11408 <origin>jvmdi</origin> 11409 <capabilities> 11410 </capabilities> 11411 <parameters> 11412 <param id="version_ptr"> 11413 <outptr><jint/></outptr> 11414 <description> 11415 On return, points to the <jvmti/> version. 11416 </description> 11417 </param> 11418 </parameters> 11419 <errors> 11420 </errors> 11421 </function> 11422 11423 11424 <function id="GetErrorName" phase="any" num="128"> 11425 <synopsis>Get Error Name</synopsis> 11426 <description> 11427 Return the symbolic name for an 11428 <internallink id="ErrorSection">error code</internallink>. 11429 <p/> 11430 For example 11431 <code>GetErrorName(env, JVMTI_ERROR_NONE, &err_name)</code> 11432 would return in <code>err_name</code> the string 11433 <code>"JVMTI_ERROR_NONE"</code>. 11434 </description> 11435 <origin>new</origin> 11436 <capabilities> 11437 </capabilities> 11438 <parameters> 11439 <param id="error"> 11440 <enum>jvmtiError</enum> 11441 <description> 11442 The error code. 11443 </description> 11444 </param> 11445 <param id="name_ptr"> 11446 <allocbuf><char/></allocbuf> 11447 <description> 11448 On return, points to the error name. 11449 The name is encoded as a 11450 <internallink id="mUTF">modified UTF-8</internallink> string, 11451 but is restricted to the ASCII subset. 11452 </description> 11453 </param> 11454 </parameters> 11455 <errors> 11456 </errors> 11457 </function> 11458 11459 <function id="SetVerboseFlag" phase="any" num="150"> 11460 <synopsis>Set Verbose Flag</synopsis> 11461 <description> 11462 <constants id="jvmtiVerboseFlag" label="Verbose Flag Enumeration" kind="enum"> 11463 <constant id="JVMTI_VERBOSE_OTHER" num="0"> 11464 Verbose output other than the below. 11465 </constant> 11466 <constant id="JVMTI_VERBOSE_GC" num="1"> 11467 Verbose garbage collector output, like that specified with <code>-verbose:gc</code>. 11468 </constant> 11469 <constant id="JVMTI_VERBOSE_CLASS" num="2"> 11470 Verbose class loading output, like that specified with <code>-verbose:class</code>. 11471 </constant> 11472 <constant id="JVMTI_VERBOSE_JNI" num="4"> 11473 Verbose JNI output, like that specified with <code>-verbose:jni</code>. 11474 </constant> 11475 </constants> 11476 Control verbose output. 11477 This is the output which typically is sent to <code>stderr</code>. 11478 </description> 11479 <origin>new</origin> 11480 <capabilities> 11481 </capabilities> 11482 <parameters> 11483 <param id="flag"> 11484 <enum>jvmtiVerboseFlag</enum> 11485 <description> 11486 Which verbose flag to set. 11487 </description> 11488 </param> 11489 <param id="value"> 11490 <jboolean/> 11491 <description> 11492 New value of the flag. 11493 </description> 11494 </param> 11495 </parameters> 11496 <errors> 11497 </errors> 11498 </function> 11499 11500 11501 <function id="GetJLocationFormat" phase="any" num="129"> 11502 <synopsis>Get JLocation Format</synopsis> 11503 <description> 11504 Although the greatest functionality is achieved with location information 11505 referencing the virtual machine bytecode index, the definition of 11506 <code>jlocation</code> has intentionally been left unconstrained to allow VM 11507 implementations that do not have this information. 11508 <p/> 11509 This function describes the representation of <code>jlocation</code> used in this VM. 11510 If the returned format is <datalink id="JVMTI_JLOCATION_JVMBCI"></datalink>, 11511 <code>jlocation</code>s can 11512 be used as in indices into the array returned by 11513 <functionlink id="GetBytecodes"></functionlink>. 11514 <constants id="jvmtiJlocationFormat" label="JLocation Format Enumeration" kind="enum"> 11515 <constant id="JVMTI_JLOCATION_JVMBCI" num="1"> 11516 <code>jlocation</code> values represent virtual machine 11517 bytecode indices--that is, offsets into the 11518 virtual machine code for a method. 11519 </constant> 11520 <constant id="JVMTI_JLOCATION_MACHINEPC" num="2"> 11521 <code>jlocation</code> values represent native machine 11522 program counter values. 11523 </constant> 11524 <constant id="JVMTI_JLOCATION_OTHER" num="0"> 11525 <code>jlocation</code> values have some other representation. 11526 </constant> 11527 </constants> 11528 </description> 11529 <origin>new</origin> 11530 <capabilities> 11531 </capabilities> 11532 <parameters> 11533 <param id="format_ptr"> 11534 <outptr><enum>jvmtiJlocationFormat</enum></outptr> 11535 <description> 11536 On return, points to the format identifier for <code>jlocation</code> values. 11537 </description> 11538 </param> 11539 </parameters> 11540 <errors> 11541 </errors> 11542 </function> 11543 11544 </category> 11545 11546 </functionsection> 11547 11548 <errorsection label="Error Reference"> 11549 <intro> 11550 Every <jvmti/> function returns a <b><code>jvmtiError</code></b> error code. 11551 <p/> 11552 It is the responsibility of the agent to call <jvmti/> functions with 11553 valid parameters and in the proper context (calling thread is attached, 11554 phase is correct, etc.). 11555 Detecting some error conditions may be difficult, inefficient, or 11556 impossible for an implementation. 11557 The errors listed in 11558 <internallink id="reqerrors">Function Specific Required Errors</internallink> 11559 must be detected by the implementation. 11560 All other errors represent the recommended response to the error 11561 condition. 11562 </intro> 11563 11564 <errorcategory id="universal-error" label="Universal Errors"> 11565 <intro> 11566 The following errors may be returned by any function 11567 </intro> 11568 11569 <errorid id="JVMTI_ERROR_NONE" num="0"> 11570 No error has occurred. This is the error code that is returned 11571 on successful completion of the function. 11572 </errorid> 11573 <errorid id="JVMTI_ERROR_NULL_POINTER" num="100"> 11574 Pointer is unexpectedly <code>NULL</code>. 11575 </errorid> 11576 <errorid id="JVMTI_ERROR_OUT_OF_MEMORY" num="110"> 11577 The function attempted to allocate memory and no more memory was 11578 available for allocation. 11579 </errorid> 11580 <errorid id="JVMTI_ERROR_ACCESS_DENIED" num="111"> 11581 The desired functionality has not been enabled in this virtual machine. 11582 </errorid> 11583 <errorid id="JVMTI_ERROR_UNATTACHED_THREAD" num="115"> 11584 The thread being used to call this function is not attached 11585 to the virtual machine. Calls must be made from attached threads. 11586 See <code>AttachCurrentThread</code> in the JNI invocation API. 11587 </errorid> 11588 <errorid id="JVMTI_ERROR_INVALID_ENVIRONMENT" num="116"> 11589 The <jvmti/> environment provided is no longer connected or is 11590 not an environment. 11591 </errorid> 11592 <errorid id="JVMTI_ERROR_WRONG_PHASE" num="112"> 11593 The desired functionality is not available in the current 11594 <functionlink id="GetPhase">phase</functionlink>. 11595 Always returned if the virtual machine has completed running. 11596 </errorid> 11597 <errorid id="JVMTI_ERROR_INTERNAL" num="113"> 11598 An unexpected internal error has occurred. 11599 </errorid> 11600 </errorcategory> 11601 11602 <errorcategory id="reqerrors" label="Function Specific Required Errors"> 11603 <intro> 11604 The following errors are returned by some <jvmti/> functions and must 11605 be returned by the implementation when the condition occurs. 11606 </intro> 11607 11608 <errorid id="JVMTI_ERROR_INVALID_PRIORITY" num="12"> 11609 Invalid priority. 11610 </errorid> 11611 <errorid id="JVMTI_ERROR_THREAD_NOT_SUSPENDED" num="13"> 11612 Thread was not suspended. 11613 </errorid> 11614 <errorid id="JVMTI_ERROR_THREAD_SUSPENDED" num="14"> 11615 Thread already suspended. 11616 </errorid> 11617 <errorid id="JVMTI_ERROR_THREAD_NOT_ALIVE" num="15"> 11618 This operation requires the thread to be alive--that is, 11619 it must be started and not yet have died. 11620 </errorid> 11621 <errorid id="JVMTI_ERROR_CLASS_NOT_PREPARED" num="22"> 11622 The class has been loaded but not yet prepared. 11623 </errorid> 11624 <errorid id="JVMTI_ERROR_NO_MORE_FRAMES" num="31"> 11625 There are no Java programming language or JNI stack frames at the specified depth. 11626 </errorid> 11627 <errorid id="JVMTI_ERROR_OPAQUE_FRAME" num="32"> 11628 Information about the frame is not available (e.g. for native frames). 11629 </errorid> 11630 <errorid id="JVMTI_ERROR_DUPLICATE" num="40"> 11631 Item already set. 11632 </errorid> 11633 <errorid id="JVMTI_ERROR_NOT_FOUND" num="41"> 11634 Desired element (e.g. field or breakpoint) not found 11635 </errorid> 11636 <errorid id="JVMTI_ERROR_NOT_MONITOR_OWNER" num="51"> 11637 This thread doesn't own the raw monitor. 11638 </errorid> 11639 <errorid id="JVMTI_ERROR_INTERRUPT" num="52"> 11640 The call has been interrupted before completion. 11641 </errorid> 11642 <errorid id="JVMTI_ERROR_UNMODIFIABLE_CLASS" num="79"> 11643 The class cannot be modified. 11644 </errorid> 11645 <errorid id="JVMTI_ERROR_UNMODIFIABLE_MODULE" num="80"> 11646 The module cannot be modified. 11647 </errorid> 11648 <errorid id="JVMTI_ERROR_NOT_AVAILABLE" num="98"> 11649 The functionality is not available in this virtual machine. 11650 </errorid> 11651 <errorid id="JVMTI_ERROR_ABSENT_INFORMATION" num="101"> 11652 The requested information is not available. 11653 </errorid> 11654 <errorid id="JVMTI_ERROR_INVALID_EVENT_TYPE" num="102"> 11655 The specified event type ID is not recognized. 11656 </errorid> 11657 <errorid id="JVMTI_ERROR_NATIVE_METHOD" num="104"> 11658 The requested information is not available for native method. 11659 </errorid> 11660 <errorid id="JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED" num="106"> 11661 The class loader does not support this operation. 11662 </errorid> 11663 </errorcategory> 11664 11665 <errorcategory id="function-specific-errors" label="Function Specific Agent Errors"> 11666 <intro> 11667 The following errors are returned by some <jvmti/> functions. 11668 They are returned in the event of invalid parameters passed by the 11669 agent or usage in an invalid context. 11670 An implementation is not required to detect these errors. 11671 </intro> 11672 11673 <errorid id="JVMTI_ERROR_INVALID_THREAD" num="10"> 11674 The passed thread is not a valid thread. 11675 </errorid> 11676 <errorid id="JVMTI_ERROR_INVALID_FIELDID" num="25"> 11677 Invalid field. 11678 </errorid> 11679 <errorid id="JVMTI_ERROR_INVALID_MODULE" num="26"> 11680 Invalid module. 11681 </errorid> 11682 <errorid id="JVMTI_ERROR_INVALID_METHODID" num="23"> 11683 Invalid method. 11684 </errorid> 11685 <errorid id="JVMTI_ERROR_INVALID_LOCATION" num="24"> 11686 Invalid location. 11687 </errorid> 11688 <errorid id="JVMTI_ERROR_INVALID_OBJECT" num="20"> 11689 Invalid object. 11690 </errorid> 11691 <errorid id="JVMTI_ERROR_INVALID_CLASS" num="21"> 11692 Invalid class. 11693 </errorid> 11694 <errorid id="JVMTI_ERROR_TYPE_MISMATCH" num="34"> 11695 The variable is not an appropriate type for the function used. 11696 </errorid> 11697 <errorid id="JVMTI_ERROR_INVALID_SLOT" num="35"> 11698 Invalid slot. 11699 </errorid> 11700 <errorid id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY" num="99"> 11701 The capability being used is false in this environment. 11702 </errorid> 11703 <errorid id="JVMTI_ERROR_INVALID_THREAD_GROUP" num="11"> 11704 Thread group invalid. 11705 </errorid> 11706 <errorid id="JVMTI_ERROR_INVALID_MONITOR" num="50"> 11707 Invalid raw monitor. 11708 </errorid> 11709 <errorid id="JVMTI_ERROR_ILLEGAL_ARGUMENT" num="103"> 11710 Illegal argument. 11711 </errorid> 11712 <errorid id="JVMTI_ERROR_INVALID_TYPESTATE" num="65"> 11713 The state of the thread has been modified, and is now inconsistent. 11714 </errorid> 11715 <errorid id="JVMTI_ERROR_UNSUPPORTED_VERSION" num="68"> 11716 A new class file has a version number not supported by this VM. 11717 </errorid> 11718 <errorid id="JVMTI_ERROR_INVALID_CLASS_FORMAT" num="60"> 11719 A new class file is malformed (the VM would return a <code>ClassFormatError</code>). 11720 </errorid> 11721 <errorid id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION" num="61"> 11722 The new class file definitions would lead to a circular 11723 definition (the VM would return a <code>ClassCircularityError</code>). 11724 </errorid> 11725 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED" num="63"> 11726 A new class file would require adding a method. 11727 </errorid> 11728 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED" num="64"> 11729 A new class version changes a field. 11730 </errorid> 11731 <errorid id="JVMTI_ERROR_FAILS_VERIFICATION" num="62"> 11732 The class bytes fail verification. 11733 </errorid> 11734 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED" num="66"> 11735 A direct superclass is different for the new class 11736 version, or the set of directly implemented 11737 interfaces is different. 11738 </errorid> 11739 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED" num="67"> 11740 A new class version does not declare a method 11741 declared in the old class version. 11742 </errorid> 11743 <errorid id="JVMTI_ERROR_NAMES_DONT_MATCH" num="69"> 11744 The class name defined in the new class file is 11745 different from the name in the old class object. 11746 </errorid> 11747 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED" num="70"> 11748 A new class version has different modifiers. 11749 </errorid> 11750 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED" num="71"> 11751 A method in the new class version has different modifiers 11752 than its counterpart in the old class version. 11753 </errorid> 11754 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED" num="72"> 11755 A new class version has unsupported differences in class attributes. 11756 </errorid> 11757 </errorcategory> 11758 </errorsection> 11759 11760 <eventsection label="Events"> 11761 <intro label="Handling Events" id="eventIntro"> 11762 Agents can be informed of many events that occur in application 11763 programs. 11764 <p/> 11765 To handle events, designate a set of callback functions with 11766 <functionlink id="SetEventCallbacks"></functionlink>. 11767 For each event the corresponding callback function will be 11768 called. 11769 Arguments to the callback function provide additional 11770 information about the event. 11771 <p/> 11772 The callback function is usually called from within an application 11773 thread. The <jvmti/> implementation does not 11774 queue events in any way. This means 11775 that event callback functions must be written 11776 carefully. Here are some general guidelines. See 11777 the individual event descriptions for further 11778 suggestions. 11779 <p/> 11780 <ul> 11781 <li>Any exception thrown during the execution of an event callback can 11782 overwrite any current pending exception in the current application thread. 11783 Care must be taken to preserve a pending exception 11784 when an event callback makes a JNI call that might generate an exception. 11785 </li> 11786 <li>Event callback functions must be re-entrant. The <jvmti/> implementation does 11787 not queue events. If an agent needs to process events one at a time, it 11788 can use a raw monitor inside the 11789 event callback functions to serialize event processing. 11790 </li> 11791 <li>Event callback functions that execute JNI's FindClass function to load 11792 classes need to note that FindClass locates the class loader associated 11793 with the current native method. For the purposes of class loading, an 11794 event callback that includes a JNI environment as a parameter to the 11795 callback will treated as if it is a native call, where the native method 11796 is in the class of the event thread's current frame. 11797 </li> 11798 </ul> 11799 <p/> 11800 Some <jvmti/> events identify objects with JNI references. 11801 All references 11802 in <jvmti/> events are JNI local references and will become invalid 11803 after the event callback returns. 11804 Unless stated otherwise, memory referenced by pointers sent in event 11805 callbacks may not be referenced after the event callback returns. 11806 <p/> 11807 Except where stated otherwise, events are delivered on the thread 11808 that caused the event. 11809 Events are sent at the time they occur. 11810 The specification for each event includes the set of 11811 <functionlink id="GetPhase">phases</functionlink> in which it can be sent; 11812 if an event triggering activity occurs during another phase, no event 11813 is sent. 11814 <p/> 11815 A thread that generates an event does not change its execution status 11816 (for example, the event does not cause the thread to be suspended). 11817 If an agent wishes the event to result in suspension, then the agent 11818 is responsible for explicitly suspending the thread with 11819 <functionlink id="SuspendThread"></functionlink>. 11820 <p/> 11821 If an event is enabled in multiple environments, the event will be sent 11822 to each agent in the order that the environments were created. 11823 </intro> 11824 11825 <intro label="Enabling Events" id="enablingevents"> 11826 All events are initially disabled. In order to receive any 11827 event: 11828 <ul> 11829 <li> 11830 If the event requires a capability, that capability must 11831 be added with 11832 <functionlink id="AddCapabilities"></functionlink>. 11833 </li> 11834 <li> 11835 A callback for the event must be set with 11836 <functionlink id="SetEventCallbacks"></functionlink>. 11837 </li> 11838 <li> 11839 The event must be enabled with 11840 <functionlink id="SetEventNotificationMode"></functionlink>. 11841 </li> 11842 </ul> 11843 </intro> 11844 11845 <intro label="Multiple Co-located Events" id="eventorder"> 11846 In many situations it is possible for multiple events to occur 11847 at the same location in one thread. When this happens, all the events 11848 are reported through the event callbacks in the order specified in this section. 11849 <p/> 11850 If the current location is at the entry point of a method, the 11851 <eventlink id="MethodEntry"></eventlink> event is reported before 11852 any other event at the current location in the same thread. 11853 <p/> 11854 If an exception catch has been detected at the current location, 11855 either because it is the beginning of a catch clause or a native method 11856 that cleared a pending exception has returned, the 11857 <code>exceptionCatch</code> event is reported before 11858 any other event at the current location in the same thread. 11859 <p/> 11860 If a <code>singleStep</code> event or 11861 <code>breakpoint</code> event is triggered at the 11862 current location, the event is defined to occur 11863 immediately before the code at the current location is executed. 11864 These events are reported before any events which are triggered 11865 by the execution of code at the current location in the same 11866 thread (specifically: 11867 <code>exception</code>, 11868 <code>fieldAccess</code>, and 11869 <code>fieldModification</code>). 11870 If both a step and breakpoint event are triggered for the same thread and 11871 location, the step event is reported before the breakpoint event. 11872 <p/> 11873 If the current location is the exit point of a method (that is, the last 11874 location before returning to the caller), the 11875 <eventlink id="MethodExit"></eventlink> event and 11876 the <eventlink id="FramePop"></eventlink> event (if requested) 11877 are reported after all other events at the current location in the same 11878 thread. There is no specified ordering of these two events 11879 with respect to each other. 11880 <p/> 11881 Co-located events can be triggered during the processing of some other 11882 event by the agent at the same location in the same thread. 11883 If such an event, of type <i>y</i>, is triggered during the processing of 11884 an event of type <i>x</i>, and if <i>x</i> 11885 precedes <i>y</i> in the ordering specified above, the co-located event 11886 <i>y</i> is reported for the current thread and location. If <i>x</i> does not precede 11887 <i>y</i>, <i>y</i> is not reported for the current thread and location. 11888 For example, if a breakpoint is set at the current location 11889 during the processing of <eventlink id="SingleStep"></eventlink>, 11890 that breakpoint will be reported before the thread moves off the current 11891 location. 11892 <p/>The following events are never considered to be co-located with 11893 other events. 11894 <ul> 11895 <li><eventlink id="VMStart"></eventlink></li> 11896 <li><eventlink id="VMInit"></eventlink></li> 11897 <li><eventlink id="VMDeath"></eventlink></li> 11898 <li><eventlink id="ThreadStart"></eventlink></li> 11899 <li><eventlink id="ThreadEnd"></eventlink></li> 11900 <li><eventlink id="ClassLoad"></eventlink></li> 11901 <li><eventlink id="ClassPrepare"></eventlink></li> 11902 </ul> 11903 </intro> 11904 11905 <intro label="Event Callbacks" id="jvmtiEventCallbacks"> 11906 The event callback structure below is used to specify the handler function 11907 for events. It is set with the 11908 <functionlink id="SetEventCallbacks"></functionlink> function. 11909 </intro> 11910 11911 <event label="Single Step" 11912 id="SingleStep" const="JVMTI_EVENT_SINGLE_STEP" filtered="thread" num="60"> 11913 <description> 11914 Single step events allow the agent to trace thread execution 11915 at the finest granularity allowed by the VM. A single step event is 11916 generated whenever a thread reaches a new location. 11917 Typically, single step events represent the completion of one VM 11918 instruction as defined in <vmspec/>. However, some implementations 11919 may define locations differently. In any case the 11920 <code>method</code> and <code>location</code> 11921 parameters uniquely identify the current location and allow 11922 the mapping to source file and line number when that information is 11923 available. 11924 <p/> 11925 No single step events are generated from within native methods. 11926 </description> 11927 <origin>jvmdi</origin> 11928 <capabilities> 11929 <required id="can_generate_single_step_events"></required> 11930 </capabilities> 11931 <parameters> 11932 <param id="jni_env"> 11933 <outptr> 11934 <struct>JNIEnv</struct> 11935 </outptr> 11936 <description> 11937 The JNI environment of the event (current) thread 11938 </description> 11939 </param> 11940 <param id="thread"> 11941 <jthread/> 11942 <description> 11943 Thread about to execution a new instruction 11944 </description> 11945 </param> 11946 <param id="klass"> 11947 <jclass method="method"/> 11948 <description> 11949 Class of the method about to execute a new instruction 11950 </description> 11951 </param> 11952 <param id="method"> 11953 <jmethodID class="klass"/> 11954 <description> 11955 Method about to execute a new instruction 11956 </description> 11957 </param> 11958 <param id="location"> 11959 <jlocation/> 11960 <description> 11961 Location of the new instruction 11962 </description> 11963 </param> 11964 </parameters> 11965 </event> 11966 11967 <event label="Breakpoint" 11968 id="Breakpoint" const="JVMTI_EVENT_BREAKPOINT" filtered="thread" num="62"> 11969 <description> 11970 Breakpoint events are generated whenever a thread reaches a location 11971 designated as a breakpoint with <functionlink id="SetBreakpoint"></functionlink>. 11972 The <code>method</code> and <code>location</code> 11973 parameters uniquely identify the current location and allow 11974 the mapping to source file and line number when that information is 11975 available. 11976 </description> 11977 <origin>jvmdi</origin> 11978 <capabilities> 11979 <required id="can_generate_breakpoint_events"></required> 11980 </capabilities> 11981 <parameters> 11982 <param id="jni_env"> 11983 <outptr> 11984 <struct>JNIEnv</struct> 11985 </outptr> 11986 <description> 11987 The JNI environment of the event (current) thread. 11988 </description> 11989 </param> 11990 <param id="thread"> 11991 <jthread/> 11992 <description> 11993 Thread that hit the breakpoint 11994 </description> 11995 </param> 11996 <param id="klass"> 11997 <jclass method="method"/> 11998 <description> 11999 Class of the method that hit the breakpoint 12000 </description> 12001 </param> 12002 <param id="method"> 12003 <jmethodID class="klass"/> 12004 <description> 12005 Method that hit the breakpoint 12006 </description> 12007 </param> 12008 <param id="location"> 12009 <jlocation/> 12010 <description> 12011 location of the breakpoint 12012 </description> 12013 </param> 12014 </parameters> 12015 </event> 12016 12017 <event label="Field Access" 12018 id="FieldAccess" const="JVMTI_EVENT_FIELD_ACCESS" filtered="thread" num="63"> 12019 <description> 12020 Field access events are generated whenever a thread accesses 12021 a field that was designated as a watchpoint 12022 with <functionlink id="SetFieldAccessWatch"></functionlink>. 12023 The <code>method</code> and <code>location</code> 12024 parameters uniquely identify the current location and allow 12025 the mapping to source file and line number when that information is 12026 available. 12027 </description> 12028 <origin>jvmdi</origin> 12029 <capabilities> 12030 <required id="can_generate_field_access_events"></required> 12031 </capabilities> 12032 <parameters> 12033 <param id="jni_env"> 12034 <outptr> 12035 <struct>JNIEnv</struct> 12036 </outptr> 12037 <description> 12038 The JNI environment of the event (current) thread 12039 </description> 12040 </param> 12041 <param id="thread"> 12042 <jthread/> 12043 <description> 12044 Thread accessing the field 12045 </description> 12046 </param> 12047 <param id="klass"> 12048 <jclass method="method"/> 12049 <description> 12050 Class of the method where the access is occurring 12051 </description> 12052 </param> 12053 <param id="method"> 12054 <jmethodID class="klass"/> 12055 <description> 12056 Method where the access is occurring 12057 </description> 12058 </param> 12059 <param id="location"> 12060 <jlocation/> 12061 <description> 12062 Location where the access is occurring 12063 </description> 12064 </param> 12065 <param id="field_klass"> 12066 <jclass field="field"/> 12067 <description> 12068 Class of the field being accessed 12069 </description> 12070 </param> 12071 <param id="object"> 12072 <jobject/> 12073 <description> 12074 Object with the field being accessed if the field is an 12075 instance field; <code>NULL</code> otherwise 12076 </description> 12077 </param> 12078 <param id="field"> 12079 <jfieldID class="field_klass"/> 12080 <description> 12081 Field being accessed 12082 </description> 12083 </param> 12084 </parameters> 12085 </event> 12086 12087 <event label="Field Modification" 12088 id="FieldModification" const="JVMTI_EVENT_FIELD_MODIFICATION" filtered="thread" num="64"> 12089 <description> 12090 Field modification events are generated whenever a thread modifies 12091 a field that was designated as a watchpoint 12092 with <functionlink id="SetFieldModificationWatch"></functionlink>. 12093 The <code>method</code> and <code>location</code> 12094 parameters uniquely identify the current location and allow 12095 the mapping to source file and line number when that information is 12096 available. 12097 </description> 12098 <origin>jvmdi</origin> 12099 <capabilities> 12100 <required id="can_generate_field_modification_events"></required> 12101 </capabilities> 12102 <parameters> 12103 <param id="jni_env"> 12104 <outptr> 12105 <struct>JNIEnv</struct> 12106 </outptr> 12107 <description> 12108 The JNI environment of the event (current) thread 12109 </description> 12110 </param> 12111 <param id="thread"> 12112 <jthread/> 12113 <description> 12114 Thread modifying the field 12115 </description> 12116 </param> 12117 <param id="klass"> 12118 <jclass method="method"/> 12119 <description> 12120 Class of the method where the modification is occurring 12121 </description> 12122 </param> 12123 <param id="method"> 12124 <jmethodID class="klass"/> 12125 <description> 12126 Method where the modification is occurring 12127 </description> 12128 </param> 12129 <param id="location"> 12130 <jlocation/> 12131 <description> 12132 Location where the modification is occurring 12133 </description> 12134 </param> 12135 <param id="field_klass"> 12136 <jclass field="field"/> 12137 <description> 12138 Class of the field being modified 12139 </description> 12140 </param> 12141 <param id="object"> 12142 <jobject/> 12143 <description> 12144 Object with the field being modified if the field is an 12145 instance field; <code>NULL</code> otherwise 12146 </description> 12147 </param> 12148 <param id="field"> 12149 <jfieldID class="field_klass"/> 12150 <description> 12151 Field being modified 12152 </description> 12153 </param> 12154 <param id="signature_type"> 12155 <char/> 12156 <description> 12157 Signature type of the new value 12158 </description> 12159 </param> 12160 <param id="new_value"> 12161 <jvalue/> 12162 <description> 12163 The new value 12164 </description> 12165 </param> 12166 </parameters> 12167 </event> 12168 12169 <event label="Frame Pop" 12170 id="FramePop" const="JVMTI_EVENT_FRAME_POP" filtered="thread" num="61"> 12171 <description> 12172 Frame pop events are generated upon exit from a single method 12173 in a single frame as specified 12174 in a call to <functionlink id="NotifyFramePop"></functionlink>. 12175 This is true whether termination is caused by 12176 executing its return instruction 12177 or by throwing an exception to its caller 12178 (see <paramlink id="was_popped_by_exception"></paramlink>). 12179 However, frame pops caused by the <functionlink id="PopFrame"/> 12180 function are not reported. 12181 <p/> 12182 The location reported by <functionlink id="GetFrameLocation"></functionlink> 12183 identifies the executable location in the returning method, 12184 immediately prior to the return. 12185 </description> 12186 <origin>jvmdi</origin> 12187 <capabilities> 12188 <required id="can_generate_frame_pop_events"></required> 12189 </capabilities> 12190 <parameters> 12191 <param id="jni_env"> 12192 <outptr> 12193 <struct>JNIEnv</struct> 12194 </outptr> 12195 <description> 12196 The JNI environment of the event (current) thread 12197 </description> 12198 </param> 12199 <param id="thread"> 12200 <jthread/> 12201 <description> 12202 Thread that is popping the frame 12203 </description> 12204 </param> 12205 <param id="klass"> 12206 <jclass method="method"/> 12207 <description> 12208 Class of the method being popped 12209 </description> 12210 </param> 12211 <param id="method"> 12212 <jmethodID class="klass"/> 12213 <description> 12214 Method being popped 12215 </description> 12216 </param> 12217 <param id="was_popped_by_exception"> 12218 <jboolean/> 12219 <description> 12220 True if frame was popped by a thrown exception. 12221 False if method exited through its return instruction. 12222 </description> 12223 </param> 12224 </parameters> 12225 </event> 12226 12227 <event label="Method Entry" 12228 id="MethodEntry" const="JVMTI_EVENT_METHOD_ENTRY" filtered="thread" num="65"> 12229 <description> 12230 Method entry events are generated upon entry of Java 12231 programming language methods (including native methods). 12232 <p/> 12233 The location reported by <functionlink id="GetFrameLocation"></functionlink> 12234 identifies the initial executable location in 12235 the method. 12236 <p/> 12237 Enabling method 12238 entry or exit events will significantly degrade performance on many platforms and is thus 12239 not advised for performance critical usage (such as profiling). 12240 <internallink id="bci">Bytecode instrumentation</internallink> should be 12241 used in these cases. 12242 </description> 12243 <origin>jvmdi</origin> 12244 <capabilities> 12245 <required id="can_generate_method_entry_events"></required> 12246 </capabilities> 12247 <parameters> 12248 <param id="jni_env"> 12249 <outptr> 12250 <struct>JNIEnv</struct> 12251 </outptr> 12252 <description> 12253 The JNI environment of the event (current) thread 12254 </description> 12255 </param> 12256 <param id="thread"> 12257 <jthread/> 12258 <description> 12259 Thread entering the method 12260 </description> 12261 </param> 12262 <param id="klass"> 12263 <jclass method="method"/> 12264 <description> 12265 Class of the method being entered 12266 </description> 12267 </param> 12268 <param id="method"> 12269 <jmethodID class="klass"/> 12270 <description> 12271 Method being entered 12272 </description> 12273 </param> 12274 </parameters> 12275 </event> 12276 12277 <event label="Method Exit" 12278 id="MethodExit" const="JVMTI_EVENT_METHOD_EXIT" filtered="thread" num="66"> 12279 <description> 12280 Method exit events are generated upon exit from Java 12281 programming language methods (including native methods). 12282 This is true whether termination is caused by 12283 executing its return instruction 12284 or by throwing an exception to its caller 12285 (see <paramlink id="was_popped_by_exception"></paramlink>). 12286 <p/> 12287 The <code>method</code> field uniquely identifies the 12288 method being entered or exited. The <code>frame</code> field provides 12289 access to the stack frame for the method. 12290 <p/> 12291 The location reported by <functionlink id="GetFrameLocation"></functionlink> 12292 identifies the executable location in the returning method 12293 immediately prior to the return. 12294 <p/> 12295 Enabling method 12296 entry or exit events will significantly degrade performance on many platforms and is thus 12297 not advised for performance critical usage (such as profiling). 12298 <internallink id="bci">Bytecode instrumentation</internallink> should be 12299 used in these cases. 12300 </description> 12301 <origin>jvmdi</origin> 12302 <capabilities> 12303 <required id="can_generate_method_exit_events"></required> 12304 </capabilities> 12305 <parameters> 12306 <param id="jni_env"> 12307 <outptr> 12308 <struct>JNIEnv</struct> 12309 </outptr> 12310 <description> 12311 The JNI environment of the event (current) thread 12312 </description> 12313 </param> 12314 <param id="thread"> 12315 <jthread/> 12316 <description> 12317 Thread exiting the method 12318 </description> 12319 </param> 12320 <param id="klass"> 12321 <jclass method="method"/> 12322 <description> 12323 Class of the method being exited 12324 </description> 12325 </param> 12326 <param id="method"> 12327 <jmethodID class="klass"/> 12328 <description> 12329 Method being exited 12330 </description> 12331 </param> 12332 <param id="was_popped_by_exception"> 12333 <jboolean/> 12334 <description> 12335 True if frame was popped by a thrown exception. 12336 False if method exited through its return instruction. 12337 </description> 12338 </param> 12339 <param id="return_value"> 12340 <jvalue/> 12341 <description> 12342 The return value of the method being exited. 12343 Undefined and should not be used if 12344 <paramlink id="was_popped_by_exception"></paramlink> 12345 is true. 12346 </description> 12347 </param> 12348 </parameters> 12349 </event> 12350 12351 <event label="Native Method Bind" phase="any" 12352 id="NativeMethodBind" const="JVMTI_EVENT_NATIVE_METHOD_BIND" num="67"> 12353 <description> 12354 A Native Method Bind event is sent when a VM binds a 12355 Java programming language native method 12356 to the address of a function that implements the native method. 12357 This will occur when the native method is called for the first time 12358 and also occurs when the JNI function <code>RegisterNatives</code> is called. 12359 This event allows the bind to be redirected to an agent-specified 12360 proxy function. 12361 This event is not sent when the native method is unbound. 12362 Typically, this proxy function will need to be specific to a 12363 particular method or, to handle the general case, automatically 12364 generated assembly code, since after instrumentation code is 12365 executed the function at the original binding 12366 address will usually be invoked. 12367 The original binding can be restored or the redirection changed 12368 by use of the JNI function <code>RegisterNatives</code>. 12369 Some events may be sent during the primordial phase, JNI and 12370 most of <jvmti/> cannot be used at this time but the method and 12371 address can be saved for use later. 12372 </description> 12373 <origin>new</origin> 12374 <capabilities> 12375 <required id="can_generate_native_method_bind_events"></required> 12376 </capabilities> 12377 <parameters> 12378 <param id="jni_env"> 12379 <outptr> 12380 <struct>JNIEnv</struct> 12381 </outptr> 12382 <description> 12383 The JNI environment of the event (current) thread 12384 Will be <code>NULL</code> if sent during the primordial 12385 <functionlink id="GetPhase">phase</functionlink>. 12386 </description> 12387 </param> 12388 <param id="thread"> 12389 <jthread/> 12390 <description> 12391 Thread requesting the bind 12392 </description> 12393 </param> 12394 <param id="klass"> 12395 <jclass method="method"/> 12396 <description> 12397 Class of the method being bound 12398 </description> 12399 </param> 12400 <param id="method"> 12401 <jmethodID class="klass"/> 12402 <description> 12403 Native method being bound 12404 </description> 12405 </param> 12406 <param id="address"> 12407 <outptr><void/></outptr> 12408 <description> 12409 The address the VM is about to bind to--that is, the 12410 address of the implementation of the native method 12411 </description> 12412 </param> 12413 <param id="new_address_ptr"> 12414 <agentbuf><void/></agentbuf> 12415 <description> 12416 if the referenced address is changed (that is, if 12417 <code>*new_address_ptr</code> is set), the binding 12418 will instead be made to the supplied address. 12419 </description> 12420 </param> 12421 </parameters> 12422 </event> 12423 12424 <event label="Exception" 12425 id="Exception" const="JVMTI_EVENT_EXCEPTION" filtered="thread" num="58"> 12426 <description> 12427 Exception events are generated whenever an exception is first detected 12428 in a Java programming language method. 12429 Where "exception" means any <code>java.lang.Throwable</code>. 12430 The exception may have been thrown by a Java programming language or native 12431 method, but in the case of native methods, the event is not generated 12432 until the exception is first seen by a Java programming language method. If an exception is 12433 set and cleared in a native method (and thus is never visible to Java programming language code), 12434 no exception event is generated. 12435 <p/> 12436 The <code>method</code> and <code>location</code> 12437 parameters uniquely identify the current location 12438 (where the exception was detected) and allow 12439 the mapping to source file and line number when that information is 12440 available. The <code>exception</code> field identifies the thrown 12441 exception object. The <code>catch_method</code> 12442 and <code>catch_location</code> identify the location of the catch clause, 12443 if any, that handles the thrown exception. If there is no such catch clause, 12444 each field is set to 0. There is no guarantee that the thread will ever 12445 reach this catch clause. If there are native methods on the call stack 12446 between the throw location and the catch clause, the exception may 12447 be reset by one of those native methods. 12448 Similarly, exceptions that are reported as uncaught (<code>catch_klass</code> 12449 et al. set to 0) may in fact be caught by native code. 12450 Agents can check for these occurrences by monitoring 12451 <eventlink id="ExceptionCatch"></eventlink> events. 12452 Note that finally clauses are implemented as catch and re-throw. Therefore they 12453 will be reported in the catch location. 12454 </description> 12455 <origin>jvmdi</origin> 12456 <capabilities> 12457 <required id="can_generate_exception_events"></required> 12458 </capabilities> 12459 <parameters> 12460 <param id="jni_env"> 12461 <outptr> 12462 <struct>JNIEnv</struct> 12463 </outptr> 12464 <description> 12465 The JNI environment of the event (current) thread 12466 </description> 12467 </param> 12468 <param id="thread"> 12469 <jthread/> 12470 <description> 12471 Thread generating the exception 12472 </description> 12473 </param> 12474 <param id="klass"> 12475 <jclass method="method"/> 12476 <description> 12477 Class generating the exception 12478 </description> 12479 </param> 12480 <param id="method"> 12481 <jmethodID class="klass"/> 12482 <description> 12483 Method generating the exception 12484 </description> 12485 </param> 12486 <param id="location"> 12487 <jlocation/> 12488 <description> 12489 Location where exception occurred 12490 </description> 12491 </param> 12492 <param id="exception"> 12493 <jobject/> 12494 <description> 12495 The exception being thrown 12496 </description> 12497 </param> 12498 <param id="catch_klass"> 12499 <jclass method="catch_method"/> 12500 <description> 12501 Class that will catch the exception, or <code>NULL</code> if no known catch 12502 </description> 12503 </param> 12504 <param id="catch_method"> 12505 <jmethodID class="catch_klass"/> 12506 <description> 12507 Method that will catch the exception, or <code>NULL</code> if no known catch 12508 </description> 12509 </param> 12510 <param id="catch_location"> 12511 <jlocation/> 12512 <description> 12513 location which will catch the exception or zero if no known catch 12514 </description> 12515 </param> 12516 </parameters> 12517 </event> 12518 12519 <event label="Exception Catch" 12520 id="ExceptionCatch" const="JVMTI_EVENT_EXCEPTION_CATCH" filtered="thread" num="59"> 12521 <description> 12522 Exception catch events are generated whenever a thrown exception is caught. 12523 Where "exception" means any <code>java.lang.Throwable</code>. 12524 If the exception is caught in a Java programming language method, the event is generated 12525 when the catch clause is reached. If the exception is caught in a native 12526 method, the event is generated as soon as control is returned to a Java programming language 12527 method. Exception catch events are generated for any exception for which 12528 a throw was detected in a Java programming language method. 12529 Note that finally clauses are implemented as catch and re-throw. Therefore they 12530 will generate exception catch events. 12531 <p/> 12532 The <code>method</code> and <code>location</code> 12533 parameters uniquely identify the current location 12534 and allow the mapping to source file and line number when that information is 12535 available. For exceptions caught in a Java programming language method, the 12536 <code>exception</code> object identifies the exception object. Exceptions 12537 caught in native methods are not necessarily available by the time the 12538 exception catch is reported, so the <code>exception</code> field is set 12539 to <code>NULL</code>. 12540 </description> 12541 <origin>jvmdi</origin> 12542 <capabilities> 12543 <required id="can_generate_exception_events"></required> 12544 </capabilities> 12545 <parameters> 12546 <param id="jni_env"> 12547 <outptr> 12548 <struct>JNIEnv</struct> 12549 </outptr> 12550 <description> 12551 The JNI environment of the event (current) thread 12552 </description> 12553 </param> 12554 <param id="thread"> 12555 <jthread/> 12556 <description> 12557 Thread catching the exception 12558 </description> 12559 </param> 12560 <param id="klass"> 12561 <jclass method="method"/> 12562 <description> 12563 Class catching the exception 12564 </description> 12565 </param> 12566 <param id="method"> 12567 <jmethodID class="klass"/> 12568 <description> 12569 Method catching the exception 12570 </description> 12571 </param> 12572 <param id="location"> 12573 <jlocation/> 12574 <description> 12575 Location where exception is being caught 12576 </description> 12577 </param> 12578 <param id="exception"> 12579 <jobject/> 12580 <description> 12581 Exception being caught 12582 </description> 12583 </param> 12584 </parameters> 12585 </event> 12586 12587 <event label="Thread Start" 12588 id="ThreadStart" const="JVMTI_EVENT_THREAD_START" num="52" phase="start"> 12589 <description> 12590 Thread start events are generated by a new thread before its initial 12591 method executes. 12592 <p/> 12593 A thread may be listed in the array returned by 12594 <functionlink id="GetAllThreads"></functionlink> 12595 before its thread start event is generated. 12596 It is possible for other events to be generated 12597 on a thread before its thread start event. 12598 <p/> 12599 The event is sent on the newly started <paramlink id="thread"></paramlink>. 12600 </description> 12601 <origin>jvmdi</origin> 12602 <capabilities> 12603 </capabilities> 12604 <parameters> 12605 <param id="jni_env"> 12606 <outptr> 12607 <struct>JNIEnv</struct> 12608 </outptr> 12609 <description> 12610 The JNI environment of the event (current) thread. 12611 </description> 12612 </param> 12613 <param id="thread"> 12614 <jthread/> 12615 <description> 12616 Thread starting 12617 </description> 12618 </param> 12619 </parameters> 12620 </event> 12621 12622 <event label="Thread End" 12623 id="ThreadEnd" const="JVMTI_EVENT_THREAD_END" filtered="thread" num="53" phase="start"> 12624 <description> 12625 Thread end events are generated by a terminating thread 12626 after its initial method has finished execution. 12627 <p/> 12628 A thread may be listed in the array returned by 12629 <functionlink id="GetAllThreads"></functionlink> 12630 after its thread end event is generated. 12631 No events are generated on a thread 12632 after its thread end event. 12633 <p/> 12634 The event is sent on the dying <paramlink id="thread"></paramlink>. 12635 </description> 12636 <origin>jvmdi</origin> 12637 <capabilities> 12638 </capabilities> 12639 <parameters> 12640 <param id="jni_env"> 12641 <outptr> 12642 <struct>JNIEnv</struct> 12643 </outptr> 12644 <description> 12645 The JNI environment of the event (current) thread. 12646 </description> 12647 </param> 12648 <param id="thread"> 12649 <jthread/> 12650 <description> 12651 Thread ending 12652 </description> 12653 </param> 12654 </parameters> 12655 </event> 12656 12657 <event label="Class Load" 12658 id="ClassLoad" const="JVMTI_EVENT_CLASS_LOAD" filtered="thread" phase="start" num="55"> 12659 <description> 12660 A class load event is generated when a class is first loaded. The order 12661 of class load events generated by a particular thread are guaranteed 12662 to match the order of class loading within that thread. 12663 Array class creation does not generate a class load event. 12664 The creation of a primitive class (for example, java.lang.Integer.TYPE) 12665 does not generate a class load event. 12666 <p/> 12667 This event is sent at an early stage in loading the class. As 12668 a result the class should be used carefully. Note, for example, 12669 that methods and fields are not yet loaded, so queries for methods, 12670 fields, subclasses, and so on will not give correct results. 12671 See "Loading of Classes and Interfaces" in the <i>Java Language 12672 Specification</i>. For most 12673 purposes the <eventlink id="ClassPrepare"></eventlink> event will 12674 be more useful. 12675 </description> 12676 <origin>jvmdi</origin> 12677 <capabilities> 12678 </capabilities> 12679 <parameters> 12680 <param id="jni_env"> 12681 <outptr> 12682 <struct>JNIEnv</struct> 12683 </outptr> 12684 <description> 12685 The JNI environment of the event (current) thread 12686 </description> 12687 </param> 12688 <param id="thread"> 12689 <jthread/> 12690 <description> 12691 Thread loading the class 12692 </description> 12693 </param> 12694 <param id="klass"> 12695 <jclass/> 12696 <description> 12697 Class being loaded 12698 </description> 12699 </param> 12700 </parameters> 12701 </event> 12702 12703 <elide> 12704 <event label="Class Unload" 12705 id="ClassUnload" const="JVMTI_EVENT_CLASS_UNLOAD" num="57"> 12706 <description> 12707 A class unload event is generated when the class is about to be unloaded. 12708 Class unload events take place during garbage collection and must be 12709 handled extremely carefully. The garbage collector holds many locks 12710 and has suspended all other threads, so the event handler cannot depend 12711 on the ability to acquire any locks. The class unload event handler should 12712 do as little as possible, perhaps by queuing information to be processed 12713 later. In particular, the <code>jclass</code> should be used only in 12714 the JNI function <code>isSameObject</code> or in the following <jvmti/> functions: 12715 <ul> 12716 <li><functionlink id="GetClassSignature"></functionlink></li> 12717 <li><functionlink id="GetSourceFileName"></functionlink></li> 12718 <li><functionlink id="IsInterface"></functionlink></li> 12719 <li><functionlink id="IsArrayClass"></functionlink></li> 12720 </ul> 12721 </description> 12722 <origin>jvmdi</origin> 12723 <capabilities> 12724 </capabilities> 12725 <parameters> 12726 <param id="jni_env"> 12727 <outptr> 12728 <struct>JNIEnv</struct> 12729 </outptr> 12730 <description> 12731 The JNI environment of the event (current) thread 12732 </description> 12733 </param> 12734 <param id="thread"> 12735 <jthread/> 12736 <description> 12737 Thread generating the class unload 12738 </description> 12739 </param> 12740 <param id="klass"> 12741 <jclass/> 12742 <description> 12743 Class being unloaded 12744 </description> 12745 </param> 12746 </parameters> 12747 </event> 12748 </elide> 12749 12750 <event label="Class Prepare" 12751 id="ClassPrepare" const="JVMTI_EVENT_CLASS_PREPARE" filtered="thread" phase="start" num="56"> 12752 <description> 12753 A class prepare event is generated when class preparation is complete. 12754 At this point, class fields, methods, and implemented interfaces are 12755 available, and no code from the class has been executed. Since array 12756 classes never have fields or methods, class prepare events are not 12757 generated for them. Class prepare events are not generated for 12758 primitive classes (for example, <code>java.lang.Integer.TYPE</code>). 12759 </description> 12760 <origin>jvmdi</origin> 12761 <capabilities> 12762 </capabilities> 12763 <parameters> 12764 <param id="jni_env"> 12765 <outptr> 12766 <struct>JNIEnv</struct> 12767 </outptr> 12768 <description> 12769 The JNI environment of the event (current) thread 12770 </description> 12771 </param> 12772 <param id="thread"> 12773 <jthread/> 12774 <description> 12775 Thread generating the class prepare 12776 </description> 12777 </param> 12778 <param id="klass"> 12779 <jclass/> 12780 <description> 12781 Class being prepared 12782 </description> 12783 </param> 12784 </parameters> 12785 </event> 12786 12787 <event label="Class File Load Hook" phase="any" 12788 id="ClassFileLoadHook" const="JVMTI_EVENT_CLASS_FILE_LOAD_HOOK" num="54"> 12789 <description> 12790 This event is sent when the VM obtains class file data, 12791 but before it constructs 12792 the in-memory representation for that class. 12793 This event is also sent when the class is being modified by the 12794 <functionlink id="RetransformClasses"/> function or 12795 the <functionlink id="RedefineClasses"/> function, 12796 called in any <jvmti/> environment. 12797 The agent can instrument 12798 the existing class file data sent by the VM to include profiling/debugging hooks. 12799 See the description of 12800 <internallink id="bci">bytecode instrumentation</internallink> 12801 for usage information. 12802 <p/> 12803 When the capabilities 12804 <internallink id="jvmtiCapabilities.can_generate_early_class_hook_events"> 12805 <code>can_generate_early_class_hook_events</code></internallink> and 12806 <internallink id="jvmtiCapabilities.can_generate_all_class_hook_events"> 12807 <code>can_generate_all_class_hook_events</code></internallink> 12808 are enabled then this event may be sent in the primordial phase. 12809 Otherwise, this event may be sent before the VM is initialized (the start 12810 <functionlink id="GetPhase">phase</functionlink>). 12811 Some classes might not be compatible 12812 with the function (eg. ROMized classes or implementation defined classes) and this event will 12813 not be generated for these classes. 12814 <p/> 12815 The agent must allocate the space for the modified 12816 class file data buffer 12817 using the memory allocation function 12818 <functionlink id="Allocate"></functionlink> because the 12819 VM is responsible for freeing the new class file data buffer 12820 using <functionlink id="Deallocate"></functionlink>. 12821 <p/> 12822 If the agent wishes to modify the class file, it must set 12823 <code>new_class_data</code> to point 12824 to the newly instrumented class file data buffer and set 12825 <code>new_class_data_len</code> to the length of that 12826 buffer before returning 12827 from this call. If no modification is desired, the agent simply 12828 does not set <code>new_class_data</code>. If multiple agents 12829 have enabled this event the results are chained. That is, if 12830 <code>new_class_data</code> has been set, it becomes the 12831 <code>class_data</code> for the next agent. 12832 <p/> 12833 When handling a class load in the live phase, then the 12834 <functionlink id="GetNamedModule"></functionlink> 12835 function can be used to map class loader and a package name to a module. 12836 When a class is being redefined or retransformed then 12837 <code>class_being_redefined</code> is non <code>NULL</code> and so 12838 the JNI <code>GetModule</code> function can also be used 12839 to obtain the Module. 12840 <p/> 12841 The order that this event is sent to each environment differs 12842 from other events. 12843 This event is sent to environments in the following order: 12844 <ul> 12845 <li><fieldlink id="can_retransform_classes" 12846 struct="jvmtiCapabilities">retransformation 12847 incapable</fieldlink> 12848 environments, in the 12849 order in which they were created 12850 </li> 12851 <li><fieldlink id="can_retransform_classes" 12852 struct="jvmtiCapabilities">retransformation 12853 capable</fieldlink> 12854 environments, in the 12855 order in which they were created 12856 </li> 12857 </ul> 12858 When triggered by <functionlink id="RetransformClasses"/>, 12859 this event is sent only to <fieldlink id="can_retransform_classes" 12860 struct="jvmtiCapabilities">retransformation 12861 capable</fieldlink> 12862 environments. 12863 </description> 12864 <origin>jvmpi</origin> 12865 <capabilities> 12866 <capability id="can_generate_all_class_hook_events"></capability> 12867 <capability id="can_generate_early_class_hook_events"></capability> 12868 </capabilities> 12869 <parameters> 12870 <param id="jni_env"> 12871 <outptr> 12872 <struct>JNIEnv</struct> 12873 </outptr> 12874 <description> 12875 The JNI environment of the event (current) thread. 12876 </description> 12877 </param> 12878 <param id="class_being_redefined"> 12879 <jclass/> 12880 <description> 12881 The class being 12882 <functionlink id="RedefineClasses">redefined</functionlink> or 12883 <functionlink id="RetransformClasses">retransformed</functionlink>. 12884 <code>NULL</code> if sent by class load. 12885 </description> 12886 </param> 12887 <param id="loader"> 12888 <jobject/> 12889 <description> 12890 The class loader loading the class. 12891 <code>NULL</code> if the bootstrap class loader. 12892 </description> 12893 </param> 12894 <param id="name"> 12895 <vmbuf><char/></vmbuf> 12896 <description> 12897 Name of class being loaded as a VM internal qualified name 12898 (for example, "java/util/List"), encoded as a 12899 <internallink id="mUTF">modified UTF-8</internallink> string. 12900 Note: if the class is defined with a <code>NULL</code> name or 12901 without a name specified, <code>name</code> will be <code>NULL</code>. 12902 </description> 12903 </param> 12904 <param id="protection_domain"> 12905 <jobject/> 12906 <description> 12907 The <code>ProtectionDomain</code> of the class. 12908 </description> 12909 </param> 12910 <param id="class_data_len"> 12911 <jint/> 12912 <description> 12913 Length of current class file data buffer. 12914 </description> 12915 </param> 12916 <param id="class_data"> 12917 <vmbuf><uchar/></vmbuf> 12918 <description> 12919 Pointer to the current class file data buffer. 12920 </description> 12921 </param> 12922 <param id="new_class_data_len"> 12923 <outptr><jint/></outptr> 12924 <description> 12925 Pointer to the length of the new class file data buffer. 12926 </description> 12927 </param> 12928 <param id="new_class_data"> 12929 <agentbuf incount="new_class_data_len"><uchar/></agentbuf> 12930 <description> 12931 Pointer to the pointer to the instrumented class file data buffer. 12932 </description> 12933 </param> 12934 </parameters> 12935 </event> 12936 12937 <event label="VM Start Event" 12938 id="VMStart" const="JVMTI_EVENT_VM_START" num="57" phase="start"> 12939 <description> 12940 The VM start event signals the start of the VM. 12941 At this time JNI is live but the VM is not yet fully initialized. 12942 Once this event is generated, the agent is free to call any JNI function. 12943 This event signals the beginning of the start phase, 12944 <jvmti/> functions permitted in the start phase may be called. 12945 <p/> 12946 The timing of this event may depend on whether the agent has added the 12947 <internallink id="jvmtiCapabilities.can_generate_early_vmstart"> 12948 <code>can_generate_early_vmstart</code></internallink> capability or not. 12949 If the capability has been added then the VM posts the event as early 12950 as possible. The VM is capable of executing bytecode but it may not have 12951 initialized to the point where it can load classes in modules other than 12952 <code>java.base</code>, or even arbitrary classes in <code>java.base</code>. 12953 Agents that do load-time instrumentation in this 12954 phase must take great care when instrumenting code that potentially 12955 executes in this phase. Extreme care should also be taken with JNI 12956 <code>FindClass</code> as it may not be possible to load classes and attempts 12957 to do so may result in unpredictable behavior, maybe even stability issues 12958 on some VM implementations. 12959 If the capability has not been added then the VM delays posting this 12960 event until it is capable of loading classes in modules other than 12961 <code>java.base</code> or the VM has completed its initialization. 12962 Agents that create more than one JVM TI environment, where the 12963 capability is added to some but not all environments, may observe the 12964 start phase beginning earlier in the JVM TI environments that possess 12965 the capabilty. 12966 <p/> 12967 In the case of VM start-up failure, this event will not be sent. 12968 </description> 12969 <origin>jvmdi</origin> 12970 <capabilities> 12971 </capabilities> 12972 <parameters> 12973 <param id="jni_env"> 12974 <outptr> 12975 <struct>JNIEnv</struct> 12976 </outptr> 12977 <description> 12978 The JNI environment of the event (current) thread. 12979 </description> 12980 </param> 12981 </parameters> 12982 </event> 12983 12984 <event label="VM Initialization Event" 12985 id="VMInit" const="JVMTI_EVENT_VM_INIT" num="50"> 12986 <description> 12987 The VM initialization event signals the completion of VM initialization. Once 12988 this event is generated, the agent is free to call any JNI or <jvmti/> 12989 function. The VM initialization event can be preceded by or can be concurrent 12990 with other events, but 12991 the preceding events should be handled carefully, if at all, because the 12992 VM has not completed its initialization. The thread start event for the 12993 main application thread is guaranteed not to occur until after the 12994 handler for the VM initialization event returns. 12995 <p/> 12996 In the case of VM start-up failure, this event will not be sent. 12997 </description> 12998 <origin>jvmdi</origin> 12999 <capabilities> 13000 </capabilities> 13001 <parameters> 13002 <param id="jni_env"> 13003 <outptr> 13004 <struct>JNIEnv</struct> 13005 </outptr> 13006 <description> 13007 The JNI environment of the event (current) thread. 13008 </description> 13009 </param> 13010 <param id="thread"> 13011 <jthread/> 13012 <description> 13013 The initial thread 13014 </description> 13015 </param> 13016 </parameters> 13017 </event> 13018 13019 <event label="VM Death Event" 13020 id="VMDeath" const="JVMTI_EVENT_VM_DEATH" num="51"> 13021 <description> 13022 The VM death event notifies the agent of the termination of the VM. 13023 No events will occur after the VMDeath event. 13024 <p/> 13025 In the case of VM start-up failure, this event will not be sent. 13026 Note that <internallink id="onunload">Agent_OnUnload</internallink> 13027 will still be called in these cases. 13028 </description> 13029 <origin>jvmdi</origin> 13030 <capabilities> 13031 </capabilities> 13032 <parameters> 13033 <param id="jni_env"> 13034 <outptr> 13035 <struct>JNIEnv</struct> 13036 </outptr> 13037 <description> 13038 The JNI environment of the event (current) thread 13039 </description> 13040 </param> 13041 </parameters> 13042 </event> 13043 13044 <event label="Compiled Method Load" phase="start" 13045 id="CompiledMethodLoad" const="JVMTI_EVENT_COMPILED_METHOD_LOAD" num="68"> 13046 <description> 13047 Sent when a method is compiled and loaded into memory by the VM. 13048 If it is unloaded, the <eventlink id="CompiledMethodUnload"/> event is sent. 13049 If it is moved, the <eventlink id="CompiledMethodUnload"/> event is sent, 13050 followed by a new <code>CompiledMethodLoad</code> event. 13051 Note that a single method may have multiple compiled forms, and that 13052 this event will be sent for each form. 13053 Note also that several methods may be inlined into a single 13054 address range, and that this event will be sent for each method. 13055 <p/> 13056 These events can be sent after their initial occurrence with 13057 <functionlink id="GenerateEvents"></functionlink>. 13058 </description> 13059 <origin>jvmpi</origin> 13060 <typedef id="jvmtiAddrLocationMap" label="Native address to location entry"> 13061 <field id="start_address"> 13062 <vmbuf><void/></vmbuf> 13063 <description> 13064 Starting native address of code corresponding to a location 13065 </description> 13066 </field> 13067 <field id="location"> 13068 <jlocation/> 13069 <description> 13070 Corresponding location. See 13071 <functionlink id="GetJLocationFormat"></functionlink> 13072 for the meaning of location. 13073 </description> 13074 </field> 13075 </typedef> 13076 <capabilities> 13077 <required id="can_generate_compiled_method_load_events"></required> 13078 </capabilities> 13079 <parameters> 13080 <param id="klass"> 13081 <jclass method="method"/> 13082 <description> 13083 Class of the method being compiled and loaded 13084 </description> 13085 </param> 13086 <param id="method"> 13087 <jmethodID class="klass"/> 13088 <description> 13089 Method being compiled and loaded 13090 </description> 13091 </param> 13092 <param id="code_size"> 13093 <jint/> 13094 <description> 13095 Size of compiled code 13096 </description> 13097 </param> 13098 <param id="code_addr"> 13099 <vmbuf><void/></vmbuf> 13100 <description> 13101 Address where compiled method code is loaded 13102 </description> 13103 </param> 13104 <param id="map_length"> 13105 <jint/> 13106 <description> 13107 Number of <typelink id="jvmtiAddrLocationMap"></typelink> 13108 entries in the address map. 13109 Zero if mapping information cannot be supplied. 13110 </description> 13111 </param> 13112 <param id="map"> 13113 <vmbuf><struct>jvmtiAddrLocationMap</struct></vmbuf> 13114 <description> 13115 Map from native addresses to location. 13116 The native address range of each entry is from 13117 <fieldlink id="start_address" struct="jvmtiAddrLocationMap"></fieldlink> 13118 to <code>start_address-1</code> of the next entry. 13119 <code>NULL</code> if mapping information cannot be supplied. 13120 </description> 13121 </param> 13122 <param id="compile_info"> 13123 <vmbuf><void/></vmbuf> 13124 <description> 13125 VM-specific compilation information. 13126 The referenced compile information is managed by the VM 13127 and must not depend on the agent for collection. 13128 A VM implementation defines the content and lifetime 13129 of the information. 13130 </description> 13131 </param> 13132 </parameters> 13133 </event> 13134 13135 <event label="Compiled Method Unload" phase="start" 13136 id="CompiledMethodUnload" const="JVMTI_EVENT_COMPILED_METHOD_UNLOAD" num="69"> 13137 <description> 13138 Sent when a compiled method is unloaded from memory. 13139 This event might not be sent on the thread which performed the unload. 13140 This event may be sent sometime after the unload occurs, but 13141 will be sent before the memory is reused 13142 by a newly generated compiled method. This event may be sent after 13143 the class is unloaded. 13144 </description> 13145 <origin>jvmpi</origin> 13146 <capabilities> 13147 <required id="can_generate_compiled_method_load_events"></required> 13148 </capabilities> 13149 <parameters> 13150 <param id="klass"> 13151 <jclass method="method"/> 13152 <description> 13153 Class of the compiled method being unloaded. 13154 </description> 13155 </param> 13156 <param id="method"> 13157 <jmethodID class="klass"/> 13158 <description> 13159 Compiled method being unloaded. 13160 For identification of the compiled method only -- the class 13161 may be unloaded and therefore the method should not be used 13162 as an argument to further JNI or <jvmti/> functions. 13163 </description> 13164 </param> 13165 <param id="code_addr"> 13166 <vmbuf><void/></vmbuf> 13167 <description> 13168 Address where compiled method code was loaded. 13169 For identification of the compiled method only -- 13170 the space may have been reclaimed. 13171 </description> 13172 </param> 13173 </parameters> 13174 </event> 13175 13176 <event label="Dynamic Code Generated" phase="any" 13177 id="DynamicCodeGenerated" const="JVMTI_EVENT_DYNAMIC_CODE_GENERATED" num="70"> 13178 <description> 13179 Sent when a component of the virtual machine is generated dynamically. 13180 This does not correspond to Java programming language code that is 13181 compiled--see <eventlink id="CompiledMethodLoad"></eventlink>. 13182 This is for native code--for example, an interpreter that is generated 13183 differently depending on command-line options. 13184 <p/> 13185 Note that this event has no controlling capability. 13186 If a VM cannot generate these events, it simply does not send any. 13187 <p/> 13188 These events can be sent after their initial occurrence with 13189 <functionlink id="GenerateEvents"></functionlink>. 13190 </description> 13191 <origin>jvmpi</origin> 13192 <capabilities> 13193 </capabilities> 13194 <parameters> 13195 <param id="name"> 13196 <vmbuf><char/></vmbuf> 13197 <description> 13198 Name of the code, encoded as a 13199 <internallink id="mUTF">modified UTF-8</internallink> string. 13200 Intended for display to an end-user. 13201 The name might not be unique. 13202 </description> 13203 </param> 13204 <param id="address"> 13205 <vmbuf><void/></vmbuf> 13206 <description> 13207 Native address of the code 13208 </description> 13209 </param> 13210 <param id="length"> 13211 <jint/> 13212 <description> 13213 Length in bytes of the code 13214 </description> 13215 </param> 13216 </parameters> 13217 </event> 13218 13219 <event label="Data Dump Request" 13220 id="DataDumpRequest" const="JVMTI_EVENT_DATA_DUMP_REQUEST" num="71"> 13221 <description> 13222 Sent by the VM to request the agent to dump its data. This 13223 is just a hint and the agent need not react to this event. 13224 This is useful for processing command-line signals from users. For 13225 example, in the Java 2 SDK a CTRL-Break on Win32 and a CTRL-\ on Solaris 13226 causes the VM to send this event to the agent. 13227 </description> 13228 <origin>jvmpi</origin> 13229 <capabilities> 13230 </capabilities> 13231 <parameters> 13232 </parameters> 13233 </event> 13234 13235 <event label="Monitor Contended Enter" 13236 id="MonitorContendedEnter" const="JVMTI_EVENT_MONITOR_CONTENDED_ENTER" filtered="thread" num="75"> 13237 <description> 13238 Sent when a thread is attempting to enter a Java programming language 13239 monitor already acquired by another thread. 13240 </description> 13241 <origin>jvmpi</origin> 13242 <capabilities> 13243 <required id="can_generate_monitor_events"></required> 13244 </capabilities> 13245 <parameters> 13246 <param id="jni_env"> 13247 <outptr> 13248 <struct>JNIEnv</struct> 13249 </outptr> 13250 <description> 13251 The JNI environment of the event (current) thread 13252 </description> 13253 </param> 13254 <param id="thread"> 13255 <jthread/> 13256 <description> 13257 JNI local reference to the thread 13258 attempting to enter the monitor 13259 </description> 13260 </param> 13261 <param id="object"> 13262 <jobject/> 13263 <description> 13264 JNI local reference to the monitor 13265 </description> 13266 </param> 13267 </parameters> 13268 </event> 13269 13270 <event label="Monitor Contended Entered" 13271 id="MonitorContendedEntered" const="JVMTI_EVENT_MONITOR_CONTENDED_ENTERED" filtered="thread" num="76"> 13272 <description> 13273 Sent when a thread enters a Java programming language 13274 monitor after waiting for it to be released by another thread. 13275 </description> 13276 <origin>jvmpi</origin> 13277 <capabilities> 13278 <required id="can_generate_monitor_events"></required> 13279 </capabilities> 13280 <parameters> 13281 <param id="jni_env"> 13282 <outptr> 13283 <struct>JNIEnv</struct> 13284 </outptr> 13285 <description> 13286 The JNI environment of the event (current) thread 13287 </description> 13288 </param> 13289 <param id="thread"> 13290 <jthread/> 13291 <description> 13292 JNI local reference to the thread entering 13293 the monitor 13294 </description> 13295 </param> 13296 <param id="object"> 13297 <jobject/> 13298 <description> 13299 JNI local reference to the monitor 13300 </description> 13301 </param> 13302 </parameters> 13303 </event> 13304 13305 <event label="Monitor Wait" 13306 id="MonitorWait" const="JVMTI_EVENT_MONITOR_WAIT" filtered="thread" num="73"> 13307 <description> 13308 Sent when a thread is about to wait on an object. 13309 </description> 13310 <origin>jvmpi</origin> 13311 <capabilities> 13312 <required id="can_generate_monitor_events"></required> 13313 </capabilities> 13314 <parameters> 13315 <param id="jni_env"> 13316 <outptr> 13317 <struct>JNIEnv</struct> 13318 </outptr> 13319 <description> 13320 The JNI environment of the event (current) thread 13321 </description> 13322 </param> 13323 <param id="thread"> 13324 <jthread/> 13325 <description> 13326 JNI local reference to the thread about to wait 13327 </description> 13328 </param> 13329 <param id="object"> 13330 <jobject/> 13331 <description> 13332 JNI local reference to the monitor 13333 </description> 13334 </param> 13335 <param id="timeout"> 13336 <jlong/> 13337 <description> 13338 The number of milliseconds the thread will wait 13339 </description> 13340 </param> 13341 </parameters> 13342 </event> 13343 13344 <event label="Monitor Waited" 13345 id="MonitorWaited" const="JVMTI_EVENT_MONITOR_WAITED" filtered="thread" num="74"> 13346 <description> 13347 Sent when a thread finishes waiting on an object. 13348 </description> 13349 <origin>jvmpi</origin> 13350 <capabilities> 13351 <required id="can_generate_monitor_events"></required> 13352 </capabilities> 13353 <parameters> 13354 <param id="jni_env"> 13355 <outptr> 13356 <struct>JNIEnv</struct> 13357 </outptr> 13358 <description> 13359 The JNI environment of the event (current) thread 13360 </description> 13361 </param> 13362 <param id="thread"> 13363 <jthread/> 13364 <description> 13365 JNI local reference to the thread that was finished waiting 13366 </description> 13367 </param> 13368 <param id="object"> 13369 <jobject/> 13370 <description> 13371 JNI local reference to the monitor. 13372 </description> 13373 </param> 13374 <param id="timed_out"> 13375 <jboolean/> 13376 <description> 13377 True if the monitor timed out 13378 </description> 13379 </param> 13380 </parameters> 13381 </event> 13382 13383 <event label="Resource Exhausted" 13384 id="ResourceExhausted" const="JVMTI_EVENT_RESOURCE_EXHAUSTED" num="80" 13385 since="1.1"> 13386 <description> 13387 Sent when a VM resource needed by a running application has been exhausted. 13388 Except as required by the optional capabilities, the set of resources 13389 which report exhaustion is implementation dependent. 13390 <p/> 13391 The following bit flags define the properties of the resource exhaustion: 13392 <constants id="jvmtiResourceExhaustionFlags" 13393 label="Resource Exhaustion Flags" 13394 kind="bits" 13395 since="1.1"> 13396 <constant id="JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR" num="0x0001"> 13397 After this event returns, the VM will throw a 13398 <code>java.lang.OutOfMemoryError</code>. 13399 </constant> 13400 <constant id="JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP" num="0x0002"> 13401 The VM was unable to allocate memory from the <tm>Java</tm> 13402 platform <i>heap</i>. 13403 The <i>heap</i> is the runtime 13404 data area from which memory for all class instances and 13405 arrays are allocated. 13406 </constant> 13407 <constant id="JVMTI_RESOURCE_EXHAUSTED_THREADS" num="0x0004"> 13408 The VM was unable to create a thread. 13409 </constant> 13410 </constants> 13411 </description> 13412 <origin>new</origin> 13413 <capabilities> 13414 <capability id="can_generate_resource_exhaustion_heap_events"> 13415 Can generate events when the VM is unable to allocate memory from the 13416 <internallink id="JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP">heap</internallink>. 13417 </capability> 13418 <capability id="can_generate_resource_exhaustion_threads_events"> 13419 Can generate events when the VM is unable to 13420 <internallink id="JVMTI_RESOURCE_EXHAUSTED_THREADS">create 13421 a thread</internallink>. 13422 </capability> 13423 </capabilities> 13424 <parameters> 13425 <param id="jni_env"> 13426 <outptr> 13427 <struct>JNIEnv</struct> 13428 </outptr> 13429 <description> 13430 The JNI environment of the event (current) thread 13431 </description> 13432 </param> 13433 <param id="flags"> 13434 <jint/> 13435 <description> 13436 Flags defining the properties of the of resource exhaustion 13437 as specified by the 13438 <internallink id="jvmtiResourceExhaustionFlags">Resource 13439 Exhaustion Flags</internallink>. 13440 </description> 13441 </param> 13442 <param id="reserved"> 13443 <vmbuf><void/></vmbuf> 13444 <description> 13445 Reserved. 13446 </description> 13447 </param> 13448 <param id="description"> 13449 <vmbuf><char/></vmbuf> 13450 <description> 13451 Description of the resource exhaustion, encoded as a 13452 <internallink id="mUTF">modified UTF-8</internallink> string. 13453 </description> 13454 </param> 13455 </parameters> 13456 </event> 13457 13458 <event label="VM Object Allocation" 13459 id="VMObjectAlloc" const="JVMTI_EVENT_VM_OBJECT_ALLOC" num="84"> 13460 <description> 13461 Sent when a method causes the virtual machine to allocate an 13462 Object visible to Java programming language code and the 13463 allocation is not detectable by other intrumentation mechanisms. 13464 Generally object allocation should be detected by instrumenting 13465 the bytecodes of allocating methods. 13466 Object allocation generated in native code by JNI function 13467 calls should be detected using 13468 <internallink id="jniIntercept">JNI function interception</internallink>. 13469 Some methods might not have associated bytecodes and are not 13470 native methods, they instead are executed directly by the 13471 VM. These methods should send this event. 13472 Virtual machines which are incapable of bytecode instrumentation 13473 for some or all of their methods can send this event. 13474 <p/> 13475 Typical examples where this event might be sent: 13476 <ul> 13477 <li>Reflection -- for example, <code>java.lang.Class.newInstance()</code></li> 13478 <li>Methods not represented by bytecodes -- for example, VM intrinsics and 13479 J2ME preloaded classes</li> 13480 </ul> 13481 Cases where this event would not be generated: 13482 <ul> 13483 <li>Allocation due to bytecodes -- for example, the <code>new</code> 13484 and <code>newarray</code> VM instructions</li> 13485 <li>Allocation due to JNI function calls -- for example, 13486 <code>AllocObject</code></li> 13487 <li>Allocations during VM initialization</li> 13488 <li>VM internal objects</li> 13489 </ul> 13490 </description> 13491 <origin>new</origin> 13492 <capabilities> 13493 <required id="can_generate_vm_object_alloc_events"></required> 13494 </capabilities> 13495 <parameters> 13496 <param id="jni_env"> 13497 <outptr> 13498 <struct>JNIEnv</struct> 13499 </outptr> 13500 <description> 13501 The JNI environment of the event (current) thread 13502 </description> 13503 </param> 13504 <param id="thread"> 13505 <jthread/> 13506 <description> 13507 Thread allocating the object. 13508 </description> 13509 </param> 13510 <param id="object"> 13511 <jobject/> 13512 <description> 13513 JNI local reference to the object that was allocated 13514 </description> 13515 </param> 13516 <param id="object_klass"> 13517 <jclass/> 13518 <description> 13519 JNI local reference to the class of the object 13520 </description> 13521 </param> 13522 <param id="size"> 13523 <jlong/> 13524 <description> 13525 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 13526 </description> 13527 </param> 13528 </parameters> 13529 </event> 13530 13531 <event label="Object Free" 13532 id="ObjectFree" const="JVMTI_EVENT_OBJECT_FREE" num="83"> 13533 <description> 13534 An Object Free event is sent when the garbage collector frees an object. 13535 Events are only sent for tagged objects--see 13536 <internallink id="Heap">heap functions</internallink>. 13537 <p/> 13538 The event handler must not use JNI functions and 13539 must not use <jvmti/> functions except those which 13540 specifically allow such use (see the raw monitor, memory management, 13541 and environment local storage functions). 13542 </description> 13543 <origin>new</origin> 13544 <capabilities> 13545 <required id="can_generate_object_free_events"></required> 13546 </capabilities> 13547 <parameters> 13548 <param id="tag"> 13549 <jlong/> 13550 <description> 13551 The freed object's tag 13552 </description> 13553 </param> 13554 </parameters> 13555 </event> 13556 13557 <event label="Garbage Collection Start" 13558 id="GarbageCollectionStart" const="JVMTI_EVENT_GARBAGE_COLLECTION_START" num="81"> 13559 <description> 13560 A Garbage Collection Start event is sent when a 13561 garbage collection pause begins. 13562 Only stop-the-world collections are reported--that is, collections during 13563 which all threads cease to modify the state of the Java virtual machine. 13564 This means that some collectors will never generate these events. 13565 This event is sent while the VM is still stopped, thus 13566 the event handler must not use JNI functions and 13567 must not use <jvmti/> functions except those which 13568 specifically allow such use (see the raw monitor, memory management, 13569 and environment local storage functions). 13570 <p/> 13571 This event is always sent as a matched pair with 13572 <eventlink id="GarbageCollectionFinish"/> 13573 (assuming both events are enabled) and no garbage collection 13574 events will occur between them. 13575 </description> 13576 <origin>new</origin> 13577 <capabilities> 13578 <required id="can_generate_garbage_collection_events"></required> 13579 </capabilities> 13580 <parameters> 13581 </parameters> 13582 </event> 13583 13584 <event label="Garbage Collection Finish" 13585 id="GarbageCollectionFinish" const="JVMTI_EVENT_GARBAGE_COLLECTION_FINISH" num="82"> 13586 <description> 13587 A Garbage Collection Finish event is sent when a 13588 garbage collection pause ends. 13589 This event is sent while the VM is still stopped, thus 13590 the event handler must not use JNI functions and 13591 must not use <jvmti/> functions except those which 13592 specifically allow such use (see the raw monitor, memory management, 13593 and environment local storage functions). 13594 <p/> 13595 Some agents may need to do post garbage collection operations that 13596 require the use of the disallowed <jvmti/> or JNI functions. For these 13597 cases an agent thread can be created which waits on a raw monitor, 13598 and the handler for the Garbage Collection Finish event simply 13599 notifies the raw monitor 13600 <p/> 13601 This event is always sent as a matched pair with 13602 <eventlink id="GarbageCollectionStart"/> (assuming both events are enabled). 13603 <issue> 13604 The most important use of this event is to provide timing information, 13605 and thus additional information is not required. However, 13606 information about the collection which is "free" should be included - 13607 what that information is needs to be determined. 13608 </issue> 13609 </description> 13610 <origin>new</origin> 13611 <capabilities> 13612 <required id="can_generate_garbage_collection_events"></required> 13613 </capabilities> 13614 <parameters> 13615 </parameters> 13616 </event> 13617 13618 <elide> 13619 <event label="Verbose Output" phase="any" 13620 id="VerboseOutput" const="JVMTI_EVENT_VERBOSE_OUTPUT" num="85"> 13621 <description> 13622 Send verbose messages as strings. 13623 <issue> 13624 This format is extremely fragile, as it can change with each 13625 platform, collector and version. Alternatives include: 13626 <ul> 13627 <li>building off Java programming language M and M APIs</li> 13628 <li>XML</li> 13629 <li>key/value pairs</li> 13630 <li>removing it</li> 13631 </ul> 13632 </issue> 13633 <issue> 13634 Though this seemed trivial to implement. 13635 In the RI it appears this will be quite complex. 13636 </issue> 13637 </description> 13638 <origin>new</origin> 13639 <capabilities> 13640 </capabilities> 13641 <parameters> 13642 <param id="flag"> 13643 <enum>jvmtiVerboseFlag</enum> 13644 <description> 13645 Which verbose output is being sent. 13646 </description> 13647 </param> 13648 <param id="message"> 13649 <vmbuf><char/></vmbuf> 13650 <description> 13651 Message text, encoded as a 13652 <internallink id="mUTF">modified UTF-8</internallink> string. 13653 </description> 13654 </param> 13655 </parameters> 13656 </event> 13657 </elide> 13658 13659 </eventsection> 13660 13661 <datasection> 13662 <intro> 13663 <jvmti/> extends the data types defined by JNI. 13664 </intro> 13665 <basetypes id="jniTypes" label="JNI Types Used in the JVM Tool Interface"> 13666 <basetype id="jboolean"> 13667 <description> 13668 Holds a Java programming language <code>boolean</code>. 13669 Unsigned 8 bits. 13670 </description> 13671 </basetype> 13672 <basetype id="jchar"> 13673 <description> 13674 Holds a Java programming language <code>char</code>. 13675 Unsigned 16 bits. 13676 </description> 13677 </basetype> 13678 <basetype id="jint"> 13679 <description> 13680 Holds a Java programming language <code>int</code>. 13681 Signed 32 bits. 13682 </description> 13683 </basetype> 13684 <basetype id="jlong"> 13685 <description> 13686 Holds a Java programming language <code>long</code>. 13687 Signed 64 bits. 13688 </description> 13689 </basetype> 13690 <basetype id="jfloat"> 13691 <description> 13692 Holds a Java programming language <code>float</code>. 13693 32 bits. 13694 </description> 13695 </basetype> 13696 <basetype id="jdouble"> 13697 <description> 13698 Holds a Java programming language <code>double</code>. 13699 64 bits. 13700 </description> 13701 </basetype> 13702 <basetype id="jobject"> 13703 <description> 13704 Holds a Java programming language object. 13705 </description> 13706 </basetype> 13707 <basetype id="jclass"> 13708 <description> 13709 Holds a Java programming language class. 13710 </description> 13711 </basetype> 13712 <basetype id="jvalue"> 13713 <description> 13714 Is a union of all primitive types and <code>jobject</code>. Thus, holds any Java 13715 programming language value. 13716 </description> 13717 </basetype> 13718 <basetype id="jfieldID"> 13719 <description> 13720 Identifies a Java programming language field. 13721 <code>jfieldID</code>s returned by <jvmti/> functions and events may be 13722 safely stored. 13723 </description> 13724 </basetype> 13725 <basetype id="jmethodID"> 13726 <description> 13727 Identifies a Java programming language method, initializer, or constructor. 13728 <code>jmethodID</code>s returned by <jvmti/> functions and events may be 13729 safely stored. However, if the class is unloaded, they become invalid 13730 and must not be used. 13731 </description> 13732 </basetype> 13733 <basetype id="JNIEnv"> 13734 <description> 13735 Pointer to the JNI function table. Pointer to this (<code>JNIEnv *</code>) 13736 is a JNI environment. 13737 </description> 13738 </basetype> 13739 </basetypes> 13740 13741 <basetypes id="jvmtiTypes" label="JVM Tool Interface Base Types"> 13742 <basetype id="jvmtiEnv"> 13743 <description> 13744 The <jvmti/> <internallink id="environments">environment</internallink> pointer. 13745 See the <internallink id="FunctionSection">Function Section</internallink>. 13746 <code>jvmtiEnv</code> points to the 13747 <internallink id="FunctionTable">function table</internallink> pointer. 13748 </description> 13749 </basetype> 13750 <basetype id="jthread"> 13751 <definition>typedef jobject jthread;</definition> 13752 <description> 13753 Subtype of <datalink id="jobject"></datalink> that holds a thread. 13754 </description> 13755 </basetype> 13756 <basetype id="jthreadGroup"> 13757 <definition>typedef jobject jthreadGroup;</definition> 13758 <description> 13759 Subtype of <datalink id="jobject"></datalink> that holds a thread group. 13760 </description> 13761 </basetype> 13762 <basetype id="jlocation"> 13763 <definition>typedef jlong jlocation;</definition> 13764 <description> 13765 A 64 bit value, representing a monotonically increasing 13766 executable position within a method. 13767 <code>-1</code> indicates a native method. 13768 See <functionlink id="GetJLocationFormat"></functionlink> for the format on a 13769 given VM. 13770 </description> 13771 </basetype> 13772 <basetype id="jrawMonitorID"> 13773 <definition>struct _jrawMonitorID; 13774 typedef struct _jrawMonitorID *jrawMonitorID;</definition> 13775 <description> 13776 A raw monitor. 13777 </description> 13778 </basetype> 13779 <basetype id="jvmtiError"> 13780 <description> 13781 Holds an error return code. 13782 See the <internallink id="ErrorSection">Error section</internallink> for possible values. 13783 <example> 13784 typedef enum { 13785 JVMTI_ERROR_NONE = 0, 13786 JVMTI_ERROR_INVALID_THREAD = 10, 13787 ... 13788 } jvmtiError; 13789 </example> 13790 </description> 13791 </basetype> 13792 <basetype id="jvmtiEvent"> 13793 <description> 13794 An identifier for an event type. 13795 See the <internallink id="EventSection">Event section</internallink> for possible values. 13796 It is guaranteed that future versions of this specification will 13797 never assign zero as an event type identifier. 13798 <example> 13799 typedef enum { 13800 JVMTI_EVENT_SINGLE_STEP = 1, 13801 JVMTI_EVENT_BREAKPOINT = 2, 13802 ... 13803 } jvmtiEvent; 13804 </example> 13805 </description> 13806 </basetype> 13807 <basetype id="jvmtiEventCallbacks" name="eventCallbacks"> 13808 <description> 13809 The callbacks used for events. 13810 <example> 13811 typedef struct { 13812 jvmtiEventVMInit VMInit; 13813 jvmtiEventVMDeath VMDeath; 13814 ... 13815 } jvmtiEventCallbacks; 13816 </example> 13817 See <internallink id="jvmtiEventCallbacks">event callbacks</internallink> 13818 for the complete structure. 13819 <p/> 13820 Where, for example, the VM initialization callback is defined: 13821 <example> 13822 typedef void (JNICALL *jvmtiEventVMInit) 13823 (jvmtiEnv *jvmti_env, 13824 JNIEnv* jni_env, 13825 jthread thread); 13826 </example> 13827 See the individual events for the callback function definition. 13828 </description> 13829 </basetype> 13830 <basetype id="jniNativeInterface"> 13831 <definition>typedef struct JNINativeInterface_ jniNativeInterface;</definition> 13832 <description> 13833 Typedef for the JNI function table <code>JNINativeInterface</code> 13834 defined in the 13835 <externallink id="jni/functions.html#interface-function-table"> 13836 JNI Specification</externallink>. 13837 The JNI reference implementation defines this with an underscore. 13838 </description> 13839 </basetype> 13840 </basetypes> 13841 13842 </datasection> 13843 13844 <issuessection label="Issues"> 13845 <intro id="suspendRequired" label="Resolved Issue: Suspend - Required or Automatic"> 13846 JVMDI requires that the agent suspend threads before calling 13847 certain sensitive functions. JVMPI requires garbage collection to be 13848 disabled before calling certain sensitive functions. 13849 It was suggested that rather than have this requirement, that 13850 VM place itself in a suitable state before performing an 13851 operation. This makes considerable sense since each VM 13852 knows its requirements and can most easily arrange a 13853 safe state. 13854 <p/> 13855 The ability to externally suspend/resume threads will, of 13856 course, remain. The ability to enable/disable garbage collection will not. 13857 <p/> 13858 This issue is resolved--suspend will not 13859 be required. The spec has been updated to reflect this. 13860 </intro> 13861 13862 <intro id="stackSampling" label="Resolved Issue: Call Stack Sampling"> 13863 There are a variety of approaches to sampling call stacks. 13864 The biggest bifurcation is between VM controlled and agent 13865 controlled. 13866 <p/> 13867 This issue is resolved--agent controlled 13868 sampling will be the approach. 13869 </intro> 13870 13871 <intro id="threadRepresentation" label="Resolved Issue: Thread Representation"> 13872 JVMDI represents threads as jthread. JVMPI primarily 13873 uses JNIEnv* to represent threads. 13874 <p/> 13875 The Expert Group has chosen jthread as the representation 13876 for threads in <jvmti/>. 13877 JNIEnv* is sent by 13878 events since it is needed to JNI functions. JNIEnv, per the 13879 JNI spec, are not supposed to be used outside their thread. 13880 </intro> 13881 13882 <intro id="design" label="Resolved Issue: Method Representation"> 13883 The JNI spec allows an implementation to depend on jclass/jmethodID 13884 pairs, rather than simply a jmethodID, to reference a method. 13885 JVMDI, for consistency, choose the same representation. 13886 JVMPI, however, specifies that a jmethodID alone maps to a 13887 method. Both of the Sun <tm>J2SE</tm> virtual machines (Classic and <tm>HotSpot</tm>) store 13888 pointers in jmethodIDs, and as a result, a jmethodID is sufficient. 13889 In fact, any JVM implementation that supports JVMPI must have 13890 such a representation. 13891 <jvmti/> will use jmethodID as a unique representation of a method 13892 (no jclass is used). 13893 There should be efficiency gains, particularly in 13894 functionality like stack dumping, to this representation. 13895 <p/> 13896 Note that fields were not used in JVMPI and that the access profile 13897 of fields differs from methods--for implementation efficiency 13898 reasons, a jclass/jfieldID pair will still be needed for field 13899 reference. 13900 </intro> 13901 13902 <intro id="localReferenceIssue" label="Resolved Issue: Local References"> 13903 Functions return local references. 13904 </intro> 13905 13906 <intro id="frameRep" label="Resolved Issue: Representation of frames"> 13907 In JVMDI, a frame ID is used to represent a frame. Problem with this 13908 is that a VM must track when a frame becomes invalid, a far better 13909 approach, and the one used in <jvmti/>, is to reference frames by depth. 13910 </intro> 13911 13912 <intro id="requiredCapabilities" label="Issue: Required Capabilities"> 13913 Currently, having a required capabilities means that the functionality 13914 is optional. Capabilities are useful even for required functionality 13915 since they can inform the VM is needed set-up. Thus, there should be 13916 a set of capabilities that a conformant implementation must provide 13917 (if requested during Agent_OnLoad). 13918 </intro> 13919 13920 <intro id="taghint" label="Proposal: add tag hint function"> 13921 A hint of the percentage of objects that will be tagged would 13922 help the VM pick a good implementation. 13923 </intro> 13924 13925 <intro id="moreMonitorQueries" label="Request: More Monitor Quires"> 13926 How difficult or easy would be to extend the monitor_info category to include 13927 <pre> 13928 - current number of monitors 13929 - enumeration of monitors 13930 - enumeration of threads waiting on a given monitor 13931 </pre> 13932 The reason for my question is the fact that current get_monitor_info support 13933 requires the agent to specify a given thread to get the info which is probably 13934 OK in the profiling/debugging space, while in the monitoring space the agent 13935 could be watching the monitor list and then decide which thread to ask for 13936 the info. You might ask why is this important for monitoring .... I think it 13937 can aid in the detection/prediction of application contention caused by hot-locks. 13938 </intro> 13939 </issuessection> 13940 13941 <changehistory id="ChangeHistory" update="09/05/07"> 13942 <intro> 13943 The <jvmti/> specification is an evolving document with major, minor, 13944 and micro version numbers. 13945 A released version of the specification is uniquely identified 13946 by its major and minor version. 13947 The functions, events, and capabilities in this specification 13948 indicate a "Since" value which is the major and minor version in 13949 which it was introduced. 13950 The version of the specification implemented by the VM can 13951 be retrieved at runtime with the <functionlink id="GetVersionNumber"/> 13952 function. 13953 </intro> 13954 <change date="14 Nov 2002"> 13955 Converted to XML document. 13956 </change> 13957 <change date="14 Nov 2002"> 13958 Elided heap dump functions (for now) since what was there 13959 was wrong. 13960 </change> 13961 <change date="18 Nov 2002"> 13962 Added detail throughout. 13963 </change> 13964 <change date="18 Nov 2002"> 13965 Changed JVMTI_THREAD_STATUS_RUNNING to JVMTI_THREAD_STATUS_RUNNABLE. 13966 </change> 13967 <change date="19 Nov 2002"> 13968 Added AsyncGetStackTrace. 13969 </change> 13970 <change date="19 Nov 2002"> 13971 Added jframeID return to GetStackTrace. 13972 </change> 13973 <change date="19 Nov 2002"> 13974 Elided GetCurrentFrame and GetCallingFrame functions (for now) since what was there 13975 since they are redundant with GetStackTrace. 13976 </change> 13977 <change date="19 Nov 2002"> 13978 Elided ClearAllBreakpoints since it has always been redundant. 13979 </change> 13980 <change date="19 Nov 2002"> 13981 Added GetSystemProperties. 13982 </change> 13983 <change date="19 Nov 2002"> 13984 Changed the thread local storage functions to use jthread. 13985 </change> 13986 <change date="20 Nov 2002"> 13987 Added GetJLocationFormat. 13988 </change> 13989 <change date="22 Nov 2002"> 13990 Added events and introductory text. 13991 </change> 13992 <change date="22 Nov 2002"> 13993 Cross reference type and constant definitions. 13994 </change> 13995 <change date="24 Nov 2002"> 13996 Added DTD. 13997 </change> 13998 <change date="24 Nov 2002"> 13999 Added capabilities function section. 14000 </change> 14001 <change date="29 Nov 2002"> 14002 Assign capabilities to each function and event. 14003 </change> 14004 <change date="29 Nov 2002"> 14005 Add <internallink id="jniIntercept">JNI interception functions</internallink>. 14006 </change> 14007 <change date="30 Nov 2002"> 14008 Auto generate SetEventNotificationMode capabilities. 14009 </change> 14010 <change date="30 Nov 2002"> 14011 Add <eventlink id="VMObjectAlloc"></eventlink> event. 14012 </change> 14013 <change date="30 Nov 2002"> 14014 Add <eventlink id="DynamicCodeGenerated"></eventlink> event. 14015 </change> 14016 <change date="30 Nov 2002"> 14017 Add const to declarations. 14018 </change> 14019 <change date="30 Nov 2002"> 14020 Change method exit and frame pop to send on exception. 14021 </change> 14022 <change date="1 Dec 2002"> 14023 Add ForceGarbageCollection. 14024 </change> 14025 <change date="2 Dec 2002"> 14026 Redo Xrun section; clarify GetStackTrace and add example; 14027 Fix width problems; use "agent" consistently. 14028 </change> 14029 <change date="8 Dec 2002"> 14030 Remove previous start-up intro. 14031 Add <internallink id="environments"><jvmti/> Environments</internallink> 14032 section. 14033 </change> 14034 <change date="8 Dec 2002"> 14035 Add <functionlink id="DisposeEnvironment"></functionlink>. 14036 </change> 14037 <change date="9 Dec 2002"> 14038 Numerous minor updates. 14039 </change> 14040 <change date="15 Dec 2002"> 14041 Add heap profiling functions added: 14042 get/set annotation, iterate live objects/heap. 14043 Add heap profiling functions place holder added: 14044 heap roots. 14045 Heap profiling event added: object free. 14046 Heap profiling event redesigned: vm object allocation. 14047 Heap profiling event placeholders added: garbage collection start/finish. 14048 Native method bind event added. 14049 </change> 14050 <change date="19 Dec 2002"> 14051 Revamp suspend/resume functions. 14052 Add origin information with jvmdi tag. 14053 Misc fixes. 14054 </change> 14055 <change date="24 Dec 2002"> 14056 Add semantics to types. 14057 </change> 14058 <change date="27 Dec 2002"> 14059 Add local reference section. 14060 Autogenerate parameter descriptions from types. 14061 </change> 14062 <change date="28 Dec 2002"> 14063 Document that RunAgentThread sends threadStart. 14064 </change> 14065 <change date="29 Dec 2002"> 14066 Remove redundant local ref and dealloc warning. 14067 Convert GetRawMonitorName to allocated buffer. 14068 Add GenerateEvents. 14069 </change> 14070 <change date="30 Dec 2002"> 14071 Make raw monitors a type and rename to "jrawMonitorID". 14072 </change> 14073 <change date="1 Jan 2003"> 14074 Include origin information. 14075 Clean-up JVMDI issue references. 14076 Remove Deallocate warnings which are now automatically generated. 14077 </change> 14078 <change date="2 Jan 2003"> 14079 Fix representation issues for jthread. 14080 </change> 14081 <change date="3 Jan 2003"> 14082 Make capabilities buffered out to 64 bits - and do it automatically. 14083 </change> 14084 <change date="4 Jan 2003"> 14085 Make constants which are enumeration into enum types. 14086 Parameters now of enum type. 14087 Clean-up and index type section. 14088 Replace remaining datadef entities with callback. 14089 </change> 14090 <change date="7 Jan 2003"> 14091 Correct GenerateEvents description. 14092 More internal semantics work. 14093 </change> 14094 <change date="9 Jan 2003"> 14095 Replace previous GetSystemProperties with two functions 14096 which use allocated information instead fixed. 14097 Add SetSystemProperty. 14098 More internal semantics work. 14099 </change> 14100 <change date="12 Jan 2003"> 14101 Add varargs to end of SetEventNotificationMode. 14102 </change> 14103 <change date="20 Jan 2003"> 14104 Finish fixing spec to reflect that alloc sizes are jlong. 14105 </change> 14106 <change date="22 Jan 2003"> 14107 Allow NULL as RunAgentThread arg. 14108 </change> 14109 <change date="22 Jan 2003"> 14110 Fixed names to standardized naming convention 14111 Removed AsyncGetStackTrace. 14112 </change> 14113 <change date="29 Jan 2003"> 14114 Since we are using jthread, removed GetThread. 14115 </change> 14116 <change date="31 Jan 2003"> 14117 Change GetFieldName to allow NULLs like GetMethodName. 14118 </change> 14119 <change date="29 Feb 2003" version="v40"> 14120 Rewrite the introductory text, adding sections on 14121 start-up, environments and bytecode instrumentation. 14122 Change the command line arguments per EG discussions. 14123 Add an introduction to the capabilities section. 14124 Add the extension mechanism category and functions. 14125 Mark for deletion, but clarified anyhow, SuspendAllThreads. 14126 Rename IterateOverLiveObjects to IterateOverReachableObjects and 14127 change the text accordingly. 14128 Clarify IterateOverHeap. 14129 Clarify CompiledMethodLoad. 14130 Discuss prerequisite state for Calling Functions. 14131 Clarify SetAllocationHooks. 14132 Added issues ("To be resolved:") through-out. 14133 And so on... 14134 </change> 14135 <change date="6 Mar 2003" version="v41"> 14136 Remove struct from the call to GetOwnedMonitorInfo. 14137 Automatically generate most error documentation, remove 14138 (rather broken) hand written error doc. 14139 Better describe capability use (empty initial set). 14140 Add min value to jint params. 14141 Remove the capability can_access_thread_local_storage. 14142 Rename error JVMTI_ERROR_NOT_IMPLEMENTED to JVMTI_ERROR_MUST_POSSESS_CAPABILITY; 14143 same for *NOT_IMPLEMENTED. 14144 Description fixes. 14145 </change> 14146 <change date="8 Mar 2003" version="v42"> 14147 Rename GetClassSignature to GetClassName. 14148 Rename IterateOverClassObjects to IterateOverInstancesOfClass. 14149 Remove GetMaxStack (operand stack isn't used in <jvmti/>). 14150 Description fixes: define launch-time, remove native frame pop 14151 from PopFrame, and assorted clarifications. 14152 </change> 14153 <change date="8 Mar 2003" version="v43"> 14154 Fix minor editing problem. 14155 </change> 14156 <change date="10 Mar 2003" version="v44"> 14157 Add phase information. 14158 Remap (compact) event numbers. 14159 </change> 14160 <change date="11 Mar 2003" version="v45"> 14161 More phase information - allow "any". 14162 Elide raw monitor queries and events. 14163 Minor description fixes. 14164 </change> 14165 <change date="12 Mar 2003" version="v46"> 14166 Add GetPhase. 14167 Use "phase" through document. 14168 Elide GetRawMonitorName. 14169 Elide GetObjectMonitors. 14170 </change> 14171 <change date="12 Mar 2003" version="v47"> 14172 Fixes from link, XML, and spell checking. 14173 Auto-generate the callback structure. 14174 </change> 14175 <change date="13 Mar 2003" version="v48"> 14176 One character XML fix. 14177 </change> 14178 <change date="13 Mar 2003" version="v49"> 14179 Change function parameter names to be consistent with 14180 event parameters (fooBarBaz becomes foo_bar_baz). 14181 </change> 14182 <change date="14 Mar 2003" version="v50"> 14183 Fix broken link. Fix thread markers. 14184 </change> 14185 <change date="14 Mar 2003" version="v51"> 14186 Change constants so they are under 128 to workaround 14187 compiler problems. 14188 </change> 14189 <change date="23 Mar 2003" version="v52"> 14190 Overhaul capabilities. Separate GetStackTrace into 14191 GetStackTrace and GetStackFrames. 14192 </change> 14193 <change date="8 Apr 2003" version="v54"> 14194 Use depth instead of jframeID to reference frames. 14195 Remove the now irrelevant GetCurrentFrame, GetCallerFrame and GetStackFrames. 14196 Remove frame arg from events. 14197 </change> 14198 <change date="9 Apr 2003" version="v55"> 14199 Remove GetObjectWithAnnotation since tests show bufferred approach more efficient. 14200 Add missing annotation_count to GetObjectsWithAnnotations 14201 </change> 14202 <change date="10 Apr 2003" version="v56"> 14203 Remove confusing parenthetical statement in GetObjectsWithAnnotations 14204 </change> 14205 <change date="13 Apr 2003" version="v58"> 14206 Replace jclass/jmethodID representation of method with simply jmethodID; 14207 Pass JvmtiEnv* as first arg of every event; remove JNIEnv* where inappropriate. 14208 Replace can_access_frames with can_access_local_variables; remove from purely stack access. 14209 Use can_get_synthetic_attribute; fix description. 14210 Clarify that zero length arrays must be deallocated. 14211 Clarify RelinquishCapabilities. 14212 Generalize JVMTI_ERROR_VM_DEAD to JVMTI_ERROR_WRONG_PHASE. 14213 </change> 14214 <change date="27 Apr 2003" version="v59"> 14215 Remove lingering indirect references to OBSOLETE_METHOD_ID. 14216 </change> 14217 <change date="4 May 2003" version="v60"> 14218 Allow DestroyRawMonitor during OnLoad. 14219 </change> 14220 <change date="7 May 2003" version="v61"> 14221 Added not monitor owner error return to DestroyRawMonitor. 14222 </change> 14223 <change date="13 May 2003" version="v62"> 14224 Clarify semantics of raw monitors. 14225 Change flags on <code>GetThreadStatus</code>. 14226 <code>GetClassLoader</code> return NULL for the bootstrap class loader. 14227 Add <code>GetClassName</code> issue. 14228 Define local variable signature. 14229 Disallow zero in annotations array of <code>GetObjectsWithAnnotations</code>. 14230 Remove over specification in <code>GetObjectsWithAnnotations</code>. 14231 Elide <code>SetAllocationHooks</code>. 14232 Elide <code>SuspendAllThreads</code>. 14233 </change> 14234 <change date="14 May 2003" version="v63"> 14235 Define the data type <code>jvmtiEventCallbacks</code>. 14236 Zero length allocations return NULL. 14237 Keep SetAllocationHooks in JVMDI, but remove from <jvmti/>. 14238 Add JVMTI_THREAD_STATUS_FLAG_INTERRUPTED. 14239 </change> 14240 <change date="15 May 2003" version="v64"> 14241 Better wording, per review. 14242 </change> 14243 <change date="15 May 2003" version="v65"> 14244 First Alpha. 14245 Make jmethodID and jfieldID unique, jclass not used. 14246 </change> 14247 <change date="27 May 2003" version="v66"> 14248 Fix minor XSLT errors. 14249 </change> 14250 <change date="13 June 2003" version="v67"> 14251 Undo making jfieldID unique (jmethodID still is). 14252 </change> 14253 <change date="17 June 2003" version="v68"> 14254 Changes per June 11th Expert Group meeting -- 14255 Overhaul Heap functionality: single callback, 14256 remove GetHeapRoots, add reachable iterators, 14257 and rename "annotation" to "tag". 14258 NULL thread parameter on most functions is current 14259 thread. 14260 Add timers. 14261 Remove ForceExit. 14262 Add GetEnvironmentLocalStorage. 14263 Add verbose flag and event. 14264 Add AddToBootstrapClassLoaderSearch. 14265 Update ClassFileLoadHook. 14266 </change> 14267 <change date="18 June 2003" version="v69"> 14268 Clean up issues sections. 14269 Rename GetClassName back to GetClassSignature and 14270 fix description. 14271 Add generic signature to GetClassSignature, 14272 GetFieldSignature, GetMethodSignature, and 14273 GetLocalVariableTable. 14274 Elide EstimateCostOfCapabilities. 14275 Clarify that the system property functions operate 14276 on the VM view of system properties. 14277 Clarify Agent_OnLoad. 14278 Remove "const" from JNIEnv* in events. 14279 Add metadata accessors. 14280 </change> 14281 <change date="18 June 2003" version="v70"> 14282 Add start_depth to GetStackTrace. 14283 Move system properties to a new category. 14284 Add GetObjectSize. 14285 Remove "X" from command line flags. 14286 XML, HTML, and spell check corrections. 14287 </change> 14288 <change date="19 June 2003" version="v71"> 14289 Fix JVMTI_HEAP_ROOT_THREAD to be 6. 14290 Make each synopsis match the function name. 14291 Fix unclear wording. 14292 </change> 14293 <change date="26 June 2003" version="v72"> 14294 SetThreadLocalStorage and SetEnvironmentLocalStorage should allow value 14295 to be set to NULL. 14296 NotifyFramePop, GetFrameLocationm and all the local variable operations 14297 needed to have their wording about frames fixed. 14298 Grammar and clarity need to be fixed throughout. 14299 Capitalization and puntuation need to be consistent. 14300 Need micro version number and masks for accessing major, minor, and micro. 14301 The error code lists should indicate which must be returned by 14302 an implementation. 14303 The command line properties should be visible in the properties functions. 14304 Disallow popping from the current thread. 14305 Allow implementations to return opaque frame error when they cannot pop. 14306 The NativeMethodBind event should be sent during any phase. 14307 The DynamicCodeGenerated event should be sent during any phase. 14308 The following functions should be allowed to operate before VMInit: 14309 Set/GetEnvironmentLocalStorage 14310 GetMethodDeclaringClass 14311 GetClassSignature 14312 GetClassModifiers 14313 IsInterface 14314 IsArrayClass 14315 GetMethodName 14316 GetMethodModifiers 14317 GetMaxLocals 14318 GetArgumentsSize 14319 GetLineNumberTable 14320 GetMethodLocation 14321 IsMethodNative 14322 IsMethodSynthetic. 14323 Other changes (to XSL): 14324 Argument description should show asterisk after not before pointers. 14325 NotifyFramePop, GetFrameLocationm and all the local variable operations 14326 should hsve the NO_MORE_FRAMES error added. 14327 Not alive threads should have a different error return than invalid thread. 14328 </change> 14329 <change date="7 July 2003" version="v73"> 14330 VerboseOutput event was missing message parameter. 14331 Minor fix-ups. 14332 </change> 14333 <change date="14 July 2003" version="v74"> 14334 Technical Publications Department corrections. 14335 Allow thread and environment local storage to be set to NULL. 14336 </change> 14337 <change date="23 July 2003" version="v75"> 14338 Use new Agent_OnLoad rather than overloaded JVM_OnLoad. 14339 Add JNICALL to callbacks (XSL). 14340 Document JNICALL requirement for both events and callbacks (XSL). 14341 Restrict RedefineClasses to methods and attributes. 14342 Elide the VerboseOutput event. 14343 VMObjectAlloc: restrict when event is sent and remove method parameter. 14344 Finish loose ends from Tech Pubs edit. 14345 </change> 14346 <change date="24 July 2003" version="v76"> 14347 Change ClassFileLoadHook event to send the class instead of a boolean of redefine. 14348 </change> 14349 <change date="24 July 2003" version="v77"> 14350 XML fixes. 14351 Minor text clarifications and corrections. 14352 </change> 14353 <change date="24 July 2003" version="v78"> 14354 Remove GetExceptionHandlerTable and GetThrownExceptions from <jvmti/>. 14355 Clarify that stack frames are JVM Spec frames. 14356 Split can_get_source_info into can_get_source_file_name, can_get_line_numbers, 14357 and can_get_source_debug_extension. 14358 PopFrame cannot have a native calling method. 14359 Removed incorrect statement in GetClassloaderClasses 14360 (see <vmspec chapter="4.4"/>). 14361 </change> 14362 <change date="24 July 2003" version="v79"> 14363 XML and text fixes. 14364 Move stack frame description into Stack Frame category. 14365 </change> 14366 <change date="26 July 2003" version="v80"> 14367 Allow NULL (means bootstrap loader) for GetClassloaderClasses. 14368 Add new heap reference kinds for references from classes. 14369 Add timer information struct and query functions. 14370 Add AvailableProcessors. 14371 Rename GetOtherThreadCpuTime to GetThreadCpuTime. 14372 Explicitly add JVMTI_ERROR_INVALID_THREAD and JVMTI_ERROR_THREAD_NOT_ALIVE 14373 to SetEventNotification mode. 14374 Add initial thread to the VM_INIT event. 14375 Remove platform assumptions from AddToBootstrapClassLoaderSearch. 14376 </change> 14377 <change date="26 July 2003" version="v81"> 14378 Grammar and clarity changes per review. 14379 </change> 14380 <change date="27 July 2003" version="v82"> 14381 More grammar and clarity changes per review. 14382 Add Agent_OnUnload. 14383 </change> 14384 <change date="28 July 2003" version="v83"> 14385 Change return type of Agent_OnUnload to void. 14386 </change> 14387 <change date="28 July 2003" version="v84"> 14388 Rename JVMTI_REFERENCE_ARRAY to JVMTI_REFERENCE_ARRAY_ELEMENT. 14389 </change> 14390 <change date="28 July 2003" version="v85"> 14391 Steal java.lang.Runtime.availableProcessors() wording for 14392 AvailableProcessors(). 14393 Guarantee that zero will never be an event ID. 14394 Remove some issues which are no longer issues. 14395 Per review, rename and more completely document the timer 14396 information functions. 14397 </change> 14398 <change date="29 July 2003" version="v86"> 14399 Non-spec visible change to XML controlled implementation: 14400 SetThreadLocalStorage must run in VM mode. 14401 </change> 14402 <change date="5 August 2003" version="0.1.87"> 14403 Add GetErrorName. 14404 Add varargs warning to jvmtiExtensionEvent. 14405 Remove "const" on the jvmtiEnv* of jvmtiExtensionEvent. 14406 Remove unused can_get_exception_info capability. 14407 Pass jvmtiEnv* and JNIEnv* to the jvmtiStartFunction. 14408 Fix jvmtiExtensionFunctionInfo.func declared type. 14409 Extension function returns error code. 14410 Use new version numbering. 14411 </change> 14412 <change date="5 August 2003" version="0.2.88"> 14413 Remove the ClassUnload event. 14414 </change> 14415 <change date="8 August 2003" version="0.2.89"> 14416 Heap reference iterator callbacks return an enum that 14417 allows outgoing object references to be ignored. 14418 Allow JNIEnv as a param type to extension events/functions. 14419 </change> 14420 <change date="15 August 2003" version="0.2.90"> 14421 Fix a typo. 14422 </change> 14423 <change date="2 September 2003" version="0.2.91"> 14424 Remove all metadata functions: GetClassMetadata, 14425 GetFieldMetadata, and GetMethodMetadata. 14426 </change> 14427 <change date="1 October 2003" version="0.2.92"> 14428 Mark the functions Allocate. Deallocate, RawMonitor*, 14429 SetEnvironmentLocalStorage, and GetEnvironmentLocalStorage 14430 as safe for use in heap callbacks and GC events. 14431 </change> 14432 <change date="24 November 2003" version="0.2.93"> 14433 Add pass through opaque user data pointer to heap iterate 14434 functions and callbacks. 14435 In the CompiledMethodUnload event, send the code address. 14436 Add GarbageCollectionOccurred event. 14437 Add constant pool reference kind. 14438 Mark the functions CreateRawMonitor and DestroyRawMonitor 14439 as safe for use in heap callbacks and GC events. 14440 Clarify: VMDeath, GetCurrentThreadCpuTimerInfo, 14441 GetThreadCpuTimerInfo, IterateOverReachableObjects, 14442 IterateOverObjectsReachableFromObject, GetTime and 14443 JVMTI_ERROR_NULL_POINTER. 14444 Add missing errors to: GenerateEvents and 14445 AddToBootstrapClassLoaderSearch. 14446 Fix description of ClassFileLoadHook name parameter. 14447 In heap callbacks and GC/ObjectFree events, specify 14448 that only explicitly allowed functions can be called. 14449 Allow GetCurrentThreadCpuTimerInfo, GetCurrentThreadCpuTime, 14450 GetTimerInfo, and GetTime during callback. 14451 Allow calling SetTag/GetTag during the onload phase. 14452 SetEventNotificationMode, add: error attempted inappropriate 14453 thread level control. 14454 Remove jvmtiExceptionHandlerEntry. 14455 Fix handling of native methods on the stack -- 14456 location_ptr param of GetFrameLocation, remove 14457 JVMTI_ERROR_OPAQUE_FRAME from GetFrameLocation, 14458 jvmtiFrameInfo.location, and jlocation. 14459 Remove typo (from JVMPI) implying that the MonitorWaited 14460 event is sent on sleep. 14461 </change> 14462 <change date="25 November 2003" version="0.2.94"> 14463 Clarifications and typos. 14464 </change> 14465 <change date="3 December 2003" version="0.2.95"> 14466 Allow NULL user_data in heap iterators. 14467 </change> 14468 <change date="28 January 2004" version="0.2.97"> 14469 Add GetThreadState, deprecate GetThreadStatus. 14470 </change> 14471 <change date="29 January 2004" version="0.2.98"> 14472 INVALID_SLOT and TYPE_MISMATCH errors should be optional. 14473 </change> 14474 <change date="12 February 2004" version="0.2.102"> 14475 Remove MonitorContendedExit. 14476 Added JNIEnv parameter to VMObjectAlloc. 14477 Clarified definition of class_tag and referrer_index 14478 parameters to heap callbacks. 14479 </change> 14480 <change date="16 Febuary 2004" version="0.2.103"> 14481 Document JAVA_TOOL_OPTIONS. 14482 </change> 14483 <change date="17 Febuary 2004" version="0.2.105"> 14484 Divide start phase into primordial and start. 14485 Add VMStart event 14486 Change phase associations of functions and events. 14487 </change> 14488 <change date="18 Febuary 2004" version="0.3.6"> 14489 Elide deprecated GetThreadStatus. 14490 Bump minor version, subtract 100 from micro version 14491 </change> 14492 <change date="18 Febuary 2004" version="0.3.7"> 14493 Document that timer nanosecond values are unsigned. 14494 Clarify text having to do with native methods. 14495 </change> 14496 <change date="19 Febuary 2004" version="0.3.8"> 14497 Fix typos. 14498 Remove elided deprecated GetThreadStatus. 14499 </change> 14500 <change date="23 Febuary 2004" version="0.3.9"> 14501 Require NotifyFramePop to act on suspended threads. 14502 </change> 14503 <change date="24 Febuary 2004" version="0.3.10"> 14504 Add capabilities 14505 (<internallink id="jvmtiCapabilities.can_redefine_any_class" 14506 ><code>can_redefine_any_class</code></internallink> 14507 and 14508 <internallink id="jvmtiCapabilities.can_generate_all_class_hook_events" 14509 ><code>can_generate_all_class_hook_events</code></internallink>) 14510 and an error (<errorlink id="JVMTI_ERROR_UNMODIFIABLE_CLASS"></errorlink>) 14511 which allow some classes to be unmodifiable. 14512 </change> 14513 <change date="28 Febuary 2004" version="0.3.11"> 14514 Add JVMTI_ERROR_MUST_POSSESS_CAPABILITY to SetEventNotificationMode. 14515 </change> 14516 <change date="8 March 2004" version="0.3.12"> 14517 Clarified CompiledMethodUnload so that it is clear the event 14518 may be posted after the class has been unloaded. 14519 </change> 14520 <change date="5 March 2004" version="0.3.13"> 14521 Change the size parameter of VMObjectAlloc to jlong to match GetObjectSize. 14522 </change> 14523 <change date="13 March 2004" version="0.3.14"> 14524 Added guideline for the use of the JNI FindClass function in event 14525 callback functions. 14526 </change> 14527 <change date="15 March 2004" version="0.3.15"> 14528 Add GetAllStackTraces and GetThreadListStackTraces. 14529 </change> 14530 <change date="19 March 2004" version="0.3.16"> 14531 ClassLoad and ClassPrepare events can be posted during start phase. 14532 </change> 14533 <change date="25 March 2004" version="0.3.17"> 14534 Add JVMTI_ERROR_NATIVE_METHOD to GetLineNumberTable, GetLocalVariableTable, 14535 GetMaxLocals, GetArgumentsSize, GetMethodLocation, GetBytecodes. 14536 </change> 14537 <change date="29 March 2004" version="0.3.18"> 14538 Return the timer kind in the timer information structure. 14539 </change> 14540 <change date="31 March 2004" version="0.3.19"> 14541 Spec clarifications: 14542 JVMTI_THREAD_STATE_IN_NATIVE might not include JNI or <jvmti/>. 14543 ForceGarbageCollection does not run finalizers. 14544 The context of the specification is the Java platform. 14545 Warn about early instrumentation. 14546 </change> 14547 <change date="1 April 2004" version="0.3.20"> 14548 Refinements to the above clarifications and 14549 Clarify that an error returned by Agent_OnLoad terminates the VM. 14550 </change> 14551 <change date="1 April 2004" version="0.3.21"> 14552 Array class creation does not generate a class load event. 14553 </change> 14554 <change date="7 April 2004" version="0.3.22"> 14555 Align thread state hierarchy more closely with java.lang.Thread.State. 14556 </change> 14557 <change date="12 April 2004" version="0.3.23"> 14558 Clarify the documentation of thread state. 14559 </change> 14560 <change date="19 April 2004" version="0.3.24"> 14561 Remove GarbageCollectionOccurred event -- can be done by agent. 14562 </change> 14563 <change date="22 April 2004" version="0.3.25"> 14564 Define "command-line option". 14565 </change> 14566 <change date="29 April 2004" version="0.3.26"> 14567 Describe the intended use of bytecode instrumentation. 14568 Fix description of extension event first parameter. 14569 </change> 14570 <change date="30 April 2004" version="0.3.27"> 14571 Clarification and typos. 14572 </change> 14573 <change date="18 May 2004" version="0.3.28"> 14574 Remove DataDumpRequest event. 14575 </change> 14576 <change date="18 May 2004" version="0.3.29"> 14577 Clarify RawMonitorWait with zero timeout. 14578 Clarify thread state after RunAgentThread. 14579 </change> 14580 <change date="24 May 2004" version="0.3.30"> 14581 Clean-up: fix bad/old links, etc. 14582 </change> 14583 <change date="30 May 2004" version="0.3.31"> 14584 Clarifications including: 14585 All character strings are modified UTF-8. 14586 Agent thread visibiity. 14587 Meaning of obsolete method version. 14588 Thread invoking heap callbacks, 14589 </change> 14590 <change date="1 June 2004" version="1.0.32"> 14591 Bump major.minor version numbers to "1.0". 14592 </change> 14593 <change date="2 June 2004" version="1.0.33"> 14594 Clarify interaction between ForceGarbageCollection 14595 and ObjectFree. 14596 </change> 14597 <change date="6 June 2004" version="1.0.34"> 14598 Restrict AddToBootstrapClassLoaderSearch and 14599 SetSystemProperty to the OnLoad phase only. 14600 </change> 14601 <change date="11 June 2004" version="1.0.35"> 14602 Fix typo in SetTag. 14603 </change> 14604 <change date="18 June 2004" version="1.0.36"> 14605 Fix trademarks. 14606 Add missing parameter in example GetThreadState usage. 14607 </change> 14608 <change date="4 August 2004" version="1.0.37"> 14609 Copyright updates. 14610 </change> 14611 <change date="5 November 2004" version="1.0.38"> 14612 Add missing function table layout. 14613 Add missing description of C++ member function format of functions. 14614 Clarify that name in CFLH can be NULL. 14615 Released as part of <tm>J2SE</tm> 5.0. 14616 </change> 14617 <change date="24 April 2005" version="1.1.47"> 14618 Bump major.minor version numbers to "1.1". 14619 Add ForceEarlyReturn* functions. 14620 Add GetOwnedMonitorStackDepthInfo function. 14621 Add GetCurrentThread function. 14622 Add "since" version marker. 14623 Add AddToSystemClassLoaderSearch. 14624 Allow AddToBootstrapClassLoaderSearch be used in live phase. 14625 Fix historic rubbish in the descriptions of the heap_object_callback 14626 parameter of IterateOverHeap and IterateOverInstancesOfClass functions; 14627 disallow NULL for this parameter. 14628 Clarify, correct and make consistent: wording about current thread, 14629 opaque frames and insufficient number of frames in PopFrame. 14630 Consistently use "current frame" rather than "topmost". 14631 Clarify the JVMTI_ERROR_TYPE_MISMATCH errors in GetLocal* and SetLocal* 14632 by making them compatible with those in ForceEarlyReturn*. 14633 Many other clarifications and wording clean ups. 14634 </change> 14635 <change date="25 April 2005" version="1.1.48"> 14636 Add GetConstantPool. 14637 Switch references to the first edition of the VM Spec, to the seconds edition. 14638 </change> 14639 <change date="26 April 2005" version="1.1.49"> 14640 Clarify minor/major version order in GetConstantPool. 14641 </change> 14642 <change date="26 April 2005" version="1.1.50"> 14643 Add SetNativeMethodPrefix and SetNativeMethodPrefixes. 14644 Reassign GetOwnedMonitorStackDepthInfo to position 153. 14645 Break out Class Loader Search in its own documentation category. 14646 Deal with overly long lines in XML source. 14647 </change> 14648 <change date="29 April 2005" version="1.1.51"> 14649 Allow agents be started in the live phase. 14650 Added paragraph about deploying agents. 14651 </change> 14652 <change date="30 April 2005" version="1.1.52"> 14653 Add specification description to SetNativeMethodPrefix(es). 14654 Better define the conditions on GetConstantPool. 14655 </change> 14656 <change date="30 April 2005" version="1.1.53"> 14657 Break out the GetClassVersionNumber function from GetConstantPool. 14658 Clean-up the references to the VM Spec. 14659 </change> 14660 <change date="1 May 2005" version="1.1.54"> 14661 Allow SetNativeMethodPrefix(es) in any phase. 14662 Add clarifications about the impact of redefinition on GetConstantPool. 14663 </change> 14664 <change date="2 May 2005" version="1.1.56"> 14665 Various clarifications to SetNativeMethodPrefix(es). 14666 </change> 14667 <change date="2 May 2005" version="1.1.57"> 14668 Add missing performance warning to the method entry event. 14669 </change> 14670 <change date="5 May 2005" version="1.1.58"> 14671 Remove internal JVMDI support. 14672 </change> 14673 <change date="8 May 2005" version="1.1.59"> 14674 Add <functionlink id="RetransformClasses"/>. 14675 Revamp the bytecode instrumentation documentation. 14676 Change <functionlink id="IsMethodObsolete"/> to no longer 14677 require the can_redefine_classes capability. 14678 </change> 14679 <change date="11 May 2005" version="1.1.63"> 14680 Clarifications for retransformation. 14681 </change> 14682 <change date="11 May 2005" version="1.1.64"> 14683 Clarifications for retransformation, per review. 14684 Lock "retransformation (in)capable" at class load enable time. 14685 </change> 14686 <change date="4 June 2005" version="1.1.67"> 14687 Add new heap functionity which supports reporting primitive values, 14688 allows setting the referrer tag, and has more powerful filtering: 14689 FollowReferences, IterateThroughHeap, and their associated 14690 callbacks, structs, enums, and constants. 14691 </change> 14692 <change date="4 June 2005" version="1.1.68"> 14693 Clarification. 14694 </change> 14695 <change date="6 June 2005" version="1.1.69"> 14696 FollowReferences, IterateThroughHeap: Put callbacks in a struct; 14697 Add missing error codes; reduce bits in the visit control flags. 14698 </change> 14699 <change date="14 June 2005" version="1.1.70"> 14700 More on new heap functionity: spec clean-up per review. 14701 </change> 14702 <change date="15 June 2005" version="1.1.71"> 14703 More on new heap functionity: Rename old heap section to Heap (1.0). 14704 </change> 14705 <change date="21 June 2005" version="1.1.72"> 14706 Fix typos. 14707 </change> 14708 <change date="27 June 2005" version="1.1.73"> 14709 Make referrer info structure a union. 14710 </change> 14711 <change date="9 September 2005" version="1.1.74"> 14712 In new heap functions: 14713 Add missing superclass reference kind. 14714 Use a single scheme for computing field indexes. 14715 Remove outdated references to struct based referrer info. 14716 </change> 14717 <change date="12 September 2005" version="1.1.75"> 14718 Don't callback during FollowReferences on frivolous java.lang.Object superclass. 14719 </change> 14720 <change date="13 September 2005" version="1.1.76"> 14721 In string primitive callback, length now Unicode length. 14722 In array and string primitive callbacks, value now "const". 14723 Note possible compiler impacts on setting JNI function table. 14724 </change> 14725 <change date="13 September 2005" version="1.1.77"> 14726 GetClassVersionNumbers() and GetConstantPool() should return 14727 error on array or primitive class. 14728 </change> 14729 <change date="14 September 2005" version="1.1.78"> 14730 Grammar fixes. 14731 </change> 14732 <change date="26 September 2005" version="1.1.79"> 14733 Add IsModifiableClass query. 14734 </change> 14735 <change date="9 February 2006" version="1.1.81"> 14736 Add referrer_class_tag parameter to jvmtiHeapReferenceCallback. 14737 </change> 14738 <change date="13 February 2006" version="1.1.82"> 14739 Doc fixes: update can_redefine_any_class to include retransform. 14740 Clarify that exception events cover all Throwables. 14741 In GetStackTrace, no test is done for start_depth too big if start_depth is zero, 14742 Clarify fields reported in Primitive Field Callback -- static vs instance. 14743 Repair confusing names of heap types, including callback names. 14744 Require consistent usage of stack depth in the face of thread launch methods. 14745 Note incompatibility of <jvmti/> memory management with other systems. 14746 </change> 14747 <change date="14 February 2006" version="1.1.85"> 14748 Fix typos and missing renames. 14749 </change> 14750 <change date="13 March 2006" version="1.1.86"> 14751 Clarify that jmethodIDs and jfieldIDs can be saved. 14752 Clarify that Iterate Over Instances Of Class includes subclasses. 14753 </change> 14754 <change date="14 March 2006" version="1.1.87"> 14755 Better phrasing. 14756 </change> 14757 <change date="16 March 2006" version="1.1.88"> 14758 Match the referrer_index for static fields in Object Reference Callback 14759 with the Reference Implementation (and all other known implementations); 14760 that is, make it match the definition for instance fields. 14761 In GetThreadListStackTraces, add JVMTI_ERROR_INVALID_THREAD to cover 14762 an invalid thread in the list; and specify that not started threads 14763 return empty stacks. 14764 </change> 14765 <change date="17 March 2006" version="1.1.89"> 14766 Typo. 14767 </change> 14768 <change date="25 March 2006" version="1.1.90"> 14769 Typo. 14770 </change> 14771 <change date="6 April 2006" version="1.1.91"> 14772 Remove restrictions on AddToBootstrapClassLoaderSearch and 14773 AddToSystemClassLoaderSearch. 14774 </change> 14775 <change date="1 May 2006" version="1.1.93"> 14776 Changed spec to return -1 for monitor stack depth for the 14777 implementation which can not determine stack depth. 14778 </change> 14779 <change date="3 May 2006" version="1.1.94"> 14780 Corrections for readability and accuracy courtesy of Alan Pratt of IBM. 14781 List the object relationships reported in FollowReferences. 14782 </change> 14783 <change date="5 May 2006" version="1.1.95"> 14784 Clarify the object relationships reported in FollowReferences. 14785 </change> 14786 <change date="28 June 2006" version="1.1.98"> 14787 Clarify DisposeEnvironment; add warning. 14788 Fix typos in SetLocalXXX "retrieve" => "set". 14789 Clarify that native method prefixes must remain set while used. 14790 Clarify that exactly one Agent_OnXXX is called per agent. 14791 Clarify that library loading is independent from start-up. 14792 Remove ambiguous reference to Agent_OnLoad in the Agent_OnUnload spec. 14793 </change> 14794 <change date="31 July 2006" version="1.1.99"> 14795 Clarify the interaction between functions and exceptions. 14796 Clarify and give examples of field indices. 14797 Remove confusing "That is" sentence from MonitorWait and MonitorWaited events. 14798 Update links to point to Java 6. 14799 </change> 14800 <change date="6 August 2006" version="1.1.102"> 14801 Add ResourceExhaustedEvent. 14802 </change> 14803 <change date="11 October 2012" version="1.2.2"> 14804 Fixed the "HTTP" and "Missing Anchor" errors reported by the LinkCheck tool. 14805 </change> 14806 <change date="19 June 2013" version="1.2.3"> 14807 Added support for statically linked agents. 14808 </change> 14809 <change date="13 October 2016" version="9.0.0"> 14810 Support for modules: 14811 - The majorversion is 9 now 14812 - The ClassFileLoadHook events are not sent during the primordial phase anymore. 14813 - Allow CompiledMethodLoad events at start phase 14814 - Add new capabilities: 14815 - can_generate_early_vmstart 14816 - can_generate_early_class_hook_events 14817 - Add new functions: 14818 - GetAllModules 14819 - AddModuleReads, AddModuleExports, AddModuleOpens, AddModuleUses, AddModuleProvides 14820 - IsModifiableModule 14821 Clarified can_redefine_any_classes, can_retransform_any_classes and IsModifiableClass API to 14822 disallow some implementation defined classes. 14823 </change> 14824 <change date="12 February 2017" version="9.0.0"> 14825 Minor update for GetCurrentThread function: 14826 - The function may return NULL in the start phase if the 14827 can_generate_early_vmstart capability is enabled. 14828 </change> 14829 <change date="7 February 2018" version="11.0.0"> 14830 Minor update for new class file NestHost and NestMembers attributes: 14831 - Specify that RedefineClasses and RetransformClasses are not allowed 14832 to change the class file NestHost and NestMembers attributes. 14833 - Add new error JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED 14834 that can be returned by RedefineClasses and RetransformClasses. 14835 </change> 14836 </changehistory> 14837 14838 </specification> 14839 <!-- Keep this comment at the end of the file 14840 Local variables: 14841 mode: sgml 14842 sgml-omittag:t 14843 sgml-shorttag:t 14844 sgml-namecase-general:t 14845 sgml-general-insert-case:lower 14846 sgml-minimize-attributes:nil 14847 sgml-always-quote-attributes:t 14848 sgml-indent-step:2 14849 sgml-indent-data:t 14850 sgml-parent-document:nil 14851 sgml-exposed-tags:nil 14852 sgml-local-catalogs:nil 14853 sgml-local-ecat-files:nil 14854 End: 14855 -->