1 <?xml version="1.0" encoding="ISO-8859-1"?> 2 <?xml-stylesheet type="text/xsl" href="jvmti.xsl"?> 3 <!-- 4 Copyright (c) 2002, 2012, 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 27 <!DOCTYPE specification [ 28 <!ELEMENT specification (title, intro*, functionsection, errorsection, 29 eventsection, datasection, issuessection, changehistory)> 30 <!ATTLIST specification label CDATA #REQUIRED 31 majorversion CDATA #REQUIRED 32 minorversion CDATA #REQUIRED 33 microversion CDATA #REQUIRED> 34 35 <!ELEMENT title (#PCDATA|jvmti|tm)*> 36 <!ATTLIST title subtitle CDATA #REQUIRED> 37 38 <!ELEMENT intro ANY> 39 <!ATTLIST intro id CDATA #IMPLIED 40 label CDATA ""> 41 42 <!ELEMENT functionsection (intro*, category*)> 43 <!ATTLIST functionsection label CDATA #REQUIRED> 44 45 <!ELEMENT category ((intro|typedef|uniontypedef|capabilitiestypedef)*, 46 (function|callback|elide)*)> 47 <!ATTLIST category id CDATA #REQUIRED 48 label CDATA #REQUIRED> 49 50 <!ELEMENT function (synopsis, typedef*, description?, origin, 51 (capabilities|eventcapabilities), 52 parameters, errors)> 53 <!ATTLIST function id CDATA #REQUIRED 54 num CDATA #REQUIRED 55 phase (onload|onloadOnly|start|live|any) #IMPLIED 56 callbacksafe (safe|unsafe) #IMPLIED 57 impl CDATA #IMPLIED 58 hide CDATA #IMPLIED 59 jkernel (yes|no) #IMPLIED 60 since CDATA "1.0"> 61 62 <!ELEMENT callback ((jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|jthreadGroup|jobject| 63 jvalue|enum|jint|jlong|jfloat|jdouble|jlocation|jboolean|char|uchar|size_t|void), 64 synopsis, description?, parameters)> 65 <!ATTLIST callback id CDATA #REQUIRED 66 since CDATA "1.0"> 67 68 <!ELEMENT synopsis (#PCDATA|jvmti)*> 69 70 <!ELEMENT typedef (description?, field*)> 71 <!ATTLIST typedef id CDATA #REQUIRED 72 label CDATA #REQUIRED 73 since CDATA "1.0"> 74 75 <!ELEMENT uniontypedef (description?, field*)> 76 <!ATTLIST uniontypedef id CDATA #REQUIRED 77 label CDATA #REQUIRED 78 since CDATA "1.0"> 79 80 <!ELEMENT field ((jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|jthreadGroup|jobject| 81 jvalue|enum|jint|jlong|jfloat|jdouble|jlocation|jboolean|char|uchar|size_t|void|allocfieldbuf|inptr|inbuf|outbuf|vmbuf|ptrtype|struct), 82 description)> 83 <!ATTLIST field id CDATA #REQUIRED> 84 85 <!ELEMENT capabilitiestypedef (description?, capabilityfield*)> 86 <!ATTLIST capabilitiestypedef id CDATA #REQUIRED 87 label CDATA #REQUIRED> 88 89 <!ELEMENT capabilityfield (description)> 90 <!ATTLIST capabilityfield id CDATA #REQUIRED 91 disp1 CDATA "" 92 disp2 CDATA "" 93 since CDATA "1.0"> 94 95 <!ELEMENT description ANY> 96 97 <!ELEMENT capabilities (required*, capability*)> 98 99 <!ELEMENT eventcapabilities EMPTY> 100 101 <!ELEMENT required ANY> 102 <!ATTLIST required id CDATA #REQUIRED> 103 104 <!ELEMENT capability ANY> 105 <!ATTLIST capability id CDATA #REQUIRED> 106 107 <!ELEMENT parameters (param*)> 108 109 <!ELEMENT param ((jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|jthreadGroup|jobject| 110 jvalue|enum|jint|jlong|jfloat|jdouble|jlocation|jboolean|char|uchar|size_t|void|varargs|struct|ptrtype| 111 outptr|allocbuf|allocallocbuf|inptr|inbuf|outbuf|vmbuf|agentbuf), 112 description)> 113 <!ATTLIST param id CDATA #REQUIRED> 114 115 <!ELEMENT jmethodID EMPTY> 116 <!ATTLIST jmethodID class CDATA #IMPLIED 117 native CDATA #IMPLIED> 118 119 <!ELEMENT jfieldID EMPTY> 120 <!ATTLIST jfieldID class CDATA #IMPLIED> 121 122 <!ELEMENT jclass EMPTY> 123 <!ATTLIST jclass method CDATA #IMPLIED 124 field CDATA #IMPLIED> 125 126 <!ELEMENT jframeID EMPTY> 127 <!ATTLIST jframeID thread CDATA #IMPLIED> 128 129 <!ELEMENT jrawMonitorID EMPTY> 130 131 <!ELEMENT jthread EMPTY> 132 <!ATTLIST jthread started CDATA #IMPLIED 133 null CDATA #IMPLIED 134 frame CDATA #IMPLIED 135 impl CDATA #IMPLIED> 136 137 <!ELEMENT varargs EMPTY> 138 139 <!ELEMENT jthreadGroup EMPTY> 140 <!ELEMENT jobject EMPTY> 141 <!ELEMENT jvalue EMPTY> 142 <!ELEMENT jchar EMPTY> 143 <!ELEMENT jint EMPTY> 144 <!ATTLIST jint min CDATA #IMPLIED> 145 <!ELEMENT jlong EMPTY> 146 <!ELEMENT jfloat EMPTY> 147 <!ELEMENT jdouble EMPTY> 148 <!ELEMENT jlocation EMPTY> 149 <!ELEMENT jboolean EMPTY> 150 <!ELEMENT char EMPTY> 151 <!ELEMENT uchar EMPTY> 152 <!ELEMENT size_t EMPTY> 153 <!ELEMENT void EMPTY> 154 <!ELEMENT enum (#PCDATA)*> 155 <!ELEMENT struct (#PCDATA)*> 156 157 <!ELEMENT nullok ANY> 158 159 <!ELEMENT ptrtype ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread| 160 jthreadGroup|jobject|jvalue), nullok?)> 161 162 <!ELEMENT outptr ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread| 163 jthreadGroup|jobject|jvalue|enum|jchar|jint|jlong|jfloat|jdouble| 164 jlocation|jboolean|char|uchar|size_t|void), nullok?)> 165 166 <!ELEMENT allocbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread| 167 jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble| 168 jlocation|jboolean|char|uchar|size_t|void), nullok?)> 169 <!ATTLIST allocbuf incount CDATA #IMPLIED 170 outcount CDATA #IMPLIED> 171 172 <!ELEMENT allocallocbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread| 173 jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble| 174 jlocation|jboolean|char|uchar|size_t|void), nullok?)> 175 <!ATTLIST allocallocbuf incount CDATA #IMPLIED 176 outcount CDATA #IMPLIED> 177 178 <!ELEMENT inptr (struct, nullok?)> 179 180 <!ELEMENT inbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread| 181 jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble| 182 jlocation|jboolean|char|uchar|size_t|void), nullok?)> 183 <!ATTLIST inbuf incount CDATA #IMPLIED> 184 185 <!ELEMENT outbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread| 186 jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble| 187 jlocation|jboolean|char|uchar|size_t|void|outbuf), nullok?)> 188 <!ATTLIST outbuf incount CDATA #IMPLIED 189 outcount CDATA #IMPLIED> 190 191 <!ELEMENT vmbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread| 192 jthreadGroup|jobject|jvalue|enum|jchar|jint|jlong|jfloat|jdouble| 193 jlocation|jboolean|char|uchar|size_t|void), nullok?)> 194 <!ATTLIST vmbuf incount CDATA #IMPLIED 195 outcount CDATA #IMPLIED> 196 197 <!ELEMENT agentbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread| 198 jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble| 199 jlocation|jboolean|char|uchar|size_t|void), nullok?)> 200 <!ATTLIST agentbuf incount CDATA #IMPLIED 201 outcount CDATA #IMPLIED> 202 203 <!ELEMENT allocfieldbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread| 204 jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble| 205 jlocation|jboolean|char|uchar|size_t|void))> 206 <!ATTLIST allocfieldbuf outcount CDATA #IMPLIED> 207 208 <!ELEMENT errors (error*)> 209 210 <!ELEMENT error ANY> 211 <!ATTLIST error id CDATA #REQUIRED> 212 213 <!ELEMENT errorsection (intro*, errorcategory*)> 214 <!ATTLIST errorsection label CDATA #REQUIRED> 215 216 <!ELEMENT errorcategory (intro*, errorid*)> 217 <!ATTLIST errorcategory id CDATA #REQUIRED 218 label CDATA #REQUIRED> 219 220 <!ELEMENT errorid ANY> 221 <!ATTLIST errorid id CDATA #REQUIRED 222 num CDATA #REQUIRED> 223 224 <!ELEMENT datasection (intro*, basetypes*)> 225 226 <!ELEMENT basetypes (intro*, basetype*)> 227 <!ATTLIST basetypes id CDATA #REQUIRED 228 label CDATA #REQUIRED> 229 230 <!ELEMENT basetype (definition?,description)> 231 <!ATTLIST basetype id CDATA #REQUIRED> 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 dl (dt|dd)+> 337 338 <!ELEMENT dd ANY> 339 340 <!ELEMENT dt (#PCDATA|jvmti|code|i|b)*> 341 342 <!ELEMENT table (tr)+> 343 344 <!ELEMENT tr (td|th)*> 345 346 <!ELEMENT td ANY> 347 <!ATTLIST td align (left|right|center) "center"> 348 349 <!ELEMENT th ANY> 350 <!ATTLIST th align (left|right|center) "center"> 351 352 <!ELEMENT ul (li)+> 353 <!ATTLIST ul type (disc|circle|square) "disc"> 354 355 <!ELEMENT li ANY> 356 ]> 357 358 <specification label="JVM(TM) Tool Interface" 359 majorversion="1" 360 minorversion="2" 361 microversion="3"> 362 <title subtitle="Version"> 363 <tm>JVM</tm> Tool Interface 364 </title> 365 366 <intro id="whatIs" label="What is the JVM Tool Interface?"> 367 The <tm>JVM</tm> Tool Interface (<jvmti/>) 368 is a programming interface used by development and monitoring tools. 369 It provides both a way to inspect the state and 370 to control the execution of applications running in the 371 <tm>Java</tm> virtual machine (VM). 372 <p/> 373 <jvmti/> is intended to provide a VM interface for the full breadth of tools 374 that need access to VM state, including but not limited to: profiling, 375 debugging, monitoring, thread analysis, and coverage analysis tools. 376 <p/> 377 <jvmti/> may not be available in all implementations of the <tm>Java</tm> virtual 378 machine. 379 <p/> 380 <jvmti/> is a two-way interface. 381 A client of <jvmti/>, hereafter called an <i>agent</i>, 382 can be notified of 383 interesting occurrences through <internallink id="EventSection">events</internallink>. 384 <jvmti/> 385 can query and control the application through many 386 <internallink id="FunctionSection">functions</internallink>, 387 either in response to events or 388 independent of them. 389 <p/> 390 Agents run in the same process with and communicate directly with 391 the virtual machine executing 392 the application being examined. This communication is 393 through a native interface (<jvmti/>). The native in-process interface allows 394 maximal control with minimal intrusion on the part of a tool. 395 Typically, agents are relatively compact. They can be controlled 396 by a separate process which implements the bulk of a tool's 397 function without interfering with the target application's normal execution. 398 </intro> 399 400 <intro id="architecture" label="Architecture"> 401 Tools can be written directly to <jvmti/> or indirectly 402 through higher level interfaces. 403 The Java Platform Debugger Architecture includes <jvmti/>, but also 404 contains higher-level, out-of-process debugger interfaces. The higher-level 405 interfaces are more appropriate than <jvmti/> for many tools. 406 For more information on the Java Platform Debugger Architecture, 407 see the 408 <externallink id="http://docs.oracle.com/javase/7/docs/technotes/guides/jpda/architecture.html">Java 409 Platform Debugger Architecture website</externallink>. 410 </intro> 411 412 <intro id="writingAgents" label="Writing Agents"> 413 Agents can be written in any native language that supports C 414 language calling conventions and C or C++ 415 definitions. 416 <p/> 417 The function, event, data type, and constant definitions needed for 418 using <jvmti/> are defined in the include file <code>jvmti.h</code>. 419 To use these definitions add the <tm>J2SE</tm> include directory 420 to your include path and add 421 <example> 422 #include <jvmti.h> 423 </example> 424 to your source code. 425 </intro> 426 427 <intro id="deployingAgents" label="Deploying Agents"> 428 An agent is deployed in a platform specific manner but is typically the 429 platform equivalent of a dynamic library. On the <tm>Windows</tm> operating 430 system, for example, an agent library is a "Dynamic Linked Library" (DLL). 431 On the <tm>Solaris</tm> Operating Environment, an agent library is a shared 432 object (<code>.so</code> file). 433 <p/> 434 435 An agent may be started at VM startup by specifying the agent library 436 name using a <internallink id="starting">command line option</internallink>. 437 Some implementations may support a mechanism to <internallink id="onattach"> 438 start agents</internallink> in the live <functionlink id="GetPhase">phase</functionlink>. 439 The details of how this is initiated are implementation specific. 440 </intro> 441 442 <intro id="entry point" label="Statically Linked Agents (since version 1.2.3)"> 443 444 A native JVMTI Agent may be <i>statically linked</i> with the VM. 445 The manner in which the library and VM image are combined is 446 implementation-dependent. 447 An agent L whose image has been combined with the VM is defined as 448 <i>statically linked</i> if and only if the agent exports a function 449 called Agent_OnLoad_L. 450 <p/> 451 If a <i>statically linked</i> agent L exports a function called 452 Agent_OnLoad_L and a function called Agent_OnLoad, the Agent_OnLoad 453 function will be ignored. 454 If an agent L is <i>statically linked</i>, an Agent_OnLoad_L 455 function will be invoked with the same arguments and expected return 456 value as specified for the Agent_OnLoad function. 457 An agent L that is <i>statically linked</i> will prohibit an agent of 458 the same name from being loaded dynamically. 459 <p/> 460 The VM will invoke the Agent_OnUnload_L function of the agent, if such 461 a function is exported, at the same point during startup as it would 462 have called the dynamic entry point Agent_OnUnLoad. 463 If a <i>statically linked</i> agent L exports a function called 464 Agent_OnUnLoad_L and a function called Agent_OnUnLoad, the Agent_OnUnLoad 465 function will be ignored. 466 <p/> 467 If an agent L is <i>statically linked</i>, an Agent_OnAttach_L function 468 will be invoked with the same arguments and expected return value as 469 specified for the Agent_OnAttach function. 470 If a <i>statically linked</i> agent L exports a function called 471 Agent_OnAttach_L and a function called Agent_OnAttach, the Agent_OnAttach 472 function will be ignored. 473 </intro> 474 475 <intro id="starting" label="Agent Command Line Options"> 476 The term "command-line option" is used below to 477 mean options supplied in the <code>JavaVMInitArgs</code> argument 478 to the <code>JNI_CreateJavaVM</code> function of the JNI 479 Invocation API. 480 <p/> 481 One of the two following 482 command-line options is used on VM startup to 483 properly load and run agents. 484 These arguments identify the library containing 485 the agent as well as an options 486 string to be passed in at startup. 487 <dl> 488 <dt><code>-agentlib:</code><i><agent-lib-name></i><code>=</code><i><options></i></dt> 489 <dd> 490 The name following <code>-agentlib:</code> is the name of the 491 library to load. Lookup of the library, both its full name and location, 492 proceeds in a platform-specific manner. 493 Typically, the <i><agent-lib-name></i> is expanded to an 494 operating system specific file name. 495 The <i><options></i> will be passed to the agent on start-up. 496 For example, if the option 497 <code>-agentlib:foo=opt1,opt2</code> is specified, the VM will attempt to 498 load the shared library <code>foo.dll</code> from the system <code>PATH</code> 499 under <tm>Windows</tm> or <code>libfoo.so</code> from the 500 <code>LD_LIBRARY_PATH</code> under the <tm>Solaris</tm> operating 501 environment. 502 If the agent library is statically linked into the executable 503 then no actual loading takes place. 504 <p/> 505 </dd> 506 <dt><code>-agentpath:</code><i><path-to-agent></i><code>=</code><i><options></i></dt> 507 <dd> 508 The path following <code>-agentpath:</code> is the absolute path from which 509 to load the library. 510 No library name expansion will occur. 511 The <i><options></i> will be passed to the agent on start-up. 512 For example, if the option 513 <code>-agentpath:c:\myLibs\foo.dll=opt1,opt2</code> is specified, the VM will attempt to 514 load the shared library <code>c:\myLibs\foo.dll</code>. If the agent 515 library is statically linked into the executable 516 then no actual loading takes place. 517 <p/> 518 </dd> 519 </dl> 520 For a dynamic shared library agent, the start-up routine <internallink id="onload"><code>Agent_OnLoad</code></internallink> 521 in the library will be invoked. If the agent library is statically linked 522 into the executable then the system will attempt to invoke the <code>Agent_OnLoad_<agent-lib-name></code> entry point where <agent-lib-name> is the basename of the 523 agent. In the above example <code>-agentpath:c:\myLibs\foo.dll=opt1,opt2</code>, the system will attempt to find and call the <code>Agent_OnLoad_foo</code> start-up routine. 524 <p/> 525 Libraries loaded with <code>-agentlib:</code> or <code>-agentpath:</code> 526 will be searched for JNI native method implementations to facilitate the 527 use of Java programming language code in tools, as is needed for 528 <internallink id="bci">bytecode instrumentation</internallink>. 529 <p/> 530 The agent libraries will be searched after all other libraries have been 531 searched (agents wishing to override or intercept the native method 532 implementations of non-agent methods can use the 533 <eventlink id="NativeMethodBind">NativeMethodBind event</eventlink>). 534 <p/> 535 These switches do the above and nothing more - they do not change the 536 state of the VM or <jvmti/>. No command line options are needed 537 to enable <jvmti/> 538 or aspects of <jvmti/>, this is handled programmatically 539 by the use of 540 <internallink id="capability">capabilities</internallink>. 541 </intro> 542 543 <intro id="startup" label="Agent Start-Up"> 544 The VM starts each agent by invoking a start-up function. 545 If the agent is started in the <code>OnLoad</code> 546 <functionlink id="GetPhase">phase</functionlink> the function 547 <internallink id="onload"><code>Agent_OnLoad</code></internallink> 548 or <internallink id="onload"><code>Agent_OnLoad_L</code></internallink> 549 for statically linked agents will be invoked. 550 If the agent is started in the live 551 <functionlink id="GetPhase">phase</functionlink> the function 552 <internallink id="onattach"><code>Agent_OnAttach</code></internallink> 553 or <internallink id="onattach"><code>Agent_OnAttach_L</code></internallink> 554 for statically linked agents will be invoked. 555 Exactly one call to a start-up function is made per agent. 556 </intro> 557 558 <intro id="onload" label="Agent Start-Up (OnLoad phase)"> 559 If an agent is started during the <code>OnLoad</code> phase then its 560 agent library must export a start-up function with the following prototype: 561 <example> 562 JNIEXPORT jint JNICALL 563 Agent_OnLoad(JavaVM *vm, char *options, void *reserved)</example> 564 Or for a statically linked agent named 'L': 565 <example> 566 JNIEXPORT jint JNICALL 567 Agent_OnLoad_L(JavaVM *vm, char *options, void *reserved)</example> 568 569 The VM will start the agent by calling this function. 570 It will be called early enough in VM initialization that: 571 <ul> 572 <li><functionlink id="SetSystemProperty">system properties</functionlink> 573 may be set before they have been used in the start-up of the VM</li> 574 <li>the full set of 575 <internallink id="capability">capabilities</internallink> 576 is still available (note that capabilities that configure the VM 577 may only be available at this time--see the 578 <internallink id="capability">Capability function section</internallink>)</li> 579 <li>no bytecodes have executed</li> 580 <li>no classes have been loaded</li> 581 <li>no objects have been created</li> 582 </ul> 583 <p/> 584 The VM will call the <code>Agent_OnLoad</code> or <code>Agent_OnLoad_<agent-lib-name></code> function with 585 <i><options></i> as the second argument - 586 that is, using the command-line option examples, 587 <code>"opt1,opt2"</code> will be passed to the <code>char *options</code> 588 argument of <code>Agent_OnLoad</code>. 589 The <code>options</code> argument is encoded as a 590 <internallink id="mUTF">modified UTF-8</internallink> string. 591 If <i>=<options></i> is not specified, 592 a zero length string is passed to <code>options</code>. 593 The lifespan of the <code>options</code> string is the <code>Agent_OnLoad</code> or <code>Agent_OnLoad_<agent-lib-name></code> 594 call. If needed beyond this time the string or parts of the string must 595 be copied. 596 The period between when <code>Agent_OnLoad</code> is called and when it 597 returns is called the <i>OnLoad phase</i>. 598 Since the VM is not initialized during the OnLoad 599 <functionlink id="GetPhase">phase</functionlink>, 600 the set of allowed operations 601 inside <code>Agent_OnLoad</code> is restricted (see the function descriptions for the 602 functionality available at this time). 603 The agent can safely process the options and set 604 event callbacks with <functionlink id="SetEventCallbacks"></functionlink>. Once 605 the VM initialization event is received 606 (that is, the <eventlink id="VMInit">VMInit</eventlink> 607 callback is invoked), the agent 608 can complete its initialization. 609 <rationale> 610 Early startup is required so that agents can set the desired capabilities, 611 many of which must be set before the VM is initialized. 612 In JVMDI, the -Xdebug command-line option provided 613 very coarse-grain control of capabilities. 614 JVMPI implementations use various tricks to provide a single "JVMPI on" switch. 615 No reasonable command-line 616 option could provide the fine-grain of control required to balance needed capabilities vs 617 performance impact. 618 Early startup is also needed so that agents can control the execution 619 environment - modifying the file system and system properties to install 620 their functionality. 621 </rationale> 622 <p/> 623 The return value from <code>Agent_OnLoad</code> or <code>Agent_OnLoad_<agent-lib-name></code> is used to indicate an error. 624 Any value other than zero indicates an error and causes termination of the VM. 625 </intro> 626 627 <intro id="onattach" label="Agent Start-Up (Live phase)"> 628 A VM may support a mechanism that allows agents to be started in the VM during the live 629 <functionlink id="GetPhase">phase</functionlink>. The details of how this is supported, 630 are implementation specific. For example, a tool may use some platform specific mechanism, 631 or implementation specific API, to attach to the running VM, and request it start a given 632 agent. 633 <p/> 634 If an agent is started during the live phase then its agent library 635 must export a start-up function 636 with the following prototype: 637 <example> 638 JNIEXPORT jint JNICALL 639 Agent_OnAttach(JavaVM* vm, char *options, void *reserved)</example> 640 Or for a statically linked agent named 'L': 641 <example> 642 JNIEXPORT jint JNICALL 643 Agent_OnAttach_L(JavaVM* vm, char *options, void *reserved)</example> 644 645 <p/> 646 The VM will start the agent by calling this function. 647 It will be called in the context of a thread 648 that is attached to the VM. The first argument <i><vm></i> is the Java VM. 649 The <i><options></i> argument is the startup options provided to the agent. 650 <i><options></i> is encoded as a <internallink id="mUTF">modified UTF-8 651 </internallink> string. 652 If startup options were not provided, a zero length string is passed to 653 <code>options</code>. The lifespan of the <code>options</code> string is the 654 <code>Agent_OnAttach</code> or <code>Agent_OnAttach_<agent-lib-name></code> call. If needed beyond this time the string or parts of 655 the string must be copied. 656 <p/> 657 Note that some <internallink id="capability">capabilities</internallink> 658 may not be available in the live phase. 659 <p/> 660 The <code>Agent_OnAttach</code> or <code>Agent_OnAttach_<agent-lib-name></code> function initializes the agent and returns a value 661 to the VM to indicate if an error occurred. Any value other than zero indicates an error. 662 An error does not cause the VM to terminate. Instead the VM ignores the error, or takes 663 some implementation specific action -- for example it might print an error to standard error, 664 or record the error in a system log. 665 </intro> 666 667 <intro id="onunload" label="Agent Shutdown"> 668 The library may optionally export a 669 shutdown function with the following prototype: 670 <example> 671 JNIEXPORT void JNICALL 672 Agent_OnUnload(JavaVM *vm)</example> 673 Or for a statically linked agent named 'L': 674 <example> 675 JNIEXPORT void JNICALL 676 Agent_OnUnload_L(JavaVM *vm)</example> 677 678 This function will be called by the VM when the library is about to be unloaded. 679 The library will be unloaded (unless it is statically linked into the executable) and this function will be called if some platform specific 680 mechanism causes the unload (an unload mechanism is not specified in this document) 681 or the library is (in effect) unloaded by the termination of the VM whether through 682 normal termination or VM failure, including start-up failure. 683 Uncontrolled shutdown is, of couse, an exception to this rule. 684 Note the distinction between this function and the 685 <eventlink id="VMDeath">VM Death event</eventlink>: for the VM Death event 686 to be sent, the VM must have run at least to the point of initialization and a valid 687 <jvmti/> environment must exist which has set a callback for VMDeath 688 and enabled the event. 689 None of these are required for <code>Agent_OnUnload</code> or <code>Agent_OnUnload_<agent-lib-name></code> and this function 690 is also called if the library is unloaded for other reasons. 691 In the case that a VM Death event is sent, it will be sent before this 692 function is called (assuming this function is called due to VM termination). 693 This function can be used to clean-up resources allocated by the agent. 694 </intro> 695 696 <intro id="tooloptions" label="JAVA_TOOL_OPTIONS"> 697 Since the command-line cannot always be accessed or modified, for example in embedded VMs 698 or simply VMs launched deep within scripts, a <code>JAVA_TOOL_OPTIONS</code> variable is 699 provided so that agents may be launched in these cases. 700 <p/> 701 Platforms which support environment variables or other named strings, may support the 702 <code>JAVA_TOOL_OPTIONS</code> variable. This variable will be broken into options at white-space 703 boundaries. White-space characters include space, tab, carriage-return, new-line, 704 vertical-tab, and form-feed. Sequences of white-space characters are considered 705 equivalent to a single white-space character. No white-space is included in the options 706 unless quoted. Quoting is as follows: 707 <ul> 708 <li>All characters enclosed between a pair of single quote marks (''), except a single 709 quote, are quoted.</li> 710 <li>Double quote characters have no special meaning inside a pair of single quote marks.</li> 711 <li>All characters enclosed between a pair of double quote marks (""), except a double 712 quote, are quoted.</li> 713 <li>Single quote characters have no special meaning inside a pair of double quote marks.</li> 714 <li>A quoted part can start or end anywhere in the variable.</li> 715 <li>White-space characters have no special meaning when quoted -- they are included in 716 the option like any other character and do not mark white-space boundaries.</li> 717 <li>The pair of quote marks is not included in the option.</li> 718 </ul> 719 <code>JNI_CreateJavaVM</code> (in the JNI Invocation API) will prepend these options to the options supplied 720 in its <code>JavaVMInitArgs</code> argument. Platforms may disable this feature in cases where security is 721 a concern; for example, the Reference Implementation disables this feature on Unix systems when 722 the effective user or group ID differs from the real ID. 723 This feature is intended to support the initialization of tools -- specifically including the 724 launching of native or Java programming language agents. Multiple tools may wish to use this 725 feature, so the variable should not be overwritten, instead, options should be appended to 726 the variable. Note that since the variable is processed at the time of the JNI Invocation 727 API create VM call, options processed by a launcher (e.g., VM selection options) will not be handled. 728 </intro> 729 730 <intro id="environments" label="Environments"> 731 The <jvmti/> specification supports the use of multiple simultaneous 732 <jvmti/> agents. 733 Each agent has its own <jvmti/> environment. 734 That is, the <jvmti/> state is 735 separate for each agent - changes to one environment do not affect the 736 others. The state of a <jvmti/> 737 environment includes: 738 <ul> 739 <li><functionlink id="SetEventCallbacks">the event callbacks</functionlink></li> 740 <li><functionlink id="SetEventNotificationMode">the set of events which are enabled</functionlink></li> 741 <li><internallink id="capability">the capabilities</internallink></li> 742 <li><internallink id="memory">the memory allocation/deallocation hooks</internallink></li> 743 </ul> 744 Although their <jvmti/> state 745 is separate, agents inspect and modify the shared state 746 of the VM, they also share the native environment in which they execute. 747 As such, an agent can perturb the results of other agents or cause them 748 to fail. It is the responsibility of the agent writer to specify the level 749 of compatibility with other agents. <jvmti/> implementations are not capable 750 of preventing destructive interactions between agents. Techniques to reduce 751 the likelihood of these occurrences are beyond the scope of this document. 752 <p/> 753 An agent creates a <jvmti/> environment 754 by passing a <jvmti/> version 755 as the interface ID to the JNI Invocation API function 756 <externallink id="http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/invocation.html#GetEnv"><code>GetEnv</code></externallink>. 757 See <internallink id="jvmtiEnvAccess">Accessing <jvmti/> Functions</internallink> 758 for more details on the creation and use of 759 <jvmti/> environments. 760 Typically, <jvmti/> environments are created by calling <code>GetEnv</code> from 761 <internallink id="onload"><code>Agent_OnLoad</code></internallink>. 762 </intro> 763 764 <intro id="bci" label="Bytecode Instrumentation"> 765 This interface does not include some events that one might expect in an interface with 766 profiling support. Some examples include object allocation events and full speed 767 method enter and exit events. The interface instead provides support for 768 <i>bytecode instrumentation</i>, the ability to alter the Java virtual machine 769 bytecode instructions which comprise the target program. Typically, these alterations 770 are to add "events" to the code of a method - for example, to add, at the beginning of a method, 771 a call to <code>MyProfiler.methodEntered()</code>. 772 Since the changes are purely additive, they do not modify application 773 state or behavior. 774 Because the inserted agent code is standard bytecodes, the VM can run at full speed, 775 optimizing not only the target program but also the instrumentation. If the 776 instrumentation does not involve switching from bytecode execution, no expensive 777 state transitions are needed. The result is high performance events. 778 This approach also provides complete control to the agent: instrumentation can be 779 restricted to "interesting" portions of the code (e.g., the end user's code) and 780 can be conditional. Instrumentation can run entirely in Java programming language 781 code or can call into the native agent. Instrumentation can simply maintain 782 counters or can statistically sample events. 783 <p/> 784 Instrumentation can be inserted in one of three ways: 785 <ul> 786 <li> 787 Static Instrumentation: The class file is instrumented before it 788 is loaded into the VM - for example, by creating a duplicate directory of 789 <code>*.class</code> files which have been modified to add the instrumentation. 790 This method is extremely awkward and, in general, an agent cannot know 791 the origin of the class files which will be loaded. 792 </li> 793 <li> 794 Load-Time Instrumentation: When a class file is loaded by the VM, the raw 795 bytes of the class file are sent for instrumentation to the agent. 796 The <eventlink id="ClassFileLoadHook"/> 797 event, triggered by the class load, 798 provides this functionality. This mechanism provides efficient 799 and complete access to one-time instrumentation. 800 </li> 801 <li> 802 Dynamic Instrumentation: A class which is already loaded (and possibly 803 even running) is modified. This optional feature is provided by the 804 <eventlink id="ClassFileLoadHook"/> event, triggered by calling the 805 <functionlink id="RetransformClasses"/> function. 806 Classes can be modified multiple times and can be returned to their 807 original state. 808 The mechanism allows instrumentation which changes during the 809 course of execution. 810 </li> 811 </ul> 812 <p/> 813 The class modification functionality provided in this interface 814 is intended to provide a mechanism for instrumentation 815 (the <eventlink id="ClassFileLoadHook"/> event 816 and the <functionlink id="RetransformClasses"/> function) 817 and, during development, for fix-and-continue debugging 818 (the <functionlink id="RedefineClasses"/> function). 819 <p/> 820 Care must be taken to avoid perturbing dependencies, especially when 821 instrumenting core classes. For example, an approach to getting notification 822 of every object allocation is to instrument the constructor on 823 <code>Object</code>. Assuming that the constructor is initially 824 empty, the constructor could be changed to: 825 <example> 826 public Object() { 827 MyProfiler.allocationTracker(this); 828 } 829 </example> 830 However, if this change was made using the 831 <eventlink id="ClassFileLoadHook"/> 832 event then this might impact a typical VM as follows: 833 the first created object will call the constructor causing a class load of 834 <code>MyProfiler</code>; which will then cause 835 object creation, and since <code>MyProfiler</code> isn't loaded yet, 836 infinite recursion; resulting in a stack overflow. A refinement of this 837 would be to delay invoking the tracking method until a safe time. For 838 example, <code>trackAllocations</code> could be set in the 839 handler for the <code>VMInit</code> event. 840 <example> 841 static boolean trackAllocations = false; 842 843 public Object() { 844 if (trackAllocations) { 845 MyProfiler.allocationTracker(this); 846 } 847 } 848 </example> 849 <p/> 850 The <functionlink id="SetNativeMethodPrefix"/> allows native methods 851 to be instrumented by the use of wrapper methods. 852 </intro> 853 854 <intro id="mUTF" label="Modified UTF-8 String Encoding"> 855 <jvmti/> uses modified UTF-8 to encode character strings. 856 This is the same encoding used by JNI. 857 Modified UTF-8 differs 858 from standard UTF-8 in the representation of supplementary characters 859 and of the null character. See the 860 <externallink id="http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/types.html#wp16542"> 861 Modified UTF-8 Strings</externallink> 862 section of the JNI specification for details. 863 </intro> 864 865 <intro id="context" label="Specification Context"> 866 Since this interface provides access to the state of applications running in the 867 Java virtual machine; 868 terminology refers to the Java platform and not the native 869 platform (unless stated otherwise). For example: 870 <ul> 871 <li>"thread" means Java programming language thread.</li> 872 <li>"stack frame" means Java virtual machine stack frame.</li> 873 <li>"class" means Java programming language class.</li> 874 <li>"heap" means Java virtual machine heap.</li> 875 <li>"monitor" means Java programming language object monitor.</li> 876 </ul> 877 <p/> 878 Sun, Sun Microsystems, the Sun logo, Java, and JVM 879 are trademarks or registered trademarks of Oracle 880 and/or its affiliates, in the U.S. and other countries. 881 </intro> 882 883 884 <functionsection label="Functions"> 885 <intro id="jvmtiEnvAccess" label="Accessing Functions"> 886 Native code accesses <jvmti/> features 887 by calling <jvmti/> functions. 888 Access to <jvmti/> functions is by use of an interface pointer 889 in the same manner as 890 <externallink id="http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/design.html">Java 891 Native Interface (JNI) functions</externallink> are accessed. 892 The <jvmti/> interface pointer is called the 893 <i>environment pointer</i>. 894 <p/> 895 An environment pointer is a pointer to an environment and has 896 the type <code>jvmtiEnv*</code>. 897 An environment has information about its <jvmti/> connection. 898 The first value in the environment is a pointer to the function table. 899 The function table is an array of pointers to <jvmti/> functions. 900 Every function pointer is at a predefined offset inside the 901 array. 902 <p/> 903 When used from the C language: 904 double indirection is used to access the functions; 905 the environment pointer provides context and is the first 906 parameter of each function call; for example: 907 <example> 908 jvmtiEnv *jvmti; 909 ... 910 jvmtiError err = (*jvmti)->GetLoadedClasses(jvmti, &class_count, &classes); 911 </example> 912 <p/> 913 When used from the C++ language: 914 functions are accessed as member functions of <code>jvmtiEnv</code>; 915 the environment pointer is not passed to the function call; for example: 916 <example> 917 jvmtiEnv *jvmti; 918 ... 919 jvmtiError err = jvmti->GetLoadedClasses(&class_count, &classes); 920 </example> 921 Unless otherwise stated, all examples and declarations in this 922 specification use the C language. 923 <p/> 924 A <jvmti/> environment can be obtained through the JNI Invocation API 925 <code>GetEnv</code> function: 926 <example> 927 jvmtiEnv *jvmti; 928 ... 929 (*jvm)->GetEnv(jvm, &jvmti, JVMTI_VERSION_1_0); 930 </example> 931 Each call to <code>GetEnv</code> 932 creates a new <jvmti/> connection and thus 933 a new <jvmti/> environment. 934 The <code>version</code> argument of <code>GetEnv</code> must be 935 a <jvmti/> version. 936 The returned environment may have a different version than the 937 requested version but the returned environment must be compatible. 938 <code>GetEnv</code> will return <code>JNI_EVERSION</code> if a 939 compatible version is not available, if <jvmti/> is not supported or 940 <jvmti/> is not supported in the current VM configuration. 941 Other interfaces may be added for creating <jvmti/> environments 942 in specific contexts. 943 Each environment has its own state (for example, 944 <functionlink id="SetEventNotificationMode">desired events</functionlink>, 945 <functionlink id="SetEventCallbacks">event handling functions</functionlink>, and 946 <functionlink id="AddCapabilities">capabilities</functionlink>). 947 An environment is released with 948 <functionlink id="DisposeEnvironment"></functionlink>. 949 Thus, unlike JNI which has one environment per thread, <jvmti/> environments work 950 across threads and are created dynamically. 951 </intro> 952 953 <intro id="functionReturn" label="Function Return Values"> 954 <jvmti/> functions always return an 955 <internallink id="ErrorSection">error code</internallink> via the 956 <datalink id="jvmtiError"/> function return value. 957 Some functions can return additional 958 values through pointers provided by the calling function. 959 In some cases, <jvmti/> functions allocate memory that your program must 960 explicitly deallocate. This is indicated in the individual <jvmti/> 961 function descriptions. Empty lists, arrays, sequences, etc are 962 returned as <code>NULL</code>. 963 <p/> 964 In the event that the <jvmti/> function encounters 965 an error (any return value other than <code>JVMTI_ERROR_NONE</code>) the values 966 of memory referenced by argument pointers is undefined, but no memory 967 will have been allocated and no global references will have been allocated. 968 If the error occurs because of invalid input, no action will have occurred. 969 </intro> 970 971 <intro id="refs" label="Managing JNI Object References"> 972 <jvmti/> functions identify objects with JNI references 973 (<datalink id="jobject"/> and <datalink id="jclass"/>) 974 and their derivatives 975 (<datalink id="jthread"/> and <datalink id="jthreadGroup"/>). 976 References passed to 977 <jvmti/> functions can be either global or local, but they must be 978 strong references. All references returned by <jvmti/> functions are 979 local references--these local references are created 980 during the <jvmti/> call. 981 Local references are a resource that must be managed (see the 982 <externallink id="http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/functions.html#wp18654">JNI Documentation</externallink>). 983 When threads return from native code all local references 984 are freed. Note that some threads, including typical 985 agent threads, will never return from native code. 986 A thread is ensured the ability to create sixteen local 987 references without the need for any explicit management. 988 For threads executing a limited number of <jvmti/> calls before 989 returning from native code 990 (for example, threads processing events), 991 it may be determined that no explicit management 992 is needed. 993 However, long running agent threads will need explicit 994 local reference management--usually with the JNI functions 995 <code>PushLocalFrame</code> and <code>PopLocalFrame</code>. 996 Conversely, to preserve references beyond the 997 return from native code, they must be converted to global references. 998 These rules do not apply to <datalink id="jmethodID"/> and <datalink id="jfieldID"/> 999 as they are not <datalink id="jobject"/>s. 1000 </intro> 1001 1002 <intro id="prereqState" label="Prerequisite State for Calling Functions"> 1003 Unless the function explicitly states that the agent must bring 1004 a thread or the VM to a particular state (for example, suspended), 1005 the <jvmti/> implementation is responsible for bringing the VM to a 1006 safe and consistent state for performing the function. 1007 </intro> 1008 1009 <intro id="functionsExceptions" label="Exceptions and Functions"> 1010 <jvmti/> functions never throw exceptions; error conditions are 1011 communicated via the 1012 <internallink id="functionReturn">function return value</internallink>. 1013 Any existing exception state is preserved across a call to a 1014 <jvmti/> function. 1015 See the 1016 <externallink 1017 id="http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/design.html#wp770" 1018 >Java Exceptions</externallink> 1019 section of the JNI specification for information on handling exceptions. 1020 </intro> 1021 1022 <category id="memory" label="Memory Management"> 1023 <intro> 1024 These functions provide for the allocation and deallocation of 1025 memory used by <jvmti/> functionality and can be used to provide 1026 working memory for agents. 1027 Memory managed by <jvmti/> is not compatible with other memory 1028 allocation libraries and mechanisms. 1029 </intro> 1030 1031 <function id="Allocate" jkernel="yes" phase="any" callbacksafe="safe" impl="notrace" num="46"> 1032 <synopsis>Allocate</synopsis> 1033 <description> 1034 Allocate an area of memory through the <jvmti/> allocator. 1035 The allocated 1036 memory should be freed with <functionlink id="Deallocate"></functionlink>. 1037 </description> 1038 <origin>jvmdi</origin> 1039 <capabilities> 1040 </capabilities> 1041 <parameters> 1042 <param id="size"> 1043 <jlong/> 1044 <description> 1045 The number of bytes to allocate. 1046 <rationale> 1047 <code>jlong</code> is used for compatibility with JVMDI. 1048 </rationale> 1049 </description> 1050 </param> 1051 <param id="mem_ptr"> 1052 <allocbuf incount="size"><uchar/></allocbuf> 1053 <description> 1054 On return, a pointer to the beginning of the allocated memory. 1055 If <code>size</code> is zero, <code>NULL</code> is returned. 1056 </description> 1057 </param> 1058 </parameters> 1059 <errors> 1060 <error id="JVMTI_ERROR_OUT_OF_MEMORY"> 1061 Memory request cannot be honored. 1062 </error> 1063 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 1064 <paramlink id="size"></paramlink> is less than zero. 1065 </error> 1066 </errors> 1067 </function> 1068 1069 <function id="Deallocate" jkernel="yes" phase="any" callbacksafe="safe" impl="notrace" num="47"> 1070 <synopsis>Deallocate</synopsis> 1071 <description> 1072 Deallocate <code>mem</code> using the <jvmti/> allocator. 1073 This function should 1074 be used to deallocate any memory allocated and returned 1075 by a <jvmti/> function 1076 (including memory allocated with <functionlink id="Allocate"></functionlink>). 1077 All allocated memory must be deallocated 1078 or the memory cannot be reclaimed. 1079 </description> 1080 <origin>jvmdi</origin> 1081 <capabilities> 1082 </capabilities> 1083 <parameters> 1084 <param id="mem"> 1085 <outbuf> 1086 <uchar/> 1087 <nullok>the call is ignored</nullok> 1088 </outbuf> 1089 <description> 1090 A pointer to the beginning of the allocated memory. 1091 Please ignore "On return, the elements are set." 1092 <todo>keep it from generating "On return, the elements are set"</todo> 1093 </description> 1094 </param> 1095 </parameters> 1096 <errors> 1097 </errors> 1098 </function> 1099 </category> 1100 1101 <category id="threadCategory" label="Thread"> 1102 <intro> 1103 </intro> 1104 1105 <function id="GetThreadState" num="17"> 1106 <synopsis>Get Thread State</synopsis> 1107 <description> 1108 Get the state of a thread. The state of the thread is represented by the 1109 answers to the hierarchical set of questions below: 1110 <ul type="circle"> 1111 <li><i>Alive?</i> 1112 <ul> 1113 <li>Not alive. 1114 <ul type="circle"> 1115 <li><i>Why not alive?</i> 1116 <ul> 1117 <li>New.</li> 1118 <li>Terminated (<datalink 1119 id="JVMTI_THREAD_STATE_TERMINATED"><code>JVMTI_THREAD_STATE_TERMINATED</code></datalink>)</li> 1120 </ul> 1121 </li> 1122 </ul> 1123 </li> 1124 <li>Alive (<datalink 1125 id="JVMTI_THREAD_STATE_ALIVE"><code>JVMTI_THREAD_STATE_ALIVE</code></datalink>) 1126 <ul type="circle"> 1127 <li><i>Suspended?</i> 1128 <ul> 1129 <li>Suspended (<datalink 1130 id="JVMTI_THREAD_STATE_SUSPENDED"><code>JVMTI_THREAD_STATE_SUSPENDED</code></datalink>)</li> 1131 <li>Not suspended</li> 1132 </ul> 1133 </li> 1134 <li><i>Interrupted?</i> 1135 <ul> 1136 <li>Interrupted (<datalink 1137 id="JVMTI_THREAD_STATE_INTERRUPTED"><code>JVMTI_THREAD_STATE_INTERRUPTED</code></datalink>)</li> 1138 <li>Not interrupted.</li> 1139 </ul> 1140 </li> 1141 <li><i>In native?</i> 1142 <ul> 1143 <li>In native code (<datalink 1144 id="JVMTI_THREAD_STATE_IN_NATIVE"><code>JVMTI_THREAD_STATE_IN_NATIVE</code></datalink>)</li> 1145 <li>In Java programming language code</li> 1146 </ul> 1147 </li> 1148 <li><i>What alive state?</i> 1149 <ul> 1150 <li>Runnable (<datalink 1151 id="JVMTI_THREAD_STATE_RUNNABLE"><code>JVMTI_THREAD_STATE_RUNNABLE</code></datalink>)</li> 1152 <li>Blocked (<datalink 1153 id="JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER"><code>JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER</code></datalink>)</li> 1154 <li>Waiting (<datalink 1155 id="JVMTI_THREAD_STATE_WAITING"><code>JVMTI_THREAD_STATE_WAITING</code></datalink>) 1156 <ul type="circle"> 1157 <li><i>Timed wait?</i> 1158 <ul> 1159 <li>Indefinite (<datalink 1160 id="JVMTI_THREAD_STATE_WAITING_INDEFINITELY"><code>JVMTI_THREAD_STATE_WAITING_INDEFINITELY</code></datalink></li> 1161 <li>Timed (<datalink 1162 id="JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT"><code>JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT</code></datalink>)</li> 1163 </ul> 1164 </li> 1165 <li><i>Why waiting?</i> 1166 <ul> 1167 <li>Object.wait (<datalink 1168 id="JVMTI_THREAD_STATE_IN_OBJECT_WAIT"><code>JVMTI_THREAD_STATE_IN_OBJECT_WAIT</code></datalink>)</li> 1169 <li>LockSupport.park (<datalink 1170 id="JVMTI_THREAD_STATE_PARKED"><code>JVMTI_THREAD_STATE_PARKED</code></datalink>)</li> 1171 <li>Sleeping (<datalink 1172 id="JVMTI_THREAD_STATE_SLEEPING"><code>JVMTI_THREAD_STATE_SLEEPING</code></datalink>)</li> 1173 </ul> 1174 </li> 1175 </ul> 1176 </li> 1177 </ul> 1178 </li> 1179 </ul> 1180 </li> 1181 </ul> 1182 </li> 1183 </ul> 1184 <p/> 1185 The answers are represented by the following bit vector. 1186 <constants id="jvmtiThreadState" label="Thread State Flags" kind="bits"> 1187 <constant id="JVMTI_THREAD_STATE_ALIVE" num="0x0001"> 1188 Thread is alive. Zero if thread is new (not started) or terminated. 1189 </constant> 1190 <constant id="JVMTI_THREAD_STATE_TERMINATED" num="0x0002"> 1191 Thread has completed execution. 1192 </constant> 1193 <constant id="JVMTI_THREAD_STATE_RUNNABLE" num="0x0004"> 1194 Thread is runnable. 1195 </constant> 1196 <constant id="JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER" num="0x0400"> 1197 Thread is waiting to enter a synchronization block/method or, 1198 after an <code>Object.wait()</code>, waiting to re-enter a 1199 synchronization block/method. 1200 </constant> 1201 <constant id="JVMTI_THREAD_STATE_WAITING" num="0x0080"> 1202 Thread is waiting. 1203 </constant> 1204 <constant id="JVMTI_THREAD_STATE_WAITING_INDEFINITELY" num="0x0010"> 1205 Thread is waiting without a timeout. 1206 For example, <code>Object.wait()</code>. 1207 </constant> 1208 <constant id="JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT" num="0x0020"> 1209 Thread is waiting with a maximum time to wait specified. 1210 For example, <code>Object.wait(long)</code>. 1211 </constant> 1212 <constant id="JVMTI_THREAD_STATE_SLEEPING" num="0x0040"> 1213 Thread is sleeping -- <code>Thread.sleep(long)</code>. 1214 </constant> 1215 <constant id="JVMTI_THREAD_STATE_IN_OBJECT_WAIT" num="0x0100"> 1216 Thread is waiting on an object monitor -- <code>Object.wait</code>. 1217 </constant> 1218 <constant id="JVMTI_THREAD_STATE_PARKED" num="0x0200"> 1219 Thread is parked, for example: <code>LockSupport.park</code>, 1220 <code>LockSupport.parkUtil</code> and <code>LockSupport.parkNanos</code>. 1221 </constant> 1222 <constant id="JVMTI_THREAD_STATE_SUSPENDED" num="0x100000"> 1223 Thread suspended. 1224 <code>java.lang.Thread.suspend()</code> 1225 or a <jvmti/> suspend function 1226 (such as <functionlink id="SuspendThread"></functionlink>) 1227 has been called on the thread. If this bit 1228 is set, the other bits refer to the thread state before suspension. 1229 </constant> 1230 <constant id="JVMTI_THREAD_STATE_INTERRUPTED" num="0x200000"> 1231 Thread has been interrupted. 1232 </constant> 1233 <constant id="JVMTI_THREAD_STATE_IN_NATIVE" num="0x400000"> 1234 Thread is in native code--that is, a native method is running 1235 which has not called back into the VM or Java programming 1236 language code. 1237 <p/> 1238 This flag is not set when running VM compiled Java programming 1239 language code nor is it set when running VM code or 1240 VM support code. Native VM interface functions, such as JNI and 1241 <jvmti/> functions, may be implemented as VM code. 1242 </constant> 1243 <constant id="JVMTI_THREAD_STATE_VENDOR_1" num="0x10000000"> 1244 Defined by VM vendor. 1245 </constant> 1246 <constant id="JVMTI_THREAD_STATE_VENDOR_2" num="0x20000000"> 1247 Defined by VM vendor. 1248 </constant> 1249 <constant id="JVMTI_THREAD_STATE_VENDOR_3" num="0x40000000"> 1250 Defined by VM vendor. 1251 </constant> 1252 </constants> 1253 The following definitions are used to convert <jvmti/> thread state 1254 to <code>java.lang.Thread.State</code> style states. 1255 <constants id="jvmtiJavaLangThreadState" label="java.lang.Thread.State Conversion Masks" kind="bits"> 1256 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_MASK" 1257 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"> 1258 Mask the state with this before comparison 1259 </constant> 1260 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_NEW" 1261 num="0"> 1262 <code>java.lang.Thread.State.NEW</code> 1263 </constant> 1264 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_TERMINATED" 1265 num="JVMTI_THREAD_STATE_TERMINATED"> 1266 <code>java.lang.Thread.State.TERMINATED</code> 1267 </constant> 1268 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_RUNNABLE" 1269 num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_RUNNABLE"> 1270 <code>java.lang.Thread.State.RUNNABLE</code> 1271 </constant> 1272 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_BLOCKED" 1273 num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER"> 1274 <code>java.lang.Thread.State.BLOCKED</code> 1275 </constant> 1276 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_WAITING" 1277 num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_INDEFINITELY"> 1278 <code>java.lang.Thread.State.WAITING</code> 1279 </constant> 1280 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_TIMED_WAITING" 1281 num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT"> 1282 <code>java.lang.Thread.State.TIMED_WAITING</code> 1283 </constant> 1284 </constants> 1285 <b>Rules</b> 1286 <p/> 1287 There can be no more than one answer to a question, although there can be no 1288 answer (because the answer is unknown, does not apply, or none of the answers is 1289 correct). An answer is set only when the enclosing answers match. 1290 That is, no more than one of 1291 <ul type="circle"> 1292 <li><code>JVMTI_THREAD_STATE_RUNNABLE</code></li> 1293 <li><code>JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER</code></li> 1294 <li><code>JVMTI_THREAD_STATE_WAITING</code></li> 1295 </ul> 1296 can be set (a <tm>J2SE</tm> compliant implementation will always set 1297 one of these if <code>JVMTI_THREAD_STATE_ALIVE</code> is set). 1298 And if any of these are set, the enclosing answer 1299 <code>JVMTI_THREAD_STATE_ALIVE</code> is set. 1300 No more than one of 1301 <ul type="circle"> 1302 <li><code>JVMTI_THREAD_STATE_WAITING_INDEFINITELY</code></li> 1303 <li><code>JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT</code></li> 1304 </ul> 1305 can be set (a <tm>J2SE</tm> compliant implementation will always set 1306 one of these if <code>JVMTI_THREAD_STATE_WAITING</code> is set). 1307 And if either is set, the enclosing answers 1308 <code>JVMTI_THREAD_STATE_ALIVE</code> and 1309 <code>JVMTI_THREAD_STATE_WAITING</code> are set. 1310 No more than one of 1311 <ul type="circle"> 1312 <li><code>JVMTI_THREAD_STATE_IN_OBJECT_WAIT</code></li> 1313 <li><code>JVMTI_THREAD_STATE_PARKED</code></li> 1314 <li><code>JVMTI_THREAD_STATE_SLEEPING</code></li> 1315 </ul> 1316 can be set. And if any of these is set, the enclosing answers 1317 <code>JVMTI_THREAD_STATE_ALIVE</code> and 1318 <code>JVMTI_THREAD_STATE_WAITING</code> are set. 1319 Also, if <code>JVMTI_THREAD_STATE_SLEEPING</code> is set, 1320 then <code>JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT</code> is set. 1321 If a state <i>A</i> is implemented using the mechanism of 1322 state <i>B</i> then it is state <i>A</i> which 1323 is returned by this function. 1324 For example, if <code>Thread.sleep(long)</code> 1325 is implemented using <code>Object.wait(long)</code> 1326 then it is still <code>JVMTI_THREAD_STATE_SLEEPING</code> 1327 which is returned. 1328 More than one of 1329 <ul type="circle"> 1330 <li><code>JVMTI_THREAD_STATE_SUSPENDED</code></li> 1331 <li><code>JVMTI_THREAD_STATE_INTERRUPTED</code></li> 1332 <li><code>JVMTI_THREAD_STATE_IN_NATIVE</code></li> 1333 </ul> 1334 can be set, but if any is set, 1335 <code>JVMTI_THREAD_STATE_ALIVE</code> is set. 1336 <p/> 1337 And finally, 1338 <code>JVMTI_THREAD_STATE_TERMINATED</code> cannot be set unless 1339 <code>JVMTI_THREAD_STATE_ALIVE</code> is not set. 1340 <p/> 1341 The thread state representation is designed for extension in future versions 1342 of the specification; thread state values should be used accordingly, that is 1343 they should not be used as ordinals. 1344 Most queries can be made by testing a single bit, if use in a switch statement is desired, 1345 the state bits should be masked with the interesting bits. 1346 All bits not defined above are reserved for future use. 1347 A VM, compliant to the current specification, must set reserved bits to zero. 1348 An agent should ignore reserved bits -- 1349 they should not be assumed to be zero and thus should not be included in comparisons. 1350 <p/> 1351 <b>Examples</b> 1352 <p/> 1353 Note that the values below exclude reserved and vendor bits. 1354 <p/> 1355 The state of a thread blocked at a <code>synchronized</code>-statement would be: 1356 <example> 1357 JVMTI_THREAD_STATE_ALIVE + JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER 1358 </example> 1359 The state of a thread which hasn't started yet would be: 1360 <example> 1361 0 1362 </example> 1363 The state of a thread at a <code>Object.wait(3000)</code> would be: 1364 <example> 1365 JVMTI_THREAD_STATE_ALIVE + JVMTI_THREAD_STATE_WAITING + 1366 JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT + 1367 JVMTI_THREAD_STATE_MONITOR_WAITING 1368 </example> 1369 The state of a thread suspended while runnable would be: 1370 <example> 1371 JVMTI_THREAD_STATE_ALIVE + JVMTI_THREAD_STATE_RUNNABLE + JVMTI_THREAD_STATE_SUSPENDED 1372 </example> 1373 <p/> 1374 <b>Testing the State</b> 1375 <p/> 1376 In most cases, the thread state can be determined by testing the one bit corresponding 1377 to that question. For example, the code to test if a thread is sleeping: 1378 <example> 1379 jint state; 1380 jvmtiError err; 1381 1382 err = (*jvmti)->GetThreadState(jvmti, thread, &state); 1383 if (err == JVMTI_ERROR_NONE) { 1384 if (state & JVMTI_THREAD_STATE_SLEEPING) { ... 1385 </example> 1386 <p/> 1387 For waiting (that is, in <code>Object.wait</code>, parked, or sleeping) it would be: 1388 <example> 1389 if (state & JVMTI_THREAD_STATE_WAITING) { ... 1390 </example> 1391 For some states, more than one bit will need to be tested as is the case 1392 when testing if a thread has not yet been started: 1393 <example> 1394 if ((state & (JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_TERMINATED)) == 0) { ... 1395 </example> 1396 To distinguish timed from untimed <code>Object.wait</code>: 1397 <example> 1398 if (state & JVMTI_THREAD_STATE_IN_OBJECT_WAIT) { 1399 if (state & JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT) { 1400 printf("in Object.wait(long timeout)\n"); 1401 } else { 1402 printf("in Object.wait()\n"); 1403 } 1404 } 1405 </example> 1406 <p/> 1407 <b>Relationship to <code>java.lang.Thread.State</code></b> 1408 <p/> 1409 The thread state represented by <code>java.lang.Thread.State</code> 1410 returned from <code>java.lang.Thread.getState()</code> is a subset of the 1411 information returned from this function. 1412 The corresponding <code>java.lang.Thread.State</code> can be determined 1413 by using the provided conversion masks. 1414 For example, this returns the name of the <code>java.lang.Thread.State</code> thread state: 1415 <example> 1416 err = (*jvmti)->GetThreadState(jvmti, thread, &state); 1417 abortOnError(err); 1418 switch (state & JVMTI_JAVA_LANG_THREAD_STATE_MASK) { 1419 case JVMTI_JAVA_LANG_THREAD_STATE_NEW: 1420 return "NEW"; 1421 case JVMTI_JAVA_LANG_THREAD_STATE_TERMINATED: 1422 return "TERMINATED"; 1423 case JVMTI_JAVA_LANG_THREAD_STATE_RUNNABLE: 1424 return "RUNNABLE"; 1425 case JVMTI_JAVA_LANG_THREAD_STATE_BLOCKED: 1426 return "BLOCKED"; 1427 case JVMTI_JAVA_LANG_THREAD_STATE_WAITING: 1428 return "WAITING"; 1429 case JVMTI_JAVA_LANG_THREAD_STATE_TIMED_WAITING: 1430 return "TIMED_WAITING"; 1431 } 1432 </example> 1433 </description> 1434 <origin>new</origin> 1435 <capabilities> 1436 </capabilities> 1437 <parameters> 1438 <param id="thread"> 1439 <jthread null="current" started="maybe" impl="noconvert"/> 1440 <description> 1441 The thread to query. 1442 </description> 1443 </param> 1444 <param id="thread_state_ptr"> 1445 <outptr><jint/></outptr> 1446 <description> 1447 On return, points to state flags, 1448 as defined by the <internallink id="jvmtiThreadState">Thread State Flags</internallink>. 1449 </description> 1450 </param> 1451 </parameters> 1452 <errors> 1453 </errors> 1454 </function> 1455 1456 <function id="GetCurrentThread" phase="start" num="18" since="1.1"> 1457 <synopsis>Get Current Thread</synopsis> 1458 <description> 1459 Get the current thread. 1460 The current thread is the Java programming language thread which has called the function. 1461 <p/> 1462 Note that most <jvmti/> functions that take a thread 1463 as an argument will accept <code>NULL</code> to mean 1464 the current thread. 1465 </description> 1466 <origin>new</origin> 1467 <capabilities> 1468 </capabilities> 1469 <parameters> 1470 <param id="thread_ptr"> 1471 <outptr><jthread/></outptr> 1472 <description> 1473 On return, points to the current thread. 1474 </description> 1475 </param> 1476 </parameters> 1477 <errors> 1478 </errors> 1479 </function> 1480 1481 <function id="GetAllThreads" num="4"> 1482 <synopsis>Get All Threads</synopsis> 1483 <description> 1484 Get all live threads. 1485 The threads are Java programming language threads; 1486 that is, threads that are attached to the VM. 1487 A thread is live if <code>java.lang.Thread.isAlive()</code> 1488 would return <code>true</code>, that is, the thread has 1489 been started and has not yet died. 1490 The universe of threads is determined by the context of the <jvmti/> 1491 environment, which typically is all threads attached to the VM. 1492 Note that this includes <jvmti/> agent threads 1493 (see <functionlink id="RunAgentThread"/>). 1494 </description> 1495 <origin>jvmdi</origin> 1496 <capabilities> 1497 </capabilities> 1498 <parameters> 1499 <param id="threads_count_ptr"> 1500 <outptr><jint/></outptr> 1501 <description> 1502 On return, points to the number of running threads. 1503 </description> 1504 </param> 1505 <param id="threads_ptr"> 1506 <allocbuf outcount="threads_count_ptr"><jthread/></allocbuf> 1507 <description> 1508 On return, points to an array of references, one 1509 for each running thread. 1510 </description> 1511 </param> 1512 </parameters> 1513 <errors> 1514 </errors> 1515 </function> 1516 1517 <function id="SuspendThread" num="5"> 1518 <synopsis>Suspend Thread</synopsis> 1519 <description> 1520 Suspend the specified thread. If the calling thread is specified, 1521 this function will not return until some other thread calls 1522 <functionlink id="ResumeThread"></functionlink>. 1523 If the thread is currently suspended, this function 1524 does nothing and returns an error. 1525 </description> 1526 <origin>jvmdi</origin> 1527 <capabilities> 1528 <required id="can_suspend"></required> 1529 </capabilities> 1530 <parameters> 1531 <param id="thread"> 1532 <jthread null="current"/> 1533 <description> 1534 The thread to suspend. 1535 </description> 1536 </param> 1537 </parameters> 1538 <errors> 1539 <error id="JVMTI_ERROR_THREAD_SUSPENDED"> 1540 Thread already suspended. 1541 </error> 1542 </errors> 1543 </function> 1544 1545 <elide> 1546 <function id="SuspendAllThreads" num="101"> 1547 <synopsis>Suspend All Threads</synopsis> 1548 <description> 1549 <issue> 1550 There has been no explicit call for this function, and it will 1551 thus be removed if there is no interest. 1552 </issue> 1553 Suspend all live threads except: 1554 <ul> 1555 <li>already suspended threads</li> 1556 <li>those listed in <paramlink id="except_list"></paramlink></li> 1557 <li>certain system (non application) threads, as determined 1558 by the VM implementation</li> 1559 </ul> 1560 The threads are Java programming language threads; 1561 native threads which are not attached to the VM are not 1562 Java programming language threads. 1563 A thread is live if <code>java.lang.Thread.isAlive()</code> 1564 would return <code>true</code>, that is, the thread has 1565 been started and has not yet died. 1566 The universe of threads is determined 1567 by the context of the <jvmti/> 1568 environment, which, typically, is all threads attached to the VM, 1569 except critical VM internal threads and <jvmti/> agent threads 1570 (see <functionlink id="RunAgentThread"/>). 1571 <p/> 1572 If the calling thread is specified, 1573 all other threads are suspended first then the caller thread is suspended - 1574 this function will not return until some other thread calls 1575 <functionlink id="ResumeThread"></functionlink>. 1576 <p/> 1577 The list of actually 1578 suspended threads is returned in 1579 <paramlink id="suspended_list_ptr"></paramlink>. 1580 Suspension is as defined in <functionlink id="SuspendThread"></functionlink>. 1581 <functionlink id="ResumeThreadList"></functionlink> 1582 can be used to resume the suspended threads. 1583 </description> 1584 <origin>new</origin> 1585 <capabilities> 1586 <required id="can_suspend"></required> 1587 </capabilities> 1588 <parameters> 1589 <param id="except_count"> 1590 <jint min="0"/> 1591 <description> 1592 The number of threads in the list of threads not to be suspended. 1593 </description> 1594 </param> 1595 <param id="except_list"> 1596 <inbuf incount="except_count"> 1597 <jthread/> 1598 <nullok>not an error if <code>except_count == 0</code></nullok> 1599 </inbuf> 1600 <description> 1601 The list of threads not to be suspended. 1602 </description> 1603 </param> 1604 <param id="suspended_count_ptr"> 1605 <outptr><jint/></outptr> 1606 <description> 1607 On return, points to the number of threads suspended by this call. 1608 </description> 1609 </param> 1610 <param id="suspended_list_ptr"> 1611 <allocbuf outcount="suspended_count_ptr"><jthread/></allocbuf> 1612 <description> 1613 On return, points to an array of references, one 1614 for each thread suspended. 1615 </description> 1616 </param> 1617 </parameters> 1618 <errors> 1619 <error id="JVMTI_ERROR_INVALID_THREAD"> 1620 A thread in <paramlink id="except_list"></paramlink> was invalid. 1621 </error> 1622 <error id="JVMTI_ERROR_NULL_POINTER"> 1623 Both <paramlink id="except_list"></paramlink> was <code>NULL</code> 1624 and <paramlink id="except_count"></paramlink> was non-zero. 1625 </error> 1626 </errors> 1627 </function> 1628 </elide> 1629 1630 <function id="SuspendThreadList" num="92"> 1631 <synopsis>Suspend Thread List</synopsis> 1632 <description> 1633 Suspend the <paramlink id="request_count"></paramlink> 1634 threads specified in the 1635 <paramlink id="request_list"></paramlink> array. 1636 Threads may be resumed with 1637 <functionlink id="ResumeThreadList"></functionlink> or 1638 <functionlink id="ResumeThread"></functionlink>. 1639 If the calling thread is specified in the 1640 <paramlink id="request_list"></paramlink> array, this function will 1641 not return until some other thread resumes it. 1642 Errors encountered in the suspension of a thread 1643 are returned in the <paramlink id="results"></paramlink> 1644 array, <b>not</b> in the return value of this function. 1645 Threads that are currently suspended do not change state. 1646 </description> 1647 <origin>jvmdi</origin> 1648 <capabilities> 1649 <required id="can_suspend"></required> 1650 </capabilities> 1651 <parameters> 1652 <param id="request_count"> 1653 <jint min="0"/> 1654 <description> 1655 The number of threads to suspend. 1656 </description> 1657 </param> 1658 <param id="request_list"> 1659 <inbuf incount="request_count"><jthread/></inbuf> 1660 <description> 1661 The list of threads to suspend. 1662 </description> 1663 </param> 1664 <param id="results"> 1665 <outbuf incount="request_count"><enum>jvmtiError</enum></outbuf> 1666 <description> 1667 An agent supplied array of 1668 <paramlink id="request_count"></paramlink> elements. 1669 On return, filled with the error code for 1670 the suspend of the corresponding thread. 1671 The error code will be 1672 <errorlink id="JVMTI_ERROR_NONE"></errorlink> 1673 if the thread was suspended by this call. 1674 Possible error codes are those specified 1675 for <functionlink id="SuspendThread"></functionlink>. 1676 </description> 1677 </param> 1678 </parameters> 1679 <errors> 1680 </errors> 1681 </function> 1682 1683 <function id="ResumeThread" num="6"> 1684 <synopsis>Resume Thread</synopsis> 1685 <description> 1686 Resume a suspended thread. 1687 Any threads currently suspended through 1688 a <jvmti/> suspend function (eg. 1689 <functionlink id="SuspendThread"></functionlink>) 1690 or <code>java.lang.Thread.suspend()</code> 1691 will resume execution; 1692 all other threads are unaffected. 1693 </description> 1694 <origin>jvmdi</origin> 1695 <capabilities> 1696 <required id="can_suspend"></required> 1697 </capabilities> 1698 <parameters> 1699 <param id="thread"> 1700 <jthread/> 1701 <description> 1702 The thread to resume. 1703 </description> 1704 </param> 1705 </parameters> 1706 <errors> 1707 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 1708 Thread was not suspended. 1709 </error> 1710 <error id="JVMTI_ERROR_INVALID_TYPESTATE"> 1711 The state of the thread has been modified, and is now inconsistent. 1712 </error> 1713 </errors> 1714 </function> 1715 1716 <function id="ResumeThreadList" num="93"> 1717 <synopsis>Resume Thread List</synopsis> 1718 <description> 1719 Resume the <paramlink id="request_count"></paramlink> 1720 threads specified in the 1721 <paramlink id="request_list"></paramlink> array. 1722 Any thread suspended through 1723 a <jvmti/> suspend function (eg. 1724 <functionlink id="SuspendThreadList"></functionlink>) 1725 or <code>java.lang.Thread.suspend()</code> 1726 will resume execution. 1727 </description> 1728 <origin>jvmdi</origin> 1729 <capabilities> 1730 <required id="can_suspend"></required> 1731 </capabilities> 1732 <parameters> 1733 <param id="request_count"> 1734 <jint min="0"/> 1735 <description> 1736 The number of threads to resume. 1737 </description> 1738 </param> 1739 <param id="request_list"> 1740 <inbuf incount="request_count"><jthread/></inbuf> 1741 <description> 1742 The threads to resume. 1743 </description> 1744 </param> 1745 <param id="results"> 1746 <outbuf incount="request_count"><enum>jvmtiError</enum></outbuf> 1747 <description> 1748 An agent supplied array of 1749 <paramlink id="request_count"></paramlink> elements. 1750 On return, filled with the error code for 1751 the resume of the corresponding thread. 1752 The error code will be 1753 <errorlink id="JVMTI_ERROR_NONE"></errorlink> 1754 if the thread was suspended by this call. 1755 Possible error codes are those specified 1756 for <functionlink id="ResumeThread"></functionlink>. 1757 </description> 1758 </param> 1759 </parameters> 1760 <errors> 1761 </errors> 1762 </function> 1763 1764 <function id="StopThread" num="7"> 1765 <synopsis>Stop Thread</synopsis> 1766 <description> 1767 Send the specified asynchronous exception to the specified thread 1768 (similar to <code>java.lang.Thread.stop</code>). 1769 Normally, this function is used to kill the specified thread with an 1770 instance of the exception <code>ThreadDeath</code>. 1771 </description> 1772 <origin>jvmdi</origin> 1773 <capabilities> 1774 <required id="can_signal_thread"></required> 1775 </capabilities> 1776 <parameters> 1777 <param id="thread"> 1778 <jthread/> 1779 <description> 1780 The thread to stop. 1781 </description> 1782 </param> 1783 <param id="exception"> 1784 <jobject/> 1785 <description> 1786 The asynchronous exception object. 1787 </description> 1788 </param> 1789 </parameters> 1790 <errors> 1791 </errors> 1792 </function> 1793 1794 <function id="InterruptThread" num="8"> 1795 <synopsis>Interrupt Thread</synopsis> 1796 <description> 1797 Interrupt the specified thread 1798 (similar to <code>java.lang.Thread.interrupt</code>). 1799 </description> 1800 <origin>jvmdi</origin> 1801 <capabilities> 1802 <required id="can_signal_thread"></required> 1803 </capabilities> 1804 <parameters> 1805 <param id="thread"> 1806 <jthread impl="noconvert"/> 1807 <description> 1808 The thread to interrupt. 1809 </description> 1810 </param> 1811 </parameters> 1812 <errors> 1813 </errors> 1814 </function> 1815 1816 <function id="GetThreadInfo" num="9"> 1817 <synopsis>Get Thread Info</synopsis> 1818 <typedef id="jvmtiThreadInfo" label="Thread information structure"> 1819 <field id="name"> 1820 <allocfieldbuf><char/></allocfieldbuf> 1821 <description> 1822 The thread name, encoded as a 1823 <internallink id="mUTF">modified UTF-8</internallink> string. 1824 </description> 1825 </field> 1826 <field id="priority"> 1827 <jint/> 1828 <description> 1829 The thread priority. See the thread priority constants: 1830 <datalink id="jvmtiThreadPriority"></datalink>. 1831 </description> 1832 </field> 1833 <field id="is_daemon"> 1834 <jboolean/> 1835 <description> 1836 Is this a daemon thread? 1837 </description> 1838 </field> 1839 <field id="thread_group"> 1840 <jthreadGroup/> 1841 <description> 1842 The thread group to which this thread belongs. 1843 <code>NULL</code> if the thread has died. 1844 </description> 1845 </field> 1846 <field id="context_class_loader"> 1847 <jobject/> 1848 <description> 1849 The context class loader associated with this thread. 1850 </description> 1851 </field> 1852 </typedef> 1853 <description> 1854 Get thread information. The fields of the <datalink id="jvmtiThreadInfo"/> structure 1855 are filled in with details of the specified thread. 1856 </description> 1857 <origin>jvmdi</origin> 1858 <capabilities> 1859 </capabilities> 1860 <parameters> 1861 <param id="thread"> 1862 <jthread null="current" impl="noconvert" started="maybe"/> 1863 <description> 1864 The thread to query. 1865 </description> 1866 </param> 1867 <param id="info_ptr"> 1868 <outptr><struct>jvmtiThreadInfo</struct></outptr> 1869 <description> 1870 On return, filled with information describing the specified thread. 1871 <p/> 1872 For JDK 1.1 implementations that don't 1873 recognize context class loaders, 1874 the <code>context_class_loader</code> field will be NULL. 1875 </description> 1876 </param> 1877 </parameters> 1878 <errors> 1879 </errors> 1880 </function> 1881 1882 <function id="GetOwnedMonitorInfo" num="10"> 1883 <synopsis>Get Owned Monitor Info</synopsis> 1884 <description> 1885 Get information about the monitors owned by the 1886 specified thread. 1887 </description> 1888 <origin>jvmdiClone</origin> 1889 <capabilities> 1890 <required id="can_get_owned_monitor_info"></required> 1891 </capabilities> 1892 <parameters> 1893 <param id="thread"> 1894 <jthread null="current"/> 1895 <description> 1896 The thread to query. 1897 </description> 1898 </param> 1899 <param id="owned_monitor_count_ptr"> 1900 <outptr><jint/></outptr> 1901 <description> 1902 The number of monitors returned. 1903 </description> 1904 </param> 1905 <param id="owned_monitors_ptr"> 1906 <allocbuf outcount="owned_monitor_count_ptr"><jobject/></allocbuf> 1907 <description> 1908 The array of owned monitors. 1909 </description> 1910 </param> 1911 </parameters> 1912 <errors> 1913 </errors> 1914 </function> 1915 1916 <function id="GetOwnedMonitorStackDepthInfo" num="153" since="1.1"> 1917 <synopsis>Get Owned Monitor Stack Depth Info</synopsis> 1918 <typedef id="jvmtiMonitorStackDepthInfo" 1919 label="Monitor stack depth information structure"> 1920 <field id="monitor"> 1921 <jobject/> 1922 <description> 1923 The owned monitor. 1924 </description> 1925 </field> 1926 <field id="stack_depth"> 1927 <jint/> 1928 <description> 1929 The stack depth. Corresponds to the stack depth used in the 1930 <internallink id="stack">Stack Frame functions</internallink>. 1931 That is, zero is the current frame, one is the frame which 1932 called the current frame. And it is negative one if the 1933 implementation cannot determine the stack depth (e.g., for 1934 monitors acquired by JNI <code>MonitorEnter</code>). 1935 </description> 1936 </field> 1937 </typedef> 1938 <description> 1939 Get information about the monitors owned by the 1940 specified thread and the depth of the stack frame which locked them. 1941 </description> 1942 <origin>new</origin> 1943 <capabilities> 1944 <required id="can_get_owned_monitor_stack_depth_info"></required> 1945 </capabilities> 1946 <parameters> 1947 <param id="thread"> 1948 <jthread null="current"/> 1949 <description> 1950 The thread to query. 1951 </description> 1952 </param> 1953 <param id="monitor_info_count_ptr"> 1954 <outptr><jint/></outptr> 1955 <description> 1956 The number of monitors returned. 1957 </description> 1958 </param> 1959 <param id="monitor_info_ptr"> 1960 <allocbuf outcount="monitor_info_count_ptr"> 1961 <struct>jvmtiMonitorStackDepthInfo</struct> 1962 </allocbuf> 1963 <description> 1964 The array of owned monitor depth information. 1965 </description> 1966 </param> 1967 </parameters> 1968 <errors> 1969 </errors> 1970 </function> 1971 1972 <function id="GetCurrentContendedMonitor" num="11"> 1973 <synopsis>Get Current Contended Monitor</synopsis> 1974 <description> 1975 Get the object, if any, whose monitor the specified thread is waiting to 1976 enter or waiting to regain through <code>java.lang.Object.wait</code>. 1977 </description> 1978 <origin>jvmdi</origin> 1979 <capabilities> 1980 <required id="can_get_current_contended_monitor"></required> 1981 </capabilities> 1982 <parameters> 1983 <param id="thread"> 1984 <jthread null="current"/> 1985 <description> 1986 The thread to query. 1987 </description> 1988 </param> 1989 <param id="monitor_ptr"> 1990 <outptr><jobject/></outptr> 1991 <description> 1992 On return, filled with the current contended monitor, or 1993 NULL if there is none. 1994 </description> 1995 </param> 1996 </parameters> 1997 <errors> 1998 </errors> 1999 </function> 2000 2001 <callback id="jvmtiStartFunction"> 2002 <void/> 2003 <synopsis>Agent Start Function</synopsis> 2004 <description> 2005 Agent supplied callback function. 2006 This function is the entry point for an agent thread 2007 started with 2008 <functionlink id="RunAgentThread"></functionlink>. 2009 </description> 2010 <parameters> 2011 <param id="jvmti_env"> 2012 <outptr> 2013 <struct>jvmtiEnv</struct> 2014 </outptr> 2015 <description> 2016 The <jvmti/> environment. 2017 </description> 2018 </param> 2019 <param id="jni_env"> 2020 <outptr> 2021 <struct>JNIEnv</struct> 2022 </outptr> 2023 <description> 2024 The JNI environment. 2025 </description> 2026 </param> 2027 <param id="arg"> 2028 <outptr> 2029 <void/> 2030 </outptr> 2031 <description> 2032 The <code>arg</code> parameter passed to 2033 <functionlink id="RunAgentThread"></functionlink>. 2034 </description> 2035 </param> 2036 </parameters> 2037 </callback> 2038 2039 <function id="RunAgentThread" num="12"> 2040 <synopsis>Run Agent Thread</synopsis> 2041 <description> 2042 Starts the execution of an agent thread. with the specified native function. 2043 The parameter <paramlink id="arg"></paramlink> is forwarded on to the 2044 <functionlink id="jvmtiStartFunction">start function</functionlink> 2045 (specified with <paramlink id="proc"></paramlink>) as its single argument. 2046 This function allows the creation of agent threads 2047 for handling communication with another process or for handling events 2048 without the need to load a special subclass of <code>java.lang.Thread</code> or 2049 implementer of <code>java.lang.Runnable</code>. 2050 Instead, the created thread can run entirely in native code. 2051 However, the created thread does require a newly created instance 2052 of <code>java.lang.Thread</code> (referenced by the argument <code>thread</code>) to 2053 which it will be associated. 2054 The thread object can be created with JNI calls. 2055 <p/> 2056 The following common thread priorities are provided for your convenience: 2057 <constants id="jvmtiThreadPriority" label="Thread Priority Constants" kind="const"> 2058 <constant id="JVMTI_THREAD_MIN_PRIORITY" num="1"> 2059 Minimum possible thread priority 2060 </constant> 2061 <constant id="JVMTI_THREAD_NORM_PRIORITY" num="5"> 2062 Normal thread priority 2063 </constant> 2064 <constant id="JVMTI_THREAD_MAX_PRIORITY" num="10"> 2065 Maximum possible thread priority 2066 </constant> 2067 </constants> 2068 <p/> 2069 The new thread is started as a daemon thread with the specified 2070 <paramlink id="priority"></paramlink>. 2071 If enabled, a <eventlink id="ThreadStart"/> event will be sent. 2072 <p/> 2073 Since the thread has been started, the thread will be live when this function 2074 returns, unless the thread has died immediately. 2075 <p/> 2076 The thread group of the thread is ignored -- specifically, the thread is not 2077 added to the thread group and the thread is not seen on queries of the thread 2078 group at either the Java programming language or <jvmti/> levels. 2079 <p/> 2080 The thread is not visible to Java programming language queries but is 2081 included in <jvmti/> queries (for example, 2082 <functionlink id="GetAllThreads"/> and 2083 <functionlink id="GetAllStackTraces"/>). 2084 <p/> 2085 Upon execution of <code>proc</code>, the new thread will be attached to the 2086 VM--see the JNI documentation on 2087 <externallink id="http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/invocation.html#wp1060" 2088 >Attaching to the VM</externallink>. 2089 </description> 2090 <origin>jvmdiClone</origin> 2091 <capabilities> 2092 </capabilities> 2093 <parameters> 2094 <param id="thread"> 2095 <jthread impl="noconvert" started="no"/> 2096 <description> 2097 The thread to run. 2098 </description> 2099 </param> 2100 <param id="proc"> 2101 <ptrtype> 2102 <struct>jvmtiStartFunction</struct> 2103 </ptrtype> 2104 <description> 2105 The start function. 2106 </description> 2107 </param> 2108 <param id="arg"> 2109 <inbuf> 2110 <void/> 2111 <nullok><code>NULL</code> is passed to the start function</nullok> 2112 </inbuf> 2113 <description> 2114 The argument to the start function. 2115 </description> 2116 </param> 2117 <param id="priority"> 2118 <jint/> 2119 <description> 2120 The priority of the started thread. Any thread 2121 priority allowed by <code>java.lang.Thread.setPriority</code> can be used including 2122 those in <datalink id="jvmtiThreadPriority"></datalink>. 2123 </description> 2124 </param> 2125 </parameters> 2126 <errors> 2127 <error id="JVMTI_ERROR_INVALID_PRIORITY"> 2128 <paramlink id="priority"/> is less than 2129 <datalink id="JVMTI_THREAD_MIN_PRIORITY"/> 2130 or greater than 2131 <datalink id="JVMTI_THREAD_MAX_PRIORITY"/> 2132 </error> 2133 </errors> 2134 </function> 2135 2136 <function id="SetThreadLocalStorage" jkernel="yes" impl="notrace" phase="start" num="103"> 2137 <synopsis>Set Thread Local Storage</synopsis> 2138 <description> 2139 The VM stores a pointer value associated with each environment-thread 2140 pair. This pointer value is called <i>thread-local storage</i>. 2141 This value is <code>NULL</code> unless set with this function. 2142 Agents can allocate memory in which they store thread specific 2143 information. By setting thread-local storage it can then be 2144 accessed with 2145 <functionlink id="GetThreadLocalStorage"></functionlink>. 2146 <p/> 2147 This function is called by the agent to set the value of the <jvmti/> 2148 thread-local storage. <jvmti/> supplies to the agent a pointer-size 2149 thread-local storage that can be used to record per-thread 2150 information. 2151 </description> 2152 <origin>jvmpi</origin> 2153 <capabilities> 2154 </capabilities> 2155 <parameters> 2156 <param id="thread"> 2157 <jthread null="current"/> 2158 <description> 2159 Store to this thread. 2160 </description> 2161 </param> 2162 <param id="data"> 2163 <inbuf> 2164 <void/> 2165 <nullok>value is set to <code>NULL</code></nullok> 2166 </inbuf> 2167 <description> 2168 The value to be entered into the thread-local storage. 2169 </description> 2170 </param> 2171 </parameters> 2172 <errors> 2173 </errors> 2174 </function> 2175 2176 <function id="GetThreadLocalStorage" jkernel="yes" impl="innative notrace" phase="start" num="102"> 2177 <synopsis>Get Thread Local Storage</synopsis> 2178 <description> 2179 Called by the agent to get the value of the <jvmti/> thread-local 2180 storage. 2181 </description> 2182 <origin>jvmpi</origin> 2183 <capabilities> 2184 </capabilities> 2185 <parameters> 2186 <param id="thread"> 2187 <jthread null="current" impl="noconvert"/> 2188 <description> 2189 Retrieve from this thread. 2190 </description> 2191 </param> 2192 <param id="data_ptr"> 2193 <agentbuf><void/></agentbuf> 2194 <description> 2195 Pointer through which the value of the thread local 2196 storage is returned. 2197 If thread-local storage has not been set with 2198 <functionlink id="SetThreadLocalStorage"></functionlink> the returned 2199 pointer is <code>NULL</code>. 2200 </description> 2201 </param> 2202 </parameters> 2203 <errors> 2204 </errors> 2205 </function> 2206 2207 </category> 2208 2209 <category id="thread_groups" label="Thread Group"> 2210 <intro> 2211 </intro> 2212 2213 <function id="GetTopThreadGroups" num="13"> 2214 <synopsis>Get Top Thread Groups</synopsis> 2215 <description> 2216 Return all top-level (parentless) thread groups in the VM. 2217 </description> 2218 <origin>jvmdi</origin> 2219 <capabilities> 2220 </capabilities> 2221 <parameters> 2222 <param id="group_count_ptr"> 2223 <outptr><jint/></outptr> 2224 <description> 2225 On return, points to the number of top-level thread groups. 2226 </description> 2227 </param> 2228 <param id="groups_ptr"> 2229 <allocbuf outcount="group_count_ptr"><jthreadGroup/></allocbuf> 2230 <description> 2231 On return, refers to a pointer to the top-level thread group array. 2232 </description> 2233 </param> 2234 </parameters> 2235 <errors> 2236 </errors> 2237 </function> 2238 2239 <function id="GetThreadGroupInfo" num="14"> 2240 <synopsis>Get Thread Group Info</synopsis> 2241 <typedef id="jvmtiThreadGroupInfo" label="Thread group information structure"> 2242 <field id="parent"> 2243 <jthreadGroup/> 2244 <description> 2245 The parent thread group. 2246 </description> 2247 </field> 2248 <field id="name"> 2249 <allocfieldbuf><char/></allocfieldbuf> 2250 <description> 2251 The thread group's name, encoded as a 2252 <internallink id="mUTF">modified UTF-8</internallink> string. 2253 </description> 2254 </field> 2255 <field id="max_priority"> 2256 <jint/> 2257 <description> 2258 The maximum priority for this thread group. 2259 </description> 2260 </field> 2261 <field id="is_daemon"> 2262 <jboolean/> 2263 <description> 2264 Is this a daemon thread group? 2265 </description> 2266 </field> 2267 </typedef> 2268 <description> 2269 Get information about the thread group. The fields of the 2270 <functionlink id="jvmtiThreadGroupInfo"></functionlink> structure 2271 are filled in with details of the specified thread group. 2272 </description> 2273 <origin>jvmdi</origin> 2274 <capabilities> 2275 </capabilities> 2276 <parameters> 2277 <param id="group"> 2278 <jthreadGroup/> 2279 <description> 2280 The thread group to query. 2281 </description> 2282 </param> 2283 <param id="info_ptr"> 2284 <outptr><struct>jvmtiThreadGroupInfo</struct></outptr> 2285 <description> 2286 On return, filled with information describing the specified 2287 thread group. 2288 </description> 2289 </param> 2290 </parameters> 2291 <errors> 2292 </errors> 2293 </function> 2294 2295 <function id="GetThreadGroupChildren" num="15"> 2296 <synopsis>Get Thread Group Children</synopsis> 2297 <description> 2298 Get the live threads and active subgroups in this thread group. 2299 </description> 2300 <origin>jvmdi</origin> 2301 <capabilities> 2302 </capabilities> 2303 <parameters> 2304 <param id="group"> 2305 <jthreadGroup/> 2306 <description> 2307 The group to query. 2308 </description> 2309 </param> 2310 <param id="thread_count_ptr"> 2311 <outptr><jint/></outptr> 2312 <description> 2313 On return, points to the number of live threads in this thread group. 2314 </description> 2315 </param> 2316 <param id="threads_ptr"> 2317 <allocbuf outcount="thread_count_ptr"><jthread/></allocbuf> 2318 <description> 2319 On return, points to an array of the live threads in this thread group. 2320 </description> 2321 </param> 2322 <param id="group_count_ptr"> 2323 <outptr><jint/></outptr> 2324 <description> 2325 On return, points to the number of active child thread groups 2326 </description> 2327 </param> 2328 <param id="groups_ptr"> 2329 <allocbuf outcount="group_count_ptr"><jthreadGroup/></allocbuf> 2330 <description> 2331 On return, points to an array of the active child thread groups. 2332 </description> 2333 </param> 2334 </parameters> 2335 <errors> 2336 </errors> 2337 </function> 2338 </category> 2339 2340 <category id="stack" label="Stack Frame"> 2341 <intro> 2342 These functions provide information about the stack of a thread. 2343 Stack frames are referenced by depth. 2344 The frame at depth zero is the current frame. 2345 <p/> 2346 Stack frames are as described in 2347 <vmspec chapter="3.6"/>, 2348 That is, they correspond to method 2349 invocations (including native methods) but do not correspond to platform native or 2350 VM internal frames. 2351 <p/> 2352 A <jvmti/> implementation may use method invocations to launch a thread and 2353 the corresponding frames may be included in the stack as presented by these functions -- 2354 that is, there may be frames shown 2355 deeper than <code>main()</code> and <code>run()</code>. 2356 However this presentation must be consistent across all <jvmti/> functionality which 2357 uses stack frames or stack depth. 2358 </intro> 2359 2360 <typedef id="jvmtiFrameInfo" label="Stack frame information structure"> 2361 <description> 2362 Information about a stack frame is returned in this structure. 2363 </description> 2364 <field id="method"> 2365 <jmethodID/> 2366 <description> 2367 The method executing in this frame. 2368 </description> 2369 </field> 2370 <field id="location"> 2371 <jlocation/> 2372 <description> 2373 The index of the instruction executing in this frame. 2374 <code>-1</code> if the frame is executing a native method. 2375 </description> 2376 </field> 2377 </typedef> 2378 2379 <typedef id="jvmtiStackInfo" label="Stack information structure"> 2380 <description> 2381 Information about a set of stack frames is returned in this structure. 2382 </description> 2383 <field id="thread"> 2384 <jthread/> 2385 <description> 2386 On return, the thread traced. 2387 </description> 2388 </field> 2389 <field id="state"> 2390 <jint/> 2391 <description> 2392 On return, the thread state. See <functionlink id="GetThreadState"></functionlink>. 2393 </description> 2394 </field> 2395 <field id="frame_buffer"> 2396 <outbuf incount="max_frame_count"> 2397 <struct>jvmtiFrameInfo</struct> 2398 </outbuf> 2399 <description> 2400 On return, this agent allocated buffer is filled 2401 with stack frame information. 2402 </description> 2403 </field> 2404 <field id="frame_count"> 2405 <jint/> 2406 <description> 2407 On return, the number of records filled into 2408 <code>frame_buffer</code>. 2409 This will be 2410 min(<code>max_frame_count</code>, <i>stackDepth</i>). 2411 </description> 2412 </field> 2413 </typedef> 2414 2415 <function id="GetStackTrace" num="104"> 2416 <synopsis>Get Stack Trace</synopsis> 2417 <description> 2418 Get information about the stack of a thread. 2419 If <paramlink id="max_frame_count"></paramlink> is less than the depth of the stack, 2420 the <paramlink id="max_frame_count"></paramlink> topmost frames are returned, 2421 otherwise the entire stack is returned. 2422 The topmost frames, those most recently invoked, are at the beginning of the returned buffer. 2423 <p/> 2424 The following example causes up to five of the topmost frames 2425 to be returned and (if there are any frames) the currently 2426 executing method name to be printed. 2427 <example> 2428 jvmtiFrameInfo frames[5]; 2429 jint count; 2430 jvmtiError err; 2431 2432 err = (*jvmti)->GetStackTrace(jvmti, aThread, 0, 5, 2433 frames, &count); 2434 if (err == JVMTI_ERROR_NONE && count >= 1) { 2435 char *methodName; 2436 err = (*jvmti)->GetMethodName(jvmti, frames[0].method, 2437 &methodName, NULL, NULL); 2438 if (err == JVMTI_ERROR_NONE) { 2439 printf("Executing method: %s", methodName); 2440 } 2441 } 2442 </example> 2443 <todo> 2444 check example code. 2445 </todo> 2446 <p/> 2447 The <paramlink id="thread"></paramlink> need not be suspended 2448 to call this function. 2449 <p/> 2450 The <functionlink id="GetLineNumberTable"></functionlink> 2451 function can be used to map locations to line numbers. Note that 2452 this mapping can be done lazily. 2453 </description> 2454 <origin>jvmpi</origin> 2455 <capabilities> 2456 </capabilities> 2457 <parameters> 2458 <param id="thread"> 2459 <jthread null="current"/> 2460 <description> 2461 Fetch the stack trace of this thread. 2462 </description> 2463 </param> 2464 <param id="start_depth"> 2465 <jint/> 2466 <description> 2467 Begin retrieving frames at this depth. 2468 If non-negative, count from the current frame, 2469 the first frame retrieved is at depth <code>start_depth</code>. 2470 For example, if zero, start from the current frame; if one, start from the 2471 caller of the current frame; if two, start from the caller of the 2472 caller of the current frame; and so on. 2473 If negative, count from below the oldest frame, 2474 the first frame retrieved is at depth <i>stackDepth</i><code> + start_depth</code>, 2475 where <i>stackDepth</i> is the count of frames on the stack. 2476 For example, if negative one, only the oldest frame is retrieved; 2477 if negative two, start from the frame called by the oldest frame. 2478 </description> 2479 </param> 2480 <param id="max_frame_count"> 2481 <jint min="0"/> 2482 <description> 2483 The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve. 2484 </description> 2485 </param> 2486 <param id="frame_buffer"> 2487 <outbuf incount="max_frame_count" outcount="count_ptr"> 2488 <struct>jvmtiFrameInfo</struct> 2489 </outbuf> 2490 <description> 2491 On return, this agent allocated buffer is filled 2492 with stack frame information. 2493 </description> 2494 </param> 2495 <param id="count_ptr"> 2496 <outptr><jint/></outptr> 2497 <description> 2498 On return, points to the number of records filled in. 2499 For non-negative <code>start_depth</code>, this will be 2500 min(<code>max_frame_count</code>, <i>stackDepth</i><code> - start_depth</code>). 2501 For negative <code>start_depth</code>, this will be 2502 min(<code>max_frame_count</code>, <code>-start_depth</code>). 2503 </description> 2504 </param> 2505 </parameters> 2506 <errors> 2507 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 2508 <paramlink id="start_depth"/> is positive and greater than or equal to <i>stackDepth</i>. 2509 Or <paramlink id="start_depth"/> is negative and less than <i>-stackDepth</i>. 2510 </error> 2511 </errors> 2512 </function> 2513 2514 2515 <function id="GetAllStackTraces" num="100"> 2516 <synopsis>Get All Stack Traces</synopsis> 2517 <description> 2518 Get information about the stacks of all live threads 2519 (including <internallink id="RunAgentThread">agent threads</internallink>). 2520 If <paramlink id="max_frame_count"/> is less than the depth of a stack, 2521 the <paramlink id="max_frame_count"/> topmost frames are returned for that thread, 2522 otherwise the entire stack is returned. 2523 The topmost frames, those most recently invoked, are at the beginning of the returned buffer. 2524 <p/> 2525 All stacks are collected simultaneously, that is, no changes will occur to the 2526 thread state or stacks between the sampling of one thread and the next. 2527 The threads need not be suspended. 2528 2529 <example> 2530 jvmtiStackInfo *stack_info; 2531 jint thread_count; 2532 int ti; 2533 jvmtiError err; 2534 2535 err = (*jvmti)->GetAllStackTraces(jvmti, MAX_FRAMES, &stack_info, &thread_count); 2536 if (err != JVMTI_ERROR_NONE) { 2537 ... 2538 } 2539 for (ti = 0; ti < thread_count; ++ti) { 2540 jvmtiStackInfo *infop = &stack_info[ti]; 2541 jthread thread = infop->thread; 2542 jint state = infop->state; 2543 jvmtiFrameInfo *frames = infop->frame_buffer; 2544 int fi; 2545 2546 myThreadAndStatePrinter(thread, state); 2547 for (fi = 0; fi < infop->frame_count; fi++) { 2548 myFramePrinter(frames[fi].method, frames[fi].location); 2549 } 2550 } 2551 /* this one Deallocate call frees all data allocated by GetAllStackTraces */ 2552 err = (*jvmti)->Deallocate(jvmti, stack_info); 2553 </example> 2554 <todo> 2555 check example code. 2556 </todo> 2557 2558 </description> 2559 <origin>new</origin> 2560 <capabilities> 2561 </capabilities> 2562 <parameters> 2563 <param id="max_frame_count"> 2564 <jint min="0"/> 2565 <description> 2566 The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve per thread. 2567 </description> 2568 </param> 2569 <param id="stack_info_ptr"> 2570 <allocbuf> 2571 <struct>jvmtiStackInfo</struct> 2572 </allocbuf> 2573 <description> 2574 On return, this buffer is filled 2575 with stack information for each thread. 2576 The number of <datalink id="jvmtiStackInfo"/> records is determined 2577 by <paramlink id="thread_count_ptr"/>. 2578 <p/> 2579 Note that this buffer is allocated to include the <datalink id="jvmtiFrameInfo"/> 2580 buffers pointed to by <datalink id="jvmtiStackInfo.frame_buffer"/>. 2581 These buffers must not be separately deallocated. 2582 </description> 2583 </param> 2584 <param id="thread_count_ptr"> 2585 <outptr><jint/></outptr> 2586 <description> 2587 The number of threads traced. 2588 </description> 2589 </param> 2590 </parameters> 2591 <errors> 2592 </errors> 2593 </function> 2594 2595 <function id="GetThreadListStackTraces" num="101"> 2596 <synopsis>Get Thread List Stack Traces</synopsis> 2597 <description> 2598 Get information about the stacks of the supplied threads. 2599 If <paramlink id="max_frame_count"/> is less than the depth of a stack, 2600 the <paramlink id="max_frame_count"/> topmost frames are returned for that thread, 2601 otherwise the entire stack is returned. 2602 The topmost frames, those most recently invoked, are at the beginning of the returned buffer. 2603 <p/> 2604 All stacks are collected simultaneously, that is, no changes will occur to the 2605 thread state or stacks between the sampling one thread and the next. 2606 The threads need not be suspended. 2607 <p/> 2608 If a thread has not yet started or terminates before the stack information is collected, 2609 a zero length stack (<datalink id="jvmtiStackInfo.frame_count"/> will be zero) 2610 will be returned and the thread <datalink id="jvmtiStackInfo.state"/> can be checked. 2611 <p/> 2612 See the example for the similar function 2613 <functionlink id="GetAllStackTraces"/>. 2614 </description> 2615 <origin>new</origin> 2616 <capabilities> 2617 </capabilities> 2618 <parameters> 2619 <param id="thread_count"> 2620 <jint min="0"/> 2621 <description> 2622 The number of threads to trace. 2623 </description> 2624 </param> 2625 <param id="thread_list"> 2626 <inbuf incount="thread_count"><jthread/></inbuf> 2627 <description> 2628 The list of threads to trace. 2629 </description> 2630 </param> 2631 <param id="max_frame_count"> 2632 <jint min="0"/> 2633 <description> 2634 The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve per thread. 2635 </description> 2636 </param> 2637 <param id="stack_info_ptr"> 2638 <allocbuf outcount="thread_count"> 2639 <struct>jvmtiStackInfo</struct> 2640 </allocbuf> 2641 <description> 2642 On return, this buffer is filled 2643 with stack information for each thread. 2644 The number of <datalink id="jvmtiStackInfo"/> records is determined 2645 by <paramlink id="thread_count"/>. 2646 <p/> 2647 Note that this buffer is allocated to include the <datalink id="jvmtiFrameInfo"/> 2648 buffers pointed to by <datalink id="jvmtiStackInfo.frame_buffer"/>. 2649 These buffers must not be separately deallocated. 2650 </description> 2651 </param> 2652 </parameters> 2653 <errors> 2654 <error id="JVMTI_ERROR_INVALID_THREAD"> 2655 An element in <paramlink id="thread_list"/> is not a thread object. 2656 </error> 2657 </errors> 2658 </function> 2659 2660 <elide> 2661 <function id="AsyncGetStackTrace" num="1000"> 2662 <synopsis>Get Stack Trace--Asynchronous</synopsis> 2663 <description> 2664 Get information about the entire stack of a thread (or a sub-section of it). 2665 This is the asynchronous version of <functionlink id="GetStackTrace"></functionlink> 2666 and is reentrant and safe to call 2667 from asynchronous signal handlers. 2668 The stack trace is returned only for the calling thread. 2669 <p/> 2670 The <functionlink id="GetLineNumberTable"></functionlink> 2671 function can be used to map locations to line numbers. Note that 2672 this mapping can be done lazily. 2673 </description> 2674 <origin>jvmpi</origin> 2675 <capabilities> 2676 <required id="can_get_async_stack_trace"></required> 2677 <capability id="can_show_JVM_spec_async_frames"> 2678 If <code>false</code>, 2679 <paramlink id="use_java_stack"></paramlink> 2680 must be <code>false</code>. 2681 </capability> 2682 </capabilities> 2683 <parameters> 2684 <param id="use_java_stack"> 2685 <jboolean/> 2686 <description> 2687 Return the stack showing <vmspec/> 2688 model of the stack; 2689 otherwise, show the internal representation of the stack with 2690 inlined and optimized methods missing. If the virtual machine 2691 is using the <i>Java Virtual Machine Specification</i> stack model 2692 internally, this flag is ignored. 2693 </description> 2694 </param> 2695 <param id="max_count"> 2696 <jint min="0"/> 2697 <description> 2698 The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve. 2699 Retrieve this many unless the stack depth is less than <code>max_count</code>. 2700 </description> 2701 </param> 2702 <param id="frame_buffer"> 2703 <outbuf incount="max_count" outcount="count_ptr"> 2704 <struct>jvmtiFrameInfo</struct> 2705 <nullok>this information is not returned</nullok> 2706 </outbuf> 2707 <description> 2708 The agent passes in a buffer 2709 large enough to hold <code>max_count</code> records of 2710 <datalink id="jvmtiFrameInfo"></datalink>. This buffer must be 2711 pre-allocated by the agent. 2712 </description> 2713 </param> 2714 <param id="count_ptr"> 2715 <outptr><jint/></outptr> 2716 <description> 2717 On return, points to the number of records filled in.. 2718 </description> 2719 </param> 2720 </parameters> 2721 <errors> 2722 <error id="JVMTI_ERROR_UNATTACHED_THREAD"> 2723 The thread being used to call this function is not attached 2724 to the virtual machine. Calls must be made from attached threads. 2725 </error> 2726 </errors> 2727 </function> 2728 </elide> 2729 2730 <function id="GetFrameCount" num="16"> 2731 <synopsis>Get Frame Count</synopsis> 2732 <description> 2733 Get the number of frames currently in the specified thread's call stack. 2734 <p/> 2735 If this function is called for a thread actively executing bytecodes (for example, 2736 not the current thread and not suspended), the information returned is transient. 2737 </description> 2738 <origin>jvmdi</origin> 2739 <capabilities> 2740 </capabilities> 2741 <parameters> 2742 <param id="thread"> 2743 <jthread null="current"/> 2744 <description> 2745 The thread to query. 2746 </description> 2747 </param> 2748 <param id="count_ptr"> 2749 <outptr><jint/></outptr> 2750 <description> 2751 On return, points to the number of frames in the call stack. 2752 </description> 2753 </param> 2754 </parameters> 2755 <errors> 2756 </errors> 2757 </function> 2758 2759 <function id="PopFrame" num="80"> 2760 <synopsis>Pop Frame</synopsis> 2761 <description> 2762 Pop the current frame of <code>thread</code>'s stack. 2763 Popping a frame takes you to the previous frame. 2764 When the thread is resumed, the execution 2765 state of the thread is reset to the state 2766 immediately before the called method was invoked. 2767 That is (using <vmspec/> terminology): 2768 <ul> 2769 <li>the current frame is discarded as the previous frame becomes the current one</li> 2770 <li>the operand stack is restored--the argument values are added back 2771 and if the invoke was not <code>invokestatic</code>, 2772 <code>objectref</code> is added back as well</li> 2773 <li>the Java virtual machine PC is restored to the opcode 2774 of the invoke instruction</li> 2775 </ul> 2776 Note however, that any changes to the arguments, which 2777 occurred in the called method, remain; 2778 when execution continues, the first instruction to 2779 execute will be the invoke. 2780 <p/> 2781 Between calling <code>PopFrame</code> and resuming the 2782 thread the state of the stack is undefined. 2783 To pop frames beyond the first, 2784 these three steps must be repeated: 2785 <ul> 2786 <li>suspend the thread via an event (step, breakpoint, ...)</li> 2787 <li>call <code>PopFrame</code></li> 2788 <li>resume the thread</li> 2789 </ul> 2790 <p/> 2791 A lock acquired by calling the called method 2792 (if it is a <code>synchronized</code> method) 2793 and locks acquired by entering <code>synchronized</code> 2794 blocks within the called method are released. 2795 Note: this does not apply to native locks or 2796 <code>java.util.concurrent.locks</code> locks. 2797 <p/> 2798 Finally blocks are not executed. 2799 <p/> 2800 Changes to global state are not addressed and thus remain changed. 2801 <p/> 2802 The specified thread must be suspended (which implies it cannot be the current thread). 2803 <p/> 2804 Both the called method and calling method must be non-native Java programming 2805 language methods. 2806 <p/> 2807 No <jvmti/> events are generated by this function. 2808 </description> 2809 <origin>jvmdi</origin> 2810 <capabilities> 2811 <required id="can_pop_frame"></required> 2812 </capabilities> 2813 <parameters> 2814 <param id="thread"> 2815 <jthread/> 2816 <description> 2817 The thread whose current frame is to be popped. 2818 </description> 2819 </param> 2820 </parameters> 2821 <errors> 2822 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 2823 Called or calling method is a native method. 2824 The implementation is unable to pop this frame. 2825 </error> 2826 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 2827 Thread was not suspended. 2828 </error> 2829 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 2830 There are less than two stack frames on the call stack. 2831 </error> 2832 </errors> 2833 </function> 2834 2835 <function id="GetFrameLocation" num="19"> 2836 <synopsis>Get Frame Location</synopsis> 2837 <description> 2838 <p/> 2839 For a Java programming language frame, return the location of the instruction 2840 currently executing. 2841 </description> 2842 <origin>jvmdiClone</origin> 2843 <capabilities> 2844 </capabilities> 2845 <parameters> 2846 <param id="thread"> 2847 <jthread null="current" frame="frame"/> 2848 <description> 2849 The thread of the frame to query. 2850 </description> 2851 </param> 2852 <param id="depth"> 2853 <jframeID thread="thread"/> 2854 <description> 2855 The depth of the frame to query. 2856 </description> 2857 </param> 2858 <param id="method_ptr"> 2859 <outptr><jmethodID/></outptr> 2860 <description> 2861 On return, points to the method for the current location. 2862 </description> 2863 </param> 2864 <param id="location_ptr"> 2865 <outptr><jlocation/></outptr> 2866 <description> 2867 On return, points to the index of the currently 2868 executing instruction. 2869 Is set to <code>-1</code> if the frame is executing 2870 a native method. 2871 </description> 2872 </param> 2873 </parameters> 2874 <errors> 2875 </errors> 2876 </function> 2877 2878 <function id="NotifyFramePop" num="20"> 2879 <synopsis>Notify Frame Pop</synopsis> 2880 <description> 2881 When the frame that is currently at <paramlink id="depth"></paramlink> 2882 is popped from the stack, generate a 2883 <eventlink id="FramePop"></eventlink> event. See the 2884 <eventlink id="FramePop"></eventlink> event for details. 2885 Only frames corresponding to non-native Java programming language 2886 methods can receive notification. 2887 <p/> 2888 The specified thread must either be the current thread 2889 or the thread must be suspended. 2890 </description> 2891 <origin>jvmdi</origin> 2892 <capabilities> 2893 <required id="can_generate_frame_pop_events"></required> 2894 </capabilities> 2895 <parameters> 2896 <param id="thread"> 2897 <jthread null="current" frame="depth"/> 2898 <description> 2899 The thread of the frame for which the frame pop event will be generated. 2900 </description> 2901 </param> 2902 <param id="depth"> 2903 <jframeID thread="thread"/> 2904 <description> 2905 The depth of the frame for which the frame pop event will be generated. 2906 </description> 2907 </param> 2908 </parameters> 2909 <errors> 2910 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 2911 The frame at <code>depth</code> is executing a 2912 native method. 2913 </error> 2914 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 2915 Thread was not suspended and was not the current thread. 2916 </error> 2917 </errors> 2918 </function> 2919 2920 </category> 2921 2922 <category id="ForceEarlyReturn" label="Force Early Return"> 2923 <intro> 2924 These functions allow an agent to force a method 2925 to return at any point during its execution. 2926 The method which will return early is referred to as the <i>called method</i>. 2927 The called method is the current method 2928 (as defined by 2929 <vmspec chapter="3.6"/>) 2930 for the specified thread at 2931 the time the function is called. 2932 <p/> 2933 The specified thread must be suspended or must be the current thread. 2934 The return occurs when execution of Java programming 2935 language code is resumed on this thread. 2936 Between calling one of these functions and resumption 2937 of thread execution, the state of the stack is undefined. 2938 <p/> 2939 No further instructions are executed in the called method. 2940 Specifically, finally blocks are not executed. 2941 Note: this can cause inconsistent states in the application. 2942 <p/> 2943 A lock acquired by calling the called method 2944 (if it is a <code>synchronized</code> method) 2945 and locks acquired by entering <code>synchronized</code> 2946 blocks within the called method are released. 2947 Note: this does not apply to native locks or 2948 <code>java.util.concurrent.locks</code> locks. 2949 <p/> 2950 Events, such as <eventlink id="MethodExit"></eventlink>, 2951 are generated as they would be in a normal return. 2952 <p/> 2953 The called method must be a non-native Java programming 2954 language method. 2955 Forcing return on a thread with only one frame on the 2956 stack causes the thread to exit when resumed. 2957 </intro> 2958 2959 <function id="ForceEarlyReturnObject" num="81" since="1.1"> 2960 <synopsis>Force Early Return - Object</synopsis> 2961 <description> 2962 This function can be used to return from a method whose 2963 result type is <code>Object</code> 2964 or a subclass of <code>Object</code>. 2965 </description> 2966 <origin>new</origin> 2967 <capabilities> 2968 <required id="can_force_early_return"></required> 2969 </capabilities> 2970 <parameters> 2971 <param id="thread"> 2972 <jthread null="current"/> 2973 <description> 2974 The thread whose current frame is to return early. 2975 </description> 2976 </param> 2977 <param id="value"> 2978 <jobject/> 2979 <description> 2980 The return value for the called frame. 2981 An object or <code>NULL</code>. 2982 </description> 2983 </param> 2984 </parameters> 2985 <errors> 2986 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 2987 Attempted to return early from a frame 2988 corresponding to a native method. 2989 Or the implementation is unable to provide 2990 this functionality on this frame. 2991 </error> 2992 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 2993 The result type of the called method is not 2994 <code>Object</code> or a subclass of <code>Object</code>. 2995 </error> 2996 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 2997 The supplied <paramlink id="value"/> is not compatible with the 2998 result type of the called method. 2999 </error> 3000 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3001 Thread was not the current thread and was not suspended. 3002 </error> 3003 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3004 There are no more frames on the call stack. 3005 </error> 3006 </errors> 3007 </function> 3008 3009 <function id="ForceEarlyReturnInt" num="82" since="1.1"> 3010 <synopsis>Force Early Return - Int</synopsis> 3011 <description> 3012 This function can be used to return from a method whose 3013 result type is <code>int</code>, <code>short</code>, 3014 <code>char</code>, <code>byte</code>, or 3015 <code>boolean</code>. 3016 </description> 3017 <origin>new</origin> 3018 <capabilities> 3019 <required id="can_force_early_return"></required> 3020 </capabilities> 3021 <parameters> 3022 <param id="thread"> 3023 <jthread null="current"/> 3024 <description> 3025 The thread whose current frame is to return early. 3026 </description> 3027 </param> 3028 <param id="value"> 3029 <jint/> 3030 <description> 3031 The return value for the called frame. 3032 </description> 3033 </param> 3034 </parameters> 3035 <errors> 3036 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3037 Attempted to return early from a frame 3038 corresponding to a native method. 3039 Or the implementation is unable to provide 3040 this functionality on this frame. 3041 </error> 3042 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3043 The result type of the called method is not 3044 <code>int</code>, <code>short</code>, 3045 <code>char</code>, <code>byte</code>, or 3046 <code>boolean</code>. 3047 </error> 3048 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3049 Thread was not the current thread and was not suspended. 3050 </error> 3051 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3052 There are no frames on the call stack. 3053 </error> 3054 </errors> 3055 </function> 3056 3057 <function id="ForceEarlyReturnLong" num="83" since="1.1"> 3058 <synopsis>Force Early Return - Long</synopsis> 3059 <description> 3060 This function can be used to return from a method whose 3061 result type is <code>long</code>. 3062 </description> 3063 <origin>new</origin> 3064 <capabilities> 3065 <required id="can_force_early_return"></required> 3066 </capabilities> 3067 <parameters> 3068 <param id="thread"> 3069 <jthread null="current"/> 3070 <description> 3071 The thread whose current frame is to return early. 3072 </description> 3073 </param> 3074 <param id="value"> 3075 <jlong/> 3076 <description> 3077 The return value for the called frame. 3078 </description> 3079 </param> 3080 </parameters> 3081 <errors> 3082 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3083 Attempted to return early from a frame 3084 corresponding to a native method. 3085 Or the implementation is unable to provide 3086 this functionality on this frame. 3087 </error> 3088 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3089 The result type of the called method is not <code>long</code>. 3090 </error> 3091 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3092 Thread was not the current thread and was not suspended. 3093 </error> 3094 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3095 There are no frames on the call stack. 3096 </error> 3097 </errors> 3098 </function> 3099 3100 <function id="ForceEarlyReturnFloat" num="84" since="1.1"> 3101 <synopsis>Force Early Return - Float</synopsis> 3102 <description> 3103 This function can be used to return from a method whose 3104 result type is <code>float</code>. 3105 </description> 3106 <origin>new</origin> 3107 <capabilities> 3108 <required id="can_force_early_return"></required> 3109 </capabilities> 3110 <parameters> 3111 <param id="thread"> 3112 <jthread null="current"/> 3113 <description> 3114 The thread whose current frame is to return early. 3115 </description> 3116 </param> 3117 <param id="value"> 3118 <jfloat/> 3119 <description> 3120 The return value for the called frame. 3121 </description> 3122 </param> 3123 </parameters> 3124 <errors> 3125 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3126 Attempted to return early from a frame 3127 corresponding to a native method. 3128 Or the implementation is unable to provide 3129 this functionality on this frame. 3130 </error> 3131 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3132 The result type of the called method is not <code>float</code>. 3133 </error> 3134 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3135 Thread was not the current thread and was not suspended. 3136 </error> 3137 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3138 There are no frames on the call stack. 3139 </error> 3140 </errors> 3141 </function> 3142 3143 <function id="ForceEarlyReturnDouble" num="85" since="1.1"> 3144 <synopsis>Force Early Return - Double</synopsis> 3145 <description> 3146 This function can be used to return from a method whose 3147 result type is <code>double</code>. 3148 </description> 3149 <origin>new</origin> 3150 <capabilities> 3151 <required id="can_force_early_return"></required> 3152 </capabilities> 3153 <parameters> 3154 <param id="thread"> 3155 <jthread null="current"/> 3156 <description> 3157 The thread whose current frame is to return early. 3158 </description> 3159 </param> 3160 <param id="value"> 3161 <jdouble/> 3162 <description> 3163 The return value for the called frame. 3164 </description> 3165 </param> 3166 </parameters> 3167 <errors> 3168 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3169 Attempted to return early from a frame corresponding to a native method. 3170 Or the implementation is unable to provide this functionality on this frame. 3171 </error> 3172 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3173 The result type of the called method is not <code>double</code>. 3174 </error> 3175 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3176 Thread was not the current thread and was not suspended. 3177 </error> 3178 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3179 There are no frames on the call stack. 3180 </error> 3181 </errors> 3182 </function> 3183 3184 <function id="ForceEarlyReturnVoid" num="86" since="1.1"> 3185 <synopsis>Force Early Return - Void</synopsis> 3186 <description> 3187 This function can be used to return from a method with no result type. 3188 That is, the called method must be declared <code>void</code>. 3189 </description> 3190 <origin>new</origin> 3191 <capabilities> 3192 <required id="can_force_early_return"></required> 3193 </capabilities> 3194 <parameters> 3195 <param id="thread"> 3196 <jthread null="current"/> 3197 <description> 3198 The thread whose current frame is to return early. 3199 </description> 3200 </param> 3201 </parameters> 3202 <errors> 3203 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3204 Attempted to return early from a frame 3205 corresponding to a native method. 3206 Or the implementation is unable to provide 3207 this functionality on this frame. 3208 </error> 3209 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3210 The called method has a result type. 3211 </error> 3212 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3213 Thread was not the current thread and was not suspended. 3214 </error> 3215 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3216 There are no frames on the call stack. 3217 </error> 3218 </errors> 3219 </function> 3220 3221 </category> 3222 3223 <category id="Heap" label="Heap"> 3224 <intro> 3225 These functions are used to analyze the heap. 3226 Functionality includes the ability to view the objects in the 3227 heap and to tag these objects. 3228 </intro> 3229 3230 <intro id="objectTags" label="Object Tags"> 3231 A <i>tag</i> is a value associated with an object. 3232 Tags are explicitly set by the agent using the 3233 <functionlink id="SetTag"></functionlink> function or by 3234 callback functions such as <functionlink id="jvmtiHeapIterationCallback"/>. 3235 <p/> 3236 Tags are local to the environment; that is, the tags of one 3237 environment are not visible in another. 3238 <p/> 3239 Tags are <code>jlong</code> values which can be used 3240 simply to mark an object or to store a pointer to more detailed 3241 information. Objects which have not been tagged have a 3242 tag of zero. 3243 Setting a tag to zero makes the object untagged. 3244 </intro> 3245 3246 <intro id="heapCallbacks" label="Heap Callback Functions"> 3247 Heap functions which iterate through the heap and recursively 3248 follow object references use agent supplied callback functions 3249 to deliver the information. 3250 <p/> 3251 These heap callback functions must adhere to the following restrictions -- 3252 These callbacks must not use JNI functions. 3253 These callbacks must not use <jvmti/> functions except 3254 <i>callback safe</i> functions which 3255 specifically allow such use (see the raw monitor, memory management, 3256 and environment local storage functions). 3257 <p/> 3258 An implementation may invoke a callback on an internal thread or 3259 the thread which called the iteration function. 3260 Heap callbacks are single threaded -- no more than one callback will 3261 be invoked at a time. 3262 <p/> 3263 The Heap Filter Flags can be used to prevent reporting 3264 based on the tag status of an object or its class. 3265 If no flags are set (the <code>jint</code> is zero), objects 3266 will not be filtered out. 3267 3268 <constants id="jvmtiHeapFilter" label="Heap Filter Flags" kind="bits"> 3269 <constant id="JVMTI_HEAP_FILTER_TAGGED" num="0x4"> 3270 Filter out tagged objects. Objects which are tagged are not included. 3271 </constant> 3272 <constant id="JVMTI_HEAP_FILTER_UNTAGGED" num="0x8"> 3273 Filter out untagged objects. Objects which are not tagged are not included. 3274 </constant> 3275 <constant id="JVMTI_HEAP_FILTER_CLASS_TAGGED" num="0x10"> 3276 Filter out objects with tagged classes. Objects whose class is tagged are not included. 3277 </constant> 3278 <constant id="JVMTI_HEAP_FILTER_CLASS_UNTAGGED" num="0x20"> 3279 Filter out objects with untagged classes. Objects whose class is not tagged are not included. 3280 </constant> 3281 </constants> 3282 3283 <p/> 3284 The Heap Visit Control Flags are returned by the heap callbacks 3285 and can be used to abort the iteration. For the 3286 <functionlink id="jvmtiHeapReferenceCallback">Heap 3287 Reference Callback</functionlink>, it can also be used 3288 to prune the graph of traversed references 3289 (<code>JVMTI_VISIT_OBJECTS</code> is not set). 3290 3291 <constants id="jvmtiHeapVisitControl" 3292 label="Heap Visit Control Flags" 3293 kind="bits" 3294 since="1.1"> 3295 <constant id="JVMTI_VISIT_OBJECTS" num="0x100"> 3296 If we are visiting an object and if this callback 3297 was initiated by <functionlink id="FollowReferences"/>, 3298 traverse the references of this object. 3299 Otherwise ignored. 3300 </constant> 3301 <constant id="JVMTI_VISIT_ABORT" num="0x8000"> 3302 Abort the iteration. Ignore all other bits. 3303 </constant> 3304 </constants> 3305 3306 <p/> 3307 The Heap Reference Enumeration is provided by the 3308 <functionlink id="jvmtiHeapReferenceCallback">Heap 3309 Reference Callback</functionlink> and 3310 <functionlink id="jvmtiPrimitiveFieldCallback">Primitive Field 3311 Callback</functionlink> to 3312 describe the kind of reference 3313 being reported. 3314 3315 <constants id="jvmtiHeapReferenceKind" 3316 label="Heap Reference Enumeration" 3317 kind="enum" 3318 since="1.1"> 3319 <constant id="JVMTI_HEAP_REFERENCE_CLASS" num="1"> 3320 Reference from an object to its class. 3321 </constant> 3322 <constant id="JVMTI_HEAP_REFERENCE_FIELD" num="2"> 3323 Reference from an object to the value of one of its instance fields. 3324 </constant> 3325 <constant id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT" num="3"> 3326 Reference from an array to one of its elements. 3327 </constant> 3328 <constant id="JVMTI_HEAP_REFERENCE_CLASS_LOADER" num="4"> 3329 Reference from a class to its class loader. 3330 </constant> 3331 <constant id="JVMTI_HEAP_REFERENCE_SIGNERS" num="5"> 3332 Reference from a class to its signers array. 3333 </constant> 3334 <constant id="JVMTI_HEAP_REFERENCE_PROTECTION_DOMAIN" num="6"> 3335 Reference from a class to its protection domain. 3336 </constant> 3337 <constant id="JVMTI_HEAP_REFERENCE_INTERFACE" num="7"> 3338 Reference from a class to one of its interfaces. 3339 Note: interfaces are defined via a constant pool reference, 3340 so the referenced interfaces may also be reported with a 3341 <code>JVMTI_HEAP_REFERENCE_CONSTANT_POOL</code> reference kind. 3342 </constant> 3343 <constant id="JVMTI_HEAP_REFERENCE_STATIC_FIELD" num="8"> 3344 Reference from a class to the value of one of its static fields. 3345 </constant> 3346 <constant id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL" num="9"> 3347 Reference from a class to a resolved entry in the constant pool. 3348 </constant> 3349 <constant id="JVMTI_HEAP_REFERENCE_SUPERCLASS" num="10"> 3350 Reference from a class to its superclass. 3351 A callback is bot sent if the superclass is <code>java.lang.Object</code>. 3352 Note: loaded classes define superclasses via a constant pool 3353 reference, so the referenced superclass may also be reported with 3354 a <code>JVMTI_HEAP_REFERENCE_CONSTANT_POOL</code> reference kind. 3355 </constant> 3356 <constant id="JVMTI_HEAP_REFERENCE_JNI_GLOBAL" num="21"> 3357 Heap root reference: JNI global reference. 3358 </constant> 3359 <constant id="JVMTI_HEAP_REFERENCE_SYSTEM_CLASS" num="22"> 3360 Heap root reference: System class. 3361 </constant> 3362 <constant id="JVMTI_HEAP_REFERENCE_MONITOR" num="23"> 3363 Heap root reference: monitor. 3364 </constant> 3365 <constant id="JVMTI_HEAP_REFERENCE_STACK_LOCAL" num="24"> 3366 Heap root reference: local variable on the stack. 3367 </constant> 3368 <constant id="JVMTI_HEAP_REFERENCE_JNI_LOCAL" num="25"> 3369 Heap root reference: JNI local reference. 3370 </constant> 3371 <constant id="JVMTI_HEAP_REFERENCE_THREAD" num="26"> 3372 Heap root reference: Thread. 3373 </constant> 3374 <constant id="JVMTI_HEAP_REFERENCE_OTHER" num="27"> 3375 Heap root reference: other heap root reference. 3376 </constant> 3377 </constants> 3378 3379 <p/> 3380 Definitions for the single character type descriptors of 3381 primitive types. 3382 3383 <constants id="jvmtiPrimitiveType" 3384 label="Primitive Type Enumeration" 3385 kind="enum" 3386 since="1.1"> 3387 <constant id="JVMTI_PRIMITIVE_TYPE_BOOLEAN" num="90"> 3388 'Z' - Java programming language <code>boolean</code> - JNI <code>jboolean</code> 3389 </constant> 3390 <constant id="JVMTI_PRIMITIVE_TYPE_BYTE" num="66"> 3391 'B' - Java programming language <code>byte</code> - JNI <code>jbyte</code> 3392 </constant> 3393 <constant id="JVMTI_PRIMITIVE_TYPE_CHAR" num="67"> 3394 'C' - Java programming language <code>char</code> - JNI <code>jchar</code> 3395 </constant> 3396 <constant id="JVMTI_PRIMITIVE_TYPE_SHORT" num="83"> 3397 'S' - Java programming language <code>short</code> - JNI <code>jshort</code> 3398 </constant> 3399 <constant id="JVMTI_PRIMITIVE_TYPE_INT" num="73"> 3400 'I' - Java programming language <code>int</code> - JNI <code>jint</code> 3401 </constant> 3402 <constant id="JVMTI_PRIMITIVE_TYPE_LONG" num="74"> 3403 'J' - Java programming language <code>long</code> - JNI <code>jlong</code> 3404 </constant> 3405 <constant id="JVMTI_PRIMITIVE_TYPE_FLOAT" num="70"> 3406 'F' - Java programming language <code>float</code> - JNI <code>jfloat</code> 3407 </constant> 3408 <constant id="JVMTI_PRIMITIVE_TYPE_DOUBLE" num="68"> 3409 'D' - Java programming language <code>double</code> - JNI <code>jdouble</code> 3410 </constant> 3411 </constants> 3412 </intro> 3413 3414 <typedef id="jvmtiHeapReferenceInfoField" 3415 label="Reference information structure for Field references" 3416 since="1.1"> 3417 <description> 3418 Reference information returned for 3419 <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/> and 3420 <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/> references. 3421 </description> 3422 <field id="index"> 3423 <jint/> 3424 <description> 3425 For <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/>, the 3426 referrer object is not a class or an inteface. 3427 In this case, <code>index</code> is the index of the field 3428 in the class of the referrer object. 3429 This class is referred to below as <i>C</i>. 3430 <p/> 3431 For <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/>, 3432 the referrer object is a class (referred to below as <i>C</i>) 3433 or an interface (referred to below as <i>I</i>). 3434 In this case, <code>index</code> is the index of the field in 3435 that class or interface. 3436 <p/> 3437 If the referrer object is not an interface, then the field 3438 indices are determined as follows: 3439 <ul> 3440 <li>make a list of all the fields in <i>C</i> and its 3441 superclasses, starting with all the fields in 3442 <code>java.lang.Object</code> and ending with all the 3443 fields in <i>C</i>.</li> 3444 <li>Within this list, put 3445 the fields for a given class in the order returned by 3446 <functionlink id="GetClassFields"/>.</li> 3447 <li>Assign the fields in this list indices 3448 <i>n</i>, <i>n</i>+1, ..., in order, where <i>n</i> 3449 is the count of the fields in all the interfaces 3450 implemented by <i>C</i>. 3451 Note that <i>C</i> implements all interfaces 3452 directly implemented by its superclasses; as well 3453 as all superinterfaces of these interfaces.</li> 3454 </ul> 3455 If the referrer object is an interface, then the field 3456 indices are determined as follows: 3457 <ul> 3458 <li>make a list of the fields directly declared in 3459 <i>I</i>.</li> 3460 <li>Within this list, put 3461 the fields in the order returned by 3462 <functionlink id="GetClassFields"/>.</li> 3463 <li>Assign the fields in this list indices 3464 <i>n</i>, <i>n</i>+1, ..., in order, where <i>n</i> 3465 is the count of the fields in all the superinterfaces 3466 of <i>I</i>.</li> 3467 </ul> 3468 All fields are included in this computation, regardless of 3469 field modifier (static, public, private, etc). 3470 <p/> 3471 For example, given the following classes and interfaces: 3472 <example> 3473 interface I0 { 3474 int p = 0; 3475 } 3476 3477 interface I1 extends I0 { 3478 int x = 1; 3479 } 3480 3481 interface I2 extends I0 { 3482 int y = 2; 3483 } 3484 3485 class C1 implements I1 { 3486 public static int a = 3; 3487 private int b = 4; 3488 } 3489 3490 class C2 extends C1 implements I2 { 3491 static int q = 5; 3492 final int r = 6; 3493 } 3494 </example> 3495 Assume that <functionlink id="GetClassFields"/> called on 3496 <code>C1</code> returns the fields of <code>C1</code> in the 3497 order: a, b; and that the fields of <code>C2</code> are 3498 returned in the order: q, r. 3499 An instance of class <code>C1</code> will have the 3500 following field indices: 3501 <dl><dd><table> 3502 <tr> 3503 <td> 3504 a 3505 </td> 3506 <td> 3507 2 3508 </td> 3509 <td align="left"> 3510 The count of the fields in the interfaces 3511 implemented by <code>C1</code> is two (<i>n</i>=2): 3512 <code>p</code> of <code>I0</code> 3513 and <code>x</code> of <code>I1</code>. 3514 </td> 3515 </tr> 3516 <tr> 3517 <td> 3518 b 3519 </td> 3520 <td> 3521 3 3522 </td> 3523 <td align="left"> 3524 the subsequent index. 3525 </td> 3526 </tr> 3527 </table></dd></dl> 3528 The class <code>C1</code> will have the same field indices. 3529 <p/> 3530 An instance of class <code>C2</code> will have the 3531 following field indices: 3532 <dl><dd><table> 3533 <tr> 3534 <td> 3535 a 3536 </td> 3537 <td> 3538 3 3539 </td> 3540 <td align="left"> 3541 The count of the fields in the interfaces 3542 implemented by <code>C2</code> is three (<i>n</i>=3): 3543 <code>p</code> of <code>I0</code>, 3544 <code>x</code> of <code>I1</code> and <code>y</code> of <code>I2</code> 3545 (an interface of <code>C2</code>). Note that the field <code>p</code> 3546 of <code>I0</code> is only included once. 3547 </td> 3548 </tr> 3549 <tr> 3550 <td> 3551 b 3552 </td> 3553 <td> 3554 4 3555 </td> 3556 <td align="left"> 3557 the subsequent index to "a". 3558 </td> 3559 </tr> 3560 <tr> 3561 <td> 3562 q 3563 </td> 3564 <td> 3565 5 3566 </td> 3567 <td align="left"> 3568 the subsequent index to "b". 3569 </td> 3570 </tr> 3571 <tr> 3572 <td> 3573 r 3574 </td> 3575 <td> 3576 6 3577 </td> 3578 <td align="left"> 3579 the subsequent index to "q". 3580 </td> 3581 </tr> 3582 </table></dd></dl> 3583 The class <code>C2</code> will have the same field indices. 3584 Note that a field may have a different index depending on the 3585 object that is viewing it -- for example field "a" above. 3586 Note also: not all field indices may be visible from the 3587 callbacks, but all indices are shown for illustrative purposes. 3588 <p/> 3589 The interface <code>I1</code> will have the 3590 following field indices: 3591 <dl><dd><table> 3592 <tr> 3593 <td> 3594 x 3595 </td> 3596 <td> 3597 1 3598 </td> 3599 <td align="left"> 3600 The count of the fields in the superinterfaces 3601 of <code>I1</code> is one (<i>n</i>=1): 3602 <code>p</code> of <code>I0</code>. 3603 </td> 3604 </tr> 3605 </table></dd></dl> 3606 </description> 3607 </field> 3608 </typedef> 3609 3610 <typedef id="jvmtiHeapReferenceInfoArray" 3611 label="Reference information structure for Array references" 3612 since="1.1"> 3613 <description> 3614 Reference information returned for 3615 <datalink id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT"/> references. 3616 </description> 3617 <field id="index"> 3618 <jint/> 3619 <description> 3620 The array index. 3621 </description> 3622 </field> 3623 </typedef> 3624 3625 <typedef id="jvmtiHeapReferenceInfoConstantPool" 3626 label="Reference information structure for Constant Pool references" 3627 since="1.1"> 3628 <description> 3629 Reference information returned for 3630 <datalink id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL"/> references. 3631 </description> 3632 <field id="index"> 3633 <jint/> 3634 <description> 3635 The index into the constant pool of the class. See the description in 3636 <vmspec chapter="4.4"/>. 3637 </description> 3638 </field> 3639 </typedef> 3640 3641 <typedef id="jvmtiHeapReferenceInfoStackLocal" 3642 label="Reference information structure for Local Variable references" 3643 since="1.1"> 3644 <description> 3645 Reference information returned for 3646 <datalink id="JVMTI_HEAP_REFERENCE_STACK_LOCAL"/> references. 3647 </description> 3648 <field id="thread_tag"> 3649 <jlong/> 3650 <description> 3651 The tag of the thread corresponding to this stack, zero if not tagged. 3652 </description> 3653 </field> 3654 <field id="thread_id"> 3655 <jlong/> 3656 <description> 3657 The unique thread ID of the thread corresponding to this stack. 3658 </description> 3659 </field> 3660 <field id="depth"> 3661 <jint/> 3662 <description> 3663 The depth of the frame. 3664 </description> 3665 </field> 3666 <field id="method"> 3667 <jmethodID/> 3668 <description> 3669 The method executing in this frame. 3670 </description> 3671 </field> 3672 <field id="location"> 3673 <jlocation/> 3674 <description> 3675 The currently executing location in this frame. 3676 </description> 3677 </field> 3678 <field id="slot"> 3679 <jint/> 3680 <description> 3681 The slot number of the local variable. 3682 </description> 3683 </field> 3684 </typedef> 3685 3686 <typedef id="jvmtiHeapReferenceInfoJniLocal" 3687 label="Reference information structure for JNI local references" 3688 since="1.1"> 3689 <description> 3690 Reference information returned for 3691 <datalink id="JVMTI_HEAP_REFERENCE_JNI_LOCAL"/> references. 3692 </description> 3693 <field id="thread_tag"> 3694 <jlong/> 3695 <description> 3696 The tag of the thread corresponding to this stack, zero if not tagged. 3697 </description> 3698 </field> 3699 <field id="thread_id"> 3700 <jlong/> 3701 <description> 3702 The unique thread ID of the thread corresponding to this stack. 3703 </description> 3704 </field> 3705 <field id="depth"> 3706 <jint/> 3707 <description> 3708 The depth of the frame. 3709 </description> 3710 </field> 3711 <field id="method"> 3712 <jmethodID/> 3713 <description> 3714 The method executing in this frame. 3715 </description> 3716 </field> 3717 </typedef> 3718 3719 <typedef id="jvmtiHeapReferenceInfoReserved" 3720 label="Reference information structure for Other references" 3721 since="1.1"> 3722 <description> 3723 Reference information returned for other references. 3724 </description> 3725 <field id="reserved1"> 3726 <jlong/> 3727 <description> 3728 reserved for future use. 3729 </description> 3730 </field> 3731 <field id="reserved2"> 3732 <jlong/> 3733 <description> 3734 reserved for future use. 3735 </description> 3736 </field> 3737 <field id="reserved3"> 3738 <jlong/> 3739 <description> 3740 reserved for future use. 3741 </description> 3742 </field> 3743 <field id="reserved4"> 3744 <jlong/> 3745 <description> 3746 reserved for future use. 3747 </description> 3748 </field> 3749 <field id="reserved5"> 3750 <jlong/> 3751 <description> 3752 reserved for future use. 3753 </description> 3754 </field> 3755 <field id="reserved6"> 3756 <jlong/> 3757 <description> 3758 reserved for future use. 3759 </description> 3760 </field> 3761 <field id="reserved7"> 3762 <jlong/> 3763 <description> 3764 reserved for future use. 3765 </description> 3766 </field> 3767 <field id="reserved8"> 3768 <jlong/> 3769 <description> 3770 reserved for future use. 3771 </description> 3772 </field> 3773 </typedef> 3774 3775 <uniontypedef id="jvmtiHeapReferenceInfo" 3776 label="Reference information structure" 3777 since="1.1"> 3778 <description> 3779 The information returned about referrers. 3780 Represented as a union of the various kinds of reference information. 3781 </description> 3782 <field id="field"> 3783 <struct>jvmtiHeapReferenceInfoField</struct> 3784 <description> 3785 The referrer information for 3786 <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/> 3787 and <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/> references. 3788 </description> 3789 </field> 3790 <field id="array"> 3791 <struct>jvmtiHeapReferenceInfoArray</struct> 3792 <description> 3793 The referrer information for 3794 For <datalink id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT"/> references. 3795 </description> 3796 </field> 3797 <field id="constant_pool"> 3798 <struct>jvmtiHeapReferenceInfoConstantPool</struct> 3799 <description> 3800 The referrer information for 3801 For <datalink id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL"/> references. 3802 </description> 3803 </field> 3804 <field id="stack_local"> 3805 <struct>jvmtiHeapReferenceInfoStackLocal</struct> 3806 <description> 3807 The referrer information for 3808 For <datalink id="JVMTI_HEAP_REFERENCE_STACK_LOCAL"/> references. 3809 </description> 3810 </field> 3811 <field id="jni_local"> 3812 <struct>jvmtiHeapReferenceInfoJniLocal</struct> 3813 <description> 3814 The referrer information for 3815 For <datalink id="JVMTI_HEAP_REFERENCE_JNI_LOCAL"/> references. 3816 </description> 3817 </field> 3818 <field id="other"> 3819 <struct>jvmtiHeapReferenceInfoReserved</struct> 3820 <description> 3821 reserved for future use. 3822 </description> 3823 </field> 3824 </uniontypedef> 3825 3826 <typedef id="jvmtiHeapCallbacks" 3827 label="Heap callback function structure" 3828 since="1.1"> 3829 <field id="heap_iteration_callback"> 3830 <ptrtype> 3831 <struct>jvmtiHeapIterationCallback</struct> 3832 </ptrtype> 3833 <description> 3834 The callback to be called to describe an 3835 object in the heap. Used by the 3836 <functionlink id="IterateThroughHeap"/> function, ignored by the 3837 <functionlink id="FollowReferences"/> function. 3838 </description> 3839 </field> 3840 <field id="heap_reference_callback"> 3841 <ptrtype> 3842 <struct>jvmtiHeapReferenceCallback</struct> 3843 </ptrtype> 3844 <description> 3845 The callback to be called to describe an 3846 object reference. Used by the 3847 <functionlink id="FollowReferences"/> function, ignored by the 3848 <functionlink id="IterateThroughHeap"/> function. 3849 </description> 3850 </field> 3851 <field id="primitive_field_callback"> 3852 <ptrtype> 3853 <struct>jvmtiPrimitiveFieldCallback</struct> 3854 </ptrtype> 3855 <description> 3856 The callback to be called to describe a 3857 primitive field. 3858 </description> 3859 </field> 3860 <field id="array_primitive_value_callback"> 3861 <ptrtype> 3862 <struct>jvmtiArrayPrimitiveValueCallback</struct> 3863 </ptrtype> 3864 <description> 3865 The callback to be called to describe an 3866 array of primitive values. 3867 </description> 3868 </field> 3869 <field id="string_primitive_value_callback"> 3870 <ptrtype> 3871 <struct>jvmtiStringPrimitiveValueCallback</struct> 3872 </ptrtype> 3873 <description> 3874 The callback to be called to describe a String value. 3875 </description> 3876 </field> 3877 <field id="reserved5"> 3878 <ptrtype> 3879 <struct>jvmtiReservedCallback</struct> 3880 </ptrtype> 3881 <description> 3882 Reserved for future use.. 3883 </description> 3884 </field> 3885 <field id="reserved6"> 3886 <ptrtype> 3887 <struct>jvmtiReservedCallback</struct> 3888 </ptrtype> 3889 <description> 3890 Reserved for future use.. 3891 </description> 3892 </field> 3893 <field id="reserved7"> 3894 <ptrtype> 3895 <struct>jvmtiReservedCallback</struct> 3896 </ptrtype> 3897 <description> 3898 Reserved for future use.. 3899 </description> 3900 </field> 3901 <field id="reserved8"> 3902 <ptrtype> 3903 <struct>jvmtiReservedCallback</struct> 3904 </ptrtype> 3905 <description> 3906 Reserved for future use.. 3907 </description> 3908 </field> 3909 <field id="reserved9"> 3910 <ptrtype> 3911 <struct>jvmtiReservedCallback</struct> 3912 </ptrtype> 3913 <description> 3914 Reserved for future use.. 3915 </description> 3916 </field> 3917 <field id="reserved10"> 3918 <ptrtype> 3919 <struct>jvmtiReservedCallback</struct> 3920 </ptrtype> 3921 <description> 3922 Reserved for future use.. 3923 </description> 3924 </field> 3925 <field id="reserved11"> 3926 <ptrtype> 3927 <struct>jvmtiReservedCallback</struct> 3928 </ptrtype> 3929 <description> 3930 Reserved for future use.. 3931 </description> 3932 </field> 3933 <field id="reserved12"> 3934 <ptrtype> 3935 <struct>jvmtiReservedCallback</struct> 3936 </ptrtype> 3937 <description> 3938 Reserved for future use.. 3939 </description> 3940 </field> 3941 <field id="reserved13"> 3942 <ptrtype> 3943 <struct>jvmtiReservedCallback</struct> 3944 </ptrtype> 3945 <description> 3946 Reserved for future use.. 3947 </description> 3948 </field> 3949 <field id="reserved14"> 3950 <ptrtype> 3951 <struct>jvmtiReservedCallback</struct> 3952 </ptrtype> 3953 <description> 3954 Reserved for future use.. 3955 </description> 3956 </field> 3957 <field id="reserved15"> 3958 <ptrtype> 3959 <struct>jvmtiReservedCallback</struct> 3960 </ptrtype> 3961 <description> 3962 Reserved for future use.. 3963 </description> 3964 </field> 3965 </typedef> 3966 3967 3968 <intro> 3969 <rationale> 3970 The heap dumping functionality (below) uses a callback 3971 for each object. While it would seem that a buffered approach 3972 would provide better throughput, tests do 3973 not show this to be the case--possibly due to locality of 3974 memory reference or array access overhead. 3975 </rationale> 3976 3977 <issue> 3978 Still under investigation as to if java.lang.ref references 3979 are reported as a different type of reference. 3980 </issue> 3981 3982 <issue> 3983 Should or can an indication of the cost or relative cost of 3984 these operations be included? 3985 </issue> 3986 3987 </intro> 3988 3989 <callback id="jvmtiHeapIterationCallback" since="1.1"> 3990 <jint/> 3991 <synopsis>Heap Iteration Callback</synopsis> 3992 <description> 3993 Agent supplied callback function. 3994 Describes (but does not pass in) an object in the heap. 3995 <p/> 3996 This function should return a bit vector of the desired 3997 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>. 3998 This will determine if the entire iteration should be aborted 3999 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored). 4000 <p/> 4001 See the <internallink id="heapCallbacks">heap callback 4002 function restrictions</internallink>. 4003 </description> 4004 <parameters> 4005 <param id="class_tag"> 4006 <jlong/> 4007 <description> 4008 The tag of the class of object (zero if the class is not tagged). 4009 If the object represents a runtime class, 4010 the <code>class_tag</code> is the tag 4011 associated with <code>java.lang.Class</code> 4012 (zero if <code>java.lang.Class</code> is not tagged). 4013 </description> 4014 </param> 4015 <param id="size"> 4016 <jlong/> 4017 <description> 4018 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 4019 </description> 4020 </param> 4021 <param id="tag_ptr"> 4022 <outptr><jlong/></outptr> 4023 <description> 4024 The object tag value, or zero if the object is not tagged. 4025 To set the tag value to be associated with the object 4026 the agent sets the <code>jlong</code> pointed to by the parameter. 4027 </description> 4028 </param> 4029 <param id="length"> 4030 <jint/> 4031 <description> 4032 If this object is an array, the length of the array. Otherwise negative one (-1). 4033 </description> 4034 </param> 4035 <param id="user_data"> 4036 <outptr><void/></outptr> 4037 <description> 4038 The user supplied data that was passed into the iteration function. 4039 </description> 4040 </param> 4041 </parameters> 4042 </callback> 4043 4044 <callback id="jvmtiHeapReferenceCallback" since="1.1"> 4045 <jint/> 4046 <synopsis>Heap Reference Callback</synopsis> 4047 <description> 4048 Agent supplied callback function. 4049 Describes a reference from an object or the VM (the referrer) to another object 4050 (the referree) or a heap root to a referree. 4051 <p/> 4052 This function should return a bit vector of the desired 4053 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>. 4054 This will determine if the objects referenced by the referree 4055 should be visited or if the entire iteration should be aborted. 4056 <p/> 4057 See the <internallink id="heapCallbacks">heap callback 4058 function restrictions</internallink>. 4059 </description> 4060 <parameters> 4061 <param id="reference_kind"> 4062 <enum>jvmtiHeapReferenceKind</enum> 4063 <description> 4064 The kind of reference. 4065 </description> 4066 </param> 4067 <param id="reference_info"> 4068 <inptr> 4069 <struct>jvmtiHeapReferenceInfo</struct> 4070 </inptr> 4071 <description> 4072 Details about the reference. 4073 Set when the <datalink id="jvmtiHeapReferenceCallback.reference_kind">reference_kind</datalink> is 4074 <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/>, 4075 <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/>, 4076 <datalink id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT"/>, 4077 <datalink id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL"/>, 4078 <datalink id="JVMTI_HEAP_REFERENCE_STACK_LOCAL"/>, 4079 or <datalink id="JVMTI_HEAP_REFERENCE_JNI_LOCAL"/>. 4080 Otherwise <code>NULL</code>. 4081 </description> 4082 </param> 4083 <param id="class_tag"> 4084 <jlong/> 4085 <description> 4086 The tag of the class of referree object (zero if the class is not tagged). 4087 If the referree object represents a runtime class, 4088 the <code>class_tag</code> is the tag 4089 associated with <code>java.lang.Class</code> 4090 (zero if <code>java.lang.Class</code> is not tagged). 4091 </description> 4092 </param> 4093 <param id="referrer_class_tag"> 4094 <jlong/> 4095 <description> 4096 The tag of the class of the referrer object (zero if the class is not tagged 4097 or the referree is a heap root). If the referrer object represents a runtime 4098 class, the <code>referrer_class_tag</code> is the tag associated with 4099 the <code>java.lang.Class</code> 4100 (zero if <code>java.lang.Class</code> is not tagged). 4101 </description> 4102 </param> 4103 <param id="size"> 4104 <jlong/> 4105 <description> 4106 Size of the referree object (in bytes). 4107 See <functionlink id="GetObjectSize"/>. 4108 </description> 4109 </param> 4110 <param id="tag_ptr"> 4111 <outptr><jlong/></outptr> 4112 <description> 4113 Points to the referree object tag value, or zero if the object is not 4114 tagged. 4115 To set the tag value to be associated with the object 4116 the agent sets the <code>jlong</code> pointed to by the parameter. 4117 </description> 4118 </param> 4119 <param id="referrer_tag_ptr"> 4120 <outptr><jlong/></outptr> 4121 <description> 4122 Points to the tag of the referrer object, or 4123 points to the zero if the referrer 4124 object is not tagged. 4125 <code>NULL</code> if the referrer in not an object (that is, 4126 this callback is reporting a heap root). 4127 To set the tag value to be associated with the referrer object 4128 the agent sets the <code>jlong</code> pointed to by the parameter. 4129 If this callback is reporting a reference from an object to itself, 4130 <code>referrer_tag_ptr == tag_ptr</code>. 4131 </description> 4132 </param> 4133 <param id="length"> 4134 <jint/> 4135 <description> 4136 If this object is an array, the length of the array. Otherwise negative one (-1). 4137 </description> 4138 </param> 4139 <param id="user_data"> 4140 <outptr><void/></outptr> 4141 <description> 4142 The user supplied data that was passed into the iteration function. 4143 </description> 4144 </param> 4145 </parameters> 4146 </callback> 4147 4148 <callback id="jvmtiPrimitiveFieldCallback" since="1.1"> 4149 <jint/> 4150 <synopsis>Primitive Field Callback</synopsis> 4151 <description> 4152 Agent supplied callback function which 4153 describes a primitive field of an object (<i>the object</i>). 4154 A primitive field is a field whose type is a primitive type. 4155 This callback will describe a static field if the object is a class, 4156 and otherwise will describe an instance field. 4157 <p/> 4158 This function should return a bit vector of the desired 4159 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>. 4160 This will determine if the entire iteration should be aborted 4161 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored). 4162 <p/> 4163 See the <internallink id="heapCallbacks">heap callback 4164 function restrictions</internallink>. 4165 </description> 4166 <parameters> 4167 <param id="kind"> 4168 <enum>jvmtiHeapReferenceKind</enum> 4169 <description> 4170 The kind of field -- instance or static (<datalink id="JVMTI_HEAP_REFERENCE_FIELD"/> or 4171 <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/>). 4172 </description> 4173 </param> 4174 <param id="info"> 4175 <inptr> 4176 <struct>jvmtiHeapReferenceInfo</struct> 4177 </inptr> 4178 <description> 4179 Which field (the field index). 4180 </description> 4181 </param> 4182 <param id="object_class_tag"> 4183 <jlong/> 4184 <description> 4185 The tag of the class of the object (zero if the class is not tagged). 4186 If the object represents a runtime class, the 4187 <code>object_class_tag</code> is the tag 4188 associated with <code>java.lang.Class</code> 4189 (zero if <code>java.lang.Class</code> is not tagged). 4190 </description> 4191 </param> 4192 <param id="object_tag_ptr"> 4193 <outptr><jlong/></outptr> 4194 <description> 4195 Points to the tag of the object, or zero if the object is not 4196 tagged. 4197 To set the tag value to be associated with the object 4198 the agent sets the <code>jlong</code> pointed to by the parameter. 4199 </description> 4200 </param> 4201 <param id="value"> 4202 <jvalue/> 4203 <description> 4204 The value of the field. 4205 </description> 4206 </param> 4207 <param id="value_type"> 4208 <enum>jvmtiPrimitiveType</enum> 4209 <description> 4210 The type of the field. 4211 </description> 4212 </param> 4213 <param id="user_data"> 4214 <outptr><void/></outptr> 4215 <description> 4216 The user supplied data that was passed into the iteration function. 4217 </description> 4218 </param> 4219 </parameters> 4220 </callback> 4221 4222 <callback id="jvmtiArrayPrimitiveValueCallback" since="1.1"> 4223 <jint/> 4224 <synopsis>Array Primitive Value Callback</synopsis> 4225 <description> 4226 Agent supplied callback function. 4227 Describes the values in an array of a primitive type. 4228 <p/> 4229 This function should return a bit vector of the desired 4230 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>. 4231 This will determine if the entire iteration should be aborted 4232 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored). 4233 <p/> 4234 See the <internallink id="heapCallbacks">heap callback 4235 function restrictions</internallink>. 4236 </description> 4237 <parameters> 4238 <param id="class_tag"> 4239 <jlong/> 4240 <description> 4241 The tag of the class of the array object (zero if the class is not tagged). 4242 </description> 4243 </param> 4244 <param id="size"> 4245 <jlong/> 4246 <description> 4247 Size of the array (in bytes). 4248 See <functionlink id="GetObjectSize"/>. 4249 </description> 4250 </param> 4251 <param id="tag_ptr"> 4252 <outptr><jlong/></outptr> 4253 <description> 4254 Points to the tag of the array object, or zero if the object is not 4255 tagged. 4256 To set the tag value to be associated with the object 4257 the agent sets the <code>jlong</code> pointed to by the parameter. 4258 </description> 4259 </param> 4260 <param id="element_count"> 4261 <jint/> 4262 <description> 4263 The length of the primitive array. 4264 </description> 4265 </param> 4266 <param id="element_type"> 4267 <enum>jvmtiPrimitiveType</enum> 4268 <description> 4269 The type of the elements of the array. 4270 </description> 4271 </param> 4272 <param id="elements"> 4273 <vmbuf><void/></vmbuf> 4274 <description> 4275 The elements of the array in a packed array of <code>element_count</code> 4276 items of <code>element_type</code> size each. 4277 </description> 4278 </param> 4279 <param id="user_data"> 4280 <outptr><void/></outptr> 4281 <description> 4282 The user supplied data that was passed into the iteration function. 4283 </description> 4284 </param> 4285 </parameters> 4286 </callback> 4287 4288 <callback id="jvmtiStringPrimitiveValueCallback" since="1.1"> 4289 <jint/> 4290 <synopsis>String Primitive Value Callback</synopsis> 4291 <description> 4292 Agent supplied callback function. 4293 Describes the value of a java.lang.String. 4294 <p/> 4295 This function should return a bit vector of the desired 4296 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>. 4297 This will determine if the entire iteration should be aborted 4298 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored). 4299 <p/> 4300 See the <internallink id="heapCallbacks">heap callback 4301 function restrictions</internallink>. 4302 </description> 4303 <parameters> 4304 <param id="class_tag"> 4305 <jlong/> 4306 <description> 4307 The tag of the class of the String class (zero if the class is not tagged). 4308 <issue>Is this needed?</issue> 4309 </description> 4310 </param> 4311 <param id="size"> 4312 <jlong/> 4313 <description> 4314 Size of the string (in bytes). 4315 See <functionlink id="GetObjectSize"/>. 4316 </description> 4317 </param> 4318 <param id="tag_ptr"> 4319 <outptr><jlong/></outptr> 4320 <description> 4321 Points to the tag of the String object, or zero if the object is not 4322 tagged. 4323 To set the tag value to be associated with the object 4324 the agent sets the <code>jlong</code> pointed to by the parameter. 4325 </description> 4326 </param> 4327 <param id="value"> 4328 <vmbuf><jchar/></vmbuf> 4329 <description> 4330 The value of the String, encoded as a Unicode string. 4331 </description> 4332 </param> 4333 <param id="value_length"> 4334 <jint/> 4335 <description> 4336 The length of the string. 4337 The length is equal to the number of 16-bit Unicode 4338 characters in the string. 4339 </description> 4340 </param> 4341 <param id="user_data"> 4342 <outptr><void/></outptr> 4343 <description> 4344 The user supplied data that was passed into the iteration function. 4345 </description> 4346 </param> 4347 </parameters> 4348 </callback> 4349 4350 4351 <callback id="jvmtiReservedCallback" since="1.1"> 4352 <jint/> 4353 <synopsis>reserved for future use Callback</synopsis> 4354 <description> 4355 Placeholder -- reserved for future use. 4356 </description> 4357 <parameters> 4358 </parameters> 4359 </callback> 4360 4361 <function id="FollowReferences" num="115" since="1.1"> 4362 <synopsis>Follow References</synopsis> 4363 <description> 4364 This function initiates a traversal over the objects that are 4365 directly and indirectly reachable from the specified object or, 4366 if <code>initial_object</code> is not specified, all objects 4367 reachable from the heap roots. 4368 The heap root are the set of system classes, 4369 JNI globals, references from thread stacks, and other objects used as roots 4370 for the purposes of garbage collection. 4371 <p/> 4372 This function operates by traversing the reference graph. 4373 Let <i>A</i>, <i>B</i>, ... represent objects. 4374 When a reference from <i>A</i> to <i>B</i> is traversed, 4375 when a reference from a heap root to <i>B</i> is traversed, 4376 or when <i>B</i> is specified as the <paramlink id="initial_object"/>, 4377 then <i>B</i> is said to be <i>visited</i>. 4378 A reference from <i>A</i> to <i>B</i> is not traversed until <i>A</i> 4379 is visited. 4380 References are reported in the same order that the references are traversed. 4381 Object references are reported by invoking the agent supplied 4382 callback function <functionlink id="jvmtiHeapReferenceCallback"/>. 4383 In a reference from <i>A</i> to <i>B</i>, <i>A</i> is known 4384 as the <i>referrer</i> and <i>B</i> as the <i>referree</i>. 4385 The callback is invoked exactly once for each reference from a referrer; 4386 this is true even if there are reference cycles or multiple paths to 4387 the referrer. 4388 There may be more than one reference between a referrer and a referree, 4389 each reference is reported. 4390 These references may be distinguished by examining the 4391 <datalink 4392 id="jvmtiHeapReferenceCallback.reference_kind"><code>reference_kind</code></datalink> 4393 and 4394 <datalink 4395 id="jvmtiHeapReferenceCallback.reference_info"><code>reference_info</code></datalink> 4396 parameters of the <functionlink id="jvmtiHeapReferenceCallback"/> callback. 4397 <p/> 4398 This function reports a Java programming language view of object references, 4399 not a virtual machine implementation view. The following object references 4400 are reported when they are non-null: 4401 <ul> 4402 <li>Instance objects report references to each non-primitive instance fields 4403 (including inherited fields).</li> 4404 <li>Instance objects report a reference to the object type (class).</li> 4405 <li>Classes report a reference to the superclass and directly 4406 implemented/extended interfaces.</li> 4407 <li>Classes report a reference to the class loader, protection domain, 4408 signers, and resolved entries in the constant pool.</li> 4409 <li>Classes report a reference to each directly declared non-primitive 4410 static field.</li> 4411 <li>Arrays report a reference to the array type (class) and each 4412 array element.</li> 4413 <li>Primitive arrays report a reference to the array type.</li> 4414 </ul> 4415 <p/> 4416 This function can also be used to examine primitive (non-object) values. 4417 The primitive value of an array or String 4418 is reported after the object has been visited; 4419 it is reported by invoking the agent supplied callback function 4420 <functionlink id="jvmtiArrayPrimitiveValueCallback"/> or 4421 <functionlink id="jvmtiStringPrimitiveValueCallback"/>. 4422 A primitive field 4423 is reported after the object with that field is visited; 4424 it is reported by invoking the agent supplied callback function 4425 <functionlink id="jvmtiPrimitiveFieldCallback"/>. 4426 <p/> 4427 Whether a callback is provided or is <code>NULL</code> only determines 4428 whether the callback will be invoked, it does not influence 4429 which objects are visited nor does it influence whether other callbacks 4430 will be invoked. 4431 However, the 4432 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink> 4433 returned by <functionlink id="jvmtiHeapReferenceCallback"/> 4434 do determine if the objects referenced by the 4435 current object as visited. 4436 The <datalink id="jvmtiHeapFilter">heap filter flags</datalink> 4437 and <paramlink id="klass"/> provided as parameters to this function 4438 do not control which objects are visited but they do control which 4439 objects and primitive values are reported by the callbacks. 4440 For example, if the only callback that was set is 4441 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> and <code>klass</code> 4442 is set to the array of bytes class, then only arrays of byte will be 4443 reported. 4444 The table below summarizes this: 4445 <p/> 4446 <table> 4447 <tr> 4448 <th/> 4449 <th> 4450 Controls objects visited 4451 </th> 4452 <th> 4453 Controls objects reported 4454 </th> 4455 <th> 4456 Controls primitives reported 4457 </th> 4458 </tr> 4459 <tr> 4460 <th align="left"> 4461 the 4462 <datalink id="jvmtiHeapVisitControl">Heap Visit Control Flags</datalink> 4463 returned by <functionlink id="jvmtiHeapReferenceCallback"/> 4464 </th> 4465 <td> 4466 <b>Yes</b> 4467 </td> 4468 <td> 4469 <b>Yes</b>, since visits are controlled 4470 </td> 4471 <td> 4472 <b>Yes</b>, since visits are controlled 4473 </td> 4474 </tr> 4475 <tr> 4476 <th align="left"> 4477 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> 4478 in <paramlink id="callbacks"/> set 4479 </th> 4480 <td> 4481 No 4482 </td> 4483 <td> 4484 <b>Yes</b> 4485 </td> 4486 <td> 4487 No 4488 </td> 4489 </tr> 4490 <tr> 4491 <th align="left"> 4492 <paramlink id="heap_filter"/> 4493 </th> 4494 <td> 4495 No 4496 </td> 4497 <td> 4498 <b>Yes</b> 4499 </td> 4500 <td> 4501 <b>Yes</b> 4502 </td> 4503 </tr> 4504 <tr> 4505 <th align="left"> 4506 <paramlink id="klass"/> 4507 </th> 4508 <td> 4509 No 4510 </td> 4511 <td> 4512 <b>Yes</b> 4513 </td> 4514 <td> 4515 <b>Yes</b> 4516 </td> 4517 </tr> 4518 </table> 4519 <p/> 4520 During the execution of this function the state of the heap 4521 does not change: no objects are allocated, no objects are 4522 garbage collected, and the state of objects (including 4523 held values) does not change. 4524 As a result, threads executing Java 4525 programming language code, threads attempting to resume the 4526 execution of Java programming language code, and threads 4527 attempting to execute JNI functions are typically stalled. 4528 </description> 4529 <origin>new</origin> 4530 <capabilities> 4531 <required id="can_tag_objects"></required> 4532 </capabilities> 4533 <parameters> 4534 <param id="heap_filter"> 4535 <jint/> 4536 <description> 4537 This bit vector of 4538 <datalink id="jvmtiHeapFilter">heap filter flags</datalink>. 4539 restricts the objects for which the callback function is called. 4540 This applies to both the object and primitive callbacks. 4541 </description> 4542 </param> 4543 <param id="klass"> 4544 <ptrtype> 4545 <jclass/> 4546 <nullok>callbacks are not limited to instances of a particular 4547 class</nullok> 4548 </ptrtype> 4549 <description> 4550 Callbacks are only reported when the object is an instance of 4551 this class. 4552 Objects which are instances of a subclass of <code>klass</code> 4553 are not reported. 4554 If <code>klass</code> is an interface, no objects are reported. 4555 This applies to both the object and primitive callbacks. 4556 </description> 4557 </param> 4558 <param id="initial_object"> 4559 <ptrtype> 4560 <jobject/> 4561 <nullok>references are followed from the heap roots</nullok> 4562 </ptrtype> 4563 <description> 4564 The object to follow 4565 </description> 4566 </param> 4567 <param id="callbacks"> 4568 <inptr> 4569 <struct>jvmtiHeapCallbacks</struct> 4570 </inptr> 4571 <description> 4572 Structure defining the set of callback functions. 4573 </description> 4574 </param> 4575 <param id="user_data"> 4576 <inbuf> 4577 <void/> 4578 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 4579 </inbuf> 4580 <description> 4581 User supplied data to be passed to the callback. 4582 </description> 4583 </param> 4584 </parameters> 4585 <errors> 4586 <error id="JVMTI_ERROR_INVALID_CLASS"> 4587 <paramlink id="klass"/> is not a valid class. 4588 </error> 4589 <error id="JVMTI_ERROR_INVALID_OBJECT"> 4590 <paramlink id="initial_object"/> is not a valid object. 4591 </error> 4592 </errors> 4593 </function> 4594 4595 4596 <function id="IterateThroughHeap" num="116" since="1.1"> 4597 <synopsis>Iterate Through Heap</synopsis> 4598 <description> 4599 Initiate an iteration over all objects in the heap. 4600 This includes both reachable and 4601 unreachable objects. Objects are visited in no particular order. 4602 <p/> 4603 Heap objects are reported by invoking the agent supplied 4604 callback function <functionlink id="jvmtiHeapIterationCallback"/>. 4605 References between objects are not reported. 4606 If only reachable objects are desired, or if object reference information 4607 is needed, use <functionlink id="FollowReferences"/>. 4608 <p/> 4609 This function can also be used to examine primitive (non-object) values. 4610 The primitive value of an array or String 4611 is reported after the object has been visited; 4612 it is reported by invoking the agent supplied callback function 4613 <functionlink id="jvmtiArrayPrimitiveValueCallback"/> or 4614 <functionlink id="jvmtiStringPrimitiveValueCallback"/>. 4615 A primitive field 4616 is reported after the object with that field is visited; 4617 it is reported by invoking the agent supplied 4618 callback function 4619 <functionlink id="jvmtiPrimitiveFieldCallback"/>. 4620 <p/> 4621 Unless the iteration is aborted by the 4622 <datalink id="jvmtiHeapVisitControl">Heap Visit Control Flags</datalink> 4623 returned by a callback, all objects in the heap are visited. 4624 Whether a callback is provided or is <code>NULL</code> only determines 4625 whether the callback will be invoked, it does not influence 4626 which objects are visited nor does it influence whether other callbacks 4627 will be invoked. 4628 The <datalink id="jvmtiHeapFilter">heap filter flags</datalink> 4629 and <paramlink id="klass"/> provided as parameters to this function 4630 do not control which objects are visited but they do control which 4631 objects and primitive values are reported by the callbacks. 4632 For example, if the only callback that was set is 4633 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> and <code>klass</code> 4634 is set to the array of bytes class, then only arrays of byte will be 4635 reported. The table below summarizes this (contrast this with 4636 <functionlink id="FollowReferences"/>): 4637 <p/> 4638 <table> 4639 <tr> 4640 <th/> 4641 <th> 4642 Controls objects visited 4643 </th> 4644 <th> 4645 Controls objects reported 4646 </th> 4647 <th> 4648 Controls primitives reported 4649 </th> 4650 </tr> 4651 <tr> 4652 <th align="left"> 4653 the 4654 <datalink id="jvmtiHeapVisitControl">Heap Visit Control Flags</datalink> 4655 returned by <functionlink id="jvmtiHeapIterationCallback"/> 4656 </th> 4657 <td> 4658 No<br/>(unless they abort the iteration) 4659 </td> 4660 <td> 4661 No<br/>(unless they abort the iteration) 4662 </td> 4663 <td> 4664 No<br/>(unless they abort the iteration) 4665 </td> 4666 </tr> 4667 <tr> 4668 <th align="left"> 4669 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> 4670 in <paramlink id="callbacks"/> set 4671 </th> 4672 <td> 4673 No 4674 </td> 4675 <td> 4676 <b>Yes</b> 4677 </td> 4678 <td> 4679 No 4680 </td> 4681 </tr> 4682 <tr> 4683 <th align="left"> 4684 <paramlink id="heap_filter"/> 4685 </th> 4686 <td> 4687 No 4688 </td> 4689 <td> 4690 <b>Yes</b> 4691 </td> 4692 <td> 4693 <b>Yes</b> 4694 </td> 4695 </tr> 4696 <tr> 4697 <th align="left"> 4698 <paramlink id="klass"/> 4699 </th> 4700 <td> 4701 No 4702 </td> 4703 <td> 4704 <b>Yes</b> 4705 </td> 4706 <td> 4707 <b>Yes</b> 4708 </td> 4709 </tr> 4710 </table> 4711 <p/> 4712 During the execution of this function the state of the heap 4713 does not change: no objects are allocated, no objects are 4714 garbage collected, and the state of objects (including 4715 held values) does not change. 4716 As a result, threads executing Java 4717 programming language code, threads attempting to resume the 4718 execution of Java programming language code, and threads 4719 attempting to execute JNI functions are typically stalled. 4720 </description> 4721 <origin>new</origin> 4722 <capabilities> 4723 <required id="can_tag_objects"></required> 4724 </capabilities> 4725 <parameters> 4726 <param id="heap_filter"> 4727 <jint/> 4728 <description> 4729 This bit vector of 4730 <datalink id="jvmtiHeapFilter">heap filter flags</datalink>. 4731 restricts the objects for which the callback function is called. 4732 This applies to both the object and primitive callbacks. 4733 </description> 4734 </param> 4735 <param id="klass"> 4736 <ptrtype> 4737 <jclass/> 4738 <nullok>callbacks are not limited to instances of a particular class</nullok> 4739 </ptrtype> 4740 <description> 4741 Callbacks are only reported when the object is an instance of 4742 this class. 4743 Objects which are instances of a subclass of <code>klass</code> 4744 are not reported. 4745 If <code>klass</code> is an interface, no objects are reported. 4746 This applies to both the object and primitive callbacks. 4747 </description> 4748 </param> 4749 <param id="callbacks"> 4750 <inptr> 4751 <struct>jvmtiHeapCallbacks</struct> 4752 </inptr> 4753 <description> 4754 Structure defining the set callback functions. 4755 </description> 4756 </param> 4757 <param id="user_data"> 4758 <inbuf> 4759 <void/> 4760 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 4761 </inbuf> 4762 <description> 4763 User supplied data to be passed to the callback. 4764 </description> 4765 </param> 4766 </parameters> 4767 <errors> 4768 <error id="JVMTI_ERROR_INVALID_CLASS"> 4769 <paramlink id="klass"/> is not a valid class. 4770 </error> 4771 </errors> 4772 </function> 4773 4774 <function id="GetTag" phase="start" num="106"> 4775 <synopsis>Get Tag</synopsis> 4776 <description> 4777 Retrieve the tag associated with an object. 4778 The tag is a long value typically used to store a 4779 unique identifier or pointer to object information. 4780 The tag is set with 4781 <functionlink id="SetTag"></functionlink>. 4782 Objects for which no tags have been set return a 4783 tag value of zero. 4784 </description> 4785 <origin>new</origin> 4786 <capabilities> 4787 <required id="can_tag_objects"></required> 4788 </capabilities> 4789 <parameters> 4790 <param id="object"> 4791 <jobject/> 4792 <description> 4793 The object whose tag is to be retrieved. 4794 </description> 4795 </param> 4796 <param id="tag_ptr"> 4797 <outptr><jlong/></outptr> 4798 <description> 4799 On return, the referenced long is set to the value 4800 of the tag. 4801 </description> 4802 </param> 4803 </parameters> 4804 <errors> 4805 </errors> 4806 </function> 4807 4808 <function id="SetTag" phase="start" num="107"> 4809 <synopsis>Set Tag</synopsis> 4810 <description> 4811 Set the tag associated with an object. 4812 The tag is a long value typically used to store a 4813 unique identifier or pointer to object information. 4814 The tag is visible with 4815 <functionlink id="GetTag"></functionlink>. 4816 </description> 4817 <origin>new</origin> 4818 <capabilities> 4819 <required id="can_tag_objects"></required> 4820 </capabilities> 4821 <parameters> 4822 <param id="object"> 4823 <jobject/> 4824 <description> 4825 The object whose tag is to be set. 4826 </description> 4827 </param> 4828 <param id="tag"> 4829 <jlong/> 4830 <description> 4831 The new value of the tag. 4832 </description> 4833 </param> 4834 </parameters> 4835 <errors> 4836 </errors> 4837 </function> 4838 4839 <function id="GetObjectsWithTags" num="114"> 4840 <synopsis>Get Objects With Tags</synopsis> 4841 <description> 4842 Return objects in the heap with the specified tags. 4843 The format is parallel arrays of objects and tags. 4844 </description> 4845 <origin>new</origin> 4846 <capabilities> 4847 <required id="can_tag_objects"></required> 4848 </capabilities> 4849 <parameters> 4850 <param id="tag_count"> 4851 <jint min="0"/> 4852 <description> 4853 Number of tags to scan for. 4854 </description> 4855 </param> 4856 <param id="tags"> 4857 <inbuf incount="tag_count"> 4858 <jlong/> 4859 </inbuf> 4860 <description> 4861 Scan for objects with these tags. 4862 Zero is not permitted in this array. 4863 </description> 4864 </param> 4865 <param id="count_ptr"> 4866 <outptr> 4867 <jint/> 4868 </outptr> 4869 <description> 4870 Return the number of objects with any of the tags 4871 in <paramlink id="tags"/>. 4872 </description> 4873 </param> 4874 <param id="object_result_ptr"> 4875 <allocbuf outcount="count_ptr"> 4876 <jobject/> 4877 <nullok>this information is not returned</nullok> 4878 </allocbuf> 4879 <description> 4880 Returns the array of objects with any of the tags 4881 in <paramlink id="tags"/>. 4882 </description> 4883 </param> 4884 <param id="tag_result_ptr"> 4885 <allocbuf outcount="count_ptr"> 4886 <jlong/> 4887 <nullok>this information is not returned</nullok> 4888 </allocbuf> 4889 <description> 4890 For each object in <paramlink id="object_result_ptr"/>, 4891 return the tag at the corresponding index. 4892 </description> 4893 </param> 4894 </parameters> 4895 <errors> 4896 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 4897 Zero is present in <paramlink id="tags"></paramlink>. 4898 </error> 4899 </errors> 4900 </function> 4901 4902 <function id="ForceGarbageCollection" num="108"> 4903 <synopsis>Force Garbage Collection</synopsis> 4904 <description> 4905 Force the VM to perform a garbage collection. 4906 The garbage collection is as complete as possible. 4907 This function does not cause finalizers to be run. 4908 This function does not return until the garbage collection 4909 is finished. 4910 <p/> 4911 Although garbage collection is as complete 4912 as possible there is no guarantee that all 4913 <eventlink id="ObjectFree"/> 4914 events will have been 4915 sent by the time that this function 4916 returns. In particular, an object may be 4917 prevented from being freed because it 4918 is awaiting finalization. 4919 </description> 4920 <origin>new</origin> 4921 <capabilities> 4922 </capabilities> 4923 <parameters> 4924 </parameters> 4925 <errors> 4926 </errors> 4927 </function> 4928 4929 4930 </category> 4931 4932 <category id="Heap_1_0" label="Heap (1.0)"> 4933 <intro> 4934 <b> 4935 These functions and data types were introduced in the original 4936 <jvmti/> version 1.0 and have been superseded by more 4937 </b> 4938 <internallink id="Heap"><b>powerful and flexible versions</b></internallink> 4939 <b> 4940 which: 4941 </b> 4942 <ul> 4943 <li> 4944 <b> 4945 Allow access to primitive values (the value of Strings, arrays, 4946 and primitive fields) 4947 </b> 4948 </li> 4949 <li> 4950 <b> 4951 Allow the tag of the referrer to be set, thus enabling more 4952 efficient localized reference graph building 4953 </b> 4954 </li> 4955 <li> 4956 <b> 4957 Provide more extensive filtering abilities 4958 </b> 4959 </li> 4960 <li> 4961 <b> 4962 Are extensible, allowing their abilities to grow in future versions of <jvmti/> 4963 </b> 4964 </li> 4965 </ul> 4966 <p/> 4967 <b>Please use the </b> 4968 <internallink id="Heap"><b>current Heap functions</b></internallink>. 4969 <p/> 4970 <constants id="jvmtiHeapObjectFilter" label="Heap Object Filter Enumeration" kind="enum"> 4971 <constant id="JVMTI_HEAP_OBJECT_TAGGED" num="1"> 4972 Tagged objects only. 4973 </constant> 4974 <constant id="JVMTI_HEAP_OBJECT_UNTAGGED" num="2"> 4975 Untagged objects only. 4976 </constant> 4977 <constant id="JVMTI_HEAP_OBJECT_EITHER" num="3"> 4978 Either tagged or untagged objects. 4979 </constant> 4980 </constants> 4981 4982 <constants id="jvmtiHeapRootKind" label="Heap Root Kind Enumeration" kind="enum"> 4983 <constant id="JVMTI_HEAP_ROOT_JNI_GLOBAL" num="1"> 4984 JNI global reference. 4985 </constant> 4986 <constant id="JVMTI_HEAP_ROOT_SYSTEM_CLASS" num="2"> 4987 System class. 4988 </constant> 4989 <constant id="JVMTI_HEAP_ROOT_MONITOR" num="3"> 4990 Monitor. 4991 </constant> 4992 <constant id="JVMTI_HEAP_ROOT_STACK_LOCAL" num="4"> 4993 Stack local. 4994 </constant> 4995 <constant id="JVMTI_HEAP_ROOT_JNI_LOCAL" num="5"> 4996 JNI local reference. 4997 </constant> 4998 <constant id="JVMTI_HEAP_ROOT_THREAD" num="6"> 4999 Thread. 5000 </constant> 5001 <constant id="JVMTI_HEAP_ROOT_OTHER" num="7"> 5002 Other. 5003 </constant> 5004 </constants> 5005 5006 <constants id="jvmtiObjectReferenceKind" label="Object Reference Enumeration" kind="enum"> 5007 <constant id="JVMTI_REFERENCE_CLASS" num="1"> 5008 Reference from an object to its class. 5009 </constant> 5010 <constant id="JVMTI_REFERENCE_FIELD" num="2"> 5011 Reference from an object to the value of one of its instance fields. 5012 For references of this kind the <code>referrer_index</code> 5013 parameter to the <internallink id="jvmtiObjectReferenceCallback"> 5014 jvmtiObjectReferenceCallback</internallink> is the index of the 5015 the instance field. The index is based on the order of all the 5016 object's fields. This includes all fields of the directly declared 5017 static and instance fields in the class, and includes all fields (both 5018 public and private) fields declared in superclasses and superinterfaces. 5019 The index is thus calculated by summing the index of the field in the directly 5020 declared class (see <functionlink id="GetClassFields"/>), with the total 5021 number of fields (both public and private) declared in all superclasses 5022 and superinterfaces. The index starts at zero. 5023 </constant> 5024 <constant id="JVMTI_REFERENCE_ARRAY_ELEMENT" num="3"> 5025 Reference from an array to one of its elements. 5026 For references of this kind the <code>referrer_index</code> 5027 parameter to the <internallink id="jvmtiObjectReferenceCallback"> 5028 jvmtiObjectReferenceCallback</internallink> is the array index. 5029 </constant> 5030 <constant id="JVMTI_REFERENCE_CLASS_LOADER" num="4"> 5031 Reference from a class to its class loader. 5032 </constant> 5033 <constant id="JVMTI_REFERENCE_SIGNERS" num="5"> 5034 Reference from a class to its signers array. 5035 </constant> 5036 <constant id="JVMTI_REFERENCE_PROTECTION_DOMAIN" num="6"> 5037 Reference from a class to its protection domain. 5038 </constant> 5039 <constant id="JVMTI_REFERENCE_INTERFACE" num="7"> 5040 Reference from a class to one of its interfaces. 5041 </constant> 5042 <constant id="JVMTI_REFERENCE_STATIC_FIELD" num="8"> 5043 Reference from a class to the value of one of its static fields. 5044 For references of this kind the <code>referrer_index</code> 5045 parameter to the <internallink id="jvmtiObjectReferenceCallback"> 5046 jvmtiObjectReferenceCallback</internallink> is the index of the 5047 the static field. The index is based on the order of all the 5048 object's fields. This includes all fields of the directly declared 5049 static and instance fields in the class, and includes all fields (both 5050 public and private) fields declared in superclasses and superinterfaces. 5051 The index is thus calculated by summing the index of the field in the directly 5052 declared class (see <functionlink id="GetClassFields"/>), with the total 5053 number of fields (both public and private) declared in all superclasses 5054 and superinterfaces. The index starts at zero. 5055 Note: this definition differs from that in the <jvmti/> 1.0 Specification. 5056 <rationale>No known implementations used the 1.0 definition.</rationale> 5057 </constant> 5058 <constant id="JVMTI_REFERENCE_CONSTANT_POOL" num="9"> 5059 Reference from a class to a resolved entry in the constant pool. 5060 For references of this kind the <code>referrer_index</code> 5061 parameter to the <internallink id="jvmtiObjectReferenceCallback"> 5062 jvmtiObjectReferenceCallback</internallink> is the index into 5063 constant pool table of the class, starting at 1. See 5064 <vmspec chapter="4.4"/>. 5065 </constant> 5066 </constants> 5067 5068 <constants id="jvmtiIterationControl" label="Iteration Control Enumeration" kind="enum"> 5069 <constant id="JVMTI_ITERATION_CONTINUE" num="1"> 5070 Continue the iteration. 5071 If this is a reference iteration, follow the references of this object. 5072 </constant> 5073 <constant id="JVMTI_ITERATION_IGNORE" num="2"> 5074 Continue the iteration. 5075 If this is a reference iteration, ignore the references of this object. 5076 </constant> 5077 <constant id="JVMTI_ITERATION_ABORT" num="0"> 5078 Abort the iteration. 5079 </constant> 5080 </constants> 5081 </intro> 5082 5083 <callback id="jvmtiHeapObjectCallback"> 5084 <enum>jvmtiIterationControl</enum> 5085 <synopsis>Heap Object Callback</synopsis> 5086 <description> 5087 Agent supplied callback function. 5088 Describes (but does not pass in) an object in the heap. 5089 <p/> 5090 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration, 5091 or <code>JVMTI_ITERATION_ABORT</code> to stop iteration. 5092 <p/> 5093 See the <internallink id="heapCallbacks">heap callback 5094 function restrictions</internallink>. 5095 </description> 5096 <parameters> 5097 <param id="class_tag"> 5098 <jlong/> 5099 <description> 5100 The tag of the class of object (zero if the class is not tagged). 5101 If the object represents a runtime class, 5102 the <code>class_tag</code> is the tag 5103 associated with <code>java.lang.Class</code> 5104 (zero if <code>java.lang.Class</code> is not tagged). 5105 </description> 5106 </param> 5107 <param id="size"> 5108 <jlong/> 5109 <description> 5110 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 5111 </description> 5112 </param> 5113 <param id="tag_ptr"> 5114 <outptr><jlong/></outptr> 5115 <description> 5116 The object tag value, or zero if the object is not tagged. 5117 To set the tag value to be associated with the object 5118 the agent sets the <code>jlong</code> pointed to by the parameter. 5119 </description> 5120 </param> 5121 <param id="user_data"> 5122 <outptr><void/></outptr> 5123 <description> 5124 The user supplied data that was passed into the iteration function. 5125 </description> 5126 </param> 5127 </parameters> 5128 </callback> 5129 5130 <callback id="jvmtiHeapRootCallback"> 5131 <enum>jvmtiIterationControl</enum> 5132 <synopsis>Heap Root Object Callback</synopsis> 5133 <description> 5134 Agent supplied callback function. 5135 Describes (but does not pass in) an object that is a root for the purposes 5136 of garbage collection. 5137 <p/> 5138 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration, 5139 <code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing 5140 references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration. 5141 <p/> 5142 See the <internallink id="heapCallbacks">heap callback 5143 function restrictions</internallink>. 5144 </description> 5145 <parameters> 5146 <param id="root_kind"> 5147 <enum>jvmtiHeapRootKind</enum> 5148 <description> 5149 The kind of heap root. 5150 </description> 5151 </param> 5152 <param id="class_tag"> 5153 <jlong/> 5154 <description> 5155 The tag of the class of object (zero if the class is not tagged). 5156 If the object represents a runtime class, the <code>class_tag</code> is the tag 5157 associated with <code>java.lang.Class</code> 5158 (zero if <code>java.lang.Class</code> is not tagged). 5159 </description> 5160 </param> 5161 <param id="size"> 5162 <jlong/> 5163 <description> 5164 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 5165 </description> 5166 </param> 5167 <param id="tag_ptr"> 5168 <outptr><jlong/></outptr> 5169 <description> 5170 The object tag value, or zero if the object is not tagged. 5171 To set the tag value to be associated with the object 5172 the agent sets the <code>jlong</code> pointed to by the parameter. 5173 </description> 5174 </param> 5175 <param id="user_data"> 5176 <outptr><void/></outptr> 5177 <description> 5178 The user supplied data that was passed into the iteration function. 5179 </description> 5180 </param> 5181 </parameters> 5182 </callback> 5183 5184 <callback id="jvmtiStackReferenceCallback"> 5185 <enum>jvmtiIterationControl</enum> 5186 <synopsis>Stack Reference Object Callback</synopsis> 5187 <description> 5188 Agent supplied callback function. 5189 Describes (but does not pass in) an object on the stack that is a root for 5190 the purposes of garbage collection. 5191 <p/> 5192 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration, 5193 <code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing 5194 references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration. 5195 <p/> 5196 See the <internallink id="heapCallbacks">heap callback 5197 function restrictions</internallink>. 5198 </description> 5199 <parameters> 5200 <param id="root_kind"> 5201 <enum>jvmtiHeapRootKind</enum> 5202 <description> 5203 The kind of root (either <code>JVMTI_HEAP_ROOT_STACK_LOCAL</code> or 5204 <code>JVMTI_HEAP_ROOT_JNI_LOCAL</code>). 5205 </description> 5206 </param> 5207 <param id="class_tag"> 5208 <jlong/> 5209 <description> 5210 The tag of the class of object (zero if the class is not tagged). 5211 If the object represents a runtime class, the <code>class_tag</code> is the tag 5212 associated with <code>java.lang.Class</code> 5213 (zero if <code>java.lang.Class</code> is not tagged). 5214 </description> 5215 </param> 5216 <param id="size"> 5217 <jlong/> 5218 <description> 5219 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 5220 </description> 5221 </param> 5222 <param id="tag_ptr"> 5223 <outptr><jlong/></outptr> 5224 <description> 5225 The object tag value, or zero if the object is not tagged. 5226 To set the tag value to be associated with the object 5227 the agent sets the <code>jlong</code> pointed to by the parameter. 5228 </description> 5229 </param> 5230 <param id="thread_tag"> 5231 <jlong/> 5232 <description> 5233 The tag of the thread corresponding to this stack, zero if not tagged. 5234 </description> 5235 </param> 5236 <param id="depth"> 5237 <jint/> 5238 <description> 5239 The depth of the frame. 5240 </description> 5241 </param> 5242 <param id="method"> 5243 <jmethodID/> 5244 <description> 5245 The method executing in this frame. 5246 </description> 5247 </param> 5248 <param id="slot"> 5249 <jint/> 5250 <description> 5251 The slot number. 5252 </description> 5253 </param> 5254 <param id="user_data"> 5255 <outptr><void/></outptr> 5256 <description> 5257 The user supplied data that was passed into the iteration function. 5258 </description> 5259 </param> 5260 </parameters> 5261 </callback> 5262 5263 <callback id="jvmtiObjectReferenceCallback"> 5264 <enum>jvmtiIterationControl</enum> 5265 <synopsis>Object Reference Callback</synopsis> 5266 <description> 5267 Agent supplied callback function. 5268 Describes a reference from an object (the referrer) to another object 5269 (the referree). 5270 <p/> 5271 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration, 5272 <code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing 5273 references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration. 5274 <p/> 5275 See the <internallink id="heapCallbacks">heap callback 5276 function restrictions</internallink>. 5277 </description> 5278 <parameters> 5279 <param id="reference_kind"> 5280 <enum>jvmtiObjectReferenceKind</enum> 5281 <description> 5282 The type of reference. 5283 </description> 5284 </param> 5285 <param id="class_tag"> 5286 <jlong/> 5287 <description> 5288 The tag of the class of referree object (zero if the class is not tagged). 5289 If the referree object represents a runtime class, 5290 the <code>class_tag</code> is the tag 5291 associated with <code>java.lang.Class</code> 5292 (zero if <code>java.lang.Class</code> is not tagged). 5293 </description> 5294 </param> 5295 <param id="size"> 5296 <jlong/> 5297 <description> 5298 Size of the referree object (in bytes). 5299 See <functionlink id="GetObjectSize"/>. 5300 </description> 5301 </param> 5302 <param id="tag_ptr"> 5303 <outptr><jlong/></outptr> 5304 <description> 5305 The referree object tag value, or zero if the object is not 5306 tagged. 5307 To set the tag value to be associated with the object 5308 the agent sets the <code>jlong</code> pointed to by the parameter. 5309 </description> 5310 </param> 5311 <param id="referrer_tag"> 5312 <jlong/> 5313 <description> 5314 The tag of the referrer object, or zero if the referrer 5315 object is not tagged. 5316 </description> 5317 </param> 5318 <param id="referrer_index"> 5319 <jint/> 5320 <description> 5321 For references of type <code>JVMTI_REFERENCE_FIELD</code> or 5322 <code>JVMTI_REFERENCE_STATIC_FIELD</code> the index 5323 of the field in the referrer object. The index is based on the 5324 order of all the object's fields - see <internallink 5325 id="JVMTI_REFERENCE_FIELD">JVMTI_REFERENCE_FIELD</internallink> 5326 or <internallink 5327 id="JVMTI_REFERENCE_STATIC_FIELD">JVMTI_REFERENCE_STATIC_FIELD 5328 </internallink> for further description. 5329 <p/> 5330 For references of type <code>JVMTI_REFERENCE_ARRAY_ELEMENT</code> 5331 the array index - see <internallink id="JVMTI_REFERENCE_ARRAY_ELEMENT"> 5332 JVMTI_REFERENCE_ARRAY_ELEMENT</internallink> for further description. 5333 <p/> 5334 For references of type <code>JVMTI_REFERENCE_CONSTANT_POOL</code> 5335 the index into the constant pool of the class - see 5336 <internallink id="JVMTI_REFERENCE_CONSTANT_POOL"> 5337 JVMTI_REFERENCE_CONSTANT_POOL</internallink> for further 5338 description. 5339 <p/> 5340 For references of other kinds the <code>referrer_index</code> is 5341 <code>-1</code>. 5342 </description> 5343 </param> 5344 <param id="user_data"> 5345 <outptr><void/></outptr> 5346 <description> 5347 The user supplied data that was passed into the iteration function. 5348 </description> 5349 </param> 5350 </parameters> 5351 </callback> 5352 5353 <function id="IterateOverObjectsReachableFromObject" num="109"> 5354 <synopsis>Iterate Over Objects Reachable From Object</synopsis> 5355 <description> 5356 This function iterates over all objects that are directly 5357 and indirectly reachable from the specified object. 5358 For each object <i>A</i> (known 5359 as the referrer) with a reference to object <i>B</i> the specified 5360 callback function is called to describe the object reference. 5361 The callback is called exactly once for each reference from a referrer; 5362 this is true even if there are reference cycles or multiple paths to 5363 the referrer. 5364 There may be more than one reference between a referrer and a referree, 5365 These may be distinguished by the 5366 <datalink id="jvmtiObjectReferenceCallback.reference_kind"></datalink> and 5367 <datalink id="jvmtiObjectReferenceCallback.referrer_index"></datalink>. 5368 The callback for an object will always occur after the callback for 5369 its referrer. 5370 <p/> 5371 See <functionlink id="FollowReferences"/> for the object 5372 references which are reported. 5373 <p/> 5374 During the execution of this function the state of the heap 5375 does not change: no objects are allocated, no objects are 5376 garbage collected, and the state of objects (including 5377 held values) does not change. 5378 As a result, threads executing Java 5379 programming language code, threads attempting to resume the 5380 execution of Java programming language code, and threads 5381 attempting to execute JNI functions are typically stalled. 5382 </description> 5383 <origin>new</origin> 5384 <capabilities> 5385 <required id="can_tag_objects"></required> 5386 </capabilities> 5387 <parameters> 5388 <param id="object"> 5389 <jobject/> 5390 <description> 5391 The object 5392 </description> 5393 </param> 5394 <param id="object_reference_callback"> 5395 <ptrtype> 5396 <struct>jvmtiObjectReferenceCallback</struct> 5397 </ptrtype> 5398 <description> 5399 The callback to be called to describe each 5400 object reference. 5401 </description> 5402 </param> 5403 <param id="user_data"> 5404 <inbuf> 5405 <void/> 5406 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 5407 </inbuf> 5408 <description> 5409 User supplied data to be passed to the callback. 5410 </description> 5411 </param> 5412 </parameters> 5413 <errors> 5414 </errors> 5415 </function> 5416 5417 <function id="IterateOverReachableObjects" num="110"> 5418 <synopsis>Iterate Over Reachable Objects</synopsis> 5419 <description> 5420 This function iterates over the root objects and all objects that 5421 are directly and indirectly reachable from the root objects. 5422 The root objects comprise the set of system classes, 5423 JNI globals, references from thread stacks, and other objects used as roots 5424 for the purposes of garbage collection. 5425 <p/> 5426 For each root the <paramlink id="heap_root_callback"></paramlink> 5427 or <paramlink id="stack_ref_callback"></paramlink> callback is called. 5428 An object can be a root object for more than one reason and in that case 5429 the appropriate callback is called for each reason. 5430 <p/> 5431 For each object reference the <paramlink id="object_ref_callback"></paramlink> 5432 callback function is called to describe the object reference. 5433 The callback is called exactly once for each reference from a referrer; 5434 this is true even if there are reference cycles or multiple paths to 5435 the referrer. 5436 There may be more than one reference between a referrer and a referree, 5437 These may be distinguished by the 5438 <datalink id="jvmtiObjectReferenceCallback.reference_kind"></datalink> and 5439 <datalink id="jvmtiObjectReferenceCallback.referrer_index"></datalink>. 5440 The callback for an object will always occur after the callback for 5441 its referrer. 5442 <p/> 5443 See <functionlink id="FollowReferences"/> for the object 5444 references which are reported. 5445 <p/> 5446 Roots are always reported to the profiler before any object references 5447 are reported. In other words, the <paramlink id="object_ref_callback"></paramlink> 5448 callback will not be called until the appropriate callback has been called 5449 for all roots. If the <paramlink id="object_ref_callback"></paramlink> callback is 5450 specified as <code>NULL</code> then this function returns after 5451 reporting the root objects to the profiler. 5452 <p/> 5453 During the execution of this function the state of the heap 5454 does not change: no objects are allocated, no objects are 5455 garbage collected, and the state of objects (including 5456 held values) does not change. 5457 As a result, threads executing Java 5458 programming language code, threads attempting to resume the 5459 execution of Java programming language code, and threads 5460 attempting to execute JNI functions are typically stalled. 5461 </description> 5462 <origin>new</origin> 5463 <capabilities> 5464 <required id="can_tag_objects"></required> 5465 </capabilities> 5466 <parameters> 5467 <param id="heap_root_callback"> 5468 <ptrtype> 5469 <struct>jvmtiHeapRootCallback</struct> 5470 <nullok>do not report heap roots</nullok> 5471 </ptrtype> 5472 <description> 5473 The callback function to be called for each heap root of type 5474 <code>JVMTI_HEAP_ROOT_JNI_GLOBAL</code>, 5475 <code>JVMTI_HEAP_ROOT_SYSTEM_CLASS</code>, 5476 <code>JVMTI_HEAP_ROOT_MONITOR</code>, 5477 <code>JVMTI_HEAP_ROOT_THREAD</code>, or 5478 <code>JVMTI_HEAP_ROOT_OTHER</code>. 5479 </description> 5480 </param> 5481 <param id="stack_ref_callback"> 5482 <ptrtype> 5483 <struct>jvmtiStackReferenceCallback</struct> 5484 <nullok>do not report stack references</nullok> 5485 </ptrtype> 5486 <description> 5487 The callback function to be called for each heap root of 5488 <code>JVMTI_HEAP_ROOT_STACK_LOCAL</code> or 5489 <code>JVMTI_HEAP_ROOT_JNI_LOCAL</code>. 5490 </description> 5491 </param> 5492 <param id="object_ref_callback"> 5493 <ptrtype> 5494 <struct>jvmtiObjectReferenceCallback</struct> 5495 <nullok>do not follow references from the root objects</nullok> 5496 </ptrtype> 5497 <description> 5498 The callback function to be called for each object reference. 5499 </description> 5500 </param> 5501 <param id="user_data"> 5502 <inbuf> 5503 <void/> 5504 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 5505 </inbuf> 5506 <description> 5507 User supplied data to be passed to the callback. 5508 </description> 5509 </param> 5510 </parameters> 5511 <errors> 5512 </errors> 5513 </function> 5514 5515 <function id="IterateOverHeap" num="111"> 5516 <synopsis>Iterate Over Heap</synopsis> 5517 <description> 5518 Iterate over all objects in the heap. This includes both reachable and 5519 unreachable objects. 5520 <p/> 5521 The <paramlink id="object_filter"></paramlink> parameter indicates the 5522 objects for which the callback function is called. If this parameter 5523 is <code>JVMTI_HEAP_OBJECT_TAGGED</code> then the callback will only be 5524 called for every object that is tagged. If the parameter is 5525 <code>JVMTI_HEAP_OBJECT_UNTAGGED</code> then the callback will only be 5526 for objects that are not tagged. If the parameter 5527 is <code>JVMTI_HEAP_OBJECT_EITHER</code> then the callback will be 5528 called for every object in the heap, irrespective of whether it is 5529 tagged or not. 5530 <p/> 5531 During the execution of this function the state of the heap 5532 does not change: no objects are allocated, no objects are 5533 garbage collected, and the state of objects (including 5534 held values) does not change. 5535 As a result, threads executing Java 5536 programming language code, threads attempting to resume the 5537 execution of Java programming language code, and threads 5538 attempting to execute JNI functions are typically stalled. 5539 </description> 5540 <origin>new</origin> 5541 <capabilities> 5542 <required id="can_tag_objects"></required> 5543 </capabilities> 5544 <parameters> 5545 <param id="object_filter"> 5546 <enum>jvmtiHeapObjectFilter</enum> 5547 <description> 5548 Indicates the objects for which the callback function is called. 5549 </description> 5550 </param> 5551 <param id="heap_object_callback"> 5552 <ptrtype> 5553 <struct>jvmtiHeapObjectCallback</struct> 5554 </ptrtype> 5555 <description> 5556 The iterator function to be called for each 5557 object matching the <paramlink id="object_filter"/>. 5558 </description> 5559 </param> 5560 <param id="user_data"> 5561 <inbuf> 5562 <void/> 5563 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 5564 </inbuf> 5565 <description> 5566 User supplied data to be passed to the callback. 5567 </description> 5568 </param> 5569 </parameters> 5570 <errors> 5571 </errors> 5572 </function> 5573 5574 <function id="IterateOverInstancesOfClass" num="112"> 5575 <synopsis>Iterate Over Instances Of Class</synopsis> 5576 <description> 5577 Iterate over all objects in the heap that are instances of the specified class. 5578 This includes direct instances of the specified class and 5579 instances of all subclasses of the specified class. 5580 This includes both reachable and unreachable objects. 5581 <p/> 5582 The <paramlink id="object_filter"></paramlink> parameter indicates the 5583 objects for which the callback function is called. If this parameter 5584 is <code>JVMTI_HEAP_OBJECT_TAGGED</code> then the callback will only be 5585 called for every object that is tagged. If the parameter is 5586 <code>JVMTI_HEAP_OBJECT_UNTAGGED</code> then the callback will only be 5587 called for objects that are not tagged. If the parameter 5588 is <code>JVMTI_HEAP_OBJECT_EITHER</code> then the callback will be 5589 called for every object in the heap, irrespective of whether it is 5590 tagged or not. 5591 <p/> 5592 During the execution of this function the state of the heap 5593 does not change: no objects are allocated, no objects are 5594 garbage collected, and the state of objects (including 5595 held values) does not change. 5596 As a result, threads executing Java 5597 programming language code, threads attempting to resume the 5598 execution of Java programming language code, and threads 5599 attempting to execute JNI functions are typically stalled. 5600 </description> 5601 <origin>new</origin> 5602 <capabilities> 5603 <required id="can_tag_objects"></required> 5604 </capabilities> 5605 <parameters> 5606 <param id="klass"> 5607 <jclass/> 5608 <description> 5609 Iterate over objects of this class only. 5610 </description> 5611 </param> 5612 <param id="object_filter"> 5613 <enum>jvmtiHeapObjectFilter</enum> 5614 <description> 5615 Indicates the objects for which the callback function is called. 5616 </description> 5617 </param> 5618 <param id="heap_object_callback"> 5619 <ptrtype> 5620 <struct>jvmtiHeapObjectCallback</struct> 5621 </ptrtype> 5622 <description> 5623 The iterator function to be called for each 5624 <paramlink id="klass"/> instance matching 5625 the <paramlink id="object_filter"/>. 5626 </description> 5627 </param> 5628 <param id="user_data"> 5629 <inbuf> 5630 <void/> 5631 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 5632 </inbuf> 5633 <description> 5634 User supplied data to be passed to the callback. 5635 </description> 5636 </param> 5637 </parameters> 5638 <errors> 5639 </errors> 5640 </function> 5641 5642 </category> 5643 5644 <category id="local" label="Local Variable"> 5645 5646 <intro> 5647 These functions are used to retrieve or set the value of a local variable. 5648 The variable is identified by the depth of the frame containing its 5649 value and the variable's slot number within that frame. 5650 The mapping of variables to 5651 slot numbers can be obtained with the function 5652 <functionlink id="GetLocalVariableTable"></functionlink>. 5653 </intro> 5654 5655 <function id="GetLocalObject" num="21"> 5656 <synopsis>Get Local Variable - Object</synopsis> 5657 <description> 5658 This function can be used to retrieve the value of a local 5659 variable whose type is <code>Object</code> or a subclass of <code>Object</code>. 5660 </description> 5661 <origin>jvmdi</origin> 5662 <capabilities> 5663 <required id="can_access_local_variables"></required> 5664 </capabilities> 5665 <parameters> 5666 <param id="thread"> 5667 <jthread null="current" frame="frame"/> 5668 <description> 5669 The thread of the frame containing the variable's value. 5670 </description> 5671 </param> 5672 <param id="depth"> 5673 <jframeID thread="thread"/> 5674 <description> 5675 The depth of the frame containing the variable's value. 5676 </description> 5677 </param> 5678 <param id="slot"> 5679 <jint/> 5680 <description> 5681 The variable's slot number. 5682 </description> 5683 </param> 5684 <param id="value_ptr"> 5685 <outptr><jobject/></outptr> 5686 <description> 5687 On return, points to the variable's value. 5688 </description> 5689 </param> 5690 </parameters> 5691 <errors> 5692 <error id="JVMTI_ERROR_INVALID_SLOT"> 5693 Invalid <code>slot</code>. 5694 </error> 5695 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 5696 The variable type is not 5697 <code>Object</code> or a subclass of <code>Object</code>. 5698 </error> 5699 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 5700 Not a visible frame 5701 </error> 5702 </errors> 5703 </function> 5704 5705 <function id="GetLocalInstance" num="155" since="1.2"> 5706 <synopsis>Get Local Instance</synopsis> 5707 <description> 5708 This function can be used to retrieve the value of the local object 5709 variable at slot 0 (the "<code>this</code>" object) from non-static 5710 frames. This function can retrieve the "<code>this</code>" object from 5711 native method frames, whereas <code>GetLocalObject()</code> would 5712 return <code>JVMTI_ERROR_OPAQUE_FRAME</code> in those cases. 5713 </description> 5714 <origin>new</origin> 5715 <capabilities> 5716 <required id="can_access_local_variables"></required> 5717 </capabilities> 5718 <parameters> 5719 <param id="thread"> 5720 <jthread null="current" frame="frame"/> 5721 <description> 5722 The thread of the frame containing the variable's value. 5723 </description> 5724 </param> 5725 <param id="depth"> 5726 <jframeID thread="thread"/> 5727 <description> 5728 The depth of the frame containing the variable's value. 5729 </description> 5730 </param> 5731 <param id="value_ptr"> 5732 <outptr><jobject/></outptr> 5733 <description> 5734 On return, points to the variable's value. 5735 </description> 5736 </param> 5737 </parameters> 5738 <errors> 5739 <error id="JVMTI_ERROR_INVALID_SLOT"> 5740 If the specified frame is a static method frame. 5741 </error> 5742 </errors> 5743 </function> 5744 <function id="GetLocalInt" num="22"> 5745 <synopsis>Get Local Variable - Int</synopsis> 5746 <description> 5747 This function can be used to retrieve the value of a local 5748 variable whose type is <code>int</code>, 5749 <code>short</code>, <code>char</code>, <code>byte</code>, or 5750 <code>boolean</code>. 5751 </description> 5752 <origin>jvmdi</origin> 5753 <capabilities> 5754 <required id="can_access_local_variables"></required> 5755 </capabilities> 5756 <parameters> 5757 <param id="thread"> 5758 <jthread null="current" frame="frame"/> 5759 <description> 5760 The thread of the frame containing the variable's value. 5761 </description> 5762 </param> 5763 <param id="depth"> 5764 <jframeID thread="thread"/> 5765 <description> 5766 The depth of the frame containing the variable's value. 5767 </description> 5768 </param> 5769 <param id="slot"> 5770 <jint/> 5771 <description> 5772 The variable's slot number. 5773 </description> 5774 </param> 5775 <param id="value_ptr"> 5776 <outptr><jint/></outptr> 5777 <description> 5778 On return, points to the variable's value. 5779 </description> 5780 </param> 5781 </parameters> 5782 <errors> 5783 <error id="JVMTI_ERROR_INVALID_SLOT"> 5784 Invalid <code>slot</code>. 5785 </error> 5786 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 5787 The variable type is not 5788 <code>int</code>, <code>short</code>, 5789 <code>char</code>, <code>byte</code>, or 5790 <code>boolean</code>. 5791 </error> 5792 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 5793 Not a visible frame 5794 </error> 5795 </errors> 5796 </function> 5797 5798 <function id="GetLocalLong" num="23"> 5799 <synopsis>Get Local Variable - Long</synopsis> 5800 <description> 5801 This function can be used to retrieve the value of a local 5802 variable whose type is <code>long</code>. 5803 </description> 5804 <origin>jvmdi</origin> 5805 <capabilities> 5806 <required id="can_access_local_variables"></required> 5807 </capabilities> 5808 <parameters> 5809 <param id="thread"> 5810 <jthread null="current" frame="frame"/> 5811 <description> 5812 The thread of the frame containing the variable's value. 5813 </description> 5814 </param> 5815 <param id="depth"> 5816 <jframeID thread="thread"/> 5817 <description> 5818 The depth of the frame containing the variable's value. 5819 </description> 5820 </param> 5821 <param id="slot"> 5822 <jint/> 5823 <description> 5824 The variable's slot number. 5825 </description> 5826 </param> 5827 <param id="value_ptr"> 5828 <outptr><jlong/></outptr> 5829 <description> 5830 On return, points to the variable's value. 5831 </description> 5832 </param> 5833 </parameters> 5834 <errors> 5835 <error id="JVMTI_ERROR_INVALID_SLOT"> 5836 Invalid <code>slot</code>. 5837 </error> 5838 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 5839 The variable type is not <code>long</code>. 5840 </error> 5841 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 5842 Not a visible frame 5843 </error> 5844 </errors> 5845 </function> 5846 5847 <function id="GetLocalFloat" num="24"> 5848 <synopsis>Get Local Variable - Float</synopsis> 5849 <description> 5850 This function can be used to retrieve the value of a local 5851 variable whose type is <code>float</code>. 5852 </description> 5853 <origin>jvmdi</origin> 5854 <capabilities> 5855 <required id="can_access_local_variables"></required> 5856 </capabilities> 5857 <parameters> 5858 <param id="thread"> 5859 <jthread null="current" frame="frame"/> 5860 <description> 5861 The thread of the frame containing the variable's value. 5862 </description> 5863 </param> 5864 <param id="depth"> 5865 <jframeID thread="thread"/> 5866 <description> 5867 The depth of the frame containing the variable's value. 5868 </description> 5869 </param> 5870 <param id="slot"> 5871 <jint/> 5872 <description> 5873 The variable's slot number. 5874 </description> 5875 </param> 5876 <param id="value_ptr"> 5877 <outptr><jfloat/></outptr> 5878 <description> 5879 On return, points to the variable's value. 5880 </description> 5881 </param> 5882 </parameters> 5883 <errors> 5884 <error id="JVMTI_ERROR_INVALID_SLOT"> 5885 Invalid <code>slot</code>. 5886 </error> 5887 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 5888 The variable type is not <code>float</code>. 5889 </error> 5890 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 5891 Not a visible frame 5892 </error> 5893 </errors> 5894 </function> 5895 5896 <function id="GetLocalDouble" num="25"> 5897 <synopsis>Get Local Variable - Double</synopsis> 5898 <description> 5899 This function can be used to retrieve the value of a local 5900 variable whose type is <code>long</code>. 5901 </description> 5902 <origin>jvmdi</origin> 5903 <capabilities> 5904 <required id="can_access_local_variables"></required> 5905 </capabilities> 5906 <parameters> 5907 <param id="thread"> 5908 <jthread null="current" frame="frame"/> 5909 <description> 5910 The thread of the frame containing the variable's value. 5911 </description> 5912 </param> 5913 <param id="depth"> 5914 <jframeID thread="thread"/> 5915 <description> 5916 The depth of the frame containing the variable's value. 5917 </description> 5918 </param> 5919 <param id="slot"> 5920 <jint/> 5921 <description> 5922 The variable's slot number. 5923 </description> 5924 </param> 5925 <param id="value_ptr"> 5926 <outptr><jdouble/></outptr> 5927 <description> 5928 On return, points to the variable's value. 5929 </description> 5930 </param> 5931 </parameters> 5932 <errors> 5933 <error id="JVMTI_ERROR_INVALID_SLOT"> 5934 Invalid <code>slot</code>. 5935 </error> 5936 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 5937 The variable type is not <code>double</code>. 5938 </error> 5939 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 5940 Not a visible frame 5941 </error> 5942 </errors> 5943 </function> 5944 5945 <function id="SetLocalObject" num="26"> 5946 <synopsis>Set Local Variable - Object</synopsis> 5947 <description> 5948 This function can be used to set the value of a local 5949 variable whose type is <code>Object</code> or a subclass of <code>Object</code>. 5950 </description> 5951 <origin>jvmdi</origin> 5952 <capabilities> 5953 <required id="can_access_local_variables"></required> 5954 </capabilities> 5955 <parameters> 5956 <param id="thread"> 5957 <jthread null="current" frame="frame"/> 5958 <description> 5959 The thread of the frame containing the variable's value. 5960 </description> 5961 </param> 5962 <param id="depth"> 5963 <jframeID thread="thread"/> 5964 <description> 5965 The depth of the frame containing the variable's value. 5966 </description> 5967 </param> 5968 <param id="slot"> 5969 <jint/> 5970 <description> 5971 The variable's slot number. 5972 </description> 5973 </param> 5974 <param id="value"> 5975 <jobject/> 5976 <description> 5977 The new value for the variable. 5978 </description> 5979 </param> 5980 </parameters> 5981 <errors> 5982 <error id="JVMTI_ERROR_INVALID_SLOT"> 5983 Invalid <code>slot</code>. 5984 </error> 5985 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 5986 The variable type is not 5987 <code>Object</code> or a subclass of <code>Object</code>. 5988 </error> 5989 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 5990 The supplied <paramlink id="value"/> is not compatible 5991 with the variable type. 5992 </error> 5993 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 5994 Not a visible frame 5995 </error> 5996 </errors> 5997 </function> 5998 5999 <function id="SetLocalInt" num="27"> 6000 <synopsis>Set Local Variable - Int</synopsis> 6001 <description> 6002 This function can be used to set the value of a local 6003 variable whose type is <code>int</code>, 6004 <code>short</code>, <code>char</code>, <code>byte</code>, or 6005 <code>boolean</code>. 6006 </description> 6007 <origin>jvmdi</origin> 6008 <capabilities> 6009 <required id="can_access_local_variables"></required> 6010 </capabilities> 6011 <parameters> 6012 <param id="thread"> 6013 <jthread null="current" frame="frame"/> 6014 <description> 6015 The thread of the frame containing the variable's value. 6016 </description> 6017 </param> 6018 <param id="depth"> 6019 <jframeID thread="thread"/> 6020 <description> 6021 The depth of the frame containing the variable's value. 6022 </description> 6023 </param> 6024 <param id="slot"> 6025 <jint/> 6026 <description> 6027 The variable's slot number. 6028 </description> 6029 </param> 6030 <param id="value"> 6031 <jint/> 6032 <description> 6033 The new value for the variable. 6034 </description> 6035 </param> 6036 </parameters> 6037 <errors> 6038 <error id="JVMTI_ERROR_INVALID_SLOT"> 6039 Invalid <code>slot</code>. 6040 </error> 6041 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6042 The variable type is not 6043 <code>int</code>, <code>short</code>, 6044 <code>char</code>, <code>byte</code>, or 6045 <code>boolean</code>. 6046 </error> 6047 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6048 Not a visible frame 6049 </error> 6050 </errors> 6051 </function> 6052 6053 <function id="SetLocalLong" num="28"> 6054 <synopsis>Set Local Variable - Long</synopsis> 6055 <description> 6056 This function can be used to set the value of a local 6057 variable whose type is <code>long</code>. 6058 </description> 6059 <origin>jvmdi</origin> 6060 <capabilities> 6061 <required id="can_access_local_variables"></required> 6062 </capabilities> 6063 <parameters> 6064 <param id="thread"> 6065 <jthread null="current" frame="frame"/> 6066 <description> 6067 The thread of the frame containing the variable's value. 6068 </description> 6069 </param> 6070 <param id="depth"> 6071 <jframeID thread="thread"/> 6072 <description> 6073 The depth of the frame containing the variable's value. 6074 </description> 6075 </param> 6076 <param id="slot"> 6077 <jint/> 6078 <description> 6079 The variable's slot number. 6080 </description> 6081 </param> 6082 <param id="value"> 6083 <jlong/> 6084 <description> 6085 The new value for the variable. 6086 </description> 6087 </param> 6088 </parameters> 6089 <errors> 6090 <error id="JVMTI_ERROR_INVALID_SLOT"> 6091 Invalid <code>slot</code>. 6092 </error> 6093 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6094 The variable type is not <code>long</code>. 6095 </error> 6096 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6097 Not a visible frame 6098 </error> 6099 </errors> 6100 </function> 6101 6102 <function id="SetLocalFloat" num="29"> 6103 <synopsis>Set Local Variable - Float</synopsis> 6104 <description> 6105 This function can be used to set the value of a local 6106 variable whose type is <code>float</code>. 6107 </description> 6108 <origin>jvmdi</origin> 6109 <capabilities> 6110 <required id="can_access_local_variables"></required> 6111 </capabilities> 6112 <parameters> 6113 <param id="thread"> 6114 <jthread null="current" frame="frame"/> 6115 <description> 6116 The thread of the frame containing the variable's value. 6117 </description> 6118 </param> 6119 <param id="depth"> 6120 <jframeID thread="thread"/> 6121 <description> 6122 The depth of the frame containing the variable's value. 6123 </description> 6124 </param> 6125 <param id="slot"> 6126 <jint/> 6127 <description> 6128 The variable's slot number. 6129 </description> 6130 </param> 6131 <param id="value"> 6132 <jfloat/> 6133 <description> 6134 The new value for the variable. 6135 </description> 6136 </param> 6137 </parameters> 6138 <errors> 6139 <error id="JVMTI_ERROR_INVALID_SLOT"> 6140 Invalid <code>slot</code>. 6141 </error> 6142 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6143 The variable type is not <code>float</code>. 6144 </error> 6145 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6146 Not a visible frame 6147 </error> 6148 </errors> 6149 </function> 6150 6151 <function id="SetLocalDouble" num="30"> 6152 <synopsis>Set Local Variable - Double</synopsis> 6153 <description> 6154 This function can be used to set the value of a local 6155 variable whose type is <code>double</code>. 6156 </description> 6157 <origin>jvmdi</origin> 6158 <capabilities> 6159 <required id="can_access_local_variables"></required> 6160 </capabilities> 6161 <parameters> 6162 <param id="thread"> 6163 <jthread null="current" frame="frame"/> 6164 <description> 6165 The thread of the frame containing the variable's value. 6166 </description> 6167 </param> 6168 <param id="depth"> 6169 <jframeID thread="thread"/> 6170 <description> 6171 The depth of the frame containing the variable's value. 6172 </description> 6173 </param> 6174 <param id="slot"> 6175 <jint/> 6176 <description> 6177 The variable's slot number. 6178 </description> 6179 </param> 6180 <param id="value"> 6181 <jdouble/> 6182 <description> 6183 The new value for the variable. 6184 </description> 6185 </param> 6186 </parameters> 6187 <errors> 6188 <error id="JVMTI_ERROR_INVALID_SLOT"> 6189 Invalid <code>slot</code>. 6190 </error> 6191 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6192 The variable type is not <code>double</code>. 6193 </error> 6194 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6195 Not a visible frame 6196 </error> 6197 </errors> 6198 </function> 6199 </category> 6200 6201 <category id="breakpointCategory" label="Breakpoint"> 6202 6203 <intro> 6204 </intro> 6205 6206 <function id="SetBreakpoint" num="38"> 6207 <synopsis>Set Breakpoint</synopsis> 6208 <description> 6209 Set a breakpoint at the instruction indicated by 6210 <code>method</code> and <code>location</code>. 6211 An instruction can only have one breakpoint. 6212 <p/> 6213 Whenever the designated instruction is about to be executed, a 6214 <eventlink id="Breakpoint"></eventlink> event is generated. 6215 </description> 6216 <origin>jvmdi</origin> 6217 <capabilities> 6218 <required id="can_generate_breakpoint_events"></required> 6219 </capabilities> 6220 <parameters> 6221 <param id="klass"> 6222 <jclass method="method"/> 6223 <description> 6224 The class in which to set the breakpoint 6225 </description> 6226 </param> 6227 <param id="method"> 6228 <jmethodID class="klass"/> 6229 <description> 6230 The method in which to set the breakpoint 6231 </description> 6232 </param> 6233 <param id="location"> 6234 <jlocation/> 6235 <description> 6236 the index of the instruction at which to set the breakpoint 6237 6238 </description> 6239 </param> 6240 </parameters> 6241 <errors> 6242 <error id="JVMTI_ERROR_DUPLICATE"> 6243 The designated bytecode already has a breakpoint. 6244 </error> 6245 </errors> 6246 </function> 6247 6248 <function id="ClearBreakpoint" num="39"> 6249 <synopsis>Clear Breakpoint</synopsis> 6250 <description> 6251 Clear the breakpoint at the bytecode indicated by 6252 <code>method</code> and <code>location</code>. 6253 </description> 6254 <origin>jvmdi</origin> 6255 <capabilities> 6256 <required id="can_generate_breakpoint_events"></required> 6257 </capabilities> 6258 <parameters> 6259 <param id="klass"> 6260 <jclass method="method"/> 6261 <description> 6262 The class in which to clear the breakpoint 6263 </description> 6264 </param> 6265 <param id="method"> 6266 <jmethodID class="klass"/> 6267 <description> 6268 The method in which to clear the breakpoint 6269 </description> 6270 </param> 6271 <param id="location"> 6272 <jlocation/> 6273 <description> 6274 the index of the instruction at which to clear the breakpoint 6275 </description> 6276 </param> 6277 </parameters> 6278 <errors> 6279 <error id="JVMTI_ERROR_NOT_FOUND"> 6280 There's no breakpoint at the designated bytecode. 6281 </error> 6282 </errors> 6283 </function> 6284 6285 </category> 6286 6287 <category id="fieldWatch" label="Watched Field"> 6288 6289 <intro> 6290 </intro> 6291 6292 <function id="SetFieldAccessWatch" num="41"> 6293 <synopsis>Set Field Access Watch</synopsis> 6294 <description> 6295 Generate a <eventlink id="FieldAccess"></eventlink> event 6296 when the field specified 6297 by <code>klass</code> and 6298 <code>field</code> is about to be accessed. 6299 An event will be generated for each access of the field 6300 until it is canceled with 6301 <functionlink id="ClearFieldAccessWatch"></functionlink>. 6302 Field accesses from Java programming language code or from JNI code are watched, 6303 fields modified by other means are not watched. 6304 Note that <jvmti/> users should be aware that their own field accesses 6305 will trigger the watch. 6306 A field can only have one field access watch set. 6307 Modification of a field is not considered an access--use 6308 <functionlink id="SetFieldModificationWatch"></functionlink> 6309 to monitor modifications. 6310 </description> 6311 <origin>jvmdi</origin> 6312 <capabilities> 6313 <required id="can_generate_field_access_events"></required> 6314 </capabilities> 6315 <parameters> 6316 <param id="klass"> 6317 <jclass field="field"/> 6318 <description> 6319 The class containing the field to watch 6320 </description> 6321 </param> 6322 <param id="field"> 6323 <jfieldID class="klass"/> 6324 <description> 6325 The field to watch 6326 6327 </description> 6328 </param> 6329 </parameters> 6330 <errors> 6331 <error id="JVMTI_ERROR_DUPLICATE"> 6332 The designated field is already being watched for accesses. 6333 </error> 6334 </errors> 6335 </function> 6336 6337 <function id="ClearFieldAccessWatch" num="42"> 6338 <synopsis>Clear Field Access Watch</synopsis> 6339 <description> 6340 Cancel a field access watch previously set by 6341 <functionlink id="SetFieldAccessWatch"></functionlink>, on the 6342 field specified 6343 by <code>klass</code> and 6344 <code>field</code>. 6345 </description> 6346 <origin>jvmdi</origin> 6347 <capabilities> 6348 <required id="can_generate_field_access_events"></required> 6349 </capabilities> 6350 <parameters> 6351 <param id="klass"> 6352 <jclass field="field"/> 6353 <description> 6354 The class containing the field to watch 6355 </description> 6356 </param> 6357 <param id="field"> 6358 <jfieldID class="klass"/> 6359 <description> 6360 The field to watch 6361 6362 </description> 6363 </param> 6364 </parameters> 6365 <errors> 6366 <error id="JVMTI_ERROR_NOT_FOUND"> 6367 The designated field is not being watched for accesses. 6368 </error> 6369 </errors> 6370 </function> 6371 6372 <function id="SetFieldModificationWatch" num="43"> 6373 <synopsis>Set Field Modification Watch</synopsis> 6374 <description> 6375 Generate a <eventlink id="FieldModification"></eventlink> event 6376 when the field specified 6377 by <code>klass</code> and 6378 <code>field</code> is about to be modified. 6379 An event will be generated for each modification of the field 6380 until it is canceled with 6381 <functionlink id="ClearFieldModificationWatch"></functionlink>. 6382 Field modifications from Java programming language code or from JNI code are watched, 6383 fields modified by other means are not watched. 6384 Note that <jvmti/> users should be aware that their own field modifications 6385 will trigger the watch. 6386 A field can only have one field modification watch set. 6387 </description> 6388 <origin>jvmdi</origin> 6389 <capabilities> 6390 <required id="can_generate_field_modification_events"></required> 6391 </capabilities> 6392 <parameters> 6393 <param id="klass"> 6394 <jclass field="field"/> 6395 <description> 6396 The class containing the field to watch 6397 </description> 6398 </param> 6399 <param id="field"> 6400 <jfieldID class="klass"/> 6401 <description> 6402 The field to watch 6403 6404 </description> 6405 </param> 6406 </parameters> 6407 <errors> 6408 <error id="JVMTI_ERROR_DUPLICATE"> 6409 The designated field is already being watched for modifications. 6410 </error> 6411 </errors> 6412 </function> 6413 6414 <function id="ClearFieldModificationWatch" num="44"> 6415 <synopsis>Clear Field Modification Watch</synopsis> 6416 <description> 6417 6418 Cancel a field modification watch previously set by 6419 <functionlink id="SetFieldModificationWatch"></functionlink>, on the 6420 field specified 6421 by <code>klass</code> and 6422 <code>field</code>. 6423 </description> 6424 <origin>jvmdi</origin> 6425 <capabilities> 6426 <required id="can_generate_field_modification_events"></required> 6427 </capabilities> 6428 <parameters> 6429 <param id="klass"> 6430 <jclass field="field"/> 6431 <description> 6432 The class containing the field to watch 6433 </description> 6434 </param> 6435 <param id="field"> 6436 <jfieldID class="klass"/> 6437 <description> 6438 The field to watch 6439 6440 </description> 6441 </param> 6442 </parameters> 6443 <errors> 6444 <error id="JVMTI_ERROR_NOT_FOUND"> 6445 The designated field is not being watched for modifications. 6446 </error> 6447 </errors> 6448 </function> 6449 </category> 6450 6451 <category id="class" label="Class"> 6452 6453 <intro> 6454 </intro> 6455 6456 <function id="GetLoadedClasses" jkernel="yes" num="78"> 6457 <synopsis>Get Loaded Classes</synopsis> 6458 <description> 6459 Return an array of all classes loaded in the virtual machine. 6460 The number of classes in the array is returned via 6461 <code>class_count_ptr</code>, and the array itself via 6462 <code>classes_ptr</code>. 6463 <p/> 6464 Array classes of all types (including arrays of primitive types) are 6465 included in the returned list. Primitive classes (for example, 6466 <code>java.lang.Integer.TYPE</code>) are <i>not</i> included in this list. 6467 </description> 6468 <origin>jvmdi</origin> 6469 <capabilities> 6470 </capabilities> 6471 <parameters> 6472 <param id="class_count_ptr"> 6473 <outptr><jint/></outptr> 6474 <description> 6475 On return, points to the number of classes. 6476 </description> 6477 </param> 6478 <param id="classes_ptr"> 6479 <allocbuf outcount="class_count_ptr"><jclass/></allocbuf> 6480 <description> 6481 On return, points to an array of references, one 6482 for each class. 6483 </description> 6484 </param> 6485 </parameters> 6486 <errors> 6487 </errors> 6488 </function> 6489 6490 <function id="GetClassLoaderClasses" jkernel="yes" num="79"> 6491 <synopsis>Get Classloader Classes</synopsis> 6492 <description> 6493 Returns an array of those classes for which this class loader has 6494 been recorded as an initiating loader. Each 6495 class in the returned array was created by this class loader, 6496 either by defining it directly or by delegation to another class loader. 6497 See <vmspec chapter="5.3"/>. 6498 <p/> 6499 For JDK version 1.1 implementations that don't 6500 recognize the distinction between initiating and defining class loaders, 6501 this function should return all classes loaded in the virtual machine. 6502 The number of classes in the array is returned via 6503 <code>class_count_ptr</code>, and the array itself via 6504 <code>classes_ptr</code>. 6505 </description> 6506 <origin>jvmdi</origin> 6507 <capabilities> 6508 </capabilities> 6509 <parameters> 6510 <param id="initiating_loader"> 6511 <ptrtype> 6512 <jobject/> 6513 <nullok>the classes initiated by the bootstrap loader will be returned</nullok> 6514 </ptrtype> 6515 <description> 6516 An initiating class loader. 6517 </description> 6518 </param> 6519 <param id="class_count_ptr"> 6520 <outptr><jint/></outptr> 6521 <description> 6522 On return, points to the number of classes. 6523 </description> 6524 </param> 6525 <param id="classes_ptr"> 6526 <allocbuf outcount="class_count_ptr"><jclass/></allocbuf> 6527 <description> 6528 On return, points to an array of references, one 6529 for each class. 6530 </description> 6531 </param> 6532 </parameters> 6533 <errors> 6534 </errors> 6535 </function> 6536 6537 <function id="GetClassSignature" phase="start" num="48"> 6538 <synopsis>Get Class Signature</synopsis> 6539 <description> 6540 For the class indicated by <code>klass</code>, return the 6541 <externallink id="http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/types.html#wp16432">JNI 6542 type signature</externallink> 6543 and the generic signature of the class. 6544 For example, <code>java.util.List</code> is <code>"Ljava/util/List;"</code> 6545 and <code>int[]</code> is <code>"[I"</code> 6546 The returned name for primitive classes 6547 is the type signature character of the corresponding primitive type. 6548 For example, <code>java.lang.Integer.TYPE</code> is <code>"I"</code>. 6549 </description> 6550 <origin>jvmdiClone</origin> 6551 <capabilities> 6552 </capabilities> 6553 <parameters> 6554 <param id="klass"> 6555 <jclass/> 6556 <description> 6557 The class to query. 6558 </description> 6559 </param> 6560 <param id="signature_ptr"> 6561 <allocbuf> 6562 <char/> 6563 <nullok>the signature is not returned</nullok> 6564 </allocbuf> 6565 <description> 6566 On return, points to the JNI type signature of the class, encoded as a 6567 <internallink id="mUTF">modified UTF-8</internallink> string. 6568 </description> 6569 </param> 6570 <param id="generic_ptr"> 6571 <allocbuf> 6572 <char/> 6573 <nullok>the generic signature is not returned</nullok> 6574 </allocbuf> 6575 <description> 6576 On return, points to the generic signature of the class, encoded as a 6577 <internallink id="mUTF">modified UTF-8</internallink> string. 6578 If there is no generic signature attribute for the class, then, 6579 on return, points to <code>NULL</code>. 6580 </description> 6581 </param> 6582 </parameters> 6583 <errors> 6584 </errors> 6585 </function> 6586 6587 <function id="GetClassStatus" phase="start" num="49"> 6588 <synopsis>Get Class Status</synopsis> 6589 <description> 6590 Get the status of the class. Zero or more of the following bits can be 6591 set. 6592 <constants id="jvmtiClassStatus" label="Class Status Flags" kind="bits"> 6593 <constant id="JVMTI_CLASS_STATUS_VERIFIED" num="1"> 6594 Class bytecodes have been verified 6595 </constant> 6596 <constant id="JVMTI_CLASS_STATUS_PREPARED" num="2"> 6597 Class preparation is complete 6598 </constant> 6599 <constant id="JVMTI_CLASS_STATUS_INITIALIZED" num="4"> 6600 Class initialization is complete. Static initializer has been run. 6601 </constant> 6602 <constant id="JVMTI_CLASS_STATUS_ERROR" num="8"> 6603 Error during initialization makes class unusable 6604 </constant> 6605 <constant id="JVMTI_CLASS_STATUS_ARRAY" num="16"> 6606 Class is an array. If set, all other bits are zero. 6607 </constant> 6608 <constant id="JVMTI_CLASS_STATUS_PRIMITIVE" num="32"> 6609 Class is a primitive class (for example, <code>java.lang.Integer.TYPE</code>). 6610 If set, all other bits are zero. 6611 </constant> 6612 </constants> 6613 </description> 6614 <origin>jvmdi</origin> 6615 <capabilities> 6616 </capabilities> 6617 <parameters> 6618 <param id="klass"> 6619 <jclass/> 6620 <description> 6621 The class to query. 6622 </description> 6623 </param> 6624 <param id="status_ptr"> 6625 <outptr><jint/></outptr> 6626 <description> 6627 On return, points to the current state of this class as one or 6628 more of the <internallink id="jvmtiClassStatus">class status flags</internallink>. 6629 </description> 6630 </param> 6631 </parameters> 6632 <errors> 6633 </errors> 6634 </function> 6635 6636 <function id="GetSourceFileName" phase="start" num="50"> 6637 <synopsis>Get Source File Name</synopsis> 6638 <description> 6639 For the class indicated by <code>klass</code>, return the source file 6640 name via <code>source_name_ptr</code>. The returned string 6641 is a file name only and never contains a directory name. 6642 <p/> 6643 For primitive classes (for example, <code>java.lang.Integer.TYPE</code>) 6644 and for arrays this function returns 6645 <errorlink id="JVMTI_ERROR_ABSENT_INFORMATION"></errorlink>. 6646 </description> 6647 <origin>jvmdi</origin> 6648 <capabilities> 6649 <required id="can_get_source_file_name"></required> 6650 </capabilities> 6651 <parameters> 6652 <param id="klass"> 6653 <jclass/> 6654 <description> 6655 The class to query. 6656 </description> 6657 </param> 6658 <param id="source_name_ptr"> 6659 <allocbuf><char/></allocbuf> 6660 <description> 6661 On return, points to the class's source file name, encoded as a 6662 <internallink id="mUTF">modified UTF-8</internallink> string. 6663 </description> 6664 </param> 6665 </parameters> 6666 <errors> 6667 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 6668 Class information does not include a source file name. This includes 6669 cases where the class is an array class or primitive class. 6670 </error> 6671 </errors> 6672 </function> 6673 6674 <function id="GetClassModifiers" phase="start" num="51"> 6675 <synopsis>Get Class Modifiers</synopsis> 6676 <description> 6677 For the class indicated by <code>klass</code>, return the access 6678 flags 6679 via <code>modifiers_ptr</code>. 6680 Access flags are defined in <vmspec chapter="4"/>. 6681 <p/> 6682 If the class is an array class, then its public, private, and protected 6683 modifiers are the same as those of its component type. For arrays of 6684 primitives, this component type is represented by one of the primitive 6685 classes (for example, <code>java.lang.Integer.TYPE</code>). 6686 <p/> 6687 If the class is a primitive class, its public modifier is always true, 6688 and its protected and private modifiers are always false. 6689 <p/> 6690 If the class is an array class or a primitive class then its final 6691 modifier is always true and its interface modifier is always false. 6692 The values of its other modifiers are not determined by this specification. 6693 6694 </description> 6695 <origin>jvmdi</origin> 6696 <capabilities> 6697 </capabilities> 6698 <parameters> 6699 <param id="klass"> 6700 <jclass/> 6701 <description> 6702 The class to query. 6703 </description> 6704 </param> 6705 <param id="modifiers_ptr"> 6706 <outptr><jint/></outptr> 6707 <description> 6708 On return, points to the current access flags of this class. 6709 6710 </description> 6711 </param> 6712 </parameters> 6713 <errors> 6714 </errors> 6715 </function> 6716 6717 <function id="GetClassMethods" phase="start" num="52"> 6718 <synopsis>Get Class Methods</synopsis> 6719 <description> 6720 For the class indicated by <code>klass</code>, return a count of 6721 methods via <code>method_count_ptr</code> and a list of 6722 method IDs via <code>methods_ptr</code>. The method list contains 6723 constructors and static initializers as well as true methods. 6724 Only directly declared methods are returned (not inherited methods). 6725 An empty method list is returned for array classes and primitive classes 6726 (for example, <code>java.lang.Integer.TYPE</code>). 6727 </description> 6728 <origin>jvmdi</origin> 6729 <capabilities> 6730 <capability id="can_maintain_original_method_order"/> 6731 </capabilities> 6732 <parameters> 6733 <param id="klass"> 6734 <jclass/> 6735 <description> 6736 The class to query. 6737 </description> 6738 </param> 6739 <param id="method_count_ptr"> 6740 <outptr><jint/></outptr> 6741 <description> 6742 On return, points to the number of methods declared in this class. 6743 </description> 6744 </param> 6745 <param id="methods_ptr"> 6746 <allocbuf outcount="method_count_ptr"><jmethodID class="klass"/></allocbuf> 6747 <description> 6748 On return, points to the method ID array. 6749 </description> 6750 </param> 6751 </parameters> 6752 <errors> 6753 <error id="JVMTI_ERROR_CLASS_NOT_PREPARED"> 6754 <paramlink id="klass"></paramlink> is not prepared. 6755 </error> 6756 </errors> 6757 </function> 6758 6759 <function id="GetClassFields" phase="start" num="53"> 6760 <synopsis>Get Class Fields</synopsis> 6761 <description> 6762 For the class indicated by <code>klass</code>, return a count of fields 6763 via <code>field_count_ptr</code> and a list of field IDs via 6764 <code>fields_ptr</code>. 6765 Only directly declared fields are returned (not inherited fields). 6766 Fields are returned in the order they occur in the class file. 6767 An empty field list is returned for array classes and primitive classes 6768 (for example, <code>java.lang.Integer.TYPE</code>). 6769 Use JNI to determine the length of an array. 6770 </description> 6771 <origin>jvmdi</origin> 6772 <capabilities> 6773 </capabilities> 6774 <parameters> 6775 <param id="klass"> 6776 <jclass/> 6777 <description> 6778 The class to query. 6779 </description> 6780 </param> 6781 <param id="field_count_ptr"> 6782 <outptr><jint/></outptr> 6783 <description> 6784 On return, points to the number of fields declared in this class. 6785 </description> 6786 </param> 6787 <param id="fields_ptr"> 6788 <allocbuf outcount="field_count_ptr"><jfieldID/></allocbuf> 6789 <description> 6790 On return, points to the field ID array. 6791 </description> 6792 </param> 6793 </parameters> 6794 <errors> 6795 <error id="JVMTI_ERROR_CLASS_NOT_PREPARED"> 6796 <paramlink id="klass"></paramlink> is not prepared. 6797 </error> 6798 </errors> 6799 </function> 6800 6801 <function id="GetImplementedInterfaces" phase="start" num="54"> 6802 <synopsis>Get Implemented Interfaces</synopsis> 6803 <description> 6804 Return the direct super-interfaces of this class. For a class, this 6805 function returns the interfaces declared in its <code>implements</code> 6806 clause. For an interface, this function returns the interfaces declared in 6807 its <code>extends</code> clause. 6808 An empty interface list is returned for array classes and primitive classes 6809 (for example, <code>java.lang.Integer.TYPE</code>). 6810 </description> 6811 <origin>jvmdi</origin> 6812 <capabilities> 6813 </capabilities> 6814 <parameters> 6815 <param id="klass"> 6816 <jclass/> 6817 <description> 6818 The class to query. 6819 </description> 6820 </param> 6821 <param id="interface_count_ptr"> 6822 <outptr><jint/></outptr> 6823 <description> 6824 On return, points to the number of interfaces. 6825 </description> 6826 </param> 6827 <param id="interfaces_ptr"> 6828 <allocbuf outcount="interface_count_ptr"><jclass/></allocbuf> 6829 <description> 6830 On return, points to the interface array. 6831 </description> 6832 </param> 6833 </parameters> 6834 <errors> 6835 <error id="JVMTI_ERROR_CLASS_NOT_PREPARED"> 6836 <paramlink id="klass"></paramlink> is not prepared. 6837 </error> 6838 </errors> 6839 </function> 6840 6841 <function id="GetClassVersionNumbers" phase="start" num="145" since="1.1"> 6842 <synopsis>Get Class Version Numbers</synopsis> 6843 <description> 6844 For the class indicated by <code>klass</code>, 6845 return the minor and major version numbers, 6846 as defined in 6847 <vmspec chapter="4"/>. 6848 </description> 6849 <origin>new</origin> 6850 <capabilities> 6851 </capabilities> 6852 <parameters> 6853 <param id="klass"> 6854 <jclass/> 6855 <description> 6856 The class to query. 6857 </description> 6858 </param> 6859 <param id="minor_version_ptr"> 6860 <outptr><jint/></outptr> 6861 <description> 6862 On return, points to the value of the 6863 <code>minor_version</code> item of the 6864 Class File Format. 6865 Note: to be consistent with the Class File Format, 6866 the minor version number is the first parameter. 6867 </description> 6868 </param> 6869 <param id="major_version_ptr"> 6870 <outptr><jint/></outptr> 6871 <description> 6872 On return, points to the value of the 6873 <code>major_version</code> item of the 6874 Class File Format. 6875 </description> 6876 </param> 6877 </parameters> 6878 <errors> 6879 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 6880 The class is a primitive or array class. 6881 </error> 6882 </errors> 6883 </function> 6884 6885 <function id="GetConstantPool" phase="start" num="146" since="1.1"> 6886 <synopsis>Get Constant Pool</synopsis> 6887 <description> 6888 For the class indicated by <code>klass</code>, 6889 return the raw bytes of the constant pool in the format of the 6890 <code>constant_pool</code> item of 6891 <vmspec chapter="4"/>. 6892 The format of the constant pool may differ between versions 6893 of the Class File Format, so, the 6894 <functionlink id="GetClassVersionNumbers">minor and major 6895 class version numbers</functionlink> should be checked for 6896 compatibility. 6897 <p/> 6898 The returned constant pool might not have the same layout or 6899 contents as the constant pool in the defining class file. 6900 The constant pool returned by GetConstantPool() may have 6901 more or fewer entries than the defining constant pool. 6902 Entries may be in a different order. 6903 The constant pool returned by GetConstantPool() will match the 6904 constant pool used by 6905 <functionlink id="GetBytecodes">GetBytecodes()</functionlink>. 6906 That is, the bytecodes returned by GetBytecodes() will have 6907 constant pool indices which refer to constant pool entries returned 6908 by GetConstantPool(). 6909 Note that since <functionlink id="RetransformClasses"/> 6910 and <functionlink id="RedefineClasses"/> can change 6911 the constant pool, the constant pool returned by this function 6912 can change accordingly. Thus, the correspondence between 6913 GetConstantPool() and GetBytecodes() does not hold if there 6914 is an intervening class retransformation or redefinition. 6915 The value of a constant pool entry used by a given bytecode will 6916 match that of the defining class file (even if the indices don't match). 6917 Constant pool entries which are not used directly or indirectly by 6918 bytecodes (for example, UTF-8 strings associated with annotations) are 6919 not required to exist in the returned constant pool. 6920 </description> 6921 <origin>new</origin> 6922 <capabilities> 6923 <required id="can_get_constant_pool"></required> 6924 </capabilities> 6925 <parameters> 6926 <param id="klass"> 6927 <jclass/> 6928 <description> 6929 The class to query. 6930 </description> 6931 </param> 6932 <param id="constant_pool_count_ptr"> 6933 <outptr><jint/></outptr> 6934 <description> 6935 On return, points to the number of entries 6936 in the constant pool table plus one. 6937 This corresponds to the <code>constant_pool_count</code> 6938 item of the Class File Format. 6939 </description> 6940 </param> 6941 <param id="constant_pool_byte_count_ptr"> 6942 <outptr><jint/></outptr> 6943 <description> 6944 On return, points to the number of bytes 6945 in the returned raw constant pool. 6946 </description> 6947 </param> 6948 <param id="constant_pool_bytes_ptr"> 6949 <allocbuf outcount="constant_pool_byte_count_ptr"><uchar/></allocbuf> 6950 <description> 6951 On return, points to the raw constant pool, that is the bytes 6952 defined by the <code>constant_pool</code> item of the 6953 Class File Format 6954 </description> 6955 </param> 6956 </parameters> 6957 <errors> 6958 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 6959 The class is a primitive or array class. 6960 </error> 6961 </errors> 6962 </function> 6963 6964 <function id="IsInterface" phase="start" num="55"> 6965 <synopsis>Is Interface</synopsis> 6966 <description> 6967 Determines whether a class object reference represents an interface. 6968 The <code>jboolean</code> result is 6969 <code>JNI_TRUE</code> if the "class" is actually an interface, 6970 <code>JNI_FALSE</code> otherwise. 6971 </description> 6972 <origin>jvmdi</origin> 6973 <capabilities> 6974 </capabilities> 6975 <parameters> 6976 <param id="klass"> 6977 <jclass/> 6978 <description> 6979 The class to query. 6980 </description> 6981 </param> 6982 <param id="is_interface_ptr"> 6983 <outptr><jboolean/></outptr> 6984 <description> 6985 On return, points to the boolean result of this function. 6986 6987 </description> 6988 </param> 6989 </parameters> 6990 <errors> 6991 </errors> 6992 </function> 6993 6994 <function id="IsArrayClass" phase="start" num="56"> 6995 <synopsis>Is Array Class</synopsis> 6996 <description> 6997 Determines whether a class object reference represents an array. 6998 The <code>jboolean</code> result is 6999 <code>JNI_TRUE</code> if the class is an array, 7000 <code>JNI_FALSE</code> otherwise. 7001 </description> 7002 <origin>jvmdi</origin> 7003 <capabilities> 7004 </capabilities> 7005 <parameters> 7006 <param id="klass"> 7007 <jclass/> 7008 <description> 7009 The class to query. 7010 </description> 7011 </param> 7012 <param id="is_array_class_ptr"> 7013 <outptr><jboolean/></outptr> 7014 <description> 7015 On return, points to the boolean result of this function. 7016 7017 </description> 7018 </param> 7019 </parameters> 7020 <errors> 7021 </errors> 7022 </function> 7023 7024 <function id="IsModifiableClass" jkernel="yes" phase="start" num="45" since="1.1"> 7025 <synopsis>Is Modifiable Class</synopsis> 7026 <description> 7027 Determines whether a class is modifiable. 7028 If a class is modifiable (<paramlink id="is_modifiable_class_ptr"/> 7029 returns <code>JNI_TRUE</code>) the class can be 7030 redefined with <functionlink id="RedefineClasses"/> (assuming 7031 the agent possesses the 7032 <fieldlink id="can_redefine_classes" struct="jvmtiCapabilities"/> 7033 capability) or 7034 retransformed with <functionlink id="RetransformClasses"/> (assuming 7035 the agent possesses the 7036 <fieldlink id="can_retransform_classes" struct="jvmtiCapabilities"/> 7037 capability). 7038 If a class is not modifiable (<paramlink id="is_modifiable_class_ptr"/> 7039 returns <code>JNI_FALSE</code>) the class can be neither 7040 redefined nor retransformed. 7041 <p/> 7042 Primitive classes (for example, <code>java.lang.Integer.TYPE</code>) 7043 and array classes are never modifiable. 7044 <p/> 7045 </description> 7046 <origin>new</origin> 7047 <capabilities> 7048 <capability id="can_redefine_any_class"> 7049 If possessed then all classes (except primitive and array classes) 7050 are modifiable. 7051 </capability> 7052 <capability id="can_redefine_classes"> 7053 No effect on the result of the function. 7054 But must additionally be possessed to modify the class with 7055 <functionlink id="RedefineClasses"/>. 7056 </capability> 7057 <capability id="can_retransform_classes"> 7058 No effect on the result of the function. 7059 But must additionally be possessed to modify the class with 7060 <functionlink id="RetransformClasses"/>. 7061 </capability> 7062 </capabilities> 7063 <parameters> 7064 <param id="klass"> 7065 <jclass/> 7066 <description> 7067 The class to query. 7068 </description> 7069 </param> 7070 <param id="is_modifiable_class_ptr"> 7071 <outptr><jboolean/></outptr> 7072 <description> 7073 On return, points to the boolean result of this function. 7074 </description> 7075 </param> 7076 </parameters> 7077 <errors> 7078 </errors> 7079 </function> 7080 7081 <function id="GetClassLoader" phase="start" num="57"> 7082 <synopsis>Get Class Loader</synopsis> 7083 <description> 7084 For the class indicated by <code>klass</code>, return via 7085 <code>classloader_ptr</code> a reference to the class loader for the 7086 class. 7087 </description> 7088 <origin>jvmdi</origin> 7089 <capabilities> 7090 </capabilities> 7091 <parameters> 7092 <param id="klass"> 7093 <jclass/> 7094 <description> 7095 The class to query. 7096 </description> 7097 </param> 7098 <param id="classloader_ptr"> 7099 <outptr><jobject/></outptr> 7100 <description> 7101 On return, points to the class loader that loaded 7102 this class. 7103 If the class was not created by a class loader 7104 or if the class loader is the bootstrap class loader, 7105 points to <code>NULL</code>. 7106 </description> 7107 </param> 7108 </parameters> 7109 <errors> 7110 </errors> 7111 7112 </function> 7113 7114 <function id="GetSourceDebugExtension" phase="start" num="90"> 7115 <synopsis>Get Source Debug Extension</synopsis> 7116 <description> 7117 For the class indicated by <code>klass</code>, return the debug 7118 extension via <code>source_debug_extension_ptr</code>. 7119 The returned string 7120 contains exactly the debug extension information present in the 7121 class file of <code>klass</code>. 7122 </description> 7123 <origin>jvmdi</origin> 7124 <capabilities> 7125 <required id="can_get_source_debug_extension"></required> 7126 </capabilities> 7127 <parameters> 7128 <param id="klass"> 7129 <jclass/> 7130 <description> 7131 The class to query. 7132 </description> 7133 </param> 7134 <param id="source_debug_extension_ptr"> 7135 <allocbuf><char/></allocbuf> 7136 <description> 7137 On return, points to the class's debug extension, encoded as a 7138 <internallink id="mUTF">modified UTF-8</internallink> string. 7139 </description> 7140 </param> 7141 </parameters> 7142 <errors> 7143 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 7144 Class information does not include a debug extension. 7145 </error> 7146 </errors> 7147 </function> 7148 7149 <function id="RetransformClasses" jkernel="yes" num="152" since="1.1"> 7150 <synopsis>Retransform Classes</synopsis> 7151 <description> 7152 This function facilitates the 7153 <internallink id="bci">bytecode instrumentation</internallink> 7154 of already loaded classes. 7155 To replace the class definition without reference to the existing 7156 bytecodes, as one might do when recompiling from source for 7157 fix-and-continue debugging, <functionlink id="RedefineClasses"/> 7158 function should be used instead. 7159 <p/> 7160 When classes are initially loaded or when they are 7161 <functionlink id="RedefineClasses">redefined</functionlink>, 7162 the initial class file bytes can be transformed with the 7163 <eventlink id="ClassFileLoadHook"/> event. 7164 This function reruns the transformation process 7165 (whether or not a transformation has previously occurred). 7166 This retransformation follows these steps: 7167 <ul> 7168 <li>starting from the initial class file bytes 7169 </li> 7170 <li>for each <fieldlink id="can_retransform_classes" 7171 struct="jvmtiCapabilities">retransformation 7172 incapable</fieldlink> 7173 agent which received a 7174 <code>ClassFileLoadHook</code> event during the previous 7175 load or redefine, the bytes it returned 7176 (via the <code>new_class_data</code> parameter) 7177 are reused as the output of the transformation; 7178 note that this is equivalent to reapplying 7179 the previous transformation, unaltered. except that 7180 the <code>ClassFileLoadHook</code> event 7181 is <b>not</b> sent to these agents 7182 </li> 7183 <li>for each <fieldlink id="can_retransform_classes" 7184 struct="jvmtiCapabilities">retransformation 7185 capable</fieldlink> 7186 agent, the <code>ClassFileLoadHook</code> event is sent, 7187 allowing a new transformation to be applied 7188 </li> 7189 <li>the transformed class file bytes are installed as the new 7190 definition of the class 7191 </li> 7192 </ul> 7193 See the <eventlink id="ClassFileLoadHook"/> event for more details. 7194 <p/> 7195 The initial class file bytes represent the bytes passed to 7196 <code>ClassLoader.defineClass</code> 7197 or <code>RedefineClasses</code> (before any transformations 7198 were applied), however they may not exactly match them. 7199 The constant pool may differ in ways described in 7200 <functionlink id="GetConstantPool"/>. 7201 Constant pool indices in the bytecodes of methods will correspond. 7202 Some attributes may not be present. 7203 Where order is not meaningful, for example the order of methods, 7204 order may not be preserved. 7205 <p/> 7206 Retransformation can cause new versions of methods to be installed. 7207 Old method versions may become 7208 <internallink id="obsoleteMethods">obsolete</internallink> 7209 The new method version will be used on new invokes. 7210 If a method has active stack frames, those active frames continue to 7211 run the bytecodes of the original method version. 7212 <p/> 7213 This function does not cause any initialization except that which 7214 would occur under the customary JVM semantics. 7215 In other words, retransforming a class does not cause its initializers to be 7216 run. The values of static fields will remain as they were 7217 prior to the call. 7218 <p/> 7219 Threads need not be suspended. 7220 <p/> 7221 All breakpoints in the class are cleared. 7222 <p/> 7223 All attributes are updated. 7224 <p/> 7225 Instances of the retransformed class are not affected -- fields retain their 7226 previous values. 7227 <functionlink id="GetTag">Tags</functionlink> on the instances are 7228 also unaffected. 7229 <p/> 7230 In response to this call, no events other than the 7231 <eventlink id="ClassFileLoadHook"/> event 7232 will be sent. 7233 <p/> 7234 The retransformation may change method bodies, the constant pool and attributes. 7235 The retransformation must not add, remove or rename fields or methods, change the 7236 signatures of methods, change modifiers, or change inheritance. 7237 These restrictions may be lifted in future versions. 7238 See the error return description below for information on error codes 7239 returned if an unsupported retransformation is attempted. 7240 The class file bytes are not verified or installed until they have passed 7241 through the chain of <eventlink id="ClassFileLoadHook"/> events, thus the 7242 returned error code reflects the result of the transformations. 7243 If any error code is returned other than <code>JVMTI_ERROR_NONE</code>, 7244 none of the classes to be retransformed will have a new definition installed. 7245 When this function returns (with the error code of <code>JVMTI_ERROR_NONE</code>) 7246 all of the classes to be retransformed will have their new definitions installed. 7247 </description> 7248 <origin>new</origin> 7249 <capabilities> 7250 <required id="can_retransform_classes"></required> 7251 <capability id="can_retransform_any_class"></capability> 7252 </capabilities> 7253 <parameters> 7254 <param id="class_count"> 7255 <jint min="0"/> 7256 <description> 7257 The number of classes to be retransformed. 7258 </description> 7259 </param> 7260 <param id="classes"> 7261 <inbuf incount="class_count"><jclass/></inbuf> 7262 <description> 7263 The array of classes to be retransformed. 7264 </description> 7265 </param> 7266 </parameters> 7267 <errors> 7268 <error id="JVMTI_ERROR_UNMODIFIABLE_CLASS"> 7269 One of the <paramlink id="classes"/> cannot be modified. 7270 See <functionlink id="IsModifiableClass"/>. 7271 </error> 7272 <error id="JVMTI_ERROR_INVALID_CLASS"> 7273 One of the <paramlink id="classes"/> is not a valid class. 7274 </error> 7275 <error id="JVMTI_ERROR_UNSUPPORTED_VERSION"> 7276 A retransformed class file has a version number not supported by this VM. 7277 </error> 7278 <error id="JVMTI_ERROR_INVALID_CLASS_FORMAT"> 7279 A retransformed class file is malformed (The VM would return a <code>ClassFormatError</code>). 7280 </error> 7281 <error id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION"> 7282 The retransformed class file definitions would lead to a circular definition 7283 (the VM would return a <code>ClassCircularityError</code>). 7284 </error> 7285 <error id="JVMTI_ERROR_FAILS_VERIFICATION"> 7286 The retransformed class file bytes fail verification. 7287 </error> 7288 <error id="JVMTI_ERROR_NAMES_DONT_MATCH"> 7289 The class name defined in a retransformed class file is 7290 different from the name in the old class object. 7291 </error> 7292 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED"> 7293 A retransformed class file would require adding a method. 7294 </error> 7295 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED"> 7296 A retransformed class file changes a field. 7297 </error> 7298 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED"> 7299 A direct superclass is different for a retransformed class file, 7300 or the set of directly implemented 7301 interfaces is different. 7302 </error> 7303 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED"> 7304 A retransformed class file does not declare a method 7305 declared in the old class version. 7306 </error> 7307 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED"> 7308 A retransformed class file has different class modifiers. 7309 </error> 7310 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED"> 7311 A method in the retransformed class file has different modifiers 7312 than its counterpart in the old class version. 7313 </error> 7314 </errors> 7315 </function> 7316 7317 <function id="RedefineClasses" jkernel="yes" num="87"> 7318 <synopsis>Redefine Classes</synopsis> 7319 <typedef id="jvmtiClassDefinition" label="Class redefinition description"> 7320 <field id="klass"> 7321 <jclass/> 7322 <description> 7323 Class object for this class 7324 </description> 7325 </field> 7326 <field id="class_byte_count"> 7327 <jint/> 7328 <description> 7329 Number of bytes defining class (below) 7330 </description> 7331 </field> 7332 <field id="class_bytes"> 7333 <inbuf incount="class_byte_count"><uchar/></inbuf> 7334 <description> 7335 Bytes defining class (in <vmspec chapter="4"/>) 7336 </description> 7337 </field> 7338 </typedef> 7339 <description> 7340 All classes given are redefined according to the definitions 7341 supplied. 7342 This function is used to replace the definition of a class 7343 with a new definition, as might be needed in fix-and-continue 7344 debugging. 7345 Where the existing class file bytes are to be transformed, for 7346 example in 7347 <internallink id="bci">bytecode instrumentation</internallink>, 7348 <functionlink id="RetransformClasses"/> should be used. 7349 <p/> 7350 Redefinition can cause new versions of methods to be installed. 7351 Old method versions may become 7352 <internallink id="obsoleteMethods">obsolete</internallink> 7353 The new method version will be used on new invokes. 7354 If a method has active stack frames, those active frames continue to 7355 run the bytecodes of the original method version. 7356 If resetting of stack frames is desired, use 7357 <functionlink id="PopFrame"></functionlink> 7358 to pop frames with obsolete method versions. 7359 <p/> 7360 This function does not cause any initialization except that which 7361 would occur under the customary JVM semantics. 7362 In other words, redefining a class does not cause its initializers to be 7363 run. The values of static fields will remain as they were 7364 prior to the call. 7365 <p/> 7366 Threads need not be suspended. 7367 <p/> 7368 All breakpoints in the class are cleared. 7369 <p/> 7370 All attributes are updated. 7371 <p/> 7372 Instances of the redefined class are not affected -- fields retain their 7373 previous values. 7374 <functionlink id="GetTag">Tags</functionlink> on the instances are 7375 also unaffected. 7376 <p/> 7377 In response to this call, the <jvmti/> event 7378 <eventlink id="ClassFileLoadHook">Class File Load Hook</eventlink> 7379 will be sent (if enabled), but no other <jvmti/> events will be sent. 7380 <p/> 7381 The redefinition may change method bodies, the constant pool and attributes. 7382 The redefinition must not add, remove or rename fields or methods, change the 7383 signatures of methods, change modifiers, or change inheritance. 7384 These restrictions may be lifted in future versions. 7385 See the error return description below for information on error codes 7386 returned if an unsupported redefinition is attempted. 7387 The class file bytes are not verified or installed until they have passed 7388 through the chain of <eventlink id="ClassFileLoadHook"/> events, thus the 7389 returned error code reflects the result of the transformations applied 7390 to the bytes passed into <paramlink id="class_definitions"/>. 7391 If any error code is returned other than <code>JVMTI_ERROR_NONE</code>, 7392 none of the classes to be redefined will have a new definition installed. 7393 When this function returns (with the error code of <code>JVMTI_ERROR_NONE</code>) 7394 all of the classes to be redefined will have their new definitions installed. 7395 </description> 7396 <origin>jvmdi</origin> 7397 <capabilities> 7398 <required id="can_redefine_classes"></required> 7399 <capability id="can_redefine_any_class"></capability> 7400 </capabilities> 7401 <parameters> 7402 <param id="class_count"> 7403 <jint min="0"/> 7404 <description> 7405 The number of classes specified in <code>class_definitions</code> 7406 </description> 7407 </param> 7408 <param id="class_definitions"> 7409 <inbuf incount="class_count"><struct>jvmtiClassDefinition</struct></inbuf> 7410 <description> 7411 The array of new class definitions 7412 </description> 7413 </param> 7414 </parameters> 7415 <errors> 7416 <error id="JVMTI_ERROR_NULL_POINTER"> 7417 One of <code>class_bytes</code> is <code>NULL</code>. 7418 </error> 7419 <error id="JVMTI_ERROR_UNMODIFIABLE_CLASS"> 7420 An element of <code>class_definitions</code> cannot be modified. 7421 See <functionlink id="IsModifiableClass"/>. 7422 </error> 7423 <error id="JVMTI_ERROR_INVALID_CLASS"> 7424 An element of <code>class_definitions</code> is not a valid class. 7425 </error> 7426 <error id="JVMTI_ERROR_UNSUPPORTED_VERSION"> 7427 A new class file has a version number not supported by this VM. 7428 </error> 7429 <error id="JVMTI_ERROR_INVALID_CLASS_FORMAT"> 7430 A new class file is malformed (The VM would return a <code>ClassFormatError</code>). 7431 </error> 7432 <error id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION"> 7433 The new class file definitions would lead to a circular definition 7434 (the VM would return a <code>ClassCircularityError</code>). 7435 </error> 7436 <error id="JVMTI_ERROR_FAILS_VERIFICATION"> 7437 The class bytes fail verification. 7438 </error> 7439 <error id="JVMTI_ERROR_NAMES_DONT_MATCH"> 7440 The class name defined in a new class file is 7441 different from the name in the old class object. 7442 </error> 7443 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED"> 7444 A new class file would require adding a method. 7445 </error> 7446 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED"> 7447 A new class version changes a field. 7448 </error> 7449 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED"> 7450 A direct superclass is different for a new class 7451 version, or the set of directly implemented 7452 interfaces is different. 7453 </error> 7454 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED"> 7455 A new class version does not declare a method 7456 declared in the old class version. 7457 </error> 7458 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED"> 7459 A new class version has different modifiers. 7460 </error> 7461 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED"> 7462 A method in the new class version has different modifiers 7463 than its counterpart in the old class version. 7464 </error> 7465 </errors> 7466 </function> 7467 7468 </category> 7469 7470 <category id="object" label="Object"> 7471 7472 <function id="GetObjectSize" jkernel="yes" phase="start" num="154"> 7473 <synopsis>Get Object Size</synopsis> 7474 <description> 7475 For the object indicated by <code>object</code>, 7476 return via <code>size_ptr</code> the size of the object. 7477 This size is an implementation-specific approximation of 7478 the amount of storage consumed by this object. 7479 It may include some or all of the object's overhead, and thus 7480 is useful for comparison within an implementation but not 7481 between implementations. 7482 The estimate may change during a single invocation of the JVM. 7483 </description> 7484 <origin>new</origin> 7485 <capabilities> 7486 </capabilities> 7487 <parameters> 7488 <param id="object"> 7489 <jobject/> 7490 <description> 7491 The object to query. 7492 </description> 7493 </param> 7494 <param id="size_ptr"> 7495 <outptr><jlong/></outptr> 7496 <description> 7497 On return, points to the object's size in bytes. 7498 </description> 7499 </param> 7500 </parameters> 7501 <errors> 7502 </errors> 7503 </function> 7504 7505 <function id="GetObjectHashCode" phase="start" num="58"> 7506 <synopsis>Get Object Hash Code</synopsis> 7507 <description> 7508 For the object indicated by <code>object</code>, 7509 return via <code>hash_code_ptr</code> a hash code. 7510 This hash code could be used to maintain a hash table of object references, 7511 however, on some implementations this can cause significant performance 7512 impacts--in most cases 7513 <internallink id="Heap">tags</internallink> 7514 will be a more efficient means of associating information with objects. 7515 This function guarantees 7516 the same hash code value for a particular object throughout its life 7517 </description> 7518 <origin>jvmdi</origin> 7519 <capabilities> 7520 </capabilities> 7521 <parameters> 7522 <param id="object"> 7523 <jobject/> 7524 <description> 7525 The object to query. 7526 </description> 7527 </param> 7528 <param id="hash_code_ptr"> 7529 <outptr><jint/></outptr> 7530 <description> 7531 On return, points to the object's hash code. 7532 </description> 7533 </param> 7534 </parameters> 7535 <errors> 7536 </errors> 7537 </function> 7538 7539 <function id="GetObjectMonitorUsage" num="59"> 7540 <synopsis>Get Object Monitor Usage</synopsis> 7541 <typedef id="jvmtiMonitorUsage" label="Object monitor usage information"> 7542 <field id="owner"> 7543 <jthread/> 7544 <description> 7545 The thread owning this monitor, or <code>NULL</code> if unused 7546 </description> 7547 </field> 7548 <field id="entry_count"> 7549 <jint/> 7550 <description> 7551 The number of times the owning thread has entered the monitor 7552 </description> 7553 </field> 7554 <field id="waiter_count"> 7555 <jint/> 7556 <description> 7557 The number of threads waiting to own this monitor 7558 </description> 7559 </field> 7560 <field id="waiters"> 7561 <allocfieldbuf><jthread/></allocfieldbuf> 7562 <description> 7563 The <code>waiter_count</code> waiting threads 7564 </description> 7565 </field> 7566 <field id="notify_waiter_count"> 7567 <jint/> 7568 <description> 7569 The number of threads waiting to be notified by this monitor 7570 </description> 7571 </field> 7572 <field id="notify_waiters"> 7573 <allocfieldbuf><jthread/></allocfieldbuf> 7574 <description> 7575 The <code>notify_waiter_count</code> threads waiting to be notified 7576 </description> 7577 </field> 7578 </typedef> 7579 <description> 7580 Get information about the object's monitor. 7581 The fields of the <functionlink id="jvmtiMonitorUsage"></functionlink> structure 7582 are filled in with information about usage of the monitor. 7583 <todo> 7584 Decide and then clarify suspend requirements. 7585 </todo> 7586 </description> 7587 <origin>jvmdi</origin> 7588 <capabilities> 7589 <required id="can_get_monitor_info"></required> 7590 </capabilities> 7591 <parameters> 7592 <param id="object"> 7593 <jobject/> 7594 <description> 7595 The object to query. 7596 </description> 7597 </param> 7598 <param id="info_ptr"> 7599 <outptr><struct>jvmtiMonitorUsage</struct></outptr> 7600 <description> 7601 On return, filled with monitor information for the 7602 specified object. 7603 </description> 7604 </param> 7605 </parameters> 7606 <errors> 7607 </errors> 7608 </function> 7609 7610 <elide> 7611 <function id="GetObjectMonitors" num="116"> 7612 <synopsis>Get Object Monitors</synopsis> 7613 <description> 7614 Return the list of object monitors. 7615 <p/> 7616 Note: details about each monitor can be examined with 7617 <functionlink id="GetObjectMonitorUsage"></functionlink>. 7618 </description> 7619 <origin>new</origin> 7620 <capabilities> 7621 <required id="can_get_monitor_info"></required> 7622 </capabilities> 7623 <parameters> 7624 <param id="monitorCnt"> 7625 <outptr><jint/></outptr> 7626 <description> 7627 On return, pointer to the number 7628 of monitors returned in <code>monitors_ptr</code>. 7629 </description> 7630 </param> 7631 <param id="monitors_ptr"> 7632 <allocbuf outcount="monitorCnt"><jobject/></allocbuf> 7633 <description> 7634 On return, pointer to the monitor list. 7635 </description> 7636 </param> 7637 </parameters> 7638 <errors> 7639 </errors> 7640 </function> 7641 </elide> 7642 7643 </category> 7644 7645 <category id="fieldCategory" label="Field"> 7646 7647 <intro> 7648 </intro> 7649 7650 <function id="GetFieldName" phase="start" num="60"> 7651 <synopsis>Get Field Name (and Signature)</synopsis> 7652 <description> 7653 For the field indicated by <paramlink id="klass"/> and <paramlink id="field"/>, 7654 return the field name via <paramlink id="name_ptr"/> and field signature via 7655 <paramlink id="signature_ptr"/>. 7656 <p/> 7657 Field signatures are defined in the JNI Specification and 7658 are referred to as <code>field descriptors</code> in 7659 <vmspec chapter="4.3.2"/>. 7660 </description> 7661 <origin>jvmdiClone</origin> 7662 <capabilities> 7663 </capabilities> 7664 <parameters> 7665 <param id="klass"> 7666 <jclass field="field"/> 7667 <description> 7668 The class of the field to query. 7669 </description> 7670 </param> 7671 <param id="field"> 7672 <jfieldID class="klass"/> 7673 <description> 7674 The field to query. 7675 </description> 7676 </param> 7677 <param id="name_ptr"> 7678 <allocbuf> 7679 <char/> 7680 <nullok>the name is not returned</nullok> 7681 </allocbuf> 7682 <description> 7683 On return, points to the field name, encoded as a 7684 <internallink id="mUTF">modified UTF-8</internallink> string. 7685 </description> 7686 </param> 7687 <param id="signature_ptr"> 7688 <allocbuf> 7689 <char/> 7690 <nullok>the signature is not returned</nullok> 7691 </allocbuf> 7692 <description> 7693 On return, points to the field signature, encoded as a 7694 <internallink id="mUTF">modified UTF-8</internallink> string. 7695 </description> 7696 </param> 7697 <param id="generic_ptr"> 7698 <allocbuf> 7699 <char/> 7700 <nullok>the generic signature is not returned</nullok> 7701 </allocbuf> 7702 <description> 7703 On return, points to the generic signature of the field, encoded as a 7704 <internallink id="mUTF">modified UTF-8</internallink> string. 7705 If there is no generic signature attribute for the field, then, 7706 on return, points to <code>NULL</code>. 7707 </description> 7708 </param> 7709 </parameters> 7710 <errors> 7711 </errors> 7712 </function> 7713 7714 <function id="GetFieldDeclaringClass" phase="start" num="61"> 7715 <synopsis>Get Field Declaring Class</synopsis> 7716 <description> 7717 For the field indicated by <code>klass</code> and <code>field</code> 7718 return the class that defined it via <code>declaring_class_ptr</code>. 7719 The declaring class will either be <code>klass</code>, a superclass, or 7720 an implemented interface. 7721 </description> 7722 <origin>jvmdi</origin> 7723 <capabilities> 7724 </capabilities> 7725 <parameters> 7726 <param id="klass"> 7727 <jclass field="field"/> 7728 <description> 7729 The class to query. 7730 </description> 7731 </param> 7732 <param id="field"> 7733 <jfieldID class="klass"/> 7734 <description> 7735 The field to query. 7736 </description> 7737 </param> 7738 <param id="declaring_class_ptr"> 7739 <outptr><jclass/></outptr> 7740 <description> 7741 On return, points to the declaring class 7742 </description> 7743 </param> 7744 </parameters> 7745 <errors> 7746 </errors> 7747 </function> 7748 7749 <function id="GetFieldModifiers" phase="start" num="62"> 7750 <synopsis>Get Field Modifiers</synopsis> 7751 <description> 7752 For the field indicated by <code>klass</code> and <code>field</code> 7753 return the access flags via <code>modifiers_ptr</code>. 7754 Access flags are defined in <vmspec chapter="4"/>. 7755 </description> 7756 <origin>jvmdi</origin> 7757 <capabilities> 7758 </capabilities> 7759 <parameters> 7760 <param id="klass"> 7761 <jclass field="field"/> 7762 <description> 7763 The class to query. 7764 </description> 7765 </param> 7766 <param id="field"> 7767 <jfieldID class="klass"/> 7768 <description> 7769 The field to query. 7770 </description> 7771 </param> 7772 <param id="modifiers_ptr"> 7773 <outptr><jint/></outptr> 7774 <description> 7775 On return, points to the access flags. 7776 </description> 7777 </param> 7778 </parameters> 7779 <errors> 7780 </errors> 7781 </function> 7782 7783 <function id="IsFieldSynthetic" phase="start" num="63"> 7784 <synopsis>Is Field Synthetic</synopsis> 7785 <description> 7786 For the field indicated by <code>klass</code> and <code>field</code>, return a 7787 value indicating whether the field is synthetic via <code>is_synthetic_ptr</code>. 7788 Synthetic fields are generated by the compiler but not present in the 7789 original source code. 7790 </description> 7791 <origin>jvmdi</origin> 7792 <capabilities> 7793 <required id="can_get_synthetic_attribute"></required> 7794 </capabilities> 7795 <parameters> 7796 <param id="klass"> 7797 <jclass field="field"/> 7798 <description> 7799 The class of the field to query. 7800 </description> 7801 </param> 7802 <param id="field"> 7803 <jfieldID class="klass"/> 7804 <description> 7805 The field to query. 7806 </description> 7807 </param> 7808 <param id="is_synthetic_ptr"> 7809 <outptr><jboolean/></outptr> 7810 <description> 7811 On return, points to the boolean result of this function. 7812 </description> 7813 </param> 7814 </parameters> 7815 <errors> 7816 </errors> 7817 </function> 7818 7819 </category> 7820 7821 <category id="method" label="Method"> 7822 7823 <intro> 7824 These functions provide information about a method (represented as a 7825 <typelink id="jmethodID"/>) and set how methods are processed. 7826 </intro> 7827 7828 <intro id="obsoleteMethods" label="Obsolete Methods"> 7829 The functions <functionlink id="RetransformClasses"/> and 7830 <functionlink id="RedefineClasses"/> can cause new versions 7831 of methods to be installed. 7832 An original version of a method is considered equivalent 7833 to the new version if: 7834 <ul> 7835 <li>their bytecodes are the same except for indices into the 7836 constant pool and </li> 7837 <li>the referenced constants are equal.</li> 7838 </ul> 7839 An original method version which is not equivalent to the 7840 new method version is called obsolete and is assigned a new method ID; 7841 the original method ID now refers to the new method version. 7842 A method ID can be tested for obsolescence with 7843 <functionlink id="IsMethodObsolete"/>. 7844 </intro> 7845 7846 <function id="GetMethodName" phase="start" num="64"> 7847 <synopsis>Get Method Name (and Signature)</synopsis> 7848 <description> 7849 For the method indicated by <code>method</code>, 7850 return the method name via <code>name_ptr</code> and method signature via 7851 <code>signature_ptr</code>. 7852 <p/> 7853 Method signatures are defined in the JNI Specification and are 7854 referred to as <code>method descriptors</code> in 7855 <vmspec chapter="4.3.3"/>. 7856 Note this is different 7857 than method signatures as defined in the <i>Java Language Specification</i>. 7858 </description> 7859 <origin>jvmdiClone</origin> 7860 <capabilities> 7861 </capabilities> 7862 <parameters> 7863 <param id="method"> 7864 <jmethodID/> 7865 <description> 7866 The method to query. 7867 </description> 7868 </param> 7869 <param id="name_ptr"> 7870 <allocbuf> 7871 <char/> 7872 <nullok>the name is not returned</nullok> 7873 </allocbuf> 7874 <description> 7875 On return, points to the method name, encoded as a 7876 <internallink id="mUTF">modified UTF-8</internallink> string. 7877 </description> 7878 </param> 7879 <param id="signature_ptr"> 7880 <allocbuf> 7881 <char/> 7882 <nullok>the signature is not returned</nullok> 7883 </allocbuf> 7884 <description> 7885 On return, points to the method signature, encoded as a 7886 <internallink id="mUTF">modified UTF-8</internallink> string. 7887 </description> 7888 </param> 7889 <param id="generic_ptr"> 7890 <allocbuf> 7891 <char/> 7892 <nullok>the generic signature is not returned</nullok> 7893 </allocbuf> 7894 <description> 7895 On return, points to the generic signature of the method, encoded as a 7896 <internallink id="mUTF">modified UTF-8</internallink> string. 7897 If there is no generic signature attribute for the method, then, 7898 on return, points to <code>NULL</code>. 7899 </description> 7900 </param> 7901 </parameters> 7902 <errors> 7903 </errors> 7904 </function> 7905 7906 <function id="GetMethodDeclaringClass" phase="start" num="65"> 7907 <synopsis>Get Method Declaring Class</synopsis> 7908 <description> 7909 For the method indicated by <code>method</code>, 7910 return the class that defined it via <code>declaring_class_ptr</code>. 7911 </description> 7912 <origin>jvmdi</origin> 7913 <capabilities> 7914 </capabilities> 7915 <parameters> 7916 <param id="klass"> 7917 <jclass method="method"/> 7918 <description> 7919 The class to query. 7920 </description> 7921 </param> 7922 <param id="method"> 7923 <jmethodID class="klass"/> 7924 <description> 7925 The method to query. 7926 </description> 7927 </param> 7928 <param id="declaring_class_ptr"> 7929 <outptr><jclass/></outptr> 7930 <description> 7931 On return, points to the declaring class 7932 </description> 7933 </param> 7934 </parameters> 7935 <errors> 7936 </errors> 7937 </function> 7938 7939 <function id="GetMethodModifiers" phase="start" num="66"> 7940 <synopsis>Get Method Modifiers</synopsis> 7941 <description> 7942 For the method indicated by <code>method</code>, 7943 return the access flags via <code>modifiers_ptr</code>. 7944 Access flags are defined in <vmspec chapter="4"/>. 7945 </description> 7946 <origin>jvmdi</origin> 7947 <capabilities> 7948 </capabilities> 7949 <parameters> 7950 <param id="klass"> 7951 <jclass method="method"/> 7952 <description> 7953 The class to query. 7954 </description> 7955 </param> 7956 <param id="method"> 7957 <jmethodID class="klass"/> 7958 <description> 7959 The method to query. 7960 </description> 7961 </param> 7962 <param id="modifiers_ptr"> 7963 <outptr><jint/></outptr> 7964 <description> 7965 On return, points to the access flags. 7966 </description> 7967 </param> 7968 </parameters> 7969 <errors> 7970 </errors> 7971 </function> 7972 7973 <function id="GetMaxLocals" phase="start" num="68"> 7974 <synopsis>Get Max Locals</synopsis> 7975 <description> 7976 For the method indicated by <code>method</code>, 7977 return the number of local variable slots used by the method, 7978 including the local variables used to pass parameters to the 7979 method on its invocation. 7980 <p/> 7981 See <code>max_locals</code> in <vmspec chapter="4.7.3"/>. 7982 </description> 7983 <origin>jvmdi</origin> 7984 <capabilities> 7985 </capabilities> 7986 <parameters> 7987 <param id="klass"> 7988 <jclass method="method"/> 7989 <description> 7990 The class to query. 7991 </description> 7992 </param> 7993 <param id="method"> 7994 <jmethodID class="klass" native="error"/> 7995 <description> 7996 The method to query. 7997 </description> 7998 </param> 7999 <param id="max_ptr"> 8000 <outptr><jint/></outptr> 8001 <description> 8002 On return, points to the maximum number of local slots 8003 </description> 8004 </param> 8005 </parameters> 8006 <errors> 8007 </errors> 8008 </function> 8009 8010 <function id="GetArgumentsSize" phase="start" num="69"> 8011 <synopsis>Get Arguments Size</synopsis> 8012 <description> 8013 For the method indicated by <code>method</code>, 8014 return via <code>max_ptr</code> the number of local variable slots used 8015 by the method's arguments. 8016 Note that two-word arguments use two slots. 8017 </description> 8018 <origin>jvmdi</origin> 8019 <capabilities> 8020 </capabilities> 8021 <parameters> 8022 <param id="klass"> 8023 <jclass method="method"/> 8024 <description> 8025 The class to query. 8026 </description> 8027 </param> 8028 <param id="method"> 8029 <jmethodID class="klass" native="error"/> 8030 <description> 8031 The method to query. 8032 </description> 8033 </param> 8034 <param id="size_ptr"> 8035 <outptr><jint/></outptr> 8036 <description> 8037 On return, points to the number of argument slots 8038 </description> 8039 </param> 8040 </parameters> 8041 <errors> 8042 </errors> 8043 </function> 8044 8045 <function id="GetLineNumberTable" phase="start" num="70"> 8046 <synopsis>Get Line Number Table</synopsis> 8047 <typedef id="jvmtiLineNumberEntry" label="Line number table entry"> 8048 <field id="start_location"> 8049 <jlocation/> 8050 <description> 8051 the <datalink id="jlocation"></datalink> where the line begins 8052 </description> 8053 </field> 8054 <field id="line_number"> 8055 <jint/> 8056 <description> 8057 the line number 8058 </description> 8059 </field> 8060 </typedef> 8061 <description> 8062 For the method indicated by <code>method</code>, 8063 return a table of source line number entries. The size of the table is 8064 returned via <code>entry_count_ptr</code> and the table itself is 8065 returned via <code>table_ptr</code>. 8066 </description> 8067 <origin>jvmdi</origin> 8068 <capabilities> 8069 <required id="can_get_line_numbers"></required> 8070 </capabilities> 8071 <parameters> 8072 <param id="klass"> 8073 <jclass method="method"/> 8074 <description> 8075 The class to query. 8076 </description> 8077 </param> 8078 <param id="method"> 8079 <jmethodID class="klass" native="error"/> 8080 <description> 8081 The method to query. 8082 </description> 8083 </param> 8084 <param id="entry_count_ptr"> 8085 <outptr><jint/></outptr> 8086 <description> 8087 On return, points to the number of entries in the table 8088 </description> 8089 </param> 8090 <param id="table_ptr"> 8091 <allocbuf outcount="entry_count_ptr"><struct>jvmtiLineNumberEntry</struct></allocbuf> 8092 <description> 8093 On return, points to the line number table pointer. 8094 </description> 8095 </param> 8096 </parameters> 8097 <errors> 8098 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 8099 Class information does not include line numbers. 8100 </error> 8101 </errors> 8102 </function> 8103 8104 <function id="GetMethodLocation" phase="start" num="71"> 8105 <synopsis>Get Method Location</synopsis> 8106 <description> 8107 For the method indicated by <code>method</code>, 8108 return the beginning and ending addresses through 8109 <code>start_location_ptr</code> and <code>end_location_ptr</code>. In a 8110 conventional byte code indexing scheme, 8111 <code>start_location_ptr</code> will always point to zero 8112 and <code>end_location_ptr</code> 8113 will always point to the byte code count minus one. 8114 </description> 8115 <origin>jvmdi</origin> 8116 <capabilities> 8117 </capabilities> 8118 <parameters> 8119 <param id="klass"> 8120 <jclass method="method"/> 8121 <description> 8122 The class to query. 8123 </description> 8124 </param> 8125 <param id="method"> 8126 <jmethodID class="klass" native="error"/> 8127 <description> 8128 The method to query. 8129 </description> 8130 </param> 8131 <param id="start_location_ptr"> 8132 <outptr><jlocation/></outptr> 8133 <description> 8134 On return, points to the first location, or 8135 <code>-1</code> if location information is not available. 8136 If the information is available and 8137 <functionlink id="GetJLocationFormat"></functionlink> 8138 returns <datalink id="JVMTI_JLOCATION_JVMBCI"></datalink> 8139 then this will always be zero. 8140 </description> 8141 </param> 8142 <param id="end_location_ptr"> 8143 <outptr><jlocation/></outptr> 8144 <description> 8145 On return, points to the last location, 8146 or <code>-1</code> if location information is not available. 8147 </description> 8148 </param> 8149 </parameters> 8150 <errors> 8151 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 8152 Class information does not include method sizes. 8153 </error> 8154 </errors> 8155 </function> 8156 8157 <function id="GetLocalVariableTable" num="72"> 8158 <synopsis>Get Local Variable Table</synopsis> 8159 <typedef id="jvmtiLocalVariableEntry" label="Local variable table entry"> 8160 <field id="start_location"> 8161 <jlocation/> 8162 <description> 8163 The code array index where the local variable is first valid 8164 (that is, where it must have a value). 8165 </description> 8166 </field> 8167 <field id="length"> 8168 <jint/> 8169 <description> 8170 The length of the valid section for this local variable. 8171 The last code array index where the local variable is valid 8172 is <code>start_location + length</code>. 8173 </description> 8174 </field> 8175 <field id="name"> 8176 <allocfieldbuf><char/></allocfieldbuf> 8177 <description> 8178 The local variable name, encoded as a 8179 <internallink id="mUTF">modified UTF-8</internallink> string. 8180 </description> 8181 </field> 8182 <field id="signature"> 8183 <allocfieldbuf><char/></allocfieldbuf> 8184 <description> 8185 The local variable's type signature, encoded as a 8186 <internallink id="mUTF">modified UTF-8</internallink> string. 8187 The signature format is the same as that defined in 8188 <vmspec chapter="4.3.2"/>. 8189 </description> 8190 </field> 8191 <field id="generic_signature"> 8192 <allocfieldbuf><char/></allocfieldbuf> 8193 <description> 8194 The local variable's generic signature, encoded as a 8195 <internallink id="mUTF">modified UTF-8</internallink> string. 8196 The value of this field will be <code>NULL</code> for any local 8197 variable which does not have a generic type. 8198 </description> 8199 </field> 8200 <field id="slot"> 8201 <jint/> 8202 <description> 8203 The local variable's slot. See <internallink id="local">Local Variables</internallink>. 8204 </description> 8205 </field> 8206 </typedef> 8207 <description> 8208 Return local variable information. 8209 </description> 8210 <origin>jvmdiClone</origin> 8211 <capabilities> 8212 <required id="can_access_local_variables"></required> 8213 </capabilities> 8214 <parameters> 8215 <param id="method"> 8216 <jmethodID native="error"/> 8217 <description> 8218 The method to query. 8219 </description> 8220 </param> 8221 <param id="entry_count_ptr"> 8222 <outptr><jint/></outptr> 8223 <description> 8224 On return, points to the number of entries in the table 8225 </description> 8226 </param> 8227 <param id="table_ptr"> 8228 <allocbuf outcount="entry_count_ptr"><struct>jvmtiLocalVariableEntry</struct></allocbuf> 8229 <description> 8230 On return, points to an array of local variable table entries. 8231 </description> 8232 </param> 8233 </parameters> 8234 <errors> 8235 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 8236 Class information does not include local variable 8237 information. 8238 </error> 8239 </errors> 8240 </function> 8241 8242 <function id="GetBytecodes" phase="start" num="75"> 8243 <synopsis>Get Bytecodes</synopsis> 8244 <description> 8245 For the method indicated by <code>method</code>, 8246 return the byte codes that implement the method. The number of 8247 bytecodes is returned via <code>bytecode_count_ptr</code>. The byte codes 8248 themselves are returned via <code>bytecodes_ptr</code>. 8249 </description> 8250 <origin>jvmdi</origin> 8251 <capabilities> 8252 <required id="can_get_bytecodes"></required> 8253 </capabilities> 8254 <parameters> 8255 <param id="klass"> 8256 <jclass method="method"/> 8257 <description> 8258 The class to query. 8259 </description> 8260 </param> 8261 <param id="method"> 8262 <jmethodID class="klass" native="error"/> 8263 <description> 8264 The method to query. 8265 </description> 8266 </param> 8267 <param id="bytecode_count_ptr"> 8268 <outptr><jint/></outptr> 8269 <description> 8270 On return, points to the length of the byte code array 8271 </description> 8272 </param> 8273 <param id="bytecodes_ptr"> 8274 <allocbuf outcount="bytecode_count_ptr"><uchar/></allocbuf> 8275 <description> 8276 On return, points to the pointer to the byte code array 8277 </description> 8278 </param> 8279 </parameters> 8280 <errors> 8281 </errors> 8282 </function> 8283 8284 <function id="IsMethodNative" phase="start" num="76"> 8285 <synopsis>Is Method Native</synopsis> 8286 <description> 8287 For the method indicated by <code>method</code>, return a 8288 value indicating whether the method is native via <code>is_native_ptr</code> 8289 </description> 8290 <origin>jvmdi</origin> 8291 <capabilities> 8292 </capabilities> 8293 <parameters> 8294 <param id="klass"> 8295 <jclass method="method"/> 8296 <description> 8297 The class to query. 8298 </description> 8299 </param> 8300 <param id="method"> 8301 <jmethodID class="klass"/> 8302 <description> 8303 The method to query. 8304 </description> 8305 </param> 8306 <param id="is_native_ptr"> 8307 <outptr><jboolean/></outptr> 8308 <description> 8309 On return, points to the boolean result of this function. 8310 </description> 8311 </param> 8312 </parameters> 8313 <errors> 8314 </errors> 8315 </function> 8316 8317 <function id="IsMethodSynthetic" phase="start" num="77"> 8318 <synopsis>Is Method Synthetic</synopsis> 8319 <description> 8320 For the method indicated by <code>method</code>, return a 8321 value indicating whether the method is synthetic via <code>is_synthetic_ptr</code>. 8322 Synthetic methods are generated by the compiler but not present in the 8323 original source code. 8324 </description> 8325 <origin>jvmdi</origin> 8326 <capabilities> 8327 <required id="can_get_synthetic_attribute"></required> 8328 </capabilities> 8329 <parameters> 8330 <param id="klass"> 8331 <jclass method="method"/> 8332 <description> 8333 The class to query. 8334 </description> 8335 </param> 8336 <param id="method"> 8337 <jmethodID class="klass"/> 8338 <description> 8339 The method to query. 8340 </description> 8341 </param> 8342 <param id="is_synthetic_ptr"> 8343 <outptr><jboolean/></outptr> 8344 <description> 8345 On return, points to the boolean result of this function. 8346 </description> 8347 </param> 8348 </parameters> 8349 <errors> 8350 </errors> 8351 </function> 8352 8353 <function id="IsMethodObsolete" phase="start" num="91"> 8354 <synopsis>Is Method Obsolete</synopsis> 8355 <description> 8356 Determine if a method ID refers to an 8357 <internallink id="obsoleteMethods">obsolete</internallink> 8358 method version. 8359 </description> 8360 <origin>jvmdi</origin> 8361 <capabilities> 8362 </capabilities> 8363 <parameters> 8364 <param id="klass"> 8365 <jclass method="method"/> 8366 <description> 8367 The class to query. 8368 </description> 8369 </param> 8370 <param id="method"> 8371 <jmethodID class="klass"/> 8372 <description> 8373 The method ID to query. 8374 </description> 8375 </param> 8376 <param id="is_obsolete_ptr"> 8377 <outptr><jboolean/></outptr> 8378 <description> 8379 On return, points to the boolean result of this function. 8380 </description> 8381 </param> 8382 </parameters> 8383 <errors> 8384 </errors> 8385 </function> 8386 8387 <function id="SetNativeMethodPrefix" jkernel="yes" phase="any" num="73" since="1.1"> 8388 <synopsis>Set Native Method Prefix</synopsis> 8389 <description> 8390 This function modifies the failure handling of 8391 native method resolution by allowing retry 8392 with a prefix applied to the name. 8393 When used with the 8394 <eventlink id="ClassFileLoadHook">ClassFileLoadHook 8395 event</eventlink>, it enables native methods to be 8396 <internallink id="bci">instrumented</internallink>. 8397 <p/> 8398 Since native methods cannot be directly instrumented 8399 (they have no bytecodes), they must be wrapped with 8400 a non-native method which can be instrumented. 8401 For example, if we had: 8402 <example> 8403 native boolean foo(int x);</example> 8404 <p/> 8405 We could transform the class file (with the 8406 ClassFileLoadHook event) so that this becomes: 8407 <example> 8408 boolean foo(int x) { 8409 <i>... record entry to foo ...</i> 8410 return wrapped_foo(x); 8411 } 8412 8413 native boolean wrapped_foo(int x);</example> 8414 <p/> 8415 Where foo becomes a wrapper for the actual native method 8416 with the appended prefix "wrapped_". Note that 8417 "wrapped_" would be a poor choice of prefix since it 8418 might conceivably form the name of an existing method 8419 thus something like "$$$MyAgentWrapped$$$_" would be 8420 better but would make these examples less readable. 8421 <p/> 8422 The wrapper will allow data to be collected on the native 8423 method call, but now the problem becomes linking up the 8424 wrapped method with the native implementation. 8425 That is, the method <code>wrapped_foo</code> needs to be 8426 resolved to the native implementation of <code>foo</code>, 8427 which might be: 8428 <example> 8429 Java_somePackage_someClass_foo(JNIEnv* env, jint x)</example> 8430 <p/> 8431 This function allows the prefix to be specified and the 8432 proper resolution to occur. 8433 Specifically, when the standard resolution fails, the 8434 resolution is retried taking the prefix into consideration. 8435 There are two ways that resolution occurs, explicit 8436 resolution with the JNI function <code>RegisterNatives</code> 8437 and the normal automatic resolution. For 8438 <code>RegisterNatives</code>, the VM will attempt this 8439 association: 8440 <example> 8441 method(foo) -> nativeImplementation(foo)</example> 8442 <p/> 8443 When this fails, the resolution will be retried with 8444 the specified prefix prepended to the method name, 8445 yielding the correct resolution: 8446 <example> 8447 method(wrapped_foo) -> nativeImplementation(foo)</example> 8448 <p/> 8449 For automatic resolution, the VM will attempt: 8450 <example> 8451 method(wrapped_foo) -> nativeImplementation(wrapped_foo)</example> 8452 <p/> 8453 When this fails, the resolution will be retried with 8454 the specified prefix deleted from the implementation name, 8455 yielding the correct resolution: 8456 <example> 8457 method(wrapped_foo) -> nativeImplementation(foo)</example> 8458 <p/> 8459 Note that since the prefix is only used when standard 8460 resolution fails, native methods can be wrapped selectively. 8461 <p/> 8462 Since each <jvmti/> environment is independent and 8463 can do its own transformation of the bytecodes, more 8464 than one layer of wrappers may be applied. Thus each 8465 environment needs its own prefix. Since transformations 8466 are applied in order, the prefixes, if applied, will 8467 be applied in the same order. 8468 The order of transformation application is described in 8469 the <eventlink id="ClassFileLoadHook"/> event. 8470 Thus if three environments applied 8471 wrappers, <code>foo</code> might become 8472 <code>$env3_$env2_$env1_foo</code>. But if, say, 8473 the second environment did not apply a wrapper to 8474 <code>foo</code> it would be just 8475 <code>$env3_$env1_foo</code>. To be able to 8476 efficiently determine the sequence of prefixes, 8477 an intermediate prefix is only applied if its non-native 8478 wrapper exists. Thus, in the last example, even though 8479 <code>$env1_foo</code> is not a native method, the 8480 <code>$env1_</code> prefix is applied since 8481 <code>$env1_foo</code> exists. 8482 <p/> 8483 Since the prefixes are used at resolution time 8484 and since resolution may be arbitrarily delayed, a 8485 native method prefix must remain set as long as there 8486 are corresponding prefixed native methods. 8487 </description> 8488 <origin>new</origin> 8489 <capabilities> 8490 <required id="can_set_native_method_prefix"></required> 8491 </capabilities> 8492 <parameters> 8493 <param id="prefix"> 8494 <inbuf> 8495 <char/> 8496 <nullok> 8497 any existing prefix in this environment is cancelled 8498 </nullok> 8499 </inbuf> 8500 <description> 8501 The prefix to apply, encoded as a 8502 <internallink id="mUTF">modified UTF-8</internallink> string. 8503 </description> 8504 </param> 8505 </parameters> 8506 <errors> 8507 </errors> 8508 </function> 8509 8510 <function id="SetNativeMethodPrefixes" jkernel="yes" phase="any" num="74" since="1.1"> 8511 <synopsis>Set Native Method Prefixes</synopsis> 8512 <description> 8513 For a normal agent, <functionlink id="SetNativeMethodPrefix"/> 8514 will provide all needed native method prefixing. 8515 For a meta-agent that performs multiple independent class 8516 file transformations (for example as a proxy for another 8517 layer of agents) this function allows each transformation 8518 to have its own prefix. 8519 The prefixes are applied in the order supplied and are 8520 processed in the same manor as described for the 8521 application of prefixes from multiple <jvmti/> environments 8522 in <functionlink id="SetNativeMethodPrefix"/>. 8523 <p/> 8524 Any previous prefixes are replaced. Thus, calling this 8525 function with a <paramlink id="prefix_count"/> of <code>0</code> 8526 disables prefixing in this environment. 8527 <p/> 8528 <functionlink id="SetNativeMethodPrefix"/> and this function 8529 are the two ways to set the prefixes. 8530 Calling <code>SetNativeMethodPrefix</code> with 8531 a prefix is the same as calling this function with 8532 <paramlink id="prefix_count"/> of <code>1</code>. 8533 Calling <code>SetNativeMethodPrefix</code> with 8534 <code>NULL</code> is the same as calling this function with 8535 <paramlink id="prefix_count"/> of <code>0</code>. 8536 </description> 8537 <origin>new</origin> 8538 <capabilities> 8539 <required id="can_set_native_method_prefix"></required> 8540 </capabilities> 8541 <parameters> 8542 <param id="prefix_count"> 8543 <jint min="0"/> 8544 <description> 8545 The number of prefixes to apply. 8546 </description> 8547 </param> 8548 <param id="prefixes"> 8549 <agentbuf> 8550 <char/> 8551 </agentbuf> 8552 <description> 8553 The prefixes to apply for this environment, each encoded as a 8554 <internallink id="mUTF">modified UTF-8</internallink> string. 8555 </description> 8556 </param> 8557 </parameters> 8558 <errors> 8559 </errors> 8560 </function> 8561 8562 </category> 8563 8564 <category id="RawMonitors" label="Raw Monitor"> 8565 8566 <function id="CreateRawMonitor" phase="onload" callbacksafe="safe" num="31"> 8567 <synopsis>Create Raw Monitor</synopsis> 8568 <description> 8569 Create a raw monitor. 8570 </description> 8571 <origin>jvmdi</origin> 8572 <capabilities> 8573 </capabilities> 8574 <parameters> 8575 <param id="name"> 8576 <inbuf><char/></inbuf> 8577 <description> 8578 A name to identify the monitor, encoded as a 8579 <internallink id="mUTF">modified UTF-8</internallink> string. 8580 </description> 8581 </param> 8582 <param id="monitor_ptr"> 8583 <outptr><jrawMonitorID/></outptr> 8584 <description> 8585 On return, points to the created monitor. 8586 </description> 8587 </param> 8588 </parameters> 8589 <errors> 8590 </errors> 8591 </function> 8592 8593 <function id="DestroyRawMonitor" phase="onload" callbacksafe="safe" num="32"> 8594 <synopsis>Destroy Raw Monitor</synopsis> 8595 <description> 8596 Destroy the raw monitor. 8597 If the monitor being destroyed has been entered by this thread, it will be 8598 exited before it is destroyed. 8599 If the monitor being destroyed has been entered by another thread, 8600 an error will be returned and the monitor will not be destroyed. 8601 </description> 8602 <origin>jvmdi</origin> 8603 <capabilities> 8604 </capabilities> 8605 <parameters> 8606 <param id="monitor"> 8607 <jrawMonitorID/> 8608 <description> 8609 The monitor 8610 </description> 8611 </param> 8612 </parameters> 8613 <errors> 8614 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 8615 Not monitor owner 8616 </error> 8617 </errors> 8618 </function> 8619 8620 <function id="RawMonitorEnter" phase="any" callbacksafe="safe" impl="innative notrace" num="33"> 8621 <synopsis>Raw Monitor Enter</synopsis> 8622 <description> 8623 Gain exclusive ownership of a raw monitor. 8624 The same thread may enter a monitor more then once. 8625 The thread must 8626 <functionlink id="RawMonitorExit">exit</functionlink> 8627 the monitor the same number of times as it is entered. 8628 If a monitor is entered during <code>OnLoad</code> (before attached threads exist) 8629 and has not exited when attached threads come into existence, the enter 8630 is considered to have occurred on the main thread. 8631 </description> 8632 <origin>jvmdi</origin> 8633 <capabilities> 8634 </capabilities> 8635 <parameters> 8636 <param id="monitor"> 8637 <jrawMonitorID/> 8638 <description> 8639 The monitor 8640 </description> 8641 </param> 8642 </parameters> 8643 <errors> 8644 </errors> 8645 </function> 8646 8647 <function id="RawMonitorExit" phase="any" callbacksafe="safe" impl="innative notrace" num="34"> 8648 <synopsis>Raw Monitor Exit</synopsis> 8649 <description> 8650 Release exclusive ownership of a raw monitor. 8651 </description> 8652 <origin>jvmdi</origin> 8653 <capabilities> 8654 </capabilities> 8655 <parameters> 8656 <param id="monitor"> 8657 <jrawMonitorID/> 8658 <description> 8659 The monitor 8660 </description> 8661 </param> 8662 </parameters> 8663 <errors> 8664 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 8665 Not monitor owner 8666 </error> 8667 </errors> 8668 </function> 8669 8670 <function id="RawMonitorWait" phase="any" callbacksafe="safe" impl="innative notrace" num="35"> 8671 <synopsis>Raw Monitor Wait</synopsis> 8672 <description> 8673 Wait for notification of the raw monitor. 8674 <p/> 8675 Causes the current thread to wait until either another thread calls 8676 <functionlink id="RawMonitorNotify"/> or 8677 <functionlink id="RawMonitorNotifyAll"/> 8678 for the specified raw monitor, or the specified 8679 <paramlink id="millis">timeout</paramlink> 8680 has elapsed. 8681 </description> 8682 <origin>jvmdi</origin> 8683 <capabilities> 8684 </capabilities> 8685 <parameters> 8686 <param id="monitor"> 8687 <jrawMonitorID/> 8688 <description> 8689 The monitor 8690 </description> 8691 </param> 8692 <param id="millis"> 8693 <jlong/> 8694 <description> 8695 The timeout, in milliseconds. If the timeout is 8696 zero, then real time is not taken into consideration 8697 and the thread simply waits until notified. 8698 </description> 8699 </param> 8700 </parameters> 8701 <errors> 8702 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 8703 Not monitor owner 8704 </error> 8705 <error id="JVMTI_ERROR_INTERRUPT"> 8706 Wait was interrupted, try again 8707 </error> 8708 </errors> 8709 </function> 8710 8711 <function id="RawMonitorNotify" phase="any" callbacksafe="safe" impl="notrace" num="36"> 8712 <synopsis>Raw Monitor Notify</synopsis> 8713 <description> 8714 Notify a single thread waiting on the raw monitor. 8715 </description> 8716 <origin>jvmdi</origin> 8717 <capabilities> 8718 </capabilities> 8719 <parameters> 8720 <param id="monitor"> 8721 <jrawMonitorID/> 8722 <description> 8723 The monitor 8724 </description> 8725 </param> 8726 </parameters> 8727 <errors> 8728 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 8729 Not monitor owner 8730 </error> 8731 </errors> 8732 </function> 8733 8734 <function id="RawMonitorNotifyAll" phase="any" callbacksafe="safe" impl="notrace" num="37"> 8735 <synopsis>Raw Monitor Notify All</synopsis> 8736 <description> 8737 Notify all threads waiting on the raw monitor. 8738 </description> 8739 <origin>jvmdi</origin> 8740 <capabilities> 8741 </capabilities> 8742 <parameters> 8743 <param id="monitor"> 8744 <jrawMonitorID/> 8745 <description> 8746 The monitor 8747 </description> 8748 </param> 8749 </parameters> 8750 <errors> 8751 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 8752 Not monitor owner 8753 </error> 8754 </errors> 8755 </function> 8756 8757 <elide> 8758 <function id="GetRawMonitorUse" num="118"> 8759 <synopsis>Get Raw Monitor Use</synopsis> 8760 <description> 8761 The fields of the <functionlink id="jvmtiMonitorUsage"></functionlink> structure 8762 are filled in with information about usage of the raw monitor. 8763 </description> 8764 <origin>new</origin> 8765 <capabilities> 8766 <required id="can_get_raw_monitor_usage"></required> 8767 </capabilities> 8768 <parameters> 8769 <param id="monitor"> 8770 <jrawMonitorID/> 8771 <description> 8772 the raw monitor to query. 8773 </description> 8774 </param> 8775 <param id="info_ptr"> 8776 <outptr><struct>jvmtiMonitorUsage</struct></outptr> 8777 <description> 8778 On return, filled with monitor information for the 8779 specified raw monitor. 8780 </description> 8781 </param> 8782 </parameters> 8783 <errors> 8784 </errors> 8785 </function> 8786 8787 <function id="GetRawMonitors" num="119"> 8788 <synopsis>Get Raw Monitors</synopsis> 8789 <description> 8790 Return the list of raw monitors. 8791 <p/> 8792 Note: details about each monitor can be examined with 8793 <functionlink id="GetRawMonitorUse"></functionlink>. 8794 </description> 8795 <origin>new</origin> 8796 <capabilities> 8797 <required id="can_get_raw_monitor_usage"></required> 8798 </capabilities> 8799 <parameters> 8800 <param id="monitorCnt"> 8801 <outptr><jint/></outptr> 8802 <description> 8803 On return, pointer to the number 8804 of monitors returned in <code>monitors_ptr</code>. 8805 </description> 8806 </param> 8807 <param id="monitors_ptr"> 8808 <allocbuf outcount="monitorCnt"><jrawMonitorID/></allocbuf> 8809 <description> 8810 On return, pointer to the monitor list. 8811 </description> 8812 </param> 8813 </parameters> 8814 <errors> 8815 </errors> 8816 </function> 8817 </elide> 8818 </category> 8819 8820 <category id="jniIntercept" label="JNI Function Interception"> 8821 8822 <intro> 8823 Provides the ability to intercept and resend 8824 Java Native Interface (JNI) function calls 8825 by manipulating the JNI function table. 8826 See <externallink id="http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/functions.html">JNI 8827 Functions</externallink> in the <i>Java Native Interface Specification</i>. 8828 <p/> 8829 The following example illustrates intercepting the 8830 <code>NewGlobalRef</code> JNI call in order to count reference 8831 creation. 8832 <example> 8833 JNIEnv original_jni_Functions; 8834 JNIEnv redirected_jni_Functions; 8835 int my_global_ref_count = 0; 8836 8837 jobject 8838 MyNewGlobalRef(JNIEnv *jni_env, jobject lobj) { 8839 ++my_global_ref_count; 8840 return originalJNIFunctions->NewGlobalRef(env, lobj); 8841 } 8842 8843 void 8844 myInit() { 8845 jvmtiError err; 8846 8847 err = (*jvmti_env)->GetJNIFunctionTable(jvmti_env, &original_jni_Functions); 8848 if (err != JVMTI_ERROR_NONE) { 8849 die(); 8850 } 8851 err = (*jvmti_env)->GetJNIFunctionTable(jvmti_env, &redirected_jni_Functions); 8852 if (err != JVMTI_ERROR_NONE) { 8853 die(); 8854 } 8855 redirectedJNIFunctions->NewGlobalRef = MyNewGlobalRef; 8856 err = (*jvmti_env)->SetJNIFunctionTable(jvmti_env, redirected_jni_Functions); 8857 if (err != JVMTI_ERROR_NONE) { 8858 die(); 8859 } 8860 } 8861 </example> 8862 Sometime after <code>myInit</code> is called the user's JNI 8863 code is executed which makes the call to create a new global 8864 reference. Instead of going to the normal JNI implementation 8865 the call goes to <code>myNewGlobalRef</code>. Note that a 8866 copy of the original function table is kept so that the normal 8867 JNI function can be called after the data is collected. 8868 Note also that any JNI functions which are not overwritten 8869 will behave normally. 8870 <todo> 8871 check that the example compiles and executes. 8872 </todo> 8873 </intro> 8874 8875 <function id="SetJNIFunctionTable" phase="start" num="120"> 8876 <synopsis>Set JNI Function Table</synopsis> 8877 <description> 8878 Set the JNI function table 8879 in all current and future JNI environments. 8880 As a result, all future JNI calls are directed to the specified functions. 8881 Use <functionlink id="GetJNIFunctionTable"></functionlink> to get the 8882 function table to pass to this function. 8883 For this function to take effect the the updated table entries must be 8884 used by the JNI clients. 8885 Since the table is defined <code>const</code> some compilers may optimize 8886 away the access to the table, thus preventing this function from taking 8887 effect. 8888 The table is copied--changes to the local copy of the 8889 table have no effect. 8890 This function affects only the function table, all other aspects of the environment are 8891 unaffected. 8892 See the examples <internallink id="jniIntercept">above</internallink>. 8893 </description> 8894 <origin>new</origin> 8895 <capabilities> 8896 </capabilities> 8897 <parameters> 8898 <param id="function_table"> 8899 <inptr> 8900 <struct>jniNativeInterface</struct> 8901 </inptr> 8902 <description> 8903 Points to the new JNI function table. 8904 </description> 8905 </param> 8906 </parameters> 8907 <errors> 8908 </errors> 8909 </function> 8910 8911 <function id="GetJNIFunctionTable" phase="start" num="121"> 8912 <synopsis>Get JNI Function Table</synopsis> 8913 <description> 8914 Get the JNI function table. 8915 The JNI function table is copied into allocated memory. 8916 If <functionlink id="SetJNIFunctionTable"></functionlink> 8917 has been called, the modified (not the original) function 8918 table is returned. 8919 Only the function table is copied, no other aspects of the environment 8920 are copied. 8921 See the examples <internallink id="jniIntercept">above</internallink>. 8922 </description> 8923 <origin>new</origin> 8924 <capabilities> 8925 </capabilities> 8926 <parameters> 8927 <param id="function_table"> 8928 <allocbuf> 8929 <struct>jniNativeInterface</struct> 8930 </allocbuf> 8931 <description> 8932 On return, <code>*function_table</code> 8933 points a newly allocated copy of the JNI function table. 8934 </description> 8935 </param> 8936 </parameters> 8937 <errors> 8938 </errors> 8939 </function> 8940 8941 </category> 8942 8943 <category id="eventManagement" label="Event Management"> 8944 8945 <function id="SetEventCallbacks" jkernel="yes" phase="onload" num="122"> 8946 <synopsis>Set Event Callbacks</synopsis> 8947 <description> 8948 Set the functions to be called for each event. 8949 The callbacks are specified by supplying a replacement function table. 8950 The function table is copied--changes to the local copy of the 8951 table have no effect. 8952 This is an atomic action, all callbacks are set at once. 8953 No events are sent before this function is called. 8954 When an entry is <code>NULL</code> or when the event is beyond 8955 <paramlink id="size_of_callbacks"></paramlink> no event is sent. 8956 Details on events are 8957 described <internallink id="EventSection">later</internallink> in this document. 8958 An event must be enabled and have a callback in order to be 8959 sent--the order in which this function and 8960 <functionlink id="SetEventNotificationMode"></functionlink> 8961 are called does not affect the result. 8962 </description> 8963 <origin>new</origin> 8964 <capabilities> 8965 </capabilities> 8966 <parameters> 8967 <param id="callbacks"> 8968 <inptr> 8969 <struct>jvmtiEventCallbacks</struct> 8970 <nullok>remove the existing callbacks</nullok> 8971 </inptr> 8972 <description> 8973 The new event callbacks. 8974 </description> 8975 </param> 8976 <param id="size_of_callbacks"> 8977 <jint min="0"/> 8978 <description> 8979 <code>sizeof(jvmtiEventCallbacks)</code>--for version 8980 compatibility. 8981 </description> 8982 </param> 8983 </parameters> 8984 <errors> 8985 </errors> 8986 </function> 8987 8988 <function id="SetEventNotificationMode" jkernel="yes" phase="onload" num="2"> 8989 <synopsis>Set Event Notification Mode</synopsis> 8990 <description> 8991 Control the generation of events. 8992 <constants id="jvmtiEventMode" label="Event Enable/Disable" kind="enum"> 8993 <constant id="JVMTI_ENABLE" num="1"> 8994 If <paramlink id="mode"></paramlink> is <code>JVMTI_ENABLE</code>, 8995 the event <paramlink id="event_type"></paramlink> will be enabled 8996 </constant> 8997 <constant id="JVMTI_DISABLE" num="0"> 8998 If <paramlink id="mode"></paramlink> is <code>JVMTI_DISABLE</code>, 8999 the event <paramlink id="event_type"></paramlink> will be disabled 9000 </constant> 9001 </constants> 9002 If <code>thread</code> is <code>NULL</code>, 9003 the event is enabled or disabled globally; otherwise, it is 9004 enabled or disabled for a particular thread. 9005 An event is generated for 9006 a particular thread if it is enabled either at the thread or global 9007 levels. 9008 <p/> 9009 See <internallink id="EventIndex">below</internallink> for information on specific events. 9010 <p/> 9011 The following events cannot be controlled at the thread 9012 level through this function. 9013 <ul> 9014 <li><eventlink id="VMInit"></eventlink></li> 9015 <li><eventlink id="VMStart"></eventlink></li> 9016 <li><eventlink id="VMDeath"></eventlink></li> 9017 <li><eventlink id="ThreadStart"></eventlink></li> 9018 <li><eventlink id="CompiledMethodLoad"></eventlink></li> 9019 <li><eventlink id="CompiledMethodUnload"></eventlink></li> 9020 <li><eventlink id="DynamicCodeGenerated"></eventlink></li> 9021 <li><eventlink id="DataDumpRequest"></eventlink></li> 9022 </ul> 9023 <p/> 9024 Initially, no events are enabled at either the thread level 9025 or the global level. 9026 <p/> 9027 Any needed capabilities (see Event Enabling Capabilities below) must be possessed 9028 before calling this function. 9029 <p/> 9030 Details on events are 9031 described <internallink id="EventSection">below</internallink>. 9032 </description> 9033 <origin>jvmdiClone</origin> 9034 <eventcapabilities></eventcapabilities> 9035 <parameters> 9036 <param id="mode"> 9037 <enum>jvmtiEventMode</enum> 9038 <description> 9039 <code>JVMTI_ENABLE</code> or <code>JVMTI_DISABLE</code> 9040 </description> 9041 </param> 9042 <param id="event_type"> 9043 <enum>jvmtiEvent</enum> 9044 <description> 9045 the event to control 9046 </description> 9047 </param> 9048 <param id="event_thread"> 9049 <ptrtype> 9050 <jthread impl="noconvert"/> 9051 <nullok>event is controlled at the global level</nullok> 9052 </ptrtype> 9053 <description> 9054 The thread to control 9055 </description> 9056 </param> 9057 <param id="..."> 9058 <varargs/> 9059 <description> 9060 for future expansion 9061 </description> 9062 </param> 9063 </parameters> 9064 <errors> 9065 <error id="JVMTI_ERROR_INVALID_THREAD"> 9066 <paramlink id="event_thread"/> is non-<code>NULL</code> and is not a valid thread. 9067 </error> 9068 <error id="JVMTI_ERROR_THREAD_NOT_ALIVE"> 9069 <paramlink id="event_thread"/> is non-<code>NULL</code> and is not live (has not been started or is now dead). 9070 </error> 9071 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 9072 thread level control was attempted on events which do not 9073 permit thread level control. 9074 </error> 9075 <error id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY"> 9076 The Required Event Enabling Capability is not possessed. 9077 </error> 9078 </errors> 9079 </function> 9080 9081 <function id="GenerateEvents" num="123"> 9082 <synopsis>Generate Events</synopsis> 9083 <description> 9084 Generate events to represent the current state of the VM. 9085 For example, if <paramlink id="event_type"/> is 9086 <code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code>, 9087 a <eventlink id="CompiledMethodLoad"></eventlink> event will be 9088 sent for each currently compiled method. 9089 Methods that were loaded and now have been unloaded are not sent. 9090 The history of what events have previously been sent does not 9091 effect what events are sent by this function--for example, 9092 all currently compiled methods 9093 will be sent each time this function is called. 9094 <p/> 9095 This function is useful when 9096 events may have been missed due to the agent attaching after program 9097 execution begins; this function generates the missed events. 9098 <p/> 9099 Attempts to execute Java programming language code or 9100 JNI functions may be paused until this function returns - 9101 so neither should be called from the thread sending the event. 9102 This function returns only after the missed events have been 9103 sent, processed and have returned. 9104 The event may be sent on a different thread than the thread 9105 on which the event occurred. 9106 The callback for the event must be set with 9107 <functionlink id="SetEventCallbacks"></functionlink> 9108 and the event must be enabled with 9109 <functionlink id="SetEventNotificationMode"></functionlink> 9110 or the events will not occur. 9111 If the VM no longer has the information to generate some or 9112 all of the requested events, the events are simply not sent - 9113 no error is returned. 9114 <p/> 9115 Only the following events are supported: 9116 <ul> 9117 <li><eventlink id="CompiledMethodLoad"></eventlink></li> 9118 <li><eventlink id="DynamicCodeGenerated"></eventlink></li> 9119 </ul> 9120 </description> 9121 <origin>new</origin> 9122 <capabilities> 9123 <capability id="can_generate_compiled_method_load_events"></capability> 9124 </capabilities> 9125 <parameters> 9126 <param id="event_type"> 9127 <enum>jvmtiEvent</enum> 9128 <description> 9129 The type of event to generate. Must be one of these: 9130 <ul> 9131 <li><eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink></li> 9132 <li><eventlink id="DynamicCodeGenerated"><code>JVMTI_EVENT_DYNAMIC_CODE_GENERATED</code></eventlink></li> 9133 </ul> 9134 </description> 9135 </param> 9136 </parameters> 9137 <errors> 9138 <error id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY"> 9139 <paramlink id="event_type"/> is 9140 <eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink> 9141 and <fieldlink id="can_generate_compiled_method_load_events" struct="jvmtiCapabilities"></fieldlink> 9142 is <code>false</code>. 9143 </error> 9144 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 9145 <paramlink id="event_type"/> is other than 9146 <eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink> 9147 or <eventlink id="DynamicCodeGenerated"><code>JVMTI_EVENT_DYNAMIC_CODE_GENERATED</code></eventlink>. 9148 </error> 9149 </errors> 9150 </function> 9151 9152 </category> 9153 9154 <category id="extension" label="Extension Mechanism"> 9155 9156 <intro> 9157 These functions 9158 allow a <jvmti/> implementation to provide functions and events 9159 beyond those defined in this specification. 9160 <p/> 9161 Both extension functions and extension events have parameters 9162 each of which has a 'type' and 'kind' chosen from the following tables: 9163 9164 <constants id="jvmtiParamTypes" label="Extension Function/Event Parameter Types" kind="enum"> 9165 <constant id="JVMTI_TYPE_JBYTE" num="101"> 9166 Java programming language primitive type - <code>byte</code>. 9167 JNI type <code>jbyte</code>. 9168 </constant> 9169 <constant id="JVMTI_TYPE_JCHAR" num="102"> 9170 Java programming language primitive type - <code>char</code>. 9171 JNI type <code>jchar</code>. 9172 </constant> 9173 <constant id="JVMTI_TYPE_JSHORT" num="103"> 9174 Java programming language primitive type - <code>short</code>. 9175 JNI type <code>jshort</code>. 9176 </constant> 9177 <constant id="JVMTI_TYPE_JINT" num="104"> 9178 Java programming language primitive type - <code>int</code>. 9179 JNI type <datalink id="jint"></datalink>. 9180 </constant> 9181 <constant id="JVMTI_TYPE_JLONG" num="105"> 9182 Java programming language primitive type - <code>long</code>. 9183 JNI type <datalink id="jlong"></datalink>. 9184 </constant> 9185 <constant id="JVMTI_TYPE_JFLOAT" num="106"> 9186 Java programming language primitive type - <code>float</code>. 9187 JNI type <datalink id="jfloat"></datalink>. 9188 </constant> 9189 <constant id="JVMTI_TYPE_JDOUBLE" num="107"> 9190 Java programming language primitive type - <code>double</code>. 9191 JNI type <datalink id="jdouble"></datalink>. 9192 </constant> 9193 <constant id="JVMTI_TYPE_JBOOLEAN" num="108"> 9194 Java programming language primitive type - <code>boolean</code>. 9195 JNI type <datalink id="jboolean"></datalink>. 9196 </constant> 9197 <constant id="JVMTI_TYPE_JOBJECT" num="109"> 9198 Java programming language object type - <code>java.lang.Object</code>. 9199 JNI type <datalink id="jobject"></datalink>. 9200 Returned values are JNI local references and must be managed. 9201 </constant> 9202 <constant id="JVMTI_TYPE_JTHREAD" num="110"> 9203 Java programming language object type - <code>java.lang.Thread</code>. 9204 <jvmti/> type <datalink id="jthread"></datalink>. 9205 Returned values are JNI local references and must be managed. 9206 </constant> 9207 <constant id="JVMTI_TYPE_JCLASS" num="111"> 9208 Java programming language object type - <code>java.lang.Class</code>. 9209 JNI type <datalink id="jclass"></datalink>. 9210 Returned values are JNI local references and must be managed. 9211 </constant> 9212 <constant id="JVMTI_TYPE_JVALUE" num="112"> 9213 Union of all Java programming language primitive and object types - 9214 JNI type <datalink id="jvalue"></datalink>. 9215 Returned values which represent object types are JNI local references and must be managed. 9216 </constant> 9217 <constant id="JVMTI_TYPE_JFIELDID" num="113"> 9218 Java programming language field identifier - 9219 JNI type <datalink id="jfieldID"></datalink>. 9220 </constant> 9221 <constant id="JVMTI_TYPE_JMETHODID" num="114"> 9222 Java programming language method identifier - 9223 JNI type <datalink id="jmethodID"></datalink>. 9224 </constant> 9225 <constant id="JVMTI_TYPE_CCHAR" num="115"> 9226 C programming language type - <code>char</code>. 9227 </constant> 9228 <constant id="JVMTI_TYPE_CVOID" num="116"> 9229 C programming language type - <code>void</code>. 9230 </constant> 9231 <constant id="JVMTI_TYPE_JNIENV" num="117"> 9232 JNI environment - <code>JNIEnv</code>. 9233 Should be used with the correct <datalink id="jvmtiParamKind"/> to make it a pointer type. 9234 </constant> 9235 </constants> 9236 9237 <constants id="jvmtiParamKind" label="Extension Function/Event Parameter Kinds" kind="enum"> 9238 <constant id="JVMTI_KIND_IN" num="91"> 9239 Ingoing argument - <code>foo</code>. 9240 </constant> 9241 <constant id="JVMTI_KIND_IN_PTR" num="92"> 9242 Ingoing pointer argument - <code>const foo*</code>. 9243 </constant> 9244 <constant id="JVMTI_KIND_IN_BUF" num="93"> 9245 Ingoing array argument - <code>const foo*</code>. 9246 </constant> 9247 <constant id="JVMTI_KIND_ALLOC_BUF" num="94"> 9248 Outgoing allocated array argument - <code>foo**</code>. 9249 Free with <code>Deallocate</code>. 9250 </constant> 9251 <constant id="JVMTI_KIND_ALLOC_ALLOC_BUF" num="95"> 9252 Outgoing allocated array of allocated arrays argument - <code>foo***</code>. 9253 Free with <code>Deallocate</code>. 9254 </constant> 9255 <constant id="JVMTI_KIND_OUT" num="96"> 9256 Outgoing argument - <code>foo*</code>. 9257 </constant> 9258 <constant id="JVMTI_KIND_OUT_BUF" num="97"> 9259 Outgoing array argument (pre-allocated by agent) - <code>foo*</code>. 9260 Do not <code>Deallocate</code>. 9261 </constant> 9262 </constants> 9263 9264 </intro> 9265 9266 <typedef id="jvmtiParamInfo" label="Extension Function/Event Parameter Info"> 9267 <field id="name"> 9268 <allocfieldbuf><char/></allocfieldbuf> 9269 <description> 9270 The parameter name, encoded as a 9271 <internallink id="mUTF">modified UTF-8</internallink> string 9272 </description> 9273 </field> 9274 <field id="kind"> 9275 <enum>jvmtiParamKind</enum> 9276 <description> 9277 The kind of the parameter - type modifiers 9278 </description> 9279 </field> 9280 <field id="base_type"> 9281 <enum>jvmtiParamTypes</enum> 9282 <description> 9283 The base type of the parameter - modified by <code>kind</code> 9284 </description> 9285 </field> 9286 <field id="null_ok"> 9287 <jboolean/> 9288 <description> 9289 Is a <code>NULL</code> argument permitted? Applies only to pointer and object types. 9290 </description> 9291 </field> 9292 </typedef> 9293 9294 <callback id="jvmtiExtensionFunction"> 9295 <enum>jvmtiError</enum> 9296 <synopsis>Extension Function</synopsis> 9297 <description> 9298 This is the implementation-specific extension function. 9299 </description> 9300 <parameters> 9301 <param id="jvmti_env"> 9302 <outptr> 9303 <struct>jvmtiEnv</struct> 9304 </outptr> 9305 <description> 9306 The <jvmti/> environment is the only fixed parameter for extension functions. 9307 </description> 9308 </param> 9309 <param id="..."> 9310 <varargs/> 9311 <description> 9312 The extension function-specific parameters 9313 </description> 9314 </param> 9315 </parameters> 9316 </callback> 9317 9318 <function id="GetExtensionFunctions" phase="onload" num="124"> 9319 <synopsis>Get Extension Functions</synopsis> 9320 9321 <typedef id="jvmtiExtensionFunctionInfo" label="Extension Function Info"> 9322 <field id="func"> 9323 <ptrtype> 9324 <struct>jvmtiExtensionFunction</struct> 9325 </ptrtype> 9326 <description> 9327 The actual function to call 9328 </description> 9329 </field> 9330 <field id="id"> 9331 <allocfieldbuf><char/></allocfieldbuf> 9332 <description> 9333 The identifier for the extension function, encoded as a 9334 <internallink id="mUTF">modified UTF-8</internallink> string. 9335 Uses package name conventions. 9336 For example, <code>com.sun.hotspot.bar</code> 9337 </description> 9338 </field> 9339 <field id="short_description"> 9340 <allocfieldbuf><char/></allocfieldbuf> 9341 <description> 9342 A one sentence description of the function, encoded as a 9343 <internallink id="mUTF">modified UTF-8</internallink> string. 9344 </description> 9345 </field> 9346 <field id="param_count"> 9347 <jint/> 9348 <description> 9349 The number of parameters excluding <code>jvmtiEnv *jvmti_env</code> 9350 </description> 9351 </field> 9352 <field id="params"> 9353 <allocfieldbuf outcount="param_count"> 9354 <struct>jvmtiParamInfo</struct> 9355 </allocfieldbuf> 9356 <description> 9357 Array of 9358 <fieldlink id="param_count" struct="jvmtiExtensionFunctionInfo"></fieldlink> 9359 parameters (<code>jvmtiEnv *jvmti_env</code> excluded) 9360 </description> 9361 </field> 9362 <field id="error_count"> 9363 <jint/> 9364 <description> 9365 The number of possible error returns (excluding universal errors) 9366 </description> 9367 </field> 9368 <field id="errors"> 9369 <allocfieldbuf outcount="error_count"> 9370 <enum>jvmtiError</enum> 9371 </allocfieldbuf> 9372 <description> 9373 Array of <fieldlink id="error_count" struct="jvmtiExtensionFunctionInfo"></fieldlink> 9374 possible errors 9375 </description> 9376 </field> 9377 </typedef> 9378 9379 <description> 9380 Returns the set of extension functions. 9381 </description> 9382 <origin>new</origin> 9383 <capabilities> 9384 </capabilities> 9385 <parameters> 9386 <param id="extension_count_ptr"> 9387 <outptr><jint/></outptr> 9388 <description> 9389 On return, points to the number of extension functions 9390 </description> 9391 </param> 9392 <param id="extensions"> 9393 <allocbuf outcount="extension_count_ptr"><struct>jvmtiExtensionFunctionInfo</struct></allocbuf> 9394 <description> 9395 Returns an array of extension function info, one per function 9396 </description> 9397 </param> 9398 </parameters> 9399 <errors> 9400 </errors> 9401 </function> 9402 9403 <function id="GetExtensionEvents" phase="onload" num="125"> 9404 <synopsis>Get Extension Events</synopsis> 9405 9406 <typedef id="jvmtiExtensionEventInfo" label="Extension Event Info"> 9407 <field id="extension_event_index"> 9408 <jint/> 9409 <description> 9410 The identifying index of the event 9411 </description> 9412 </field> 9413 <field id="id"> 9414 <allocfieldbuf><char/></allocfieldbuf> 9415 <description> 9416 The identifier for the extension event, encoded as a 9417 <internallink id="mUTF">modified UTF-8</internallink> string. 9418 Uses package name conventions. 9419 For example, <code>com.sun.hotspot.bar</code> 9420 </description> 9421 </field> 9422 <field id="short_description"> 9423 <allocfieldbuf><char/></allocfieldbuf> 9424 <description> 9425 A one sentence description of the event, encoded as a 9426 <internallink id="mUTF">modified UTF-8</internallink> string. 9427 </description> 9428 </field> 9429 <field id="param_count"> 9430 <jint/> 9431 <description> 9432 The number of parameters excluding <code>jvmtiEnv *jvmti_env</code> 9433 </description> 9434 </field> 9435 <field id="params"> 9436 <allocfieldbuf outcount="param_count"> 9437 <struct>jvmtiParamInfo</struct> 9438 </allocfieldbuf> 9439 <description> 9440 Array of 9441 <fieldlink id="param_count" struct="jvmtiExtensionEventInfo"></fieldlink> 9442 parameters (<code>jvmtiEnv *jvmti_env</code> excluded) 9443 </description> 9444 </field> 9445 </typedef> 9446 9447 <description> 9448 Returns the set of extension events. 9449 </description> 9450 <origin>new</origin> 9451 <capabilities> 9452 </capabilities> 9453 <parameters> 9454 <param id="extension_count_ptr"> 9455 <outptr><jint/></outptr> 9456 <description> 9457 On return, points to the number of extension events 9458 </description> 9459 </param> 9460 <param id="extensions"> 9461 <allocbuf outcount="extension_count_ptr"><struct>jvmtiExtensionEventInfo</struct></allocbuf> 9462 <description> 9463 Returns an array of extension event info, one per event 9464 </description> 9465 </param> 9466 </parameters> 9467 <errors> 9468 </errors> 9469 </function> 9470 9471 <callback id="jvmtiExtensionEvent"> 9472 <void/> 9473 <synopsis>Extension Event</synopsis> 9474 <description> 9475 This is the implementation-specific event. 9476 The event handler is set with 9477 <functionlink id="SetExtensionEventCallback"/>. 9478 <p/> 9479 Event handlers for extension events must be declared varargs to match this definition. 9480 Failure to do so could result in calling convention mismatch and undefined behavior 9481 on some platforms. 9482 <p/> 9483 For example, if the <code>jvmtiParamInfo</code> 9484 returned by <functionlink id="GetExtensionEvents"/> indicates that 9485 there is a <code>jint</code> parameter, the event handler should be 9486 declared: 9487 <example> 9488 void JNICALL myHandler(jvmtiEnv* jvmti_env, jint myInt, ...) 9489 </example> 9490 Note the terminal "<code>...</code>" which indicates varargs. 9491 </description> 9492 <parameters> 9493 <param id="jvmti_env"> 9494 <outptr> 9495 <struct>jvmtiEnv</struct> 9496 </outptr> 9497 <description> 9498 The <jvmti/> environment is the only fixed parameter for extension events. 9499 </description> 9500 </param> 9501 <param id="..."> 9502 <varargs/> 9503 <description> 9504 The extension event-specific parameters 9505 </description> 9506 </param> 9507 </parameters> 9508 </callback> 9509 9510 <function id="SetExtensionEventCallback" phase="onload" num="126"> 9511 <synopsis>Set Extension Event Callback</synopsis> 9512 9513 <description> 9514 Sets the callback function for an extension event and 9515 enables the event. Or, if the callback is <code>NULL</code>, disables 9516 the event. Note that unlike standard events, setting 9517 the callback and enabling the event are a single operation. 9518 </description> 9519 <origin>new</origin> 9520 <capabilities> 9521 </capabilities> 9522 <parameters> 9523 <param id="extension_event_index"> 9524 <jint/> 9525 <description> 9526 Identifies which callback to set. 9527 This index is the 9528 <fieldlink id="extension_event_index" struct="jvmtiExtensionEventInfo"></fieldlink> 9529 field of 9530 <datalink id="jvmtiExtensionEventInfo"/>. 9531 </description> 9532 </param> 9533 <param id="callback"> 9534 <ptrtype> 9535 <struct>jvmtiExtensionEvent</struct> 9536 <nullok>disable the event</nullok> 9537 </ptrtype> 9538 <description> 9539 If <code>callback</code> is non-<code>NULL</code>, 9540 set <code>callback</code> to be the event callback function 9541 and enable the event. 9542 </description> 9543 </param> 9544 </parameters> 9545 <errors> 9546 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 9547 <paramlink id="extension_event_index"/> is not an 9548 <fieldlink id="extension_event_index" 9549 struct="jvmtiExtensionEventInfo"/> 9550 returned by 9551 <functionlink id="GetExtensionEvents"/> 9552 </error> 9553 </errors> 9554 </function> 9555 9556 </category> 9557 9558 <category id="capability" label="Capability"> 9559 9560 <intro> 9561 The capabilities functions allow you to change the 9562 functionality available to <jvmti/>--that is, 9563 which <jvmti/> 9564 functions can be called, what events can be generated, 9565 and what functionality these events and functions can 9566 provide. 9567 <p/> 9568 The "Capabilities" section of each function and event describe which 9569 capabilities, if any, they are associated with. "Required Functionality" 9570 means it is available for use and no capabilities must be added to use it. 9571 "Optional Functionality" means the agent must possess the capability 9572 before it can be used. 9573 To possess a capability, the agent must 9574 <functionlink id="AddCapabilities">add the capability</functionlink>. 9575 "Optional Features" describe capabilities which, 9576 if added, extend the feature set. 9577 <p/> 9578 The potentially available capabilities of each <jvmti/> implementation are different. 9579 Depending on the implementation, a capability: 9580 <ul> 9581 <li>may never be added</li> 9582 <li>may be added in either the <code>OnLoad</code> or live phase in any environment</li> 9583 <li>may be added only during the <code>OnLoad</code> phase</li> 9584 <li>may be possessed by only one environment at a time</li> 9585 <li>may be possessed by only one environment at a time, 9586 and only during the <code>OnLoad</code> phase</li> 9587 <li>and so on ...</li> 9588 </ul> 9589 Frequently, the addition of a capability may incur a cost in execution speed, start up 9590 time, and/or memory footprint. Note that the overhead of using a capability 9591 is completely different than the overhead of possessing a capability. 9592 Take single stepping as an example. When single stepping is on (that 9593 is, when the event is enabled and thus actively sending events) 9594 the overhead of sending and processing an event 9595 on each instruction is huge in any implementation. 9596 However, the overhead of possessing the capability may be small or large, 9597 depending on the implementation. Also, when and if a capability is potentially 9598 available depends on the implementation. Some examples: 9599 <ul> 9600 <li>One VM might perform all execution by compiling bytecodes into 9601 native code and be unable to generate single step instructions. 9602 In this implementation the capability can not be added.</li> 9603 <li>Another VM may be able to switch execution to a single stepping 9604 interpreter at any time. In this implementation, having the capability has no 9605 overhead and could be added at any time.</li> 9606 <li>Yet another VM might be able to choose a bytecode compiling or single stepping capable interpreted 9607 execution engine at start up, but be unable to switch between them. 9608 In this implementation the capability would need to be added 9609 during the <code>OnLoad</code> phase (before bytecode 9610 execution begins) and would have a large impact on execution speed 9611 even if single stepping was never used.</li> 9612 <li>Still another VM might be able to add an "is single stepping on" check 9613 into compiled bytecodes or a generated interpreter. Again in this implementation 9614 the capability would need to be added during the <code>OnLoad</code> phase but the overhead (a test 9615 and branch on each instruction) would be considerably less.</li> 9616 </ul> 9617 <p/> 9618 Each <jvmti/> <internallink id="environments">environment</internallink> 9619 has its own set of capabilities. 9620 Initially, that set is empty. 9621 Any desired capability must be added. 9622 If possible, capabilities should be added during the <code>OnLoad</code> phase. For most 9623 virtual machines certain capabilities require special set up for 9624 the virtual machine and this set up must happen 9625 during the <code>OnLoad</code> phase, before the virtual machine begins execution. 9626 Once a capability is added, it can 9627 only be removed if explicitly relinquished by the environment. 9628 <p/> 9629 The agent can, 9630 <functionlink id="GetPotentialCapabilities">determine what 9631 capabilities this VM can potentially provide</functionlink>, 9632 <functionlink id="AddCapabilities">add the capabilities 9633 to be used</functionlink>, 9634 <functionlink id="RelinquishCapabilities">release capabilities 9635 which are no longer needed</functionlink>, and 9636 <functionlink id="GetCapabilities">examine the currently available 9637 capabilities</functionlink>. 9638 </intro> 9639 9640 <intro id="capabilityExamples" label="Capability Examples"> 9641 For example, a freshly started agent (in the <code>OnLoad</code> function) 9642 wants to enable all possible capabilities. 9643 Note that, in general, this is not advisable as the agent may suffer 9644 a performance penalty for functionality it is not using. 9645 The code might look like this in C: 9646 <example> 9647 jvmtiCapabilities capa; 9648 jvmtiError err; 9649 9650 err = (*jvmti)->GetPotentialCapabilities(jvmti, &capa); 9651 if (err == JVMTI_ERROR_NONE) { 9652 err = (*jvmti)->AddCapabilities(jvmti, &capa); 9653 </example> 9654 For example, if an agent wants to check if it can get 9655 the bytecodes of a method (that is, it wants to check 9656 if it previously added this capability and has not 9657 relinquished it), the code might 9658 look like this in C: 9659 <example> 9660 jvmtiCapabilities capa; 9661 jvmtiError err; 9662 9663 err = (*jvmti)->GetCapabilities(jvmti, &capa); 9664 if (err == JVMTI_ERROR_NONE) { 9665 if (capa.can_get_bytecodes) { ... } } 9666 </example> 9667 </intro> 9668 9669 <capabilitiestypedef id="jvmtiCapabilities" label="The Capabilities Structure"> 9670 <description> 9671 The functions in this category use this capabilities structure 9672 which contains boolean flags corresponding to each capability: 9673 </description> 9674 <capabilityfield id="can_tag_objects"> 9675 <description> 9676 Can set and get tags, as described in the 9677 <internallink id="Heap">Heap category</internallink>. 9678 </description> 9679 </capabilityfield> 9680 <capabilityfield id="can_generate_field_modification_events"> 9681 <description> 9682 Can set watchpoints on field modification - 9683 <functionlink id="SetFieldModificationWatch"></functionlink> 9684 </description> 9685 </capabilityfield> 9686 <capabilityfield id="can_generate_field_access_events"> 9687 <description> 9688 Can set watchpoints on field access - 9689 <functionlink id="SetFieldAccessWatch"></functionlink> 9690 </description> 9691 </capabilityfield> 9692 <capabilityfield id="can_get_bytecodes"> 9693 <description> 9694 Can get bytecodes of a method <functionlink id="GetBytecodes"></functionlink> 9695 </description> 9696 </capabilityfield> 9697 <capabilityfield id="can_get_synthetic_attribute"> 9698 <description> 9699 Can test if a field or method is synthetic - 9700 <functionlink id="IsFieldSynthetic"></functionlink> and 9701 <functionlink id="IsMethodSynthetic"></functionlink> 9702 </description> 9703 </capabilityfield> 9704 <capabilityfield id="can_get_owned_monitor_info"> 9705 <description> 9706 Can get information about ownership of monitors - 9707 <functionlink id="GetOwnedMonitorInfo"></functionlink> 9708 </description> 9709 </capabilityfield> 9710 <capabilityfield id="can_get_current_contended_monitor"> 9711 <description> 9712 Can <functionlink id="GetCurrentContendedMonitor"></functionlink> 9713 </description> 9714 </capabilityfield> 9715 <capabilityfield id="can_get_monitor_info"> 9716 <description> 9717 Can <functionlink id="GetObjectMonitorUsage"></functionlink> 9718 </description> 9719 </capabilityfield> 9720 <capabilityfield id="can_pop_frame"> 9721 <description> 9722 Can pop frames off the stack - <functionlink id="PopFrame"></functionlink> 9723 </description> 9724 </capabilityfield> 9725 <capabilityfield id="can_redefine_classes"> 9726 <description> 9727 Can redefine classes with <functionlink id="RedefineClasses"/>. 9728 </description> 9729 </capabilityfield> 9730 <capabilityfield id="can_signal_thread"> 9731 <description> 9732 Can send stop or interrupt to threads 9733 </description> 9734 </capabilityfield> 9735 <capabilityfield id="can_get_source_file_name"> 9736 <description> 9737 Can get the source file name of a class 9738 </description> 9739 </capabilityfield> 9740 <capabilityfield id="can_get_line_numbers"> 9741 <description> 9742 Can get the line number table of a method 9743 </description> 9744 </capabilityfield> 9745 <capabilityfield id="can_get_source_debug_extension"> 9746 <description> 9747 Can get the source debug extension of a class 9748 </description> 9749 </capabilityfield> 9750 <capabilityfield id="can_access_local_variables"> 9751 <description> 9752 Can set and get local variables 9753 </description> 9754 </capabilityfield> 9755 <capabilityfield id="can_maintain_original_method_order"> 9756 <description> 9757 Can return methods in the order they occur in the class file 9758 </description> 9759 </capabilityfield> 9760 <capabilityfield id="can_generate_single_step_events"> 9761 <description> 9762 Can get <eventlink id="SingleStep">single step</eventlink> events 9763 </description> 9764 </capabilityfield> 9765 <capabilityfield id="can_generate_exception_events"> 9766 <description> 9767 Can get <eventlink id="Exception">exception thrown</eventlink> and 9768 <eventlink id="ExceptionCatch">exception catch</eventlink> events 9769 </description> 9770 </capabilityfield> 9771 <capabilityfield id="can_generate_frame_pop_events"> 9772 <description> 9773 Can <functionlink id="NotifyFramePop">set</functionlink> and thus get 9774 <eventlink id="FramePop"></eventlink> events 9775 </description> 9776 </capabilityfield> 9777 <capabilityfield id="can_generate_breakpoint_events"> 9778 <description> 9779 Can <functionlink id="SetBreakpoint">set</functionlink> and thus get 9780 <eventlink id="Breakpoint"></eventlink> events 9781 </description> 9782 </capabilityfield> 9783 <capabilityfield id="can_suspend"> 9784 <description> 9785 Can suspend and resume threads 9786 </description> 9787 </capabilityfield> 9788 <capabilityfield id="can_redefine_any_class"> 9789 <description> 9790 Can modify (retransform or redefine) any non-primitive non-array class. 9791 See <functionlink id="IsModifiableClass"/>. 9792 </description> 9793 </capabilityfield> 9794 <capabilityfield id="can_get_current_thread_cpu_time"> 9795 <description> 9796 Can <functionlink id="GetCurrentThreadCpuTime">get</functionlink> 9797 current thread CPU time 9798 </description> 9799 </capabilityfield> 9800 <capabilityfield id="can_get_thread_cpu_time"> 9801 <description> 9802 Can <functionlink id="GetThreadCpuTime">get</functionlink> 9803 thread CPU time 9804 </description> 9805 </capabilityfield> 9806 <capabilityfield id="can_generate_method_entry_events" 9807 disp1="can_generate" disp2="_method_entry_events" 9808 > 9809 <description> 9810 Can generate method entry events on entering a method 9811 </description> 9812 </capabilityfield> 9813 <capabilityfield id="can_generate_method_exit_events" 9814 disp1="can_generate" disp2="_method_exit_events" 9815 > 9816 <description> 9817 Can generate method exit events on leaving a method 9818 </description> 9819 </capabilityfield> 9820 <capabilityfield id="can_generate_all_class_hook_events" 9821 disp1="can_generate" disp2="_all_class_hook_events" 9822 > 9823 <description> 9824 Can generate ClassFileLoadHook events for every loaded class. 9825 </description> 9826 </capabilityfield> 9827 <capabilityfield id="can_generate_compiled_method_load_events" 9828 disp1="can_generate" disp2="_compiled_method_load_events" 9829 > 9830 <description> 9831 Can generate events when a method is compiled or unloaded 9832 </description> 9833 </capabilityfield> 9834 <capabilityfield id="can_generate_monitor_events" 9835 disp1="can_generate" disp2="_monitor_events" 9836 > 9837 <description> 9838 Can generate events on monitor activity 9839 </description> 9840 </capabilityfield> 9841 <capabilityfield id="can_generate_vm_object_alloc_events" 9842 disp1="can_generate" disp2="_vm_object_alloc_events" 9843 > 9844 <description> 9845 Can generate events on VM allocation of an object 9846 </description> 9847 </capabilityfield> 9848 <capabilityfield id="can_generate_native_method_bind_events" 9849 disp1="can_generate" disp2="_native_method_bind_events" 9850 > 9851 <description> 9852 Can generate events when a native method is bound to its 9853 implementation 9854 </description> 9855 </capabilityfield> 9856 <capabilityfield id="can_generate_garbage_collection_events" 9857 disp1="can_generate" disp2="_garbage_collection_events" 9858 > 9859 <description> 9860 Can generate events when garbage collection begins or ends 9861 </description> 9862 </capabilityfield> 9863 <capabilityfield id="can_generate_object_free_events" 9864 disp1="can_generate" disp2="_object_free_events" 9865 > 9866 <description> 9867 Can generate events when the garbage collector frees an object 9868 </description> 9869 </capabilityfield> 9870 <capabilityfield id="can_force_early_return" since="1.1"> 9871 <description> 9872 Can return early from a method, as described in the 9873 <internallink id="ForceEarlyReturn">Force Early Return category</internallink>. 9874 </description> 9875 </capabilityfield> 9876 <capabilityfield id="can_get_owned_monitor_stack_depth_info" since="1.1"> 9877 <description> 9878 Can get information about owned monitors with stack depth - 9879 <functionlink id="GetOwnedMonitorStackDepthInfo"></functionlink> 9880 </description> 9881 </capabilityfield> 9882 <capabilityfield id="can_get_constant_pool" since="1.1"> 9883 <description> 9884 Can get the constant pool of a class - 9885 <functionlink id="GetConstantPool"></functionlink> 9886 </description> 9887 </capabilityfield> 9888 <capabilityfield id="can_set_native_method_prefix" since="1.1"> 9889 <description> 9890 Can set prefix to be applied when native method cannot be resolved - 9891 <functionlink id="SetNativeMethodPrefix"/> and 9892 <functionlink id="SetNativeMethodPrefixes"/> 9893 </description> 9894 </capabilityfield> 9895 <capabilityfield id="can_retransform_classes" since="1.1"> 9896 <description> 9897 Can retransform classes with <functionlink id="RetransformClasses"/>. 9898 In addition to the restrictions imposed by the specific 9899 implementation on this capability (see the 9900 <internallink id="capability">Capability</internallink> section), 9901 this capability must be set before the 9902 <eventlink id="ClassFileLoadHook"/> event is enabled for the 9903 first time in this environment. 9904 An environment that possesses this capability at the time that 9905 <code>ClassFileLoadHook</code> is enabled for the first time is 9906 said to be <i>retransformation capable</i>. 9907 An environment that does not possess this capability at the time that 9908 <code>ClassFileLoadHook</code> is enabled for the first time is 9909 said to be <i>retransformation incapable</i>. 9910 </description> 9911 </capabilityfield> 9912 <capabilityfield id="can_retransform_any_class" since="1.1"> 9913 <description> 9914 <functionlink id="RetransformClasses"/> can be called on any class 9915 (<fieldlink id="can_retransform_classes" struct="jvmtiCapabilities"/> 9916 must also be set) 9917 </description> 9918 </capabilityfield> 9919 <capabilityfield id="can_generate_resource_exhaustion_heap_events" since="1.1"> 9920 <description> 9921 Can generate events when the VM is unable to allocate memory from 9922 the <tm>Java</tm> platform heap. 9923 See <eventlink id="ResourceExhausted"/>. 9924 </description> 9925 </capabilityfield> 9926 <capabilityfield id="can_generate_resource_exhaustion_threads_events" since="1.1"> 9927 <description> 9928 Can generate events when the VM is unable to create a thread. 9929 See <eventlink id="ResourceExhausted"/>. 9930 </description> 9931 </capabilityfield> 9932 </capabilitiestypedef> 9933 9934 <function id="GetPotentialCapabilities" jkernel="yes" phase="onload" num="140"> 9935 <synopsis>Get Potential Capabilities</synopsis> 9936 <description> 9937 Returns via <paramlink id="capabilities_ptr"></paramlink> the <jvmti/> 9938 features that can potentially be possessed by this environment 9939 at this time. 9940 The returned capabilities differ from the complete set of capabilities 9941 implemented by the VM in two cases: another environment possesses 9942 capabilities that can only be possessed by one environment, or the 9943 current <functionlink id="GetPhase">phase</functionlink> is live, 9944 and certain capabilities can only be added during the <code>OnLoad</code> phase. 9945 The <functionlink id="AddCapabilities"></functionlink> function 9946 may be used to set any or all or these capabilities. 9947 Currently possessed capabilities are included. 9948 <p/> 9949 Typically this function is used in the <code>OnLoad</code> function. 9950 Some virtual machines may allow a limited set of capabilities to be 9951 added in the live phase. 9952 In this case, the set of potentially available capabilities 9953 will likely differ from the <code>OnLoad</code> phase set. 9954 <p/> 9955 See the 9956 <internallink id="capabilityExamples">Capability Examples</internallink>. 9957 </description> 9958 <origin>new</origin> 9959 <capabilities> 9960 </capabilities> 9961 <parameters> 9962 <param id="capabilities_ptr"> 9963 <outptr><struct>jvmtiCapabilities</struct></outptr> 9964 <description> 9965 On return, points to the <jvmti/> capabilities that may be added. 9966 </description> 9967 </param> 9968 </parameters> 9969 <errors> 9970 </errors> 9971 </function> 9972 9973 <elide> 9974 <function id="EstimateCostOfCapabilities" phase="onload" num="141"> 9975 <synopsis>Estimate Cost Of Capabilities</synopsis> 9976 <description> 9977 <issue>There is strong opposition to this function. The concern is 9978 that it would be difficult or impossible to provide meaningful 9979 numbers, as the amount of impact is conditional on many factors 9980 that a single number could not represent. There is doubt that 9981 conditional implementations would be used or are even a good idea. 9982 The thought is that release documentation for the implementation 9983 would be the best means of exposing this information. 9984 Unless new arguments are presented, I intend to remove this 9985 function in the next revision. 9986 </issue> 9987 <p/> 9988 Return via the <paramlink id="time_impact_ptr"></paramlink> and 9989 <paramlink id="space_impact_ptr"></paramlink> an estimate of the impact 9990 of adding the capabilities pointed to by 9991 <paramlink id="capabilities_ptr"></paramlink>. 9992 The returned estimates are in percentage of additional overhead, thus 9993 a time impact of 100 mean the application might run 9994 at half the speed. 9995 The estimates are very rough approximations and are not guaranteed. 9996 Note also, that the estimates are of the impact of having the 9997 capability available--when and if it is used the impact may be 9998 much greater. 9999 Estimates can be for a single capability or for a set of 10000 capabilities. Note that the costs are not necessarily additive, 10001 adding support for one capability might make another available 10002 for free or conversely having two capabilities at once may 10003 have multiplicative impact. 10004 Estimates are relative to the current set of capabilities - 10005 that is, how much more impact given the currently possessed capabilities. 10006 <p/> 10007 Typically this function is used in the OnLoad function, 10008 some virtual machines may allow a limited set of capabilities to be 10009 added in the live phase. 10010 In this case, the set of potentially available capabilities 10011 will likely differ from the OnLoad phase set. 10012 <p/> 10013 See the 10014 <internallink id="capabilityExamples">Capability Examples</internallink>. 10015 </description> 10016 <origin>new</origin> 10017 <capabilities> 10018 </capabilities> 10019 <parameters> 10020 <param id="capabilities_ptr"> 10021 <inptr><struct>jvmtiCapabilities</struct></inptr> 10022 <description> 10023 points to the <jvmti/> capabilities to evaluate. 10024 </description> 10025 </param> 10026 <param id="time_impact_ptr"> 10027 <outptr><jint/></outptr> 10028 <description> 10029 On return, points to the estimated percentage increase in 10030 run time if this capability was added. 10031 </description> 10032 </param> 10033 <param id="space_impact_ptr"> 10034 <outptr><jint/></outptr> 10035 <description> 10036 On return, points to the estimated percentage increase in 10037 memory space used if this capability was added. 10038 </description> 10039 </param> 10040 </parameters> 10041 <errors> 10042 <error id="JVMTI_ERROR_NOT_AVAILABLE"> 10043 The desired capabilities are not even potentially available. 10044 </error> 10045 </errors> 10046 </function> 10047 </elide> 10048 10049 <function id="AddCapabilities" jkernel="yes" phase="onload" num="142"> 10050 <synopsis>Add Capabilities</synopsis> 10051 <description> 10052 Set new capabilities by adding the capabilities 10053 whose values are set to one (<code>1</code>) in 10054 <code>*</code><paramlink id="capabilities_ptr"></paramlink>. 10055 All previous capabilities are retained. 10056 Typically this function is used in the <code>OnLoad</code> function. 10057 Some virtual machines may allow a limited set of capabilities to be 10058 added in the live phase. 10059 <p/> 10060 See the 10061 <internallink id="capabilityExamples">Capability Examples</internallink>. 10062 </description> 10063 <origin>new</origin> 10064 <capabilities> 10065 </capabilities> 10066 <parameters> 10067 <param id="capabilities_ptr"> 10068 <inptr><struct>jvmtiCapabilities</struct></inptr> 10069 <description> 10070 Points to the <jvmti/> capabilities to add. 10071 </description> 10072 </param> 10073 </parameters> 10074 <errors> 10075 <error id="JVMTI_ERROR_NOT_AVAILABLE"> 10076 The desired capabilities are not even potentially available. 10077 </error> 10078 </errors> 10079 </function> 10080 10081 10082 <function id="RelinquishCapabilities" phase="onload" num="143"> 10083 <synopsis>Relinquish Capabilities</synopsis> 10084 <description> 10085 Relinquish the capabilities 10086 whose values are set to one (<code>1</code>) in 10087 <code>*</code><paramlink id="capabilities_ptr"></paramlink>. 10088 Some implementations may allow only one environment to have a capability 10089 (see the <internallink id="capability">capability introduction</internallink>). 10090 This function releases capabilities 10091 so that they may be used by other agents. 10092 All other capabilities are retained. 10093 The capability will no longer be present in <functionlink id="GetCapabilities"></functionlink>. 10094 Attempting to relinquish a capability that the agent does not possess is not an error. 10095 <issue> 10096 It is possible for the agent to be actively using capabilities 10097 which are being relinquished. For example, a thread is currently 10098 suspended and can_suspend is being relinquished or an event is currently 10099 enabled and can_generate_whatever is being relinquished. 10100 There are three possible ways we could spec this: 10101 <ul> 10102 <li>relinquish automatically releases them</li> 10103 <li>relinquish checks and returns some error code if held</li> 10104 <li>it is the agent's responsibility and it is not checked</li> 10105 </ul> 10106 One of these should be chosen. 10107 </issue> 10108 </description> 10109 <origin>new</origin> 10110 <capabilities> 10111 </capabilities> 10112 <parameters> 10113 <param id="capabilities_ptr"> 10114 <inptr><struct>jvmtiCapabilities</struct></inptr> 10115 <description> 10116 Points to the <jvmti/> capabilities to relinquish. 10117 </description> 10118 </param> 10119 </parameters> 10120 <errors> 10121 </errors> 10122 </function> 10123 10124 10125 10126 <function id="GetCapabilities" jkernel="yes" phase="any" num="89"> 10127 <synopsis>Get Capabilities</synopsis> 10128 <description> 10129 Returns via <paramlink id="capabilities_ptr"></paramlink> the optional <jvmti/> 10130 features which this environment currently possesses. 10131 Each possessed capability is indicated by a one (<code>1</code>) in the 10132 corresponding field of the <internallink id="jvmtiCapabilities">capabilities 10133 structure</internallink>. 10134 An environment does not possess a capability unless it has been successfully added with 10135 <functionlink id="AddCapabilities"/>. 10136 An environment only loses possession of a capability if it has been relinquished with 10137 <functionlink id="RelinquishCapabilities"/>. Thus, this function returns the net result 10138 of the <code>AddCapabilities</code> and <code>RelinquishCapabilities</code> calls which 10139 have been made. 10140 <p/> 10141 See the 10142 <internallink id="capabilityExamples">Capability Examples</internallink>. 10143 </description> 10144 <origin>jvmdiClone</origin> 10145 <capabilities> 10146 </capabilities> 10147 <parameters> 10148 <param id="capabilities_ptr"> 10149 <outptr><struct>jvmtiCapabilities</struct></outptr> 10150 <description> 10151 On return, points to the <jvmti/> capabilities. 10152 </description> 10153 </param> 10154 </parameters> 10155 <errors> 10156 </errors> 10157 </function> 10158 10159 </category> 10160 10161 10162 <category id="timers" label="Timers"> 10163 10164 <intro> 10165 These functions provide timing information. 10166 The resolution at which the time is updated is not specified. 10167 They provides nanosecond precision, but not necessarily nanosecond accuracy. 10168 Details about the timers, such as their maximum values, can be accessed with 10169 the timer information functions. 10170 </intro> 10171 10172 <typedef id="jvmtiTimerInfo" label="Timer Info"> 10173 <description> 10174 The information function for each timer returns this data structure. 10175 </description> 10176 <field id="max_value"> 10177 <jlong/> 10178 <description> 10179 The maximum value the timer can reach. 10180 After this value is reached the timer wraps back to zero. 10181 This is an unsigned value. If tested or printed as a jlong (signed value) 10182 it may appear to be a negative number. 10183 </description> 10184 </field> 10185 <field id="may_skip_forward"> 10186 <jboolean/> 10187 <description> 10188 If true, the timer can be externally adjusted and as a result skip forward. 10189 If false, the timer value will never increase faster than real time. 10190 </description> 10191 </field> 10192 <field id="may_skip_backward"> 10193 <jboolean/> 10194 <description> 10195 If true, the timer can be externally adjusted and as a result skip backward. 10196 If false, the timer value will be monotonically increasing. 10197 </description> 10198 </field> 10199 <field id="kind"> 10200 <enum>jvmtiTimerKind</enum> 10201 <description> 10202 The kind of timer. 10203 On a platform that does not distinguish between user and system time, <datalink 10204 id="JVMTI_TIMER_TOTAL_CPU"><code>JVMTI_TIMER_TOTAL_CPU</code></datalink> 10205 is returned. 10206 </description> 10207 </field> 10208 <field id="reserved1"> 10209 <jlong/> 10210 <description> 10211 Reserved for future use. 10212 </description> 10213 </field> 10214 <field id="reserved2"> 10215 <jlong/> 10216 <description> 10217 Reserved for future use. 10218 </description> 10219 </field> 10220 </typedef> 10221 10222 <intro> 10223 Where the timer kind is -- 10224 10225 <constants id="jvmtiTimerKind" label="Timer Kinds" kind="enum"> 10226 <constant id="JVMTI_TIMER_USER_CPU" num="30"> 10227 CPU time that a thread is in user mode. 10228 </constant> 10229 <constant id="JVMTI_TIMER_TOTAL_CPU" num="31"> 10230 CPU time that a thread is in user or system mode. 10231 </constant> 10232 <constant id="JVMTI_TIMER_ELAPSED" num="32"> 10233 Elapsed time. 10234 </constant> 10235 </constants> 10236 </intro> 10237 10238 <function id="GetCurrentThreadCpuTimerInfo" callbacksafe="safe" impl="innative notrace" phase="start" num="134"> 10239 <synopsis>Get Current Thread CPU Timer Information</synopsis> 10240 <description> 10241 Get information about the 10242 <functionlink id="GetCurrentThreadCpuTime"/> timer. 10243 The fields of the <datalink id="jvmtiTimerInfo"/> structure 10244 are filled in with details about the timer. 10245 This information is specific to the platform and the implementation of 10246 <functionlink id="GetCurrentThreadCpuTime"/> and thus 10247 does not vary by thread nor does it vary 10248 during a particular invocation of the VM. 10249 <p/> 10250 Note that the implementations of <functionlink id="GetCurrentThreadCpuTime"/> 10251 and <functionlink id="GetThreadCpuTime"/> may differ, and thus the values 10252 returned by <code>GetCurrentThreadCpuTimerInfo</code> 10253 and <functionlink id="GetThreadCpuTimerInfo"/> 10254 may differ -- see <functionlink id="GetCurrentThreadCpuTime"/> for more information. 10255 </description> 10256 <origin>new</origin> 10257 <capabilities> 10258 <required id="can_get_current_thread_cpu_time"> 10259 Can get current thread CPU time. 10260 </required> 10261 </capabilities> 10262 <parameters> 10263 <param id="info_ptr"> 10264 <outptr><struct>jvmtiTimerInfo</struct></outptr> 10265 <description> 10266 On return, filled with information describing the time 10267 returned by <functionlink id="GetCurrentThreadCpuTime"/>. 10268 </description> 10269 </param> 10270 </parameters> 10271 <errors> 10272 </errors> 10273 </function> 10274 10275 <function id="GetCurrentThreadCpuTime" callbacksafe="safe" impl="innative notrace" phase="start" num="135"> 10276 <synopsis>Get Current Thread CPU Time</synopsis> 10277 <description> 10278 Return the CPU time utilized by the current thread. 10279 <p/> 10280 Note that the <functionlink id="GetThreadCpuTime"/> 10281 function provides CPU time for any thread, including 10282 the current thread. <code>GetCurrentThreadCpuTime</code> 10283 exists to support platforms which cannot 10284 supply CPU time for threads other than the current 10285 thread or which have more accurate information for 10286 the current thread (see 10287 <functionlink id="GetCurrentThreadCpuTimerInfo"/> vs 10288 <functionlink id="GetThreadCpuTimerInfo"/>). 10289 On many platforms this call will be equivalent to: 10290 <example> 10291 GetThreadCpuTime(env, NULL, nanos_ptr) 10292 </example> 10293 </description> 10294 <origin>new</origin> 10295 <capabilities> 10296 <required id="can_get_current_thread_cpu_time"> 10297 Can get current thread CPU time. 10298 <p/> 10299 If this capability is enabled after threads have started, 10300 the implementation may choose any time up 10301 to and including the time that the capability is enabled 10302 as the point where CPU time collection starts. 10303 <p/> 10304 This capability must be potentially available on any 10305 platform where 10306 <internallink id="jvmtiCapabilities.can_get_thread_cpu_time"><code>can_get_thread_cpu_time</code></internallink> 10307 is potentially available. 10308 </required> 10309 </capabilities> 10310 <parameters> 10311 <param id="nanos_ptr"> 10312 <outptr><jlong/></outptr> 10313 <description> 10314 On return, points to the CPU time used by this thread 10315 in nanoseconds. 10316 This is an unsigned value. If tested or printed as a jlong (signed value) 10317 it may appear to be a negative number. 10318 </description> 10319 </param> 10320 </parameters> 10321 <errors> 10322 </errors> 10323 </function> 10324 10325 <function id="GetThreadCpuTimerInfo" num="136"> 10326 <synopsis>Get Thread CPU Timer Information</synopsis> 10327 <description> 10328 Get information about the 10329 <functionlink id="GetThreadCpuTime"/> timer. 10330 The fields of the <datalink id="jvmtiTimerInfo"/> structure 10331 are filled in with details about the timer. 10332 This information is specific to the platform and the implementation of 10333 <functionlink id="GetThreadCpuTime"/> and thus 10334 does not vary by thread nor does it vary 10335 during a particular invocation of the VM. 10336 <p/> 10337 Note that the implementations of <functionlink id="GetCurrentThreadCpuTime"/> 10338 and <functionlink id="GetThreadCpuTime"/> may differ, and thus the values 10339 returned by <functionlink id="GetCurrentThreadCpuTimerInfo"/> 10340 and <code>GetThreadCpuTimerInfo</code> 10341 may differ -- see <functionlink id="GetCurrentThreadCpuTime"/> for more information. 10342 </description> 10343 <origin>new</origin> 10344 <capabilities> 10345 <required id="can_get_thread_cpu_time"> 10346 Can get thread CPU time. 10347 </required> 10348 </capabilities> 10349 <parameters> 10350 <param id="info_ptr"> 10351 <outptr><struct>jvmtiTimerInfo</struct></outptr> 10352 <description> 10353 On return, filled with information describing the time 10354 returned by <functionlink id="GetThreadCpuTime"/>. 10355 </description> 10356 </param> 10357 </parameters> 10358 <errors> 10359 </errors> 10360 </function> 10361 10362 <function id="GetThreadCpuTime" num="137"> 10363 <synopsis>Get Thread CPU Time</synopsis> 10364 <description> 10365 Return the CPU time utilized by the specified thread. 10366 <p/> 10367 Get information about this timer with 10368 <functionlink id="GetThreadCpuTimerInfo"/>. 10369 </description> 10370 <origin>new</origin> 10371 <capabilities> 10372 <required id="can_get_thread_cpu_time"> 10373 Can get thread CPU time. 10374 <p/> 10375 If this capability is enabled after threads have started, 10376 the implementation may choose any time up 10377 to and including the time that the capability is enabled 10378 as the point where CPU time collection starts. 10379 </required> 10380 </capabilities> 10381 <parameters> 10382 <param id="thread"> 10383 <jthread null="current"/> 10384 <description> 10385 The thread to query. 10386 </description> 10387 </param> 10388 <param id="nanos_ptr"> 10389 <outptr><jlong/></outptr> 10390 <description> 10391 On return, points to the CPU time used by the specified thread 10392 in nanoseconds. 10393 This is an unsigned value. If tested or printed as a jlong (signed value) 10394 it may appear to be a negative number. 10395 </description> 10396 </param> 10397 </parameters> 10398 <errors> 10399 </errors> 10400 </function> 10401 10402 <function id="GetTimerInfo" phase="any" callbacksafe="safe" num="138"> 10403 <synopsis>Get Timer Information</synopsis> 10404 <description> 10405 Get information about the 10406 <functionlink id="GetTime"/> timer. 10407 The fields of the <datalink id="jvmtiTimerInfo"/> structure 10408 are filled in with details about the timer. 10409 This information will not change during a particular invocation of the VM. 10410 </description> 10411 <origin>new</origin> 10412 <capabilities> 10413 </capabilities> 10414 <parameters> 10415 <param id="info_ptr"> 10416 <outptr><struct>jvmtiTimerInfo</struct></outptr> 10417 <description> 10418 On return, filled with information describing the time 10419 returned by <functionlink id="GetTime"/>. 10420 </description> 10421 </param> 10422 </parameters> 10423 <errors> 10424 </errors> 10425 </function> 10426 10427 <function id="GetTime" phase="any" callbacksafe="safe" num="139"> 10428 <synopsis>Get Time</synopsis> 10429 <description> 10430 Return the current value of the system timer, in nanoseconds. 10431 <p/> 10432 The value returned represents nanoseconds since some fixed but 10433 arbitrary time (perhaps in the future, so values may be 10434 negative). This function provides nanosecond precision, but not 10435 necessarily nanosecond accuracy. No guarantees are made about 10436 how frequently values change. 10437 <p/> 10438 Get information about this timer with 10439 <functionlink id="GetTimerInfo"/>. 10440 </description> 10441 <origin>new</origin> 10442 <capabilities> 10443 </capabilities> 10444 <parameters> 10445 <param id="nanos_ptr"> 10446 <outptr><jlong/></outptr> 10447 <description> 10448 On return, points to the time in nanoseconds. 10449 This is an unsigned value. If tested or printed as a jlong (signed value) 10450 it may appear to be a negative number. 10451 </description> 10452 </param> 10453 </parameters> 10454 <errors> 10455 </errors> 10456 </function> 10457 10458 <function id="GetAvailableProcessors" phase="any" num="144"> 10459 <synopsis>Get Available Processors</synopsis> 10460 <description> 10461 Returns the number of processors available to the Java virtual machine. 10462 <p/> 10463 This value may change during a particular invocation of the virtual machine. 10464 Applications that are sensitive to the number of available processors should 10465 therefore occasionally poll this property. 10466 </description> 10467 <origin>new</origin> 10468 <capabilities> 10469 </capabilities> 10470 <parameters> 10471 <param id="processor_count_ptr"> 10472 <outptr><jint/></outptr> 10473 <description> 10474 On return, points to the maximum number of processors available to the 10475 virtual machine; never smaller than one. 10476 </description> 10477 </param> 10478 </parameters> 10479 <errors> 10480 </errors> 10481 </function> 10482 10483 </category> 10484 10485 10486 <category id="classLoaderSearch" label="Class Loader Search"> 10487 10488 <intro> 10489 These functions allow the agent to add to the locations that a class loader searches for a class. 10490 This is useful for installing instrumentation under the correct class loader. 10491 </intro> 10492 10493 <function id="AddToBootstrapClassLoaderSearch" jkernel="yes" phase="onload" num="149"> 10494 <synopsis>Add To Bootstrap Class Loader Search</synopsis> 10495 <description> 10496 This function can be used to cause instrumentation classes to be defined by the 10497 bootstrap class loader. See <vmspec chapter="5.3.1"/>. 10498 After the bootstrap 10499 class loader unsuccessfully searches for a class, the specified platform-dependent 10500 search path <paramlink id="segment"/> will be searched as well. Only one segment may be specified in 10501 the <paramlink id="segment"/>. This function may be called multiple times to add multiple segments, 10502 the segments will be searched in the order that this function was called. 10503 <p/> 10504 In the <code>OnLoad</code> phase the function may be used to specify any platform-dependent 10505 search path segment to be searched after the bootstrap class loader unsuccessfully searches 10506 for a class. The segment is typically a directory or JAR file. 10507 <p/> 10508 In the live phase the <paramlink id="segment"/> may be used to specify any platform-dependent 10509 path to a <externallink id="http://docs.oracle.com/javase/7/docs/technotes/guides/jar/jar.html"> 10510 JAR file</externallink>. The agent should take care that the JAR file does not 10511 contain any classes or resources other than those to be defined by the bootstrap 10512 class loader for the purposes of instrumentation. 10513 <p/> 10514 <vmspec/> specifies that a subsequent attempt to resolve a symbolic 10515 reference that the Java virtual machine has previously unsuccessfully attempted 10516 to resolve always fails with the same error that was thrown as a result of the 10517 initial resolution attempt. Consequently, if the JAR file contains an entry 10518 that corresponds to a class for which the Java virtual machine has 10519 unsuccessfully attempted to resolve a reference, then subsequent attempts to 10520 resolve that reference will fail with the same error as the initial attempt. 10521 </description> 10522 <origin>new</origin> 10523 <capabilities> 10524 </capabilities> 10525 <parameters> 10526 <param id="segment"> 10527 <inbuf><char/></inbuf> 10528 <description> 10529 The platform-dependent search path segment, encoded as a 10530 <internallink id="mUTF">modified UTF-8</internallink> string. 10531 </description> 10532 </param> 10533 </parameters> 10534 <errors> 10535 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 10536 <paramlink id="segment"/> is an invalid path. In the live phase, anything other than an 10537 existing JAR file is an invalid path. 10538 </error> 10539 </errors> 10540 </function> 10541 10542 <function id="AddToSystemClassLoaderSearch" jkernel="yes" phase="onload" num="151" since="1.1"> 10543 <synopsis>Add To System Class Loader Search</synopsis> 10544 <description> 10545 This function can be used to cause instrumentation classes to be 10546 defined by the system class loader. See <vmspec chapter="5.3.2"/>. 10547 After the class loader unsuccessfully searches for a class, the specified platform-dependent search 10548 path <paramlink id="segment"/> will be searched as well. Only one segment may be specified in the 10549 <paramlink id="segment"/>. This function may be called multiple times to add multiple segments, the 10550 segments will be searched in the order that this function was called. 10551 <p/> 10552 In the <code>OnLoad</code> phase the function may be used to specify any platform-dependent 10553 search path segment to be searched after the system class loader unsuccessfully searches 10554 for a class. The segment is typically a directory or JAR file. 10555 <p/> 10556 In the live phase the <paramlink id="segment"/> is a platform-dependent path to a <externallink 10557 id="http://docs.oracle.com/javase/7/docs/technotes/guides/jar/jar.html">JAR file</externallink> to be 10558 searched after the system class loader unsuccessfully searches for a class. The agent should 10559 take care that the JAR file does not contain any classes or resources other than those to be 10560 defined by the system class loader for the purposes of instrumentation. 10561 <p/> 10562 In the live phase the system class loader supports adding a JAR file to be searched if 10563 the system class loader implements a method name <code>appendToClassPathForInstrumentation</code> 10564 which takes a single parameter of type <code>java.lang.String</code>. The method is not required 10565 to have <code>public</code> access. 10566 <p/> 10567 <vmspec/> specifies that a subsequent attempt to resolve a symbolic 10568 reference that the Java virtual machine has previously unsuccessfully attempted 10569 to resolve always fails with the same error that was thrown as a result of the 10570 initial resolution attempt. Consequently, if the JAR file contains an entry 10571 that corresponds to a class for which the Java virtual machine has 10572 unsuccessfully attempted to resolve a reference, then subsequent attempts to 10573 resolve that reference will fail with the same error as the initial attempt. 10574 </description> 10575 <origin>new</origin> 10576 <capabilities> 10577 </capabilities> 10578 <parameters> 10579 <param id="segment"> 10580 <inbuf><char/></inbuf> 10581 <description> 10582 The platform-dependent search path segment, encoded as a 10583 <internallink id="mUTF">modified UTF-8</internallink> string. 10584 </description> 10585 </param> 10586 </parameters> 10587 <errors> 10588 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 10589 <paramlink id="segment"/> is an invalid path. In the live phase, anything other than an 10590 existing JAR file is an invalid path. 10591 </error> 10592 <error id="JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED"> 10593 Operation not supported by the system class loader. 10594 </error> 10595 </errors> 10596 </function> 10597 10598 </category> 10599 10600 10601 <category id="props" label="System Properties"> 10602 10603 <intro> 10604 These functions get and set system properties. 10605 </intro> 10606 10607 <function id="GetSystemProperties" phase="onload" num="130"> 10608 <synopsis>Get System Properties</synopsis> 10609 <description> 10610 The list of VM system property keys which may be used with 10611 <functionlink id="GetSystemProperty"/> is returned. 10612 It is strongly recommended that virtual machines provide the 10613 following property keys: 10614 <ul> 10615 <li><code>java.vm.vendor</code></li> 10616 <li><code>java.vm.version</code></li> 10617 <li><code>java.vm.name</code></li> 10618 <li><code>java.vm.info</code></li> 10619 <li><code>java.library.path</code></li> 10620 <li><code>java.class.path</code></li> 10621 </ul> 10622 Provides access to system properties defined by and used 10623 by the VM. 10624 Properties set on the command-line are included. 10625 This allows getting and setting of these properties 10626 before the VM even begins executing bytecodes. 10627 Since this is a VM view of system properties, the set of available 10628 properties will usually be different than that 10629 in <code>java.lang.System.getProperties</code>. 10630 JNI method invocation may be used to access 10631 <code>java.lang.System.getProperties</code>. 10632 <p/> 10633 The set of properties may grow during execution. 10634 </description> 10635 <origin>new</origin> 10636 <capabilities> 10637 </capabilities> 10638 <parameters> 10639 <param id="count_ptr"> 10640 <outptr><jint/></outptr> 10641 <description> 10642 On return, points to the number of property keys returned. 10643 </description> 10644 </param> 10645 <param id="property_ptr"> 10646 <allocallocbuf outcount="count_ptr"><char/></allocallocbuf> 10647 <description> 10648 On return, points to an array of property keys, encoded as 10649 <internallink id="mUTF">modified UTF-8</internallink> strings. 10650 </description> 10651 </param> 10652 </parameters> 10653 <errors> 10654 </errors> 10655 </function> 10656 10657 <function id="GetSystemProperty" phase="onload" num="131"> 10658 <synopsis>Get System Property</synopsis> 10659 <description> 10660 Return a VM system property value given the property key. 10661 <p/> 10662 The function <functionlink id="GetSystemProperties"/> 10663 returns the set of property keys which may be used. 10664 The properties which can be retrieved may grow during 10665 execution. 10666 <p/> 10667 Since this is a VM view of system properties, the values 10668 of properties may differ from that returned by 10669 <code>java.lang.System.getProperty(String)</code>. 10670 A typical VM might copy the values of the VM system 10671 properties into the <code>Properties</code> held by 10672 <code>java.lang.System</code> during the initialization 10673 of that class. Thereafter any changes to the VM system 10674 properties (with <functionlink id="SetSystemProperty"/>) 10675 or the <code>java.lang.System</code> system properties 10676 (with <code>java.lang.System.setProperty(String,String)</code>) 10677 would cause the values to diverge. 10678 JNI method invocation may be used to access 10679 <code>java.lang.System.getProperty(String)</code>. 10680 </description> 10681 <origin>new</origin> 10682 <capabilities> 10683 </capabilities> 10684 <parameters> 10685 <param id="property"> 10686 <inbuf><char/></inbuf> 10687 <description> 10688 The key of the property to retrieve, encoded as a 10689 <internallink id="mUTF">modified UTF-8</internallink> string. 10690 </description> 10691 </param> 10692 <param id="value_ptr"> 10693 <allocbuf><char/></allocbuf> 10694 <description> 10695 On return, points to the property value, encoded as a 10696 <internallink id="mUTF">modified UTF-8</internallink> string. 10697 </description> 10698 </param> 10699 </parameters> 10700 <errors> 10701 <error id="JVMTI_ERROR_NOT_AVAILABLE"> 10702 This property is not available. 10703 Use <functionlink id="GetSystemProperties"/> to find available properties. 10704 </error> 10705 </errors> 10706 </function> 10707 10708 <function id="SetSystemProperty" phase="onloadOnly" num="132"> 10709 <synopsis>Set System Property</synopsis> 10710 <description> 10711 Set a VM system property value. 10712 <p/> 10713 The function <functionlink id="GetSystemProperties"/> 10714 returns the set of property keys, some of these may be settable. 10715 See <functionlink id="GetSystemProperty"/>. 10716 </description> 10717 <origin>new</origin> 10718 <capabilities> 10719 </capabilities> 10720 <parameters> 10721 <param id="property"> 10722 <inbuf><char/></inbuf> 10723 <description> 10724 The key of the property, encoded as a 10725 <internallink id="mUTF">modified UTF-8</internallink> string. 10726 </description> 10727 </param> 10728 <param id="value_ptr"> 10729 <inbuf> 10730 <char/> 10731 <nullok> 10732 do not set the value, but return <errorlink id="JVMTI_ERROR_NOT_AVAILABLE"/> 10733 if the property is not writeable 10734 </nullok> 10735 </inbuf> 10736 <description> 10737 The property value to set, encoded as a 10738 <internallink id="mUTF">modified UTF-8</internallink> string. 10739 </description> 10740 </param> 10741 </parameters> 10742 <errors> 10743 <error id="JVMTI_ERROR_NOT_AVAILABLE"> 10744 This property is not available or is not writeable. 10745 </error> 10746 </errors> 10747 </function> 10748 10749 </category> 10750 10751 <category id="general" label="General"> 10752 10753 <intro> 10754 </intro> 10755 10756 <function id="GetPhase" jkernel="yes" phase="any" num="133"> 10757 <synopsis>Get Phase</synopsis> 10758 <description> 10759 Return the current phase of VM execution. 10760 The phases proceed in sequence: 10761 <constants id="jvmtiPhase" label="Phases of execution" kind="enum"> 10762 <constant id="JVMTI_PHASE_ONLOAD" num="1"> 10763 <code>OnLoad</code> phase: while in the 10764 <internallink id="onload"><code>Agent_OnLoad</code></internallink> or, for statically linked agents, the <internallink id="onload"><code>Agent_OnLoad_<agent-lib-name></code></internallink> function. 10765 </constant> 10766 <constant id="JVMTI_PHASE_PRIMORDIAL" num="2"> 10767 Primordial phase: between return from <code>Agent_OnLoad</code> or <code>Agent_OnLoad_<agent-lib-name></code> and the 10768 <code>VMStart</code> event. 10769 </constant> 10770 <constant id="JVMTI_PHASE_START" num="6"> 10771 Start phase: when the <eventlink id="VMStart"><code>VMStart</code></eventlink> event 10772 is sent and until the <code>VMInit</code> event is sent. 10773 </constant> 10774 <constant id="JVMTI_PHASE_LIVE" num="4"> 10775 Live phase: when the <eventlink id="VMInit"><code>VMInit</code></eventlink> event is sent 10776 and until the <eventlink id="VMDeath"></eventlink> event returns. 10777 </constant> 10778 <constant id="JVMTI_PHASE_DEAD" num="8"> 10779 Dead phase: after the <eventlink id="VMDeath"></eventlink> event returns or after 10780 start-up failure. 10781 </constant> 10782 </constants> 10783 In the case of start-up failure the VM will proceed directly to the dead 10784 phase skipping intermediate phases and neither a <code>VMInit</code> nor 10785 <code>VMDeath</code> event will be sent. 10786 <p/> 10787 Most <jvmti/> functions operate only in the live phase. 10788 The following functions operate in either the <code>OnLoad</code> or live phases: 10789 <functionphaselist phase="onload"/> 10790 The following functions operate in only the <code>OnLoad</code> phase: 10791 <functionphaselist phase="onloadOnly"/> 10792 The following functions operate in the start or live phases: 10793 <functionphaselist phase="start"/> 10794 The following functions operate in any phase: 10795 <functionphaselist phase="any"/> 10796 JNI functions (except the Invocation API) must only be used in the start or live phases. 10797 <p/> 10798 Most <jvmti/> events are sent only in the live phase. 10799 The following events operate in others phases: 10800 <eventphaselist phase="start"/> 10801 <eventphaselist phase="any"/> 10802 </description> 10803 <origin>new</origin> 10804 <capabilities> 10805 </capabilities> 10806 <parameters> 10807 <param id="phase_ptr"> 10808 <outptr><enum>jvmtiPhase</enum></outptr> 10809 <description> 10810 On return, points to the phase. 10811 </description> 10812 </param> 10813 </parameters> 10814 <errors> 10815 </errors> 10816 </function> 10817 10818 <function id="DisposeEnvironment" jkernel="yes" phase="any" num="127"> 10819 <synopsis>Dispose Environment</synopsis> 10820 <description> 10821 Shutdown a <jvmti/> connection created with JNI <code>GetEnv</code> 10822 (see <internallink id="environments"><jvmti/> Environments</internallink>). 10823 Dispose of any resources held by the environment. 10824 <issue> 10825 What resources are reclaimed? What is undone? 10826 Breakpoints,watchpoints removed? 10827 </issue> 10828 Threads suspended by this environment are not resumed by this call, 10829 this must be done explicitly by the agent. 10830 Memory allocated by this environment via calls to <jvmti/> functions 10831 is not released, this can be done explicitly by the agent 10832 by calling <functionlink id="Deallocate"/>. 10833 Raw monitors created by this environment are not destroyed, 10834 this can be done explicitly by the agent 10835 by calling <functionlink id="DestroyRawMonitor"/>. 10836 The state of threads waiting on raw monitors created by this environment 10837 are not affected. 10838 <p/> 10839 Any <functionlink id="SetNativeMethodPrefix">native method 10840 prefixes</functionlink> for this environment will be unset; 10841 the agent must remove any prefixed native methods before 10842 dispose is called. 10843 <p/> 10844 Any <internallink id="capability">capabilities</internallink> 10845 held by this environment are relinquished. 10846 <p/> 10847 Events enabled by this environment will no longer be sent, however 10848 event handlers currently running will continue to run. Caution must 10849 be exercised in the design of event handlers whose environment may 10850 be disposed and thus become invalid during their execution. 10851 <p/> 10852 This environment may not be used after this call. 10853 This call returns to the caller. 10854 </description> 10855 <origin>new</origin> 10856 <capabilities> 10857 </capabilities> 10858 <parameters> 10859 </parameters> 10860 <errors> 10861 </errors> 10862 </function> 10863 10864 <function id="SetEnvironmentLocalStorage" jkernel="yes" phase="any" callbacksafe="safe" impl="innative notrace" num="148"> 10865 <synopsis>Set Environment Local Storage</synopsis> 10866 <description> 10867 The VM stores a pointer value associated with each environment. 10868 This pointer value is called <i>environment-local storage</i>. 10869 This value is <code>NULL</code> unless set with this function. 10870 Agents can allocate memory in which they store environment specific 10871 information. By setting environment-local storage it can then be 10872 accessed with 10873 <functionlink id="GetEnvironmentLocalStorage"></functionlink>. 10874 <p/> 10875 Called by the agent to set the value of the <jvmti/> 10876 environment-local storage. <jvmti/> supplies to the agent a pointer-size 10877 environment-local storage that can be used to record per-environment 10878 information. 10879 </description> 10880 <origin>new</origin> 10881 <capabilities> 10882 </capabilities> 10883 <parameters> 10884 <param id="data"> 10885 <inbuf> 10886 <void/> 10887 <nullok>value is set to <code>NULL</code></nullok> 10888 </inbuf> 10889 <description> 10890 The value to be entered into the environment-local storage. 10891 </description> 10892 </param> 10893 </parameters> 10894 <errors> 10895 </errors> 10896 </function> 10897 10898 <function id="GetEnvironmentLocalStorage" jkernel="yes" phase="any" callbacksafe="safe" impl="innative notrace" num="147"> 10899 <synopsis>Get Environment Local Storage</synopsis> 10900 <description> 10901 Called by the agent to get the value of the <jvmti/> environment-local 10902 storage. 10903 </description> 10904 <origin>new</origin> 10905 <capabilities> 10906 </capabilities> 10907 <parameters> 10908 <param id="data_ptr"> 10909 <agentbuf><void/></agentbuf> 10910 <description> 10911 Pointer through which the value of the environment local 10912 storage is returned. 10913 If environment-local storage has not been set with 10914 <functionlink id="SetEnvironmentLocalStorage"></functionlink> returned 10915 pointer is <code>NULL</code>. 10916 </description> 10917 </param> 10918 </parameters> 10919 <errors> 10920 </errors> 10921 </function> 10922 10923 <function id="GetVersionNumber" jkernel="yes" phase="any" num="88"> 10924 <synopsis>Get Version Number</synopsis> 10925 <description> 10926 Return the <jvmti/> version via <code>version_ptr</code>. 10927 The return value is the version identifier. 10928 The version identifier includes major, minor and micro 10929 version as well as the interface type. 10930 <constants id="jvmtiVersionInterfaceTypes" label="Version Interface Types" kind="bits"> 10931 <constant id="JVMTI_VERSION_INTERFACE_JNI" num="0x00000000"> 10932 Value of <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> for JNI. 10933 </constant> 10934 <constant id="JVMTI_VERSION_INTERFACE_JVMTI" num="0x30000000"> 10935 Value of <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> for <jvmti/>. 10936 </constant> 10937 </constants> 10938 <constants id="jvmtiVersionMasks" label="Version Masks" kind="bits"> 10939 <constant id="JVMTI_VERSION_MASK_INTERFACE_TYPE" num="0x70000000"> 10940 Mask to extract interface type. 10941 The value of the version returned by this function masked with 10942 <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> is always 10943 <code>JVMTI_VERSION_INTERFACE_JVMTI</code> 10944 since this is a <jvmti/> function. 10945 </constant> 10946 <constant id="JVMTI_VERSION_MASK_MAJOR" num="0x0FFF0000"> 10947 Mask to extract major version number. 10948 </constant> 10949 <constant id="JVMTI_VERSION_MASK_MINOR" num="0x0000FF00"> 10950 Mask to extract minor version number. 10951 </constant> 10952 <constant id="JVMTI_VERSION_MASK_MICRO" num="0x000000FF"> 10953 Mask to extract micro version number. 10954 </constant> 10955 </constants> 10956 <constants id="jvmtiVersionShifts" label="Version Shifts" kind="bits"> 10957 <constant id="JVMTI_VERSION_SHIFT_MAJOR" num="16"> 10958 Shift to extract major version number. 10959 </constant> 10960 <constant id="JVMTI_VERSION_SHIFT_MINOR" num="8"> 10961 Shift to extract minor version number. 10962 </constant> 10963 <constant id="JVMTI_VERSION_SHIFT_MICRO" num="0"> 10964 Shift to extract micro version number. 10965 </constant> 10966 </constants> 10967 </description> 10968 <origin>jvmdi</origin> 10969 <capabilities> 10970 </capabilities> 10971 <parameters> 10972 <param id="version_ptr"> 10973 <outptr><jint/></outptr> 10974 <description> 10975 On return, points to the <jvmti/> version. 10976 </description> 10977 </param> 10978 </parameters> 10979 <errors> 10980 </errors> 10981 </function> 10982 10983 10984 <function id="GetErrorName" phase="any" num="128"> 10985 <synopsis>Get Error Name</synopsis> 10986 <description> 10987 Return the symbolic name for an 10988 <internallink id="ErrorSection">error code</internallink>. 10989 <p/> 10990 For example 10991 <code>GetErrorName(env, JVMTI_ERROR_NONE, &err_name)</code> 10992 would return in <code>err_name</code> the string 10993 <code>"JVMTI_ERROR_NONE"</code>. 10994 </description> 10995 <origin>new</origin> 10996 <capabilities> 10997 </capabilities> 10998 <parameters> 10999 <param id="error"> 11000 <enum>jvmtiError</enum> 11001 <description> 11002 The error code. 11003 </description> 11004 </param> 11005 <param id="name_ptr"> 11006 <allocbuf><char/></allocbuf> 11007 <description> 11008 On return, points to the error name. 11009 The name is encoded as a 11010 <internallink id="mUTF">modified UTF-8</internallink> string, 11011 but is restricted to the ASCII subset. 11012 </description> 11013 </param> 11014 </parameters> 11015 <errors> 11016 </errors> 11017 </function> 11018 11019 <function id="SetVerboseFlag" phase="any" num="150"> 11020 <synopsis>Set Verbose Flag</synopsis> 11021 <description> 11022 <constants id="jvmtiVerboseFlag" label="Verbose Flag Enumeration" kind="enum"> 11023 <constant id="JVMTI_VERBOSE_OTHER" num="0"> 11024 Verbose output other than the below. 11025 </constant> 11026 <constant id="JVMTI_VERBOSE_GC" num="1"> 11027 Verbose garbage collector output, like that specified with <code>-verbose:gc</code>. 11028 </constant> 11029 <constant id="JVMTI_VERBOSE_CLASS" num="2"> 11030 Verbose class loading output, like that specified with <code>-verbose:class</code>. 11031 </constant> 11032 <constant id="JVMTI_VERBOSE_JNI" num="4"> 11033 Verbose JNI output, like that specified with <code>-verbose:jni</code>. 11034 </constant> 11035 </constants> 11036 Control verbose output. 11037 This is the output which typically is sent to <code>stderr</code>. 11038 </description> 11039 <origin>new</origin> 11040 <capabilities> 11041 </capabilities> 11042 <parameters> 11043 <param id="flag"> 11044 <enum>jvmtiVerboseFlag</enum> 11045 <description> 11046 Which verbose flag to set. 11047 </description> 11048 </param> 11049 <param id="value"> 11050 <jboolean/> 11051 <description> 11052 New value of the flag. 11053 </description> 11054 </param> 11055 </parameters> 11056 <errors> 11057 </errors> 11058 </function> 11059 11060 11061 <function id="GetJLocationFormat" phase="any" num="129"> 11062 <synopsis>Get JLocation Format</synopsis> 11063 <description> 11064 Although the greatest functionality is achieved with location information 11065 referencing the virtual machine bytecode index, the definition of 11066 <code>jlocation</code> has intentionally been left unconstrained to allow VM 11067 implementations that do not have this information. 11068 <p/> 11069 This function describes the representation of <code>jlocation</code> used in this VM. 11070 If the returned format is <datalink id="JVMTI_JLOCATION_JVMBCI"></datalink>, 11071 <code>jlocation</code>s can 11072 be used as in indices into the array returned by 11073 <functionlink id="GetBytecodes"></functionlink>. 11074 <constants id="jvmtiJlocationFormat" label="JLocation Format Enumeration" kind="enum"> 11075 <constant id="JVMTI_JLOCATION_JVMBCI" num="1"> 11076 <code>jlocation</code> values represent virtual machine 11077 bytecode indices--that is, offsets into the 11078 virtual machine code for a method. 11079 </constant> 11080 <constant id="JVMTI_JLOCATION_MACHINEPC" num="2"> 11081 <code>jlocation</code> values represent native machine 11082 program counter values. 11083 </constant> 11084 <constant id="JVMTI_JLOCATION_OTHER" num="0"> 11085 <code>jlocation</code> values have some other representation. 11086 </constant> 11087 </constants> 11088 </description> 11089 <origin>new</origin> 11090 <capabilities> 11091 </capabilities> 11092 <parameters> 11093 <param id="format_ptr"> 11094 <outptr><enum>jvmtiJlocationFormat</enum></outptr> 11095 <description> 11096 On return, points to the format identifier for <code>jlocation</code> values. 11097 </description> 11098 </param> 11099 </parameters> 11100 <errors> 11101 </errors> 11102 </function> 11103 11104 </category> 11105 11106 </functionsection> 11107 11108 <errorsection label="Error Reference"> 11109 <intro> 11110 Every <jvmti/> function returns a <b><code>jvmtiError</code></b> error code. 11111 <p/> 11112 It is the responsibility of the agent to call <jvmti/> functions with 11113 valid parameters and in the proper context (calling thread is attached, 11114 phase is correct, etc.). 11115 Detecting some error conditions may be difficult, inefficient, or 11116 impossible for an implementation. 11117 The errors listed in 11118 <internallink id="reqerrors">Function Specific Required Errors</internallink> 11119 must be detected by the implementation. 11120 All other errors represent the recommended response to the error 11121 condition. 11122 </intro> 11123 11124 <errorcategory id="universal-error" label="Universal Errors"> 11125 <intro> 11126 The following errors may be returned by any function 11127 </intro> 11128 11129 <errorid id="JVMTI_ERROR_NONE" num="0"> 11130 No error has occurred. This is the error code that is returned 11131 on successful completion of the function. 11132 </errorid> 11133 <errorid id="JVMTI_ERROR_NULL_POINTER" num="100"> 11134 Pointer is unexpectedly <code>NULL</code>. 11135 </errorid> 11136 <errorid id="JVMTI_ERROR_OUT_OF_MEMORY" num="110"> 11137 The function attempted to allocate memory and no more memory was 11138 available for allocation. 11139 </errorid> 11140 <errorid id="JVMTI_ERROR_ACCESS_DENIED" num="111"> 11141 The desired functionality has not been enabled in this virtual machine. 11142 </errorid> 11143 <errorid id="JVMTI_ERROR_UNATTACHED_THREAD" num="115"> 11144 The thread being used to call this function is not attached 11145 to the virtual machine. Calls must be made from attached threads. 11146 See <code>AttachCurrentThread</code> in the JNI invocation API. 11147 </errorid> 11148 <errorid id="JVMTI_ERROR_INVALID_ENVIRONMENT" num="116"> 11149 The <jvmti/> environment provided is no longer connected or is 11150 not an environment. 11151 </errorid> 11152 <errorid id="JVMTI_ERROR_WRONG_PHASE" num="112"> 11153 The desired functionality is not available in the current 11154 <functionlink id="GetPhase">phase</functionlink>. 11155 Always returned if the virtual machine has completed running. 11156 </errorid> 11157 <errorid id="JVMTI_ERROR_INTERNAL" num="113"> 11158 An unexpected internal error has occurred. 11159 </errorid> 11160 </errorcategory> 11161 11162 <errorcategory id="reqerrors" label="Function Specific Required Errors"> 11163 <intro> 11164 The following errors are returned by some <jvmti/> functions and must 11165 be returned by the implementation when the condition occurs. 11166 </intro> 11167 11168 <errorid id="JVMTI_ERROR_INVALID_PRIORITY" num="12"> 11169 Invalid priority. 11170 </errorid> 11171 <errorid id="JVMTI_ERROR_THREAD_NOT_SUSPENDED" num="13"> 11172 Thread was not suspended. 11173 </errorid> 11174 <errorid id="JVMTI_ERROR_THREAD_SUSPENDED" num="14"> 11175 Thread already suspended. 11176 </errorid> 11177 <errorid id="JVMTI_ERROR_THREAD_NOT_ALIVE" num="15"> 11178 This operation requires the thread to be alive--that is, 11179 it must be started and not yet have died. 11180 </errorid> 11181 <errorid id="JVMTI_ERROR_CLASS_NOT_PREPARED" num="22"> 11182 The class has been loaded but not yet prepared. 11183 </errorid> 11184 <errorid id="JVMTI_ERROR_NO_MORE_FRAMES" num="31"> 11185 There are no Java programming language or JNI stack frames at the specified depth. 11186 </errorid> 11187 <errorid id="JVMTI_ERROR_OPAQUE_FRAME" num="32"> 11188 Information about the frame is not available (e.g. for native frames). 11189 </errorid> 11190 <errorid id="JVMTI_ERROR_DUPLICATE" num="40"> 11191 Item already set. 11192 </errorid> 11193 <errorid id="JVMTI_ERROR_NOT_FOUND" num="41"> 11194 Desired element (e.g. field or breakpoint) not found 11195 </errorid> 11196 <errorid id="JVMTI_ERROR_NOT_MONITOR_OWNER" num="51"> 11197 This thread doesn't own the raw monitor. 11198 </errorid> 11199 <errorid id="JVMTI_ERROR_INTERRUPT" num="52"> 11200 The call has been interrupted before completion. 11201 </errorid> 11202 <errorid id="JVMTI_ERROR_UNMODIFIABLE_CLASS" num="79"> 11203 The class cannot be modified. 11204 </errorid> 11205 <errorid id="JVMTI_ERROR_NOT_AVAILABLE" num="98"> 11206 The functionality is not available in this virtual machine. 11207 </errorid> 11208 <errorid id="JVMTI_ERROR_ABSENT_INFORMATION" num="101"> 11209 The requested information is not available. 11210 </errorid> 11211 <errorid id="JVMTI_ERROR_INVALID_EVENT_TYPE" num="102"> 11212 The specified event type ID is not recognized. 11213 </errorid> 11214 <errorid id="JVMTI_ERROR_NATIVE_METHOD" num="104"> 11215 The requested information is not available for native method. 11216 </errorid> 11217 <errorid id="JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED" num="106"> 11218 The class loader does not support this operation. 11219 </errorid> 11220 </errorcategory> 11221 11222 <errorcategory id="function-specific-errors" label="Function Specific Agent Errors"> 11223 <intro> 11224 The following errors are returned by some <jvmti/> functions. 11225 They are returned in the event of invalid parameters passed by the 11226 agent or usage in an invalid context. 11227 An implementation is not required to detect these errors. 11228 </intro> 11229 11230 <errorid id="JVMTI_ERROR_INVALID_THREAD" num="10"> 11231 The passed thread is not a valid thread. 11232 </errorid> 11233 <errorid id="JVMTI_ERROR_INVALID_FIELDID" num="25"> 11234 Invalid field. 11235 </errorid> 11236 <errorid id="JVMTI_ERROR_INVALID_METHODID" num="23"> 11237 Invalid method. 11238 </errorid> 11239 <errorid id="JVMTI_ERROR_INVALID_LOCATION" num="24"> 11240 Invalid location. 11241 </errorid> 11242 <errorid id="JVMTI_ERROR_INVALID_OBJECT" num="20"> 11243 Invalid object. 11244 </errorid> 11245 <errorid id="JVMTI_ERROR_INVALID_CLASS" num="21"> 11246 Invalid class. 11247 </errorid> 11248 <errorid id="JVMTI_ERROR_TYPE_MISMATCH" num="34"> 11249 The variable is not an appropriate type for the function used. 11250 </errorid> 11251 <errorid id="JVMTI_ERROR_INVALID_SLOT" num="35"> 11252 Invalid slot. 11253 </errorid> 11254 <errorid id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY" num="99"> 11255 The capability being used is false in this environment. 11256 </errorid> 11257 <errorid id="JVMTI_ERROR_INVALID_THREAD_GROUP" num="11"> 11258 Thread group invalid. 11259 </errorid> 11260 <errorid id="JVMTI_ERROR_INVALID_MONITOR" num="50"> 11261 Invalid raw monitor. 11262 </errorid> 11263 <errorid id="JVMTI_ERROR_ILLEGAL_ARGUMENT" num="103"> 11264 Illegal argument. 11265 </errorid> 11266 <errorid id="JVMTI_ERROR_INVALID_TYPESTATE" num="65"> 11267 The state of the thread has been modified, and is now inconsistent. 11268 </errorid> 11269 <errorid id="JVMTI_ERROR_UNSUPPORTED_VERSION" num="68"> 11270 A new class file has a version number not supported by this VM. 11271 </errorid> 11272 <errorid id="JVMTI_ERROR_INVALID_CLASS_FORMAT" num="60"> 11273 A new class file is malformed (the VM would return a <code>ClassFormatError</code>). 11274 </errorid> 11275 <errorid id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION" num="61"> 11276 The new class file definitions would lead to a circular 11277 definition (the VM would return a <code>ClassCircularityError</code>). 11278 </errorid> 11279 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED" num="63"> 11280 A new class file would require adding a method. 11281 </errorid> 11282 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED" num="64"> 11283 A new class version changes a field. 11284 </errorid> 11285 <errorid id="JVMTI_ERROR_FAILS_VERIFICATION" num="62"> 11286 The class bytes fail verification. 11287 </errorid> 11288 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED" num="66"> 11289 A direct superclass is different for the new class 11290 version, or the set of directly implemented 11291 interfaces is different. 11292 </errorid> 11293 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED" num="67"> 11294 A new class version does not declare a method 11295 declared in the old class version. 11296 </errorid> 11297 <errorid id="JVMTI_ERROR_NAMES_DONT_MATCH" num="69"> 11298 The class name defined in the new class file is 11299 different from the name in the old class object. 11300 </errorid> 11301 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED" num="70"> 11302 A new class version has different modifiers. 11303 </errorid> 11304 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED" num="71"> 11305 A method in the new class version has different modifiers 11306 than its counterpart in the old class version. 11307 </errorid> 11308 </errorcategory> 11309 </errorsection> 11310 11311 <eventsection label="Events"> 11312 <intro label="Handling Events" id="eventIntro"> 11313 Agents can be informed of many events that occur in application 11314 programs. 11315 <p/> 11316 To handle events, designate a set of callback functions with 11317 <functionlink id="SetEventCallbacks"></functionlink>. 11318 For each event the corresponding callback function will be 11319 called. 11320 Arguments to the callback function provide additional 11321 information about the event. 11322 <p/> 11323 The callback function is usually called from within an application 11324 thread. The <jvmti/> implementation does not 11325 queue events in any way. This means 11326 that event callback functions must be written 11327 carefully. Here are some general guidelines. See 11328 the individual event descriptions for further 11329 suggestions. 11330 <p/> 11331 <ul> 11332 <li>Any exception thrown during the execution of an event callback can 11333 overwrite any current pending exception in the current application thread. 11334 Care must be taken to preserve a pending exception 11335 when an event callback makes a JNI call that might generate an exception. 11336 </li> 11337 <li>Event callback functions must be re-entrant. The <jvmti/> implementation does 11338 not queue events. If an agent needs to process events one at a time, it 11339 can use a raw monitor inside the 11340 event callback functions to serialize event processing. 11341 </li> 11342 <li>Event callback functions that execute JNI's FindClass function to load 11343 classes need to note that FindClass locates the class loader associated 11344 with the current native method. For the purposes of class loading, an 11345 event callback that includes a JNI environment as a parameter to the 11346 callback will treated as if it is a native call, where the native method 11347 is in the class of the event thread's current frame. 11348 </li> 11349 </ul> 11350 <p/> 11351 Some <jvmti/> events identify objects with JNI references. 11352 All references 11353 in <jvmti/> events are JNI local references and will become invalid 11354 after the event callback returns. 11355 Unless stated otherwise, memory referenced by pointers sent in event 11356 callbacks may not be referenced after the event callback returns. 11357 <p/> 11358 Except where stated otherwise, events are delivered on the thread 11359 that caused the event. 11360 Events are sent at the time they occur. 11361 The specification for each event includes the set of 11362 <functionlink id="GetPhase">phases</functionlink> in which it can be sent; 11363 if an event triggering activity occurs during another phase, no event 11364 is sent. 11365 <p/> 11366 A thread that generates an event does not change its execution status 11367 (for example, the event does not cause the thread to be suspended). 11368 If an agent wishes the event to result in suspension, then the agent 11369 is responsible for explicitly suspending the thread with 11370 <functionlink id="SuspendThread"></functionlink>. 11371 <p/> 11372 If an event is enabled in multiple environments, the event will be sent 11373 to each agent in the order that the environments were created. 11374 </intro> 11375 11376 <intro label="Enabling Events" id="enablingevents"> 11377 All events are initially disabled. In order to receive any 11378 event: 11379 <ul> 11380 <li> 11381 If the event requires a capability, that capability must 11382 be added with 11383 <functionlink id="AddCapabilities"></functionlink>. 11384 </li> 11385 <li> 11386 A callback for the event must be set with 11387 <functionlink id="SetEventCallbacks"></functionlink>. 11388 </li> 11389 <li> 11390 The event must be enabled with 11391 <functionlink id="SetEventNotificationMode"></functionlink>. 11392 </li> 11393 </ul> 11394 </intro> 11395 11396 <intro label="Multiple Co-located Events" id="eventorder"> 11397 In many situations it is possible for multiple events to occur 11398 at the same location in one thread. When this happens, all the events 11399 are reported through the event callbacks in the order specified in this section. 11400 <p/> 11401 If the current location is at the entry point of a method, the 11402 <eventlink id="MethodEntry"></eventlink> event is reported before 11403 any other event at the current location in the same thread. 11404 <p/> 11405 If an exception catch has been detected at the current location, 11406 either because it is the beginning of a catch clause or a native method 11407 that cleared a pending exception has returned, the 11408 <code>exceptionCatch</code> event is reported before 11409 any other event at the current location in the same thread. 11410 <p/> 11411 If a <code>singleStep</code> event or 11412 <code>breakpoint</code> event is triggered at the 11413 current location, the event is defined to occur 11414 immediately before the code at the current location is executed. 11415 These events are reported before any events which are triggered 11416 by the execution of code at the current location in the same 11417 thread (specifically: 11418 <code>exception</code>, 11419 <code>fieldAccess</code>, and 11420 <code>fieldModification</code>). 11421 If both a step and breakpoint event are triggered for the same thread and 11422 location, the step event is reported before the breakpoint event. 11423 <p/> 11424 If the current location is the exit point of a method (that is, the last 11425 location before returning to the caller), the 11426 <eventlink id="MethodExit"></eventlink> event and 11427 the <eventlink id="FramePop"></eventlink> event (if requested) 11428 are reported after all other events at the current location in the same 11429 thread. There is no specified ordering of these two events 11430 with respect to each other. 11431 <p/> 11432 Co-located events can be triggered during the processing of some other 11433 event by the agent at the same location in the same thread. 11434 If such an event, of type <i>y</i>, is triggered during the processing of 11435 an event of type <i>x</i>, and if <i>x</i> 11436 precedes <i>y</i> in the ordering specified above, the co-located event 11437 <i>y</i> is reported for the current thread and location. If <i>x</i> does not precede 11438 <i>y</i>, <i>y</i> is not reported for the current thread and location. 11439 For example, if a breakpoint is set at the current location 11440 during the processing of <eventlink id="SingleStep"></eventlink>, 11441 that breakpoint will be reported before the thread moves off the current 11442 location. 11443 <p/>The following events are never considered to be co-located with 11444 other events. 11445 <ul> 11446 <li><eventlink id="VMStart"></eventlink></li> 11447 <li><eventlink id="VMInit"></eventlink></li> 11448 <li><eventlink id="VMDeath"></eventlink></li> 11449 <li><eventlink id="ThreadStart"></eventlink></li> 11450 <li><eventlink id="ThreadEnd"></eventlink></li> 11451 <li><eventlink id="ClassLoad"></eventlink></li> 11452 <li><eventlink id="ClassPrepare"></eventlink></li> 11453 </ul> 11454 </intro> 11455 11456 <intro label="Event Callbacks" id="jvmtiEventCallbacks"> 11457 The event callback structure below is used to specify the handler function 11458 for events. It is set with the 11459 <functionlink id="SetEventCallbacks"></functionlink> function. 11460 </intro> 11461 11462 <event label="Single Step" 11463 id="SingleStep" const="JVMTI_EVENT_SINGLE_STEP" filtered="thread" num="60"> 11464 <description> 11465 Single step events allow the agent to trace thread execution 11466 at the finest granularity allowed by the VM. A single step event is 11467 generated whenever a thread reaches a new location. 11468 Typically, single step events represent the completion of one VM 11469 instruction as defined in <vmspec/>. However, some implementations 11470 may define locations differently. In any case the 11471 <code>method</code> and <code>location</code> 11472 parameters uniquely identify the current location and allow 11473 the mapping to source file and line number when that information is 11474 available. 11475 <p/> 11476 No single step events are generated from within native methods. 11477 </description> 11478 <origin>jvmdi</origin> 11479 <capabilities> 11480 <required id="can_generate_single_step_events"></required> 11481 </capabilities> 11482 <parameters> 11483 <param id="jni_env"> 11484 <outptr> 11485 <struct>JNIEnv</struct> 11486 </outptr> 11487 <description> 11488 The JNI environment of the event (current) thread 11489 </description> 11490 </param> 11491 <param id="thread"> 11492 <jthread/> 11493 <description> 11494 Thread about to execution a new instruction 11495 </description> 11496 </param> 11497 <param id="klass"> 11498 <jclass method="method"/> 11499 <description> 11500 Class of the method about to execute a new instruction 11501 </description> 11502 </param> 11503 <param id="method"> 11504 <jmethodID class="klass"/> 11505 <description> 11506 Method about to execute a new instruction 11507 </description> 11508 </param> 11509 <param id="location"> 11510 <jlocation/> 11511 <description> 11512 Location of the new instruction 11513 </description> 11514 </param> 11515 </parameters> 11516 </event> 11517 11518 <event label="Breakpoint" 11519 id="Breakpoint" const="JVMTI_EVENT_BREAKPOINT" filtered="thread" num="62"> 11520 <description> 11521 Breakpoint events are generated whenever a thread reaches a location 11522 designated as a breakpoint with <functionlink id="SetBreakpoint"></functionlink>. 11523 The <code>method</code> and <code>location</code> 11524 parameters uniquely identify the current location and allow 11525 the mapping to source file and line number when that information is 11526 available. 11527 </description> 11528 <origin>jvmdi</origin> 11529 <capabilities> 11530 <required id="can_generate_breakpoint_events"></required> 11531 </capabilities> 11532 <parameters> 11533 <param id="jni_env"> 11534 <outptr> 11535 <struct>JNIEnv</struct> 11536 </outptr> 11537 <description> 11538 The JNI environment of the event (current) thread. 11539 </description> 11540 </param> 11541 <param id="thread"> 11542 <jthread/> 11543 <description> 11544 Thread that hit the breakpoint 11545 </description> 11546 </param> 11547 <param id="klass"> 11548 <jclass method="method"/> 11549 <description> 11550 Class of the method that hit the breakpoint 11551 </description> 11552 </param> 11553 <param id="method"> 11554 <jmethodID class="klass"/> 11555 <description> 11556 Method that hit the breakpoint 11557 </description> 11558 </param> 11559 <param id="location"> 11560 <jlocation/> 11561 <description> 11562 location of the breakpoint 11563 </description> 11564 </param> 11565 </parameters> 11566 </event> 11567 11568 <event label="Field Access" 11569 id="FieldAccess" const="JVMTI_EVENT_FIELD_ACCESS" filtered="thread" num="63"> 11570 <description> 11571 Field access events are generated whenever a thread accesses 11572 a field that was designated as a watchpoint 11573 with <functionlink id="SetFieldAccessWatch"></functionlink>. 11574 The <code>method</code> and <code>location</code> 11575 parameters uniquely identify the current location and allow 11576 the mapping to source file and line number when that information is 11577 available. 11578 </description> 11579 <origin>jvmdi</origin> 11580 <capabilities> 11581 <required id="can_generate_field_access_events"></required> 11582 </capabilities> 11583 <parameters> 11584 <param id="jni_env"> 11585 <outptr> 11586 <struct>JNIEnv</struct> 11587 </outptr> 11588 <description> 11589 The JNI environment of the event (current) thread 11590 </description> 11591 </param> 11592 <param id="thread"> 11593 <jthread/> 11594 <description> 11595 Thread accessing the field 11596 </description> 11597 </param> 11598 <param id="klass"> 11599 <jclass method="method"/> 11600 <description> 11601 Class of the method where the access is occurring 11602 </description> 11603 </param> 11604 <param id="method"> 11605 <jmethodID class="klass"/> 11606 <description> 11607 Method where the access is occurring 11608 </description> 11609 </param> 11610 <param id="location"> 11611 <jlocation/> 11612 <description> 11613 Location where the access is occurring 11614 </description> 11615 </param> 11616 <param id="field_klass"> 11617 <jclass field="field"/> 11618 <description> 11619 Class of the field being accessed 11620 </description> 11621 </param> 11622 <param id="object"> 11623 <jobject/> 11624 <description> 11625 Object with the field being accessed if the field is an 11626 instance field; <code>NULL</code> otherwise 11627 </description> 11628 </param> 11629 <param id="field"> 11630 <jfieldID class="field_klass"/> 11631 <description> 11632 Field being accessed 11633 </description> 11634 </param> 11635 </parameters> 11636 </event> 11637 11638 <event label="Field Modification" 11639 id="FieldModification" const="JVMTI_EVENT_FIELD_MODIFICATION" filtered="thread" num="64"> 11640 <description> 11641 Field modification events are generated whenever a thread modifies 11642 a field that was designated as a watchpoint 11643 with <functionlink id="SetFieldModificationWatch"></functionlink>. 11644 The <code>method</code> and <code>location</code> 11645 parameters uniquely identify the current location and allow 11646 the mapping to source file and line number when that information is 11647 available. 11648 </description> 11649 <origin>jvmdi</origin> 11650 <capabilities> 11651 <required id="can_generate_field_modification_events"></required> 11652 </capabilities> 11653 <parameters> 11654 <param id="jni_env"> 11655 <outptr> 11656 <struct>JNIEnv</struct> 11657 </outptr> 11658 <description> 11659 The JNI environment of the event (current) thread 11660 </description> 11661 </param> 11662 <param id="thread"> 11663 <jthread/> 11664 <description> 11665 Thread modifying the field 11666 </description> 11667 </param> 11668 <param id="klass"> 11669 <jclass method="method"/> 11670 <description> 11671 Class of the method where the modification is occurring 11672 </description> 11673 </param> 11674 <param id="method"> 11675 <jmethodID class="klass"/> 11676 <description> 11677 Method where the modification is occurring 11678 </description> 11679 </param> 11680 <param id="location"> 11681 <jlocation/> 11682 <description> 11683 Location where the modification is occurring 11684 </description> 11685 </param> 11686 <param id="field_klass"> 11687 <jclass field="field"/> 11688 <description> 11689 Class of the field being modified 11690 </description> 11691 </param> 11692 <param id="object"> 11693 <jobject/> 11694 <description> 11695 Object with the field being modified if the field is an 11696 instance field; <code>NULL</code> otherwise 11697 </description> 11698 </param> 11699 <param id="field"> 11700 <jfieldID class="field_klass"/> 11701 <description> 11702 Field being modified 11703 </description> 11704 </param> 11705 <param id="signature_type"> 11706 <char/> 11707 <description> 11708 Signature type of the new value 11709 </description> 11710 </param> 11711 <param id="new_value"> 11712 <jvalue/> 11713 <description> 11714 The new value 11715 </description> 11716 </param> 11717 </parameters> 11718 </event> 11719 11720 <event label="Frame Pop" 11721 id="FramePop" const="JVMTI_EVENT_FRAME_POP" filtered="thread" num="61"> 11722 <description> 11723 Frame pop events are generated upon exit from a single method 11724 in a single frame as specified 11725 in a call to <functionlink id="NotifyFramePop"></functionlink>. 11726 This is true whether termination is caused by 11727 executing its return instruction 11728 or by throwing an exception to its caller 11729 (see <paramlink id="was_popped_by_exception"></paramlink>). 11730 However, frame pops caused by the <functionlink id="PopFrame"/> 11731 function are not reported. 11732 <p/> 11733 The location reported by <functionlink id="GetFrameLocation"></functionlink> 11734 identifies the executable location in the returning method, 11735 immediately prior to the return. 11736 </description> 11737 <origin>jvmdi</origin> 11738 <capabilities> 11739 <required id="can_generate_frame_pop_events"></required> 11740 </capabilities> 11741 <parameters> 11742 <param id="jni_env"> 11743 <outptr> 11744 <struct>JNIEnv</struct> 11745 </outptr> 11746 <description> 11747 The JNI environment of the event (current) thread 11748 </description> 11749 </param> 11750 <param id="thread"> 11751 <jthread/> 11752 <description> 11753 Thread that is popping the frame 11754 </description> 11755 </param> 11756 <param id="klass"> 11757 <jclass method="method"/> 11758 <description> 11759 Class of the method being popped 11760 </description> 11761 </param> 11762 <param id="method"> 11763 <jmethodID class="klass"/> 11764 <description> 11765 Method being popped 11766 </description> 11767 </param> 11768 <param id="was_popped_by_exception"> 11769 <jboolean/> 11770 <description> 11771 True if frame was popped by a thrown exception. 11772 False if method exited through its return instruction. 11773 </description> 11774 </param> 11775 </parameters> 11776 </event> 11777 11778 <event label="Method Entry" 11779 id="MethodEntry" const="JVMTI_EVENT_METHOD_ENTRY" filtered="thread" num="65"> 11780 <description> 11781 Method entry events are generated upon entry of Java 11782 programming language methods (including native methods). 11783 <p/> 11784 The location reported by <functionlink id="GetFrameLocation"></functionlink> 11785 identifies the initial executable location in 11786 the method. 11787 <p/> 11788 Enabling method 11789 entry or exit events will significantly degrade performance on many platforms and is thus 11790 not advised for performance critical usage (such as profiling). 11791 <internallink id="bci">Bytecode instrumentation</internallink> should be 11792 used in these cases. 11793 </description> 11794 <origin>jvmdi</origin> 11795 <capabilities> 11796 <required id="can_generate_method_entry_events"></required> 11797 </capabilities> 11798 <parameters> 11799 <param id="jni_env"> 11800 <outptr> 11801 <struct>JNIEnv</struct> 11802 </outptr> 11803 <description> 11804 The JNI environment of the event (current) thread 11805 </description> 11806 </param> 11807 <param id="thread"> 11808 <jthread/> 11809 <description> 11810 Thread entering the method 11811 </description> 11812 </param> 11813 <param id="klass"> 11814 <jclass method="method"/> 11815 <description> 11816 Class of the method being entered 11817 </description> 11818 </param> 11819 <param id="method"> 11820 <jmethodID class="klass"/> 11821 <description> 11822 Method being entered 11823 </description> 11824 </param> 11825 </parameters> 11826 </event> 11827 11828 <event label="Method Exit" 11829 id="MethodExit" const="JVMTI_EVENT_METHOD_EXIT" filtered="thread" num="66"> 11830 <description> 11831 Method exit events are generated upon exit from Java 11832 programming language methods (including native methods). 11833 This is true whether termination is caused by 11834 executing its return instruction 11835 or by throwing an exception to its caller 11836 (see <paramlink id="was_popped_by_exception"></paramlink>). 11837 <p/> 11838 The <code>method</code> field uniquely identifies the 11839 method being entered or exited. The <code>frame</code> field provides 11840 access to the stack frame for the method. 11841 <p/> 11842 The location reported by <functionlink id="GetFrameLocation"></functionlink> 11843 identifies the executable location in the returning method 11844 immediately prior to the return. 11845 <p/> 11846 Enabling method 11847 entry or exit events will significantly degrade performance on many platforms and is thus 11848 not advised for performance critical usage (such as profiling). 11849 <internallink id="bci">Bytecode instrumentation</internallink> should be 11850 used in these cases. 11851 </description> 11852 <origin>jvmdi</origin> 11853 <capabilities> 11854 <required id="can_generate_method_exit_events"></required> 11855 </capabilities> 11856 <parameters> 11857 <param id="jni_env"> 11858 <outptr> 11859 <struct>JNIEnv</struct> 11860 </outptr> 11861 <description> 11862 The JNI environment of the event (current) thread 11863 </description> 11864 </param> 11865 <param id="thread"> 11866 <jthread/> 11867 <description> 11868 Thread exiting the method 11869 </description> 11870 </param> 11871 <param id="klass"> 11872 <jclass method="method"/> 11873 <description> 11874 Class of the method being exited 11875 </description> 11876 </param> 11877 <param id="method"> 11878 <jmethodID class="klass"/> 11879 <description> 11880 Method being exited 11881 </description> 11882 </param> 11883 <param id="was_popped_by_exception"> 11884 <jboolean/> 11885 <description> 11886 True if frame was popped by a thrown exception. 11887 False if method exited through its return instruction. 11888 </description> 11889 </param> 11890 <param id="return_value"> 11891 <jvalue/> 11892 <description> 11893 The return value of the method being exited. 11894 Undefined and should not be used if 11895 <paramlink id="was_popped_by_exception"></paramlink> 11896 is true. 11897 </description> 11898 </param> 11899 </parameters> 11900 </event> 11901 11902 <event label="Native Method Bind" phase="any" 11903 id="NativeMethodBind" const="JVMTI_EVENT_NATIVE_METHOD_BIND" num="67"> 11904 <description> 11905 A Native Method Bind event is sent when a VM binds a 11906 Java programming language native method 11907 to the address of a function that implements the native method. 11908 This will occur when the native method is called for the first time 11909 and also occurs when the JNI function <code>RegisterNatives</code> is called. 11910 This event allows the bind to be redirected to an agent-specified 11911 proxy function. 11912 This event is not sent when the native method is unbound. 11913 Typically, this proxy function will need to be specific to a 11914 particular method or, to handle the general case, automatically 11915 generated assembly code, since after instrumentation code is 11916 executed the function at the original binding 11917 address will usually be invoked. 11918 The original binding can be restored or the redirection changed 11919 by use of the JNI function <code>RegisterNatives</code>. 11920 Some events may be sent during the primordial phase, JNI and 11921 most of <jvmti/> cannot be used at this time but the method and 11922 address can be saved for use later. 11923 </description> 11924 <origin>new</origin> 11925 <capabilities> 11926 <required id="can_generate_native_method_bind_events"></required> 11927 </capabilities> 11928 <parameters> 11929 <param id="jni_env"> 11930 <outptr> 11931 <struct>JNIEnv</struct> 11932 </outptr> 11933 <description> 11934 The JNI environment of the event (current) thread 11935 Will be <code>NULL</code> if sent during the primordial 11936 <functionlink id="GetPhase">phase</functionlink>. 11937 </description> 11938 </param> 11939 <param id="thread"> 11940 <jthread/> 11941 <description> 11942 Thread requesting the bind 11943 </description> 11944 </param> 11945 <param id="klass"> 11946 <jclass method="method"/> 11947 <description> 11948 Class of the method being bound 11949 </description> 11950 </param> 11951 <param id="method"> 11952 <jmethodID class="klass"/> 11953 <description> 11954 Native method being bound 11955 </description> 11956 </param> 11957 <param id="address"> 11958 <outptr><void/></outptr> 11959 <description> 11960 The address the VM is about to bind to--that is, the 11961 address of the implementation of the native method 11962 </description> 11963 </param> 11964 <param id="new_address_ptr"> 11965 <agentbuf><void/></agentbuf> 11966 <description> 11967 if the referenced address is changed (that is, if 11968 <code>*new_address_ptr</code> is set), the binding 11969 will instead be made to the supplied address. 11970 </description> 11971 </param> 11972 </parameters> 11973 </event> 11974 11975 <event label="Exception" 11976 id="Exception" const="JVMTI_EVENT_EXCEPTION" filtered="thread" num="58"> 11977 <description> 11978 Exception events are generated whenever an exception is first detected 11979 in a Java programming language method. 11980 Where "exception" means any <code>java.lang.Throwable</code>. 11981 The exception may have been thrown by a Java programming language or native 11982 method, but in the case of native methods, the event is not generated 11983 until the exception is first seen by a Java programming language method. If an exception is 11984 set and cleared in a native method (and thus is never visible to Java programming language code), 11985 no exception event is generated. 11986 <p/> 11987 The <code>method</code> and <code>location</code> 11988 parameters uniquely identify the current location 11989 (where the exception was detected) and allow 11990 the mapping to source file and line number when that information is 11991 available. The <code>exception</code> field identifies the thrown 11992 exception object. The <code>catch_method</code> 11993 and <code>catch_location</code> identify the location of the catch clause, 11994 if any, that handles the thrown exception. If there is no such catch clause, 11995 each field is set to 0. There is no guarantee that the thread will ever 11996 reach this catch clause. If there are native methods on the call stack 11997 between the throw location and the catch clause, the exception may 11998 be reset by one of those native methods. 11999 Similarly, exceptions that are reported as uncaught (<code>catch_klass</code> 12000 et al. set to 0) may in fact be caught by native code. 12001 Agents can check for these occurrences by monitoring 12002 <eventlink id="ExceptionCatch"></eventlink> events. 12003 Note that finally clauses are implemented as catch and re-throw. Therefore they 12004 will be reported in the catch location. 12005 </description> 12006 <origin>jvmdi</origin> 12007 <capabilities> 12008 <required id="can_generate_exception_events"></required> 12009 </capabilities> 12010 <parameters> 12011 <param id="jni_env"> 12012 <outptr> 12013 <struct>JNIEnv</struct> 12014 </outptr> 12015 <description> 12016 The JNI environment of the event (current) thread 12017 </description> 12018 </param> 12019 <param id="thread"> 12020 <jthread/> 12021 <description> 12022 Thread generating the exception 12023 </description> 12024 </param> 12025 <param id="klass"> 12026 <jclass method="method"/> 12027 <description> 12028 Class generating the exception 12029 </description> 12030 </param> 12031 <param id="method"> 12032 <jmethodID class="klass"/> 12033 <description> 12034 Method generating the exception 12035 </description> 12036 </param> 12037 <param id="location"> 12038 <jlocation/> 12039 <description> 12040 Location where exception occurred 12041 </description> 12042 </param> 12043 <param id="exception"> 12044 <jobject/> 12045 <description> 12046 The exception being thrown 12047 </description> 12048 </param> 12049 <param id="catch_klass"> 12050 <jclass method="catch_method"/> 12051 <description> 12052 Class that will catch the exception, or <code>NULL</code> if no known catch 12053 </description> 12054 </param> 12055 <param id="catch_method"> 12056 <jmethodID class="catch_klass"/> 12057 <description> 12058 Method that will catch the exception, or <code>NULL</code> if no known catch 12059 </description> 12060 </param> 12061 <param id="catch_location"> 12062 <jlocation/> 12063 <description> 12064 location which will catch the exception or zero if no known catch 12065 </description> 12066 </param> 12067 </parameters> 12068 </event> 12069 12070 <event label="Exception Catch" 12071 id="ExceptionCatch" const="JVMTI_EVENT_EXCEPTION_CATCH" filtered="thread" num="59"> 12072 <description> 12073 Exception catch events are generated whenever a thrown exception is caught. 12074 Where "exception" means any <code>java.lang.Throwable</code>. 12075 If the exception is caught in a Java programming language method, the event is generated 12076 when the catch clause is reached. If the exception is caught in a native 12077 method, the event is generated as soon as control is returned to a Java programming language 12078 method. Exception catch events are generated for any exception for which 12079 a throw was detected in a Java programming language method. 12080 Note that finally clauses are implemented as catch and re-throw. Therefore they 12081 will generate exception catch events. 12082 <p/> 12083 The <code>method</code> and <code>location</code> 12084 parameters uniquely identify the current location 12085 and allow the mapping to source file and line number when that information is 12086 available. For exceptions caught in a Java programming language method, the 12087 <code>exception</code> object identifies the exception object. Exceptions 12088 caught in native methods are not necessarily available by the time the 12089 exception catch is reported, so the <code>exception</code> field is set 12090 to <code>NULL</code>. 12091 </description> 12092 <origin>jvmdi</origin> 12093 <capabilities> 12094 <required id="can_generate_exception_events"></required> 12095 </capabilities> 12096 <parameters> 12097 <param id="jni_env"> 12098 <outptr> 12099 <struct>JNIEnv</struct> 12100 </outptr> 12101 <description> 12102 The JNI environment of the event (current) thread 12103 </description> 12104 </param> 12105 <param id="thread"> 12106 <jthread/> 12107 <description> 12108 Thread catching the exception 12109 </description> 12110 </param> 12111 <param id="klass"> 12112 <jclass method="method"/> 12113 <description> 12114 Class catching the exception 12115 </description> 12116 </param> 12117 <param id="method"> 12118 <jmethodID class="klass"/> 12119 <description> 12120 Method catching the exception 12121 </description> 12122 </param> 12123 <param id="location"> 12124 <jlocation/> 12125 <description> 12126 Location where exception is being caught 12127 </description> 12128 </param> 12129 <param id="exception"> 12130 <jobject/> 12131 <description> 12132 Exception being caught 12133 </description> 12134 </param> 12135 </parameters> 12136 </event> 12137 12138 <event label="Thread Start" 12139 id="ThreadStart" const="JVMTI_EVENT_THREAD_START" num="52" phase="start"> 12140 <description> 12141 Thread start events are generated by a new thread before its initial 12142 method executes. 12143 <p/> 12144 A thread may be listed in the array returned by 12145 <functionlink id="GetAllThreads"></functionlink> 12146 before its thread start event is generated. 12147 It is possible for other events to be generated 12148 on a thread before its thread start event. 12149 <p/> 12150 The event is sent on the newly started <paramlink id="thread"></paramlink>. 12151 </description> 12152 <origin>jvmdi</origin> 12153 <capabilities> 12154 </capabilities> 12155 <parameters> 12156 <param id="jni_env"> 12157 <outptr> 12158 <struct>JNIEnv</struct> 12159 </outptr> 12160 <description> 12161 The JNI environment of the event (current) thread. 12162 </description> 12163 </param> 12164 <param id="thread"> 12165 <jthread/> 12166 <description> 12167 Thread starting 12168 </description> 12169 </param> 12170 </parameters> 12171 </event> 12172 12173 <event label="Thread End" 12174 id="ThreadEnd" const="JVMTI_EVENT_THREAD_END" filtered="thread" num="53" phase="start"> 12175 <description> 12176 Thread end events are generated by a terminating thread 12177 after its initial method has finished execution. 12178 <p/> 12179 A thread may be listed in the array returned by 12180 <functionlink id="GetAllThreads"></functionlink> 12181 after its thread end event is generated. 12182 No events are generated on a thread 12183 after its thread end event. 12184 <p/> 12185 The event is sent on the dying <paramlink id="thread"></paramlink>. 12186 </description> 12187 <origin>jvmdi</origin> 12188 <capabilities> 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 ending 12203 </description> 12204 </param> 12205 </parameters> 12206 </event> 12207 12208 <event label="Class Load" 12209 id="ClassLoad" const="JVMTI_EVENT_CLASS_LOAD" filtered="thread" phase="start" num="55"> 12210 <description> 12211 A class load event is generated when a class is first loaded. The order 12212 of class load events generated by a particular thread are guaranteed 12213 to match the order of class loading within that thread. 12214 Array class creation does not generate a class load event. 12215 The creation of a primitive class (for example, java.lang.Integer.TYPE) 12216 does not generate a class load event. 12217 <p/> 12218 This event is sent at an early stage in loading the class. As 12219 a result the class should be used carefully. Note, for example, 12220 that methods and fields are not yet loaded, so queries for methods, 12221 fields, subclasses, and so on will not give correct results. 12222 See "Loading of Classes and Interfaces" in the <i>Java Language 12223 Specification</i>. For most 12224 purposes the <eventlink id="ClassPrepare"></eventlink> event will 12225 be more useful. 12226 </description> 12227 <origin>jvmdi</origin> 12228 <capabilities> 12229 </capabilities> 12230 <parameters> 12231 <param id="jni_env"> 12232 <outptr> 12233 <struct>JNIEnv</struct> 12234 </outptr> 12235 <description> 12236 The JNI environment of the event (current) thread 12237 </description> 12238 </param> 12239 <param id="thread"> 12240 <jthread/> 12241 <description> 12242 Thread loading the class 12243 </description> 12244 </param> 12245 <param id="klass"> 12246 <jclass/> 12247 <description> 12248 Class being loaded 12249 </description> 12250 </param> 12251 </parameters> 12252 </event> 12253 12254 <elide> 12255 <event label="Class Unload" 12256 id="ClassUnload" const="JVMTI_EVENT_CLASS_UNLOAD" num="57"> 12257 <description> 12258 A class unload event is generated when the class is about to be unloaded. 12259 Class unload events take place during garbage collection and must be 12260 handled extremely carefully. The garbage collector holds many locks 12261 and has suspended all other threads, so the event handler cannot depend 12262 on the ability to acquire any locks. The class unload event handler should 12263 do as little as possible, perhaps by queuing information to be processed 12264 later. In particular, the <code>jclass</code> should be used only in 12265 the JNI function <code>isSameObject</code> or in the following <jvmti/> functions: 12266 <ul> 12267 <li><functionlink id="GetClassSignature"></functionlink></li> 12268 <li><functionlink id="GetSourceFileName"></functionlink></li> 12269 <li><functionlink id="IsInterface"></functionlink></li> 12270 <li><functionlink id="IsArrayClass"></functionlink></li> 12271 </ul> 12272 </description> 12273 <origin>jvmdi</origin> 12274 <capabilities> 12275 </capabilities> 12276 <parameters> 12277 <param id="jni_env"> 12278 <outptr> 12279 <struct>JNIEnv</struct> 12280 </outptr> 12281 <description> 12282 The JNI environment of the event (current) thread 12283 </description> 12284 </param> 12285 <param id="thread"> 12286 <jthread/> 12287 <description> 12288 Thread generating the class unload 12289 </description> 12290 </param> 12291 <param id="klass"> 12292 <jclass/> 12293 <description> 12294 Class being unloaded 12295 </description> 12296 </param> 12297 </parameters> 12298 </event> 12299 </elide> 12300 12301 <event label="Class Prepare" 12302 id="ClassPrepare" const="JVMTI_EVENT_CLASS_PREPARE" filtered="thread" phase="start" num="56"> 12303 <description> 12304 A class prepare event is generated when class preparation is complete. 12305 At this point, class fields, methods, and implemented interfaces are 12306 available, and no code from the class has been executed. Since array 12307 classes never have fields or methods, class prepare events are not 12308 generated for them. Class prepare events are not generated for 12309 primitive classes (for example, <code>java.lang.Integer.TYPE</code>). 12310 </description> 12311 <origin>jvmdi</origin> 12312 <capabilities> 12313 </capabilities> 12314 <parameters> 12315 <param id="jni_env"> 12316 <outptr> 12317 <struct>JNIEnv</struct> 12318 </outptr> 12319 <description> 12320 The JNI environment of the event (current) thread 12321 </description> 12322 </param> 12323 <param id="thread"> 12324 <jthread/> 12325 <description> 12326 Thread generating the class prepare 12327 </description> 12328 </param> 12329 <param id="klass"> 12330 <jclass/> 12331 <description> 12332 Class being prepared 12333 </description> 12334 </param> 12335 </parameters> 12336 </event> 12337 12338 <event label="Class File Load Hook" phase="any" 12339 id="ClassFileLoadHook" const="JVMTI_EVENT_CLASS_FILE_LOAD_HOOK" num="54"> 12340 <description> 12341 This event is sent when the VM obtains class file data, 12342 but before it constructs 12343 the in-memory representation for that class. 12344 This event is also sent when the class is being modified by the 12345 <functionlink id="RetransformClasses"/> function or 12346 the <functionlink id="RedefineClasses"/> function, 12347 called in any <jvmti/> environment. 12348 The agent can instrument 12349 the existing class file data sent by the VM to include profiling/debugging hooks. 12350 See the description of 12351 <internallink id="bci">bytecode instrumentation</internallink> 12352 for usage information. 12353 <p/> 12354 This event may be sent before the VM is initialized (the primordial 12355 <functionlink id="GetPhase">phase</functionlink>). During this time 12356 no VM resources should be created. Some classes might not be compatible 12357 with the function (eg. ROMized classes) and this event will not be 12358 generated for these classes. 12359 <p/> 12360 The agent must allocate the space for the modified 12361 class file data buffer 12362 using the memory allocation function 12363 <functionlink id="Allocate"></functionlink> because the 12364 VM is responsible for freeing the new class file data buffer 12365 using <functionlink id="Deallocate"></functionlink>. 12366 Note that <functionlink id="Allocate"></functionlink> 12367 is permitted during the primordial phase. 12368 <p/> 12369 If the agent wishes to modify the class file, it must set 12370 <code>new_class_data</code> to point 12371 to the newly instrumented class file data buffer and set 12372 <code>new_class_data_len</code> to the length of that 12373 buffer before returning 12374 from this call. If no modification is desired, the agent simply 12375 does not set <code>new_class_data</code>. If multiple agents 12376 have enabled this event the results are chained. That is, if 12377 <code>new_class_data</code> has been set, it becomes the 12378 <code>class_data</code> for the next agent. 12379 <p/> 12380 The order that this event is sent to each environment differs 12381 from other events. 12382 This event is sent to environments in the following order: 12383 <ul> 12384 <li><fieldlink id="can_retransform_classes" 12385 struct="jvmtiCapabilities">retransformation 12386 incapable</fieldlink> 12387 environments, in the 12388 order in which they were created 12389 </li> 12390 <li><fieldlink id="can_retransform_classes" 12391 struct="jvmtiCapabilities">retransformation 12392 capable</fieldlink> 12393 environments, in the 12394 order in which they were created 12395 </li> 12396 </ul> 12397 When triggered by <functionlink id="RetransformClasses"/>, 12398 this event is sent only to <fieldlink id="can_retransform_classes" 12399 struct="jvmtiCapabilities">retransformation 12400 capable</fieldlink> 12401 environments. 12402 </description> 12403 <origin>jvmpi</origin> 12404 <capabilities> 12405 <capability id="can_generate_all_class_hook_events"></capability> 12406 </capabilities> 12407 <parameters> 12408 <param id="jni_env"> 12409 <outptr> 12410 <struct>JNIEnv</struct> 12411 </outptr> 12412 <description> 12413 The JNI environment of the event (current) thread. 12414 Will be <code>NULL</code> if sent during the primordial 12415 <functionlink id="GetPhase">phase</functionlink>. 12416 </description> 12417 </param> 12418 <param id="class_being_redefined"> 12419 <jclass/> 12420 <description> 12421 The class being 12422 <functionlink id="RedefineClasses">redefined</functionlink> or 12423 <functionlink id="RetransformClasses">retransformed</functionlink>. 12424 <code>NULL</code> if sent by class load. 12425 </description> 12426 </param> 12427 <param id="loader"> 12428 <jobject/> 12429 <description> 12430 The class loader loading the class. 12431 <code>NULL</code> if the bootstrap class loader. 12432 </description> 12433 </param> 12434 <param id="name"> 12435 <vmbuf><char/></vmbuf> 12436 <description> 12437 Name of class being loaded as a VM internal qualified name 12438 (for example, "java/util/List"), encoded as a 12439 <internallink id="mUTF">modified UTF-8</internallink> string. 12440 Note: if the class is defined with a <code>NULL</code> name or 12441 without a name specified, <code>name</code> will be <code>NULL</code>. 12442 </description> 12443 </param> 12444 <param id="protection_domain"> 12445 <jobject/> 12446 <description> 12447 The <code>ProtectionDomain</code> of the class. 12448 </description> 12449 </param> 12450 <param id="class_data_len"> 12451 <jint/> 12452 <description> 12453 Length of current class file data buffer. 12454 </description> 12455 </param> 12456 <param id="class_data"> 12457 <vmbuf><uchar/></vmbuf> 12458 <description> 12459 Pointer to the current class file data buffer. 12460 </description> 12461 </param> 12462 <param id="new_class_data_len"> 12463 <outptr><jint/></outptr> 12464 <description> 12465 Pointer to the length of the new class file data buffer. 12466 </description> 12467 </param> 12468 <param id="new_class_data"> 12469 <agentbuf incount="new_class_data_len"><uchar/></agentbuf> 12470 <description> 12471 Pointer to the pointer to the instrumented class file data buffer. 12472 </description> 12473 </param> 12474 </parameters> 12475 </event> 12476 12477 <event label="VM Start Event" 12478 id="VMStart" const="JVMTI_EVENT_VM_START" num="57" phase="start"> 12479 <description> 12480 The VM initialization event signals the start of the VM. 12481 At this time JNI is live but the VM is not yet fully initialized. 12482 Once this event is generated, the agent is free to call any JNI function. 12483 This event signals the beginning of the start phase, 12484 <jvmti/> functions permitted in the start phase may be called. 12485 <p/> 12486 In the case of VM start-up failure, this event will not be sent. 12487 </description> 12488 <origin>jvmdi</origin> 12489 <capabilities> 12490 </capabilities> 12491 <parameters> 12492 <param id="jni_env"> 12493 <outptr> 12494 <struct>JNIEnv</struct> 12495 </outptr> 12496 <description> 12497 The JNI environment of the event (current) thread. 12498 </description> 12499 </param> 12500 </parameters> 12501 </event> 12502 12503 <event label="VM Initialization Event" 12504 id="VMInit" const="JVMTI_EVENT_VM_INIT" num="50"> 12505 <description> 12506 The VM initialization event signals the completion of VM initialization. Once 12507 this event is generated, the agent is free to call any JNI or <jvmti/> 12508 function. The VM initialization event can be preceded by or can be concurrent 12509 with other events, but 12510 the preceding events should be handled carefully, if at all, because the 12511 VM has not completed its initialization. The thread start event for the 12512 main application thread is guaranteed not to occur until after the 12513 handler for the VM initialization event returns. 12514 <p/> 12515 In the case of VM start-up failure, this event will not be sent. 12516 </description> 12517 <origin>jvmdi</origin> 12518 <capabilities> 12519 </capabilities> 12520 <parameters> 12521 <param id="jni_env"> 12522 <outptr> 12523 <struct>JNIEnv</struct> 12524 </outptr> 12525 <description> 12526 The JNI environment of the event (current) thread. 12527 </description> 12528 </param> 12529 <param id="thread"> 12530 <jthread/> 12531 <description> 12532 The initial thread 12533 </description> 12534 </param> 12535 </parameters> 12536 </event> 12537 12538 <event label="VM Death Event" 12539 id="VMDeath" const="JVMTI_EVENT_VM_DEATH" num="51"> 12540 <description> 12541 The VM death event notifies the agent of the termination of the VM. 12542 No events will occur after the VMDeath event. 12543 <p/> 12544 In the case of VM start-up failure, this event will not be sent. 12545 Note that <internallink id="onunload">Agent_OnUnload</internallink> 12546 will still be called in these cases. 12547 </description> 12548 <origin>jvmdi</origin> 12549 <capabilities> 12550 </capabilities> 12551 <parameters> 12552 <param id="jni_env"> 12553 <outptr> 12554 <struct>JNIEnv</struct> 12555 </outptr> 12556 <description> 12557 The JNI environment of the event (current) thread 12558 </description> 12559 </param> 12560 </parameters> 12561 </event> 12562 12563 <event label="Compiled Method Load" 12564 id="CompiledMethodLoad" const="JVMTI_EVENT_COMPILED_METHOD_LOAD" num="68"> 12565 <description> 12566 Sent when a method is compiled and loaded into memory by the VM. 12567 If it is unloaded, the <eventlink id="CompiledMethodUnload"/> event is sent. 12568 If it is moved, the <eventlink id="CompiledMethodUnload"/> event is sent, 12569 followed by a new <code>CompiledMethodLoad</code> event. 12570 Note that a single method may have multiple compiled forms, and that 12571 this event will be sent for each form. 12572 Note also that several methods may be inlined into a single 12573 address range, and that this event will be sent for each method. 12574 <p/> 12575 These events can be sent after their initial occurrence with 12576 <functionlink id="GenerateEvents"></functionlink>. 12577 </description> 12578 <origin>jvmpi</origin> 12579 <typedef id="jvmtiAddrLocationMap" label="Native address to location entry"> 12580 <field id="start_address"> 12581 <vmbuf><void/></vmbuf> 12582 <description> 12583 Starting native address of code corresponding to a location 12584 </description> 12585 </field> 12586 <field id="location"> 12587 <jlocation/> 12588 <description> 12589 Corresponding location. See 12590 <functionlink id="GetJLocationFormat"></functionlink> 12591 for the meaning of location. 12592 </description> 12593 </field> 12594 </typedef> 12595 <capabilities> 12596 <required id="can_generate_compiled_method_load_events"></required> 12597 </capabilities> 12598 <parameters> 12599 <param id="klass"> 12600 <jclass method="method"/> 12601 <description> 12602 Class of the method being compiled and loaded 12603 </description> 12604 </param> 12605 <param id="method"> 12606 <jmethodID class="klass"/> 12607 <description> 12608 Method being compiled and loaded 12609 </description> 12610 </param> 12611 <param id="code_size"> 12612 <jint/> 12613 <description> 12614 Size of compiled code 12615 </description> 12616 </param> 12617 <param id="code_addr"> 12618 <vmbuf><void/></vmbuf> 12619 <description> 12620 Address where compiled method code is loaded 12621 </description> 12622 </param> 12623 <param id="map_length"> 12624 <jint/> 12625 <description> 12626 Number of <typelink id="jvmtiAddrLocationMap"></typelink> 12627 entries in the address map. 12628 Zero if mapping information cannot be supplied. 12629 </description> 12630 </param> 12631 <param id="map"> 12632 <vmbuf><struct>jvmtiAddrLocationMap</struct></vmbuf> 12633 <description> 12634 Map from native addresses to location. 12635 The native address range of each entry is from 12636 <fieldlink id="start_address" struct="jvmtiAddrLocationMap"></fieldlink> 12637 to <code>start_address-1</code> of the next entry. 12638 <code>NULL</code> if mapping information cannot be supplied. 12639 </description> 12640 </param> 12641 <param id="compile_info"> 12642 <vmbuf><void/></vmbuf> 12643 <description> 12644 VM-specific compilation information. 12645 The referenced compile information is managed by the VM 12646 and must not depend on the agent for collection. 12647 A VM implementation defines the content and lifetime 12648 of the information. 12649 </description> 12650 </param> 12651 </parameters> 12652 </event> 12653 12654 <event label="Compiled Method Unload" 12655 id="CompiledMethodUnload" const="JVMTI_EVENT_COMPILED_METHOD_UNLOAD" num="69"> 12656 <description> 12657 Sent when a compiled method is unloaded from memory. 12658 This event might not be sent on the thread which performed the unload. 12659 This event may be sent sometime after the unload occurs, but 12660 will be sent before the memory is reused 12661 by a newly generated compiled method. This event may be sent after 12662 the class is unloaded. 12663 </description> 12664 <origin>jvmpi</origin> 12665 <capabilities> 12666 <required id="can_generate_compiled_method_load_events"></required> 12667 </capabilities> 12668 <parameters> 12669 <param id="klass"> 12670 <jclass method="method"/> 12671 <description> 12672 Class of the compiled method being unloaded. 12673 </description> 12674 </param> 12675 <param id="method"> 12676 <jmethodID class="klass"/> 12677 <description> 12678 Compiled method being unloaded. 12679 For identification of the compiled method only -- the class 12680 may be unloaded and therefore the method should not be used 12681 as an argument to further JNI or <jvmti/> functions. 12682 </description> 12683 </param> 12684 <param id="code_addr"> 12685 <vmbuf><void/></vmbuf> 12686 <description> 12687 Address where compiled method code was loaded. 12688 For identification of the compiled method only -- 12689 the space may have been reclaimed. 12690 </description> 12691 </param> 12692 </parameters> 12693 </event> 12694 12695 <event label="Dynamic Code Generated" phase="any" 12696 id="DynamicCodeGenerated" const="JVMTI_EVENT_DYNAMIC_CODE_GENERATED" num="70"> 12697 <description> 12698 Sent when a component of the virtual machine is generated dynamically. 12699 This does not correspond to Java programming language code that is 12700 compiled--see <eventlink id="CompiledMethodLoad"></eventlink>. 12701 This is for native code--for example, an interpreter that is generated 12702 differently depending on command-line options. 12703 <p/> 12704 Note that this event has no controlling capability. 12705 If a VM cannot generate these events, it simply does not send any. 12706 <p/> 12707 These events can be sent after their initial occurrence with 12708 <functionlink id="GenerateEvents"></functionlink>. 12709 </description> 12710 <origin>jvmpi</origin> 12711 <capabilities> 12712 </capabilities> 12713 <parameters> 12714 <param id="name"> 12715 <vmbuf><char/></vmbuf> 12716 <description> 12717 Name of the code, encoded as a 12718 <internallink id="mUTF">modified UTF-8</internallink> string. 12719 Intended for display to an end-user. 12720 The name might not be unique. 12721 </description> 12722 </param> 12723 <param id="address"> 12724 <vmbuf><void/></vmbuf> 12725 <description> 12726 Native address of the code 12727 </description> 12728 </param> 12729 <param id="length"> 12730 <jint/> 12731 <description> 12732 Length in bytes of the code 12733 </description> 12734 </param> 12735 </parameters> 12736 </event> 12737 12738 <event label="Data Dump Request" 12739 id="DataDumpRequest" const="JVMTI_EVENT_DATA_DUMP_REQUEST" num="71"> 12740 <description> 12741 Sent by the VM to request the agent to dump its data. This 12742 is just a hint and the agent need not react to this event. 12743 This is useful for processing command-line signals from users. For 12744 example, in the Java 2 SDK a CTRL-Break on Win32 and a CTRL-\ on Solaris 12745 causes the VM to send this event to the agent. 12746 </description> 12747 <origin>jvmpi</origin> 12748 <capabilities> 12749 </capabilities> 12750 <parameters> 12751 </parameters> 12752 </event> 12753 12754 <event label="Monitor Contended Enter" 12755 id="MonitorContendedEnter" const="JVMTI_EVENT_MONITOR_CONTENDED_ENTER" filtered="thread" num="75"> 12756 <description> 12757 Sent when a thread is attempting to enter a Java programming language 12758 monitor already acquired by another thread. 12759 </description> 12760 <origin>jvmpi</origin> 12761 <capabilities> 12762 <required id="can_generate_monitor_events"></required> 12763 </capabilities> 12764 <parameters> 12765 <param id="jni_env"> 12766 <outptr> 12767 <struct>JNIEnv</struct> 12768 </outptr> 12769 <description> 12770 The JNI environment of the event (current) thread 12771 </description> 12772 </param> 12773 <param id="thread"> 12774 <jthread/> 12775 <description> 12776 JNI local reference to the thread 12777 attempting to enter the monitor 12778 </description> 12779 </param> 12780 <param id="object"> 12781 <jobject/> 12782 <description> 12783 JNI local reference to the monitor 12784 </description> 12785 </param> 12786 </parameters> 12787 </event> 12788 12789 <event label="Monitor Contended Entered" 12790 id="MonitorContendedEntered" const="JVMTI_EVENT_MONITOR_CONTENDED_ENTERED" filtered="thread" num="76"> 12791 <description> 12792 Sent when a thread enters a Java programming language 12793 monitor after waiting for it to be released by another thread. 12794 </description> 12795 <origin>jvmpi</origin> 12796 <capabilities> 12797 <required id="can_generate_monitor_events"></required> 12798 </capabilities> 12799 <parameters> 12800 <param id="jni_env"> 12801 <outptr> 12802 <struct>JNIEnv</struct> 12803 </outptr> 12804 <description> 12805 The JNI environment of the event (current) thread 12806 </description> 12807 </param> 12808 <param id="thread"> 12809 <jthread/> 12810 <description> 12811 JNI local reference to the thread entering 12812 the monitor 12813 </description> 12814 </param> 12815 <param id="object"> 12816 <jobject/> 12817 <description> 12818 JNI local reference to the monitor 12819 </description> 12820 </param> 12821 </parameters> 12822 </event> 12823 12824 <event label="Monitor Wait" 12825 id="MonitorWait" const="JVMTI_EVENT_MONITOR_WAIT" filtered="thread" num="73"> 12826 <description> 12827 Sent when a thread is about to wait on an object. 12828 </description> 12829 <origin>jvmpi</origin> 12830 <capabilities> 12831 <required id="can_generate_monitor_events"></required> 12832 </capabilities> 12833 <parameters> 12834 <param id="jni_env"> 12835 <outptr> 12836 <struct>JNIEnv</struct> 12837 </outptr> 12838 <description> 12839 The JNI environment of the event (current) thread 12840 </description> 12841 </param> 12842 <param id="thread"> 12843 <jthread/> 12844 <description> 12845 JNI local reference to the thread about to wait 12846 </description> 12847 </param> 12848 <param id="object"> 12849 <jobject/> 12850 <description> 12851 JNI local reference to the monitor 12852 </description> 12853 </param> 12854 <param id="timeout"> 12855 <jlong/> 12856 <description> 12857 The number of milliseconds the thread will wait 12858 </description> 12859 </param> 12860 </parameters> 12861 </event> 12862 12863 <event label="Monitor Waited" 12864 id="MonitorWaited" const="JVMTI_EVENT_MONITOR_WAITED" filtered="thread" num="74"> 12865 <description> 12866 Sent when a thread finishes waiting on an object. 12867 </description> 12868 <origin>jvmpi</origin> 12869 <capabilities> 12870 <required id="can_generate_monitor_events"></required> 12871 </capabilities> 12872 <parameters> 12873 <param id="jni_env"> 12874 <outptr> 12875 <struct>JNIEnv</struct> 12876 </outptr> 12877 <description> 12878 The JNI environment of the event (current) thread 12879 </description> 12880 </param> 12881 <param id="thread"> 12882 <jthread/> 12883 <description> 12884 JNI local reference to the thread that was finished waiting 12885 </description> 12886 </param> 12887 <param id="object"> 12888 <jobject/> 12889 <description> 12890 JNI local reference to the monitor. 12891 </description> 12892 </param> 12893 <param id="timed_out"> 12894 <jboolean/> 12895 <description> 12896 True if the monitor timed out 12897 </description> 12898 </param> 12899 </parameters> 12900 </event> 12901 12902 <event label="Resource Exhausted" 12903 id="ResourceExhausted" const="JVMTI_EVENT_RESOURCE_EXHAUSTED" num="80" 12904 since="1.1"> 12905 <description> 12906 Sent when a VM resource needed by a running application has been exhausted. 12907 Except as required by the optional capabilities, the set of resources 12908 which report exhaustion is implementation dependent. 12909 <p/> 12910 The following bit flags define the properties of the resource exhaustion: 12911 <constants id="jvmtiResourceExhaustionFlags" 12912 label="Resource Exhaustion Flags" 12913 kind="bits" 12914 since="1.1"> 12915 <constant id="JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR" num="0x0001"> 12916 After this event returns, the VM will throw a 12917 <code>java.lang.OutOfMemoryError</code>. 12918 </constant> 12919 <constant id="JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP" num="0x0002"> 12920 The VM was unable to allocate memory from the <tm>Java</tm> 12921 platform <i>heap</i>. 12922 The <i>heap</i> is the runtime 12923 data area from which memory for all class instances and 12924 arrays are allocated. 12925 </constant> 12926 <constant id="JVMTI_RESOURCE_EXHAUSTED_THREADS" num="0x0004"> 12927 The VM was unable to create a thread. 12928 </constant> 12929 </constants> 12930 </description> 12931 <origin>new</origin> 12932 <capabilities> 12933 <capability id="can_generate_resource_exhaustion_heap_events"> 12934 Can generate events when the VM is unable to allocate memory from the 12935 <internallink id="JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP">heap</internallink>. 12936 </capability> 12937 <capability id="can_generate_resource_exhaustion_threads_events"> 12938 Can generate events when the VM is unable to 12939 <internallink id="JVMTI_RESOURCE_EXHAUSTED_THREADS">create 12940 a thread</internallink>. 12941 </capability> 12942 </capabilities> 12943 <parameters> 12944 <param id="jni_env"> 12945 <outptr> 12946 <struct>JNIEnv</struct> 12947 </outptr> 12948 <description> 12949 The JNI environment of the event (current) thread 12950 </description> 12951 </param> 12952 <param id="flags"> 12953 <jint/> 12954 <description> 12955 Flags defining the properties of the of resource exhaustion 12956 as specified by the 12957 <internallink id="jvmtiResourceExhaustionFlags">Resource 12958 Exhaustion Flags</internallink>. 12959 </description> 12960 </param> 12961 <param id="reserved"> 12962 <vmbuf><void/></vmbuf> 12963 <description> 12964 Reserved. 12965 </description> 12966 </param> 12967 <param id="description"> 12968 <vmbuf><char/></vmbuf> 12969 <description> 12970 Description of the resource exhaustion, encoded as a 12971 <internallink id="mUTF">modified UTF-8</internallink> string. 12972 </description> 12973 </param> 12974 </parameters> 12975 </event> 12976 12977 <event label="VM Object Allocation" 12978 id="VMObjectAlloc" const="JVMTI_EVENT_VM_OBJECT_ALLOC" num="84"> 12979 <description> 12980 Sent when a method causes the virtual machine to allocate an 12981 Object visible to Java programming language code and the 12982 allocation is not detectable by other intrumentation mechanisms. 12983 Generally object allocation should be detected by instrumenting 12984 the bytecodes of allocating methods. 12985 Object allocation generated in native code by JNI function 12986 calls should be detected using 12987 <internallink id="jniIntercept">JNI function interception</internallink>. 12988 Some methods might not have associated bytecodes and are not 12989 native methods, they instead are executed directly by the 12990 VM. These methods should send this event. 12991 Virtual machines which are incapable of bytecode instrumentation 12992 for some or all of their methods can send this event. 12993 <p/> 12994 Typical examples where this event might be sent: 12995 <ul> 12996 <li>Reflection -- for example, <code>java.lang.Class.newInstance()</code></li> 12997 <li>Methods not represented by bytecodes -- for example, VM intrinsics and 12998 J2ME preloaded classes</li> 12999 </ul> 13000 Cases where this event would not be generated: 13001 <ul> 13002 <li>Allocation due to bytecodes -- for example, the <code>new</code> 13003 and <code>newarray</code> VM instructions</li> 13004 <li>Allocation due to JNI function calls -- for example, 13005 <code>AllocObject</code></li> 13006 <li>Allocations during VM initialization</li> 13007 <li>VM internal objects</li> 13008 </ul> 13009 </description> 13010 <origin>new</origin> 13011 <capabilities> 13012 <required id="can_generate_vm_object_alloc_events"></required> 13013 </capabilities> 13014 <parameters> 13015 <param id="jni_env"> 13016 <outptr> 13017 <struct>JNIEnv</struct> 13018 </outptr> 13019 <description> 13020 The JNI environment of the event (current) thread 13021 </description> 13022 </param> 13023 <param id="thread"> 13024 <jthread/> 13025 <description> 13026 Thread allocating the object. 13027 </description> 13028 </param> 13029 <param id="object"> 13030 <jobject/> 13031 <description> 13032 JNI local reference to the object that was allocated 13033 </description> 13034 </param> 13035 <param id="object_klass"> 13036 <jclass/> 13037 <description> 13038 JNI local reference to the class of the object 13039 </description> 13040 </param> 13041 <param id="size"> 13042 <jlong/> 13043 <description> 13044 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 13045 </description> 13046 </param> 13047 </parameters> 13048 </event> 13049 13050 <event label="Object Free" 13051 id="ObjectFree" const="JVMTI_EVENT_OBJECT_FREE" num="83"> 13052 <description> 13053 An Object Free event is sent when the garbage collector frees an object. 13054 Events are only sent for tagged objects--see 13055 <internallink id="Heap">heap functions</internallink>. 13056 <p/> 13057 The event handler must not use JNI functions and 13058 must not use <jvmti/> functions except those which 13059 specifically allow such use (see the raw monitor, memory management, 13060 and environment local storage functions). 13061 </description> 13062 <origin>new</origin> 13063 <capabilities> 13064 <required id="can_generate_object_free_events"></required> 13065 </capabilities> 13066 <parameters> 13067 <param id="tag"> 13068 <jlong/> 13069 <description> 13070 The freed object's tag 13071 </description> 13072 </param> 13073 </parameters> 13074 </event> 13075 13076 <event label="Garbage Collection Start" 13077 id="GarbageCollectionStart" const="JVMTI_EVENT_GARBAGE_COLLECTION_START" num="81"> 13078 <description> 13079 A Garbage Collection Start event is sent when a 13080 garbage collection pause begins. 13081 Only stop-the-world collections are reported--that is, collections during 13082 which all threads cease to modify the state of the Java virtual machine. 13083 This means that some collectors will never generate these events. 13084 This event is sent while the VM is still stopped, thus 13085 the event handler must not use JNI functions and 13086 must not use <jvmti/> functions except those which 13087 specifically allow such use (see the raw monitor, memory management, 13088 and environment local storage functions). 13089 <p/> 13090 This event is always sent as a matched pair with 13091 <eventlink id="GarbageCollectionFinish"/> 13092 (assuming both events are enabled) and no garbage collection 13093 events will occur between them. 13094 </description> 13095 <origin>new</origin> 13096 <capabilities> 13097 <required id="can_generate_garbage_collection_events"></required> 13098 </capabilities> 13099 <parameters> 13100 </parameters> 13101 </event> 13102 13103 <event label="Garbage Collection Finish" 13104 id="GarbageCollectionFinish" const="JVMTI_EVENT_GARBAGE_COLLECTION_FINISH" num="82"> 13105 <description> 13106 A Garbage Collection Finish event is sent when a 13107 garbage collection pause ends. 13108 This event is sent while the VM is still stopped, thus 13109 the event handler must not use JNI functions and 13110 must not use <jvmti/> functions except those which 13111 specifically allow such use (see the raw monitor, memory management, 13112 and environment local storage functions). 13113 <p/> 13114 Some agents may need to do post garbage collection operations that 13115 require the use of the disallowed <jvmti/> or JNI functions. For these 13116 cases an agent thread can be created which waits on a raw monitor, 13117 and the handler for the Garbage Collection Finish event simply 13118 notifies the raw monitor 13119 <p/> 13120 This event is always sent as a matched pair with 13121 <eventlink id="GarbageCollectionStart"/> (assuming both events are enabled). 13122 <issue> 13123 The most important use of this event is to provide timing information, 13124 and thus additional information is not required. However, 13125 information about the collection which is "free" should be included - 13126 what that information is needs to be determined. 13127 </issue> 13128 </description> 13129 <origin>new</origin> 13130 <capabilities> 13131 <required id="can_generate_garbage_collection_events"></required> 13132 </capabilities> 13133 <parameters> 13134 </parameters> 13135 </event> 13136 13137 <elide> 13138 <event label="Verbose Output" phase="any" 13139 id="VerboseOutput" const="JVMTI_EVENT_VERBOSE_OUTPUT" num="85"> 13140 <description> 13141 Send verbose messages as strings. 13142 <issue> 13143 This format is extremely fragile, as it can change with each 13144 platform, collector and version. Alternatives include: 13145 <ul> 13146 <li>building off Java programming language M and M APIs</li> 13147 <li>XML</li> 13148 <li>key/value pairs</li> 13149 <li>removing it</li> 13150 </ul> 13151 </issue> 13152 <issue> 13153 Though this seemed trivial to implement. 13154 In the RI it appears this will be quite complex. 13155 </issue> 13156 </description> 13157 <origin>new</origin> 13158 <capabilities> 13159 </capabilities> 13160 <parameters> 13161 <param id="flag"> 13162 <enum>jvmtiVerboseFlag</enum> 13163 <description> 13164 Which verbose output is being sent. 13165 </description> 13166 </param> 13167 <param id="message"> 13168 <vmbuf><char/></vmbuf> 13169 <description> 13170 Message text, encoded as a 13171 <internallink id="mUTF">modified UTF-8</internallink> string. 13172 </description> 13173 </param> 13174 </parameters> 13175 </event> 13176 </elide> 13177 13178 </eventsection> 13179 13180 <datasection> 13181 <intro> 13182 <jvmti/> extends the data types defined by JNI. 13183 </intro> 13184 <basetypes id="jniTypes" label="JNI Types Used in the JVM Tool Interface"> 13185 <basetype id="jboolean"> 13186 <description> 13187 Holds a Java programming language <code>boolean</code>. 13188 Unsigned 8 bits. 13189 </description> 13190 </basetype> 13191 <basetype id="jchar"> 13192 <description> 13193 Holds a Java programming language <code>char</code>. 13194 Unsigned 16 bits. 13195 </description> 13196 </basetype> 13197 <basetype id="jint"> 13198 <description> 13199 Holds a Java programming language <code>int</code>. 13200 Signed 32 bits. 13201 </description> 13202 </basetype> 13203 <basetype id="jlong"> 13204 <description> 13205 Holds a Java programming language <code>long</code>. 13206 Signed 64 bits. 13207 </description> 13208 </basetype> 13209 <basetype id="jfloat"> 13210 <description> 13211 Holds a Java programming language <code>float</code>. 13212 32 bits. 13213 </description> 13214 </basetype> 13215 <basetype id="jdouble"> 13216 <description> 13217 Holds a Java programming language <code>double</code>. 13218 64 bits. 13219 </description> 13220 </basetype> 13221 <basetype id="jobject"> 13222 <description> 13223 Holds a Java programming language object. 13224 </description> 13225 </basetype> 13226 <basetype id="jclass"> 13227 <description> 13228 Holds a Java programming language class. 13229 </description> 13230 </basetype> 13231 <basetype id="jvalue"> 13232 <description> 13233 Is a union of all primitive types and <code>jobject</code>. Thus, holds any Java 13234 programming language value. 13235 </description> 13236 </basetype> 13237 <basetype id="jfieldID"> 13238 <description> 13239 Identifies a Java programming language field. 13240 <code>jfieldID</code>s returned by <jvmti/> functions and events may be 13241 safely stored. 13242 </description> 13243 </basetype> 13244 <basetype id="jmethodID"> 13245 <description> 13246 Identifies a Java programming language method, initializer, or constructor. 13247 <code>jmethodID</code>s returned by <jvmti/> functions and events may be 13248 safely stored. However, if the class is unloaded, they become invalid 13249 and must not be used. 13250 </description> 13251 </basetype> 13252 <basetype id="JNIEnv"> 13253 <description> 13254 Pointer to the JNI function table. Pointer to this (<code>JNIEnv *</code>) 13255 is a JNI environment. 13256 </description> 13257 </basetype> 13258 </basetypes> 13259 13260 <basetypes id="jvmtiTypes" label="JVM Tool Interface Base Types"> 13261 <basetype id="jvmtiEnv"> 13262 <description> 13263 The <jvmti/> <internallink id="environments">environment</internallink> pointer. 13264 See the <internallink id="FunctionSection">Function Section</internallink>. 13265 <code>jvmtiEnv</code> points to the 13266 <internallink id="FunctionTable">function table</internallink> pointer. 13267 </description> 13268 </basetype> 13269 <basetype id="jthread"> 13270 <definition>typedef jobject jthread;</definition> 13271 <description> 13272 Subtype of <datalink id="jobject"></datalink> that holds a thread. 13273 </description> 13274 </basetype> 13275 <basetype id="jthreadGroup"> 13276 <definition>typedef jobject jthreadGroup;</definition> 13277 <description> 13278 Subtype of <datalink id="jobject"></datalink> that holds a thread group. 13279 </description> 13280 </basetype> 13281 <basetype id="jlocation"> 13282 <definition>typedef jlong jlocation;</definition> 13283 <description> 13284 A 64 bit value, representing a monotonically increasing 13285 executable position within a method. 13286 <code>-1</code> indicates a native method. 13287 See <functionlink id="GetJLocationFormat"></functionlink> for the format on a 13288 given VM. 13289 </description> 13290 </basetype> 13291 <basetype id="jrawMonitorID"> 13292 <definition>struct _jrawMonitorID; 13293 typedef struct _jrawMonitorID *jrawMonitorID;</definition> 13294 <description> 13295 A raw monitor. 13296 </description> 13297 </basetype> 13298 <basetype id="jvmtiError"> 13299 <description> 13300 Holds an error return code. 13301 See the <internallink id="ErrorSection">Error section</internallink> for possible values. 13302 <example> 13303 typedef enum { 13304 JVMTI_ERROR_NONE = 0, 13305 JVMTI_ERROR_INVALID_THREAD = 10, 13306 ... 13307 } jvmtiError; 13308 </example> 13309 </description> 13310 </basetype> 13311 <basetype id="jvmtiEvent"> 13312 <description> 13313 An identifier for an event type. 13314 See the <internallink id="EventSection">Event section</internallink> for possible values. 13315 It is guaranteed that future versions of this specification will 13316 never assign zero as an event type identifier. 13317 <example> 13318 typedef enum { 13319 JVMTI_EVENT_SINGLE_STEP = 1, 13320 JVMTI_EVENT_BREAKPOINT = 2, 13321 ... 13322 } jvmtiEvent; 13323 </example> 13324 </description> 13325 </basetype> 13326 <basetype id="jvmtiEventCallbacks"> 13327 <description> 13328 The callbacks used for events. 13329 <example> 13330 typedef struct { 13331 jvmtiEventVMInit VMInit; 13332 jvmtiEventVMDeath VMDeath; 13333 ... 13334 } jvmtiEventCallbacks; 13335 </example> 13336 See <internallink id="jvmtiEventCallbacks">event callbacks</internallink> 13337 for the complete structure. 13338 <p/> 13339 Where, for example, the VM initialization callback is defined: 13340 <example> 13341 typedef void (JNICALL *jvmtiEventVMInit) 13342 (jvmtiEnv *jvmti_env, 13343 JNIEnv* jni_env, 13344 jthread thread); 13345 </example> 13346 See the individual events for the callback function definition. 13347 </description> 13348 </basetype> 13349 <basetype id="jniNativeInterface"> 13350 <definition>typedef struct JNINativeInterface_ jniNativeInterface;</definition> 13351 <description> 13352 Typedef for the JNI function table <code>JNINativeInterface</code> 13353 defined in the 13354 <externallink id="http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/functions.html#wp23720">JNI Specification</externallink>. 13355 The JNI reference implementation defines this with an underscore. 13356 </description> 13357 </basetype> 13358 </basetypes> 13359 13360 </datasection> 13361 13362 <issuessection label="Issues"> 13363 <intro id="suspendRequired" label="Resolved Issue: Suspend - Required or Automatic"> 13364 JVMDI requires that the agent suspend threads before calling 13365 certain sensitive functions. JVMPI requires garbage collection to be 13366 disabled before calling certain sensitive functions. 13367 It was suggested that rather than have this requirement, that 13368 VM place itself in a suitable state before performing an 13369 operation. This makes considerable sense since each VM 13370 knows its requirements and can most easily arrange a 13371 safe state. 13372 <p/> 13373 The ability to externally suspend/resume threads will, of 13374 course, remain. The ability to enable/disable garbage collection will not. 13375 <p/> 13376 This issue is resolved--suspend will not 13377 be required. The spec has been updated to reflect this. 13378 </intro> 13379 13380 <intro id="stackSampling" label="Resolved Issue: Call Stack Sampling"> 13381 There are a variety of approaches to sampling call stacks. 13382 The biggest bifurcation is between VM controlled and agent 13383 controlled. 13384 <p/> 13385 This issue is resolved--agent controlled 13386 sampling will be the approach. 13387 </intro> 13388 13389 <intro id="threadRepresentation" label="Resolved Issue: Thread Representation"> 13390 JVMDI represents threads as jthread. JVMPI primarily 13391 uses JNIEnv* to represent threads. 13392 <p/> 13393 The Expert Group has chosen jthread as the representation 13394 for threads in <jvmti/>. 13395 JNIEnv* is sent by 13396 events since it is needed to JNI functions. JNIEnv, per the 13397 JNI spec, are not supposed to be used outside their thread. 13398 </intro> 13399 13400 <intro id="design" label="Resolved Issue: Method Representation"> 13401 The JNI spec allows an implementation to depend on jclass/jmethodID 13402 pairs, rather than simply a jmethodID, to reference a method. 13403 JVMDI, for consistency, choose the same representation. 13404 JVMPI, however, specifies that a jmethodID alone maps to a 13405 method. Both of the Sun <tm>J2SE</tm> virtual machines (Classic and <tm>HotSpot</tm>) store 13406 pointers in jmethodIDs, and as a result, a jmethodID is sufficient. 13407 In fact, any JVM implementation that supports JVMPI must have 13408 such a representation. 13409 <jvmti/> will use jmethodID as a unique representation of a method 13410 (no jclass is used). 13411 There should be efficiency gains, particularly in 13412 functionality like stack dumping, to this representation. 13413 <p/> 13414 Note that fields were not used in JVMPI and that the access profile 13415 of fields differs from methods--for implementation efficiency 13416 reasons, a jclass/jfieldID pair will still be needed for field 13417 reference. 13418 </intro> 13419 13420 <intro id="localReferenceIssue" label="Resolved Issue: Local References"> 13421 Functions return local references. 13422 </intro> 13423 13424 <intro id="frameRep" label="Resolved Issue: Representation of frames"> 13425 In JVMDI, a frame ID is used to represent a frame. Problem with this 13426 is that a VM must track when a frame becomes invalid, a far better 13427 approach, and the one used in <jvmti/>, is to reference frames by depth. 13428 </intro> 13429 13430 <intro id="requiredCapabilities" label="Issue: Required Capabilities"> 13431 Currently, having a required capabilities means that the functionality 13432 is optional. Capabilities are useful even for required functionality 13433 since they can inform the VM is needed set-up. Thus, there should be 13434 a set of capabilities that a conformant implementation must provide 13435 (if requested during Agent_OnLoad). 13436 </intro> 13437 13438 <intro id="taghint" label="Proposal: add tag hint function"> 13439 A hint of the percentage of objects that will be tagged would 13440 help the VM pick a good implementation. 13441 </intro> 13442 13443 <intro id="moreMonitorQueries" label="Request: More Monitor Quires"> 13444 How difficult or easy would be to extend the monitor_info category to include 13445 <pre> 13446 - current number of monitors 13447 - enumeration of monitors 13448 - enumeration of threads waiting on a given monitor 13449 </pre> 13450 The reason for my question is the fact that current get_monitor_info support 13451 requires the agent to specify a given thread to get the info which is probably 13452 OK in the profiling/debugging space, while in the monitoring space the agent 13453 could be watching the monitor list and then decide which thread to ask for 13454 the info. You might ask why is this important for monitoring .... I think it 13455 can aid in the detection/prediction of application contention caused by hot-locks. 13456 </intro> 13457 </issuessection> 13458 13459 <changehistory id="ChangeHistory" update="09/05/07"> 13460 <intro> 13461 The <jvmti/> specification is an evolving document with major, minor, 13462 and micro version numbers. 13463 A released version of the specification is uniquely identified 13464 by its major and minor version. 13465 The functions, events, and capabilities in this specification 13466 indicate a "Since" value which is the major and minor version in 13467 which it was introduced. 13468 The version of the specification implemented by the VM can 13469 be retrieved at runtime with the <functionlink id="GetVersionNumber"/> 13470 function. 13471 </intro> 13472 <change date="14 Nov 2002"> 13473 Converted to XML document. 13474 </change> 13475 <change date="14 Nov 2002"> 13476 Elided heap dump functions (for now) since what was there 13477 was wrong. 13478 </change> 13479 <change date="18 Nov 2002"> 13480 Added detail throughout. 13481 </change> 13482 <change date="18 Nov 2002"> 13483 Changed JVMTI_THREAD_STATUS_RUNNING to JVMTI_THREAD_STATUS_RUNNABLE. 13484 </change> 13485 <change date="19 Nov 2002"> 13486 Added AsyncGetStackTrace. 13487 </change> 13488 <change date="19 Nov 2002"> 13489 Added jframeID return to GetStackTrace. 13490 </change> 13491 <change date="19 Nov 2002"> 13492 Elided GetCurrentFrame and GetCallingFrame functions (for now) since what was there 13493 since they are redundant with GetStackTrace. 13494 </change> 13495 <change date="19 Nov 2002"> 13496 Elided ClearAllBreakpoints since it has always been redundant. 13497 </change> 13498 <change date="19 Nov 2002"> 13499 Added GetSystemProperties. 13500 </change> 13501 <change date="19 Nov 2002"> 13502 Changed the thread local storage functions to use jthread. 13503 </change> 13504 <change date="20 Nov 2002"> 13505 Added GetJLocationFormat. 13506 </change> 13507 <change date="22 Nov 2002"> 13508 Added events and introductory text. 13509 </change> 13510 <change date="22 Nov 2002"> 13511 Cross reference type and constant definitions. 13512 </change> 13513 <change date="24 Nov 2002"> 13514 Added DTD. 13515 </change> 13516 <change date="24 Nov 2002"> 13517 Added capabilities function section. 13518 </change> 13519 <change date="29 Nov 2002"> 13520 Assign capabilities to each function and event. 13521 </change> 13522 <change date="29 Nov 2002"> 13523 Add <internallink id="jniIntercept">JNI interception functions</internallink>. 13524 </change> 13525 <change date="30 Nov 2002"> 13526 Auto generate SetEventNotificationMode capabilities. 13527 </change> 13528 <change date="30 Nov 2002"> 13529 Add <eventlink id="VMObjectAlloc"></eventlink> event. 13530 </change> 13531 <change date="30 Nov 2002"> 13532 Add <eventlink id="DynamicCodeGenerated"></eventlink> event. 13533 </change> 13534 <change date="30 Nov 2002"> 13535 Add const to declarations. 13536 </change> 13537 <change date="30 Nov 2002"> 13538 Change method exit and frame pop to send on exception. 13539 </change> 13540 <change date="1 Dec 2002"> 13541 Add ForceGarbageCollection. 13542 </change> 13543 <change date="2 Dec 2002"> 13544 Redo Xrun section; clarify GetStackTrace and add example; 13545 Fix width problems; use "agent" consistently. 13546 </change> 13547 <change date="8 Dec 2002"> 13548 Remove previous start-up intro. 13549 Add <internallink id="environments"><jvmti/> Environments</internallink> 13550 section. 13551 </change> 13552 <change date="8 Dec 2002"> 13553 Add <functionlink id="DisposeEnvironment"></functionlink>. 13554 </change> 13555 <change date="9 Dec 2002"> 13556 Numerous minor updates. 13557 </change> 13558 <change date="15 Dec 2002"> 13559 Add heap profiling functions added: 13560 get/set annotation, iterate live objects/heap. 13561 Add heap profiling functions place holder added: 13562 heap roots. 13563 Heap profiling event added: object free. 13564 Heap profiling event redesigned: vm object allocation. 13565 Heap profiling event placeholders added: garbage collection start/finish. 13566 Native method bind event added. 13567 </change> 13568 <change date="19 Dec 2002"> 13569 Revamp suspend/resume functions. 13570 Add origin information with jvmdi tag. 13571 Misc fixes. 13572 </change> 13573 <change date="24 Dec 2002"> 13574 Add semantics to types. 13575 </change> 13576 <change date="27 Dec 2002"> 13577 Add local reference section. 13578 Autogenerate parameter descriptions from types. 13579 </change> 13580 <change date="28 Dec 2002"> 13581 Document that RunAgentThread sends threadStart. 13582 </change> 13583 <change date="29 Dec 2002"> 13584 Remove redundant local ref and dealloc warning. 13585 Convert GetRawMonitorName to allocated buffer. 13586 Add GenerateEvents. 13587 </change> 13588 <change date="30 Dec 2002"> 13589 Make raw monitors a type and rename to "jrawMonitorID". 13590 </change> 13591 <change date="1 Jan 2003"> 13592 Include origin information. 13593 Clean-up JVMDI issue references. 13594 Remove Deallocate warnings which are now automatically generated. 13595 </change> 13596 <change date="2 Jan 2003"> 13597 Fix representation issues for jthread. 13598 </change> 13599 <change date="3 Jan 2003"> 13600 Make capabilities buffered out to 64 bits - and do it automatically. 13601 </change> 13602 <change date="4 Jan 2003"> 13603 Make constants which are enumeration into enum types. 13604 Parameters now of enum type. 13605 Clean-up and index type section. 13606 Replace remaining datadef entities with callback. 13607 </change> 13608 <change date="7 Jan 2003"> 13609 Correct GenerateEvents description. 13610 More internal semantics work. 13611 </change> 13612 <change date="9 Jan 2003"> 13613 Replace previous GetSystemProperties with two functions 13614 which use allocated information instead fixed. 13615 Add SetSystemProperty. 13616 More internal semantics work. 13617 </change> 13618 <change date="12 Jan 2003"> 13619 Add varargs to end of SetEventNotificationMode. 13620 </change> 13621 <change date="20 Jan 2003"> 13622 Finish fixing spec to reflect that alloc sizes are jlong. 13623 </change> 13624 <change date="22 Jan 2003"> 13625 Allow NULL as RunAgentThread arg. 13626 </change> 13627 <change date="22 Jan 2003"> 13628 Fixed names to standardized naming convention 13629 Removed AsyncGetStackTrace. 13630 </change> 13631 <change date="29 Jan 2003"> 13632 Since we are using jthread, removed GetThread. 13633 </change> 13634 <change date="31 Jan 2003"> 13635 Change GetFieldName to allow NULLs like GetMethodName. 13636 </change> 13637 <change date="29 Feb 2003" version="v40"> 13638 Rewrite the introductory text, adding sections on 13639 start-up, environments and bytecode instrumentation. 13640 Change the command line arguments per EG discussions. 13641 Add an introduction to the capabilities section. 13642 Add the extension mechanism category and functions. 13643 Mark for deletion, but clarified anyhow, SuspendAllThreads. 13644 Rename IterateOverLiveObjects to IterateOverReachableObjects and 13645 change the text accordingly. 13646 Clarify IterateOverHeap. 13647 Clarify CompiledMethodLoad. 13648 Discuss prerequisite state for Calling Functions. 13649 Clarify SetAllocationHooks. 13650 Added issues ("To be resolved:") through-out. 13651 And so on... 13652 </change> 13653 <change date="6 Mar 2003" version="v41"> 13654 Remove struct from the call to GetOwnedMonitorInfo. 13655 Automatically generate most error documentation, remove 13656 (rather broken) hand written error doc. 13657 Better describe capability use (empty initial set). 13658 Add min value to jint params. 13659 Remove the capability can_access_thread_local_storage. 13660 Rename error JVMTI_ERROR_NOT_IMPLEMENTED to JVMTI_ERROR_MUST_POSSESS_CAPABILITY; 13661 same for *NOT_IMPLEMENTED. 13662 Description fixes. 13663 </change> 13664 <change date="8 Mar 2003" version="v42"> 13665 Rename GetClassSignature to GetClassName. 13666 Rename IterateOverClassObjects to IterateOverInstancesOfClass. 13667 Remove GetMaxStack (operand stack isn't used in <jvmti/>). 13668 Description fixes: define launch-time, remove native frame pop 13669 from PopFrame, and assorted clarifications. 13670 </change> 13671 <change date="8 Mar 2003" version="v43"> 13672 Fix minor editing problem. 13673 </change> 13674 <change date="10 Mar 2003" version="v44"> 13675 Add phase information. 13676 Remap (compact) event numbers. 13677 </change> 13678 <change date="11 Mar 2003" version="v45"> 13679 More phase information - allow "any". 13680 Elide raw monitor queries and events. 13681 Minor description fixes. 13682 </change> 13683 <change date="12 Mar 2003" version="v46"> 13684 Add GetPhase. 13685 Use "phase" through document. 13686 Elide GetRawMonitorName. 13687 Elide GetObjectMonitors. 13688 </change> 13689 <change date="12 Mar 2003" version="v47"> 13690 Fixes from link, XML, and spell checking. 13691 Auto-generate the callback structure. 13692 </change> 13693 <change date="13 Mar 2003" version="v48"> 13694 One character XML fix. 13695 </change> 13696 <change date="13 Mar 2003" version="v49"> 13697 Change function parameter names to be consistent with 13698 event parameters (fooBarBaz becomes foo_bar_baz). 13699 </change> 13700 <change date="14 Mar 2003" version="v50"> 13701 Fix broken link. Fix thread markers. 13702 </change> 13703 <change date="14 Mar 2003" version="v51"> 13704 Change constants so they are under 128 to workaround 13705 compiler problems. 13706 </change> 13707 <change date="23 Mar 2003" version="v52"> 13708 Overhaul capabilities. Separate GetStackTrace into 13709 GetStackTrace and GetStackFrames. 13710 </change> 13711 <change date="8 Apr 2003" version="v54"> 13712 Use depth instead of jframeID to reference frames. 13713 Remove the now irrelevant GetCurrentFrame, GetCallerFrame and GetStackFrames. 13714 Remove frame arg from events. 13715 </change> 13716 <change date="9 Apr 2003" version="v55"> 13717 Remove GetObjectWithAnnotation since tests show bufferred approach more efficient. 13718 Add missing annotation_count to GetObjectsWithAnnotations 13719 </change> 13720 <change date="10 Apr 2003" version="v56"> 13721 Remove confusing parenthetical statement in GetObjectsWithAnnotations 13722 </change> 13723 <change date="13 Apr 2003" version="v58"> 13724 Replace jclass/jmethodID representation of method with simply jmethodID; 13725 Pass JvmtiEnv* as first arg of every event; remove JNIEnv* where inappropriate. 13726 Replace can_access_frames with can_access_local_variables; remove from purely stack access. 13727 Use can_get_synthetic_attribute; fix description. 13728 Clarify that zero length arrays must be deallocated. 13729 Clarify RelinquishCapabilities. 13730 Generalize JVMTI_ERROR_VM_DEAD to JVMTI_ERROR_WRONG_PHASE. 13731 </change> 13732 <change date="27 Apr 2003" version="v59"> 13733 Remove lingering indirect references to OBSOLETE_METHOD_ID. 13734 </change> 13735 <change date="4 May 2003" version="v60"> 13736 Allow DestroyRawMonitor during OnLoad. 13737 </change> 13738 <change date="7 May 2003" version="v61"> 13739 Added not monitor owner error return to DestroyRawMonitor. 13740 </change> 13741 <change date="13 May 2003" version="v62"> 13742 Clarify semantics of raw monitors. 13743 Change flags on <code>GetThreadStatus</code>. 13744 <code>GetClassLoader</code> return NULL for the bootstrap class loader. 13745 Add <code>GetClassName</code> issue. 13746 Define local variable signature. 13747 Disallow zero in annotations array of <code>GetObjectsWithAnnotations</code>. 13748 Remove over specification in <code>GetObjectsWithAnnotations</code>. 13749 Elide <code>SetAllocationHooks</code>. 13750 Elide <code>SuspendAllThreads</code>. 13751 </change> 13752 <change date="14 May 2003" version="v63"> 13753 Define the data type <code>jvmtiEventCallbacks</code>. 13754 Zero length allocations return NULL. 13755 Keep SetAllocationHooks in JVMDI, but remove from <jvmti/>. 13756 Add JVMTI_THREAD_STATUS_FLAG_INTERRUPTED. 13757 </change> 13758 <change date="15 May 2003" version="v64"> 13759 Better wording, per review. 13760 </change> 13761 <change date="15 May 2003" version="v65"> 13762 First Alpha. 13763 Make jmethodID and jfieldID unique, jclass not used. 13764 </change> 13765 <change date="27 May 2003" version="v66"> 13766 Fix minor XSLT errors. 13767 </change> 13768 <change date="13 June 2003" version="v67"> 13769 Undo making jfieldID unique (jmethodID still is). 13770 </change> 13771 <change date="17 June 2003" version="v68"> 13772 Changes per June 11th Expert Group meeting -- 13773 Overhaul Heap functionality: single callback, 13774 remove GetHeapRoots, add reachable iterators, 13775 and rename "annotation" to "tag". 13776 NULL thread parameter on most functions is current 13777 thread. 13778 Add timers. 13779 Remove ForceExit. 13780 Add GetEnvironmentLocalStorage. 13781 Add verbose flag and event. 13782 Add AddToBootstrapClassLoaderSearch. 13783 Update ClassFileLoadHook. 13784 </change> 13785 <change date="18 June 2003" version="v69"> 13786 Clean up issues sections. 13787 Rename GetClassName back to GetClassSignature and 13788 fix description. 13789 Add generic signature to GetClassSignature, 13790 GetFieldSignature, GetMethodSignature, and 13791 GetLocalVariableTable. 13792 Elide EstimateCostOfCapabilities. 13793 Clarify that the system property functions operate 13794 on the VM view of system properties. 13795 Clarify Agent_OnLoad. 13796 Remove "const" from JNIEnv* in events. 13797 Add metadata accessors. 13798 </change> 13799 <change date="18 June 2003" version="v70"> 13800 Add start_depth to GetStackTrace. 13801 Move system properties to a new category. 13802 Add GetObjectSize. 13803 Remove "X" from command line flags. 13804 XML, HTML, and spell check corrections. 13805 </change> 13806 <change date="19 June 2003" version="v71"> 13807 Fix JVMTI_HEAP_ROOT_THREAD to be 6. 13808 Make each synopsis match the function name. 13809 Fix unclear wording. 13810 </change> 13811 <change date="26 June 2003" version="v72"> 13812 SetThreadLocalStorage and SetEnvironmentLocalStorage should allow value 13813 to be set to NULL. 13814 NotifyFramePop, GetFrameLocationm and all the local variable operations 13815 needed to have their wording about frames fixed. 13816 Grammar and clarity need to be fixed throughout. 13817 Capitalization and puntuation need to be consistent. 13818 Need micro version number and masks for accessing major, minor, and micro. 13819 The error code lists should indicate which must be returned by 13820 an implementation. 13821 The command line properties should be visible in the properties functions. 13822 Disallow popping from the current thread. 13823 Allow implementations to return opaque frame error when they cannot pop. 13824 The NativeMethodBind event should be sent during any phase. 13825 The DynamicCodeGenerated event should be sent during any phase. 13826 The following functions should be allowed to operate before VMInit: 13827 Set/GetEnvironmentLocalStorage 13828 GetMethodDeclaringClass 13829 GetClassSignature 13830 GetClassModifiers 13831 IsInterface 13832 IsArrayClass 13833 GetMethodName 13834 GetMethodModifiers 13835 GetMaxLocals 13836 GetArgumentsSize 13837 GetLineNumberTable 13838 GetMethodLocation 13839 IsMethodNative 13840 IsMethodSynthetic. 13841 Other changes (to XSL): 13842 Argument description should show asterisk after not before pointers. 13843 NotifyFramePop, GetFrameLocationm and all the local variable operations 13844 should hsve the NO_MORE_FRAMES error added. 13845 Not alive threads should have a different error return than invalid thread. 13846 </change> 13847 <change date="7 July 2003" version="v73"> 13848 VerboseOutput event was missing message parameter. 13849 Minor fix-ups. 13850 </change> 13851 <change date="14 July 2003" version="v74"> 13852 Technical Publications Department corrections. 13853 Allow thread and environment local storage to be set to NULL. 13854 </change> 13855 <change date="23 July 2003" version="v75"> 13856 Use new Agent_OnLoad rather than overloaded JVM_OnLoad. 13857 Add JNICALL to callbacks (XSL). 13858 Document JNICALL requirement for both events and callbacks (XSL). 13859 Restrict RedefineClasses to methods and attributes. 13860 Elide the VerboseOutput event. 13861 VMObjectAlloc: restrict when event is sent and remove method parameter. 13862 Finish loose ends from Tech Pubs edit. 13863 </change> 13864 <change date="24 July 2003" version="v76"> 13865 Change ClassFileLoadHook event to send the class instead of a boolean of redefine. 13866 </change> 13867 <change date="24 July 2003" version="v77"> 13868 XML fixes. 13869 Minor text clarifications and corrections. 13870 </change> 13871 <change date="24 July 2003" version="v78"> 13872 Remove GetExceptionHandlerTable and GetThrownExceptions from <jvmti/>. 13873 Clarify that stack frames are JVM Spec frames. 13874 Split can_get_source_info into can_get_source_file_name, can_get_line_numbers, 13875 and can_get_source_debug_extension. 13876 PopFrame cannot have a native calling method. 13877 Removed incorrect statement in GetClassloaderClasses 13878 (see <vmspec chapter="4.4"/>). 13879 </change> 13880 <change date="24 July 2003" version="v79"> 13881 XML and text fixes. 13882 Move stack frame description into Stack Frame category. 13883 </change> 13884 <change date="26 July 2003" version="v80"> 13885 Allow NULL (means bootstrap loader) for GetClassloaderClasses. 13886 Add new heap reference kinds for references from classes. 13887 Add timer information struct and query functions. 13888 Add AvailableProcessors. 13889 Rename GetOtherThreadCpuTime to GetThreadCpuTime. 13890 Explicitly add JVMTI_ERROR_INVALID_THREAD and JVMTI_ERROR_THREAD_NOT_ALIVE 13891 to SetEventNotification mode. 13892 Add initial thread to the VM_INIT event. 13893 Remove platform assumptions from AddToBootstrapClassLoaderSearch. 13894 </change> 13895 <change date="26 July 2003" version="v81"> 13896 Grammar and clarity changes per review. 13897 </change> 13898 <change date="27 July 2003" version="v82"> 13899 More grammar and clarity changes per review. 13900 Add Agent_OnUnload. 13901 </change> 13902 <change date="28 July 2003" version="v83"> 13903 Change return type of Agent_OnUnload to void. 13904 </change> 13905 <change date="28 July 2003" version="v84"> 13906 Rename JVMTI_REFERENCE_ARRAY to JVMTI_REFERENCE_ARRAY_ELEMENT. 13907 </change> 13908 <change date="28 July 2003" version="v85"> 13909 Steal java.lang.Runtime.availableProcessors() wording for 13910 AvailableProcessors(). 13911 Guarantee that zero will never be an event ID. 13912 Remove some issues which are no longer issues. 13913 Per review, rename and more completely document the timer 13914 information functions. 13915 </change> 13916 <change date="29 July 2003" version="v86"> 13917 Non-spec visible change to XML controlled implementation: 13918 SetThreadLocalStorage must run in VM mode. 13919 </change> 13920 <change date="5 August 2003" version="0.1.87"> 13921 Add GetErrorName. 13922 Add varargs warning to jvmtiExtensionEvent. 13923 Remove "const" on the jvmtiEnv* of jvmtiExtensionEvent. 13924 Remove unused can_get_exception_info capability. 13925 Pass jvmtiEnv* and JNIEnv* to the jvmtiStartFunction. 13926 Fix jvmtiExtensionFunctionInfo.func declared type. 13927 Extension function returns error code. 13928 Use new version numbering. 13929 </change> 13930 <change date="5 August 2003" version="0.2.88"> 13931 Remove the ClassUnload event. 13932 </change> 13933 <change date="8 August 2003" version="0.2.89"> 13934 Heap reference iterator callbacks return an enum that 13935 allows outgoing object references to be ignored. 13936 Allow JNIEnv as a param type to extension events/functions. 13937 </change> 13938 <change date="15 August 2003" version="0.2.90"> 13939 Fix a typo. 13940 </change> 13941 <change date="2 September 2003" version="0.2.91"> 13942 Remove all metadata functions: GetClassMetadata, 13943 GetFieldMetadata, and GetMethodMetadata. 13944 </change> 13945 <change date="1 October 2003" version="0.2.92"> 13946 Mark the functions Allocate. Deallocate, RawMonitor*, 13947 SetEnvironmentLocalStorage, and GetEnvironmentLocalStorage 13948 as safe for use in heap callbacks and GC events. 13949 </change> 13950 <change date="24 November 2003" version="0.2.93"> 13951 Add pass through opaque user data pointer to heap iterate 13952 functions and callbacks. 13953 In the CompiledMethodUnload event, send the code address. 13954 Add GarbageCollectionOccurred event. 13955 Add constant pool reference kind. 13956 Mark the functions CreateRawMonitor and DestroyRawMonitor 13957 as safe for use in heap callbacks and GC events. 13958 Clarify: VMDeath, GetCurrentThreadCpuTimerInfo, 13959 GetThreadCpuTimerInfo, IterateOverReachableObjects, 13960 IterateOverObjectsReachableFromObject, GetTime and 13961 JVMTI_ERROR_NULL_POINTER. 13962 Add missing errors to: GenerateEvents and 13963 AddToBootstrapClassLoaderSearch. 13964 Fix description of ClassFileLoadHook name parameter. 13965 In heap callbacks and GC/ObjectFree events, specify 13966 that only explicitly allowed functions can be called. 13967 Allow GetCurrentThreadCpuTimerInfo, GetCurrentThreadCpuTime, 13968 GetTimerInfo, and GetTime during callback. 13969 Allow calling SetTag/GetTag during the onload phase. 13970 SetEventNotificationMode, add: error attempted inappropriate 13971 thread level control. 13972 Remove jvmtiExceptionHandlerEntry. 13973 Fix handling of native methods on the stack -- 13974 location_ptr param of GetFrameLocation, remove 13975 JVMTI_ERROR_OPAQUE_FRAME from GetFrameLocation, 13976 jvmtiFrameInfo.location, and jlocation. 13977 Remove typo (from JVMPI) implying that the MonitorWaited 13978 event is sent on sleep. 13979 </change> 13980 <change date="25 November 2003" version="0.2.94"> 13981 Clarifications and typos. 13982 </change> 13983 <change date="3 December 2003" version="0.2.95"> 13984 Allow NULL user_data in heap iterators. 13985 </change> 13986 <change date="28 January 2004" version="0.2.97"> 13987 Add GetThreadState, deprecate GetThreadStatus. 13988 </change> 13989 <change date="29 January 2004" version="0.2.98"> 13990 INVALID_SLOT and TYPE_MISMATCH errors should be optional. 13991 </change> 13992 <change date="12 February 2004" version="0.2.102"> 13993 Remove MonitorContendedExit. 13994 Added JNIEnv parameter to VMObjectAlloc. 13995 Clarified definition of class_tag and referrer_index 13996 parameters to heap callbacks. 13997 </change> 13998 <change date="16 Febuary 2004" version="0.2.103"> 13999 Document JAVA_TOOL_OPTIONS. 14000 </change> 14001 <change date="17 Febuary 2004" version="0.2.105"> 14002 Divide start phase into primordial and start. 14003 Add VMStart event 14004 Change phase associations of functions and events. 14005 </change> 14006 <change date="18 Febuary 2004" version="0.3.6"> 14007 Elide deprecated GetThreadStatus. 14008 Bump minor version, subtract 100 from micro version 14009 </change> 14010 <change date="18 Febuary 2004" version="0.3.7"> 14011 Document that timer nanosecond values are unsigned. 14012 Clarify text having to do with native methods. 14013 </change> 14014 <change date="19 Febuary 2004" version="0.3.8"> 14015 Fix typos. 14016 Remove elided deprecated GetThreadStatus. 14017 </change> 14018 <change date="23 Febuary 2004" version="0.3.9"> 14019 Require NotifyFramePop to act on suspended threads. 14020 </change> 14021 <change date="24 Febuary 2004" version="0.3.10"> 14022 Add capabilities 14023 (<internallink id="jvmtiCapabilities.can_redefine_any_class" 14024 ><code>can_redefine_any_class</code></internallink> 14025 and 14026 <internallink id="jvmtiCapabilities.can_generate_all_class_hook_events" 14027 ><code>can_generate_all_class_hook_events</code></internallink>) 14028 and an error (<errorlink id="JVMTI_ERROR_UNMODIFIABLE_CLASS"></errorlink>) 14029 which allow some classes to be unmodifiable. 14030 </change> 14031 <change date="28 Febuary 2004" version="0.3.11"> 14032 Add JVMTI_ERROR_MUST_POSSESS_CAPABILITY to SetEventNotificationMode. 14033 </change> 14034 <change date="8 March 2004" version="0.3.12"> 14035 Clarified CompiledMethodUnload so that it is clear the event 14036 may be posted after the class has been unloaded. 14037 </change> 14038 <change date="5 March 2004" version="0.3.13"> 14039 Change the size parameter of VMObjectAlloc to jlong to match GetObjectSize. 14040 </change> 14041 <change date="13 March 2004" version="0.3.14"> 14042 Added guideline for the use of the JNI FindClass function in event 14043 callback functions. 14044 </change> 14045 <change date="15 March 2004" version="0.3.15"> 14046 Add GetAllStackTraces and GetThreadListStackTraces. 14047 </change> 14048 <change date="19 March 2004" version="0.3.16"> 14049 ClassLoad and ClassPrepare events can be posted during start phase. 14050 </change> 14051 <change date="25 March 2004" version="0.3.17"> 14052 Add JVMTI_ERROR_NATIVE_METHOD to GetLineNumberTable, GetLocalVariableTable, 14053 GetMaxLocals, GetArgumentsSize, GetMethodLocation, GetBytecodes. 14054 </change> 14055 <change date="29 March 2004" version="0.3.18"> 14056 Return the timer kind in the timer information structure. 14057 </change> 14058 <change date="31 March 2004" version="0.3.19"> 14059 Spec clarifications: 14060 JVMTI_THREAD_STATE_IN_NATIVE might not include JNI or <jvmti/>. 14061 ForceGarbageCollection does not run finalizers. 14062 The context of the specification is the Java platform. 14063 Warn about early instrumentation. 14064 </change> 14065 <change date="1 April 2004" version="0.3.20"> 14066 Refinements to the above clarifications and 14067 Clarify that an error returned by Agent_OnLoad terminates the VM. 14068 </change> 14069 <change date="1 April 2004" version="0.3.21"> 14070 Array class creation does not generate a class load event. 14071 </change> 14072 <change date="7 April 2004" version="0.3.22"> 14073 Align thread state hierarchy more closely with java.lang.Thread.State. 14074 </change> 14075 <change date="12 April 2004" version="0.3.23"> 14076 Clarify the documentation of thread state. 14077 </change> 14078 <change date="19 April 2004" version="0.3.24"> 14079 Remove GarbageCollectionOccurred event -- can be done by agent. 14080 </change> 14081 <change date="22 April 2004" version="0.3.25"> 14082 Define "command-line option". 14083 </change> 14084 <change date="29 April 2004" version="0.3.26"> 14085 Describe the intended use of bytecode instrumentation. 14086 Fix description of extension event first parameter. 14087 </change> 14088 <change date="30 April 2004" version="0.3.27"> 14089 Clarification and typos. 14090 </change> 14091 <change date="18 May 2004" version="0.3.28"> 14092 Remove DataDumpRequest event. 14093 </change> 14094 <change date="18 May 2004" version="0.3.29"> 14095 Clarify RawMonitorWait with zero timeout. 14096 Clarify thread state after RunAgentThread. 14097 </change> 14098 <change date="24 May 2004" version="0.3.30"> 14099 Clean-up: fix bad/old links, etc. 14100 </change> 14101 <change date="30 May 2004" version="0.3.31"> 14102 Clarifications including: 14103 All character strings are modified UTF-8. 14104 Agent thread visibiity. 14105 Meaning of obsolete method version. 14106 Thread invoking heap callbacks, 14107 </change> 14108 <change date="1 June 2004" version="1.0.32"> 14109 Bump major.minor version numbers to "1.0". 14110 </change> 14111 <change date="2 June 2004" version="1.0.33"> 14112 Clarify interaction between ForceGarbageCollection 14113 and ObjectFree. 14114 </change> 14115 <change date="6 June 2004" version="1.0.34"> 14116 Restrict AddToBootstrapClassLoaderSearch and 14117 SetSystemProperty to the OnLoad phase only. 14118 </change> 14119 <change date="11 June 2004" version="1.0.35"> 14120 Fix typo in SetTag. 14121 </change> 14122 <change date="18 June 2004" version="1.0.36"> 14123 Fix trademarks. 14124 Add missing parameter in example GetThreadState usage. 14125 </change> 14126 <change date="4 August 2004" version="1.0.37"> 14127 Copyright updates. 14128 </change> 14129 <change date="5 November 2004" version="1.0.38"> 14130 Add missing function table layout. 14131 Add missing description of C++ member function format of functions. 14132 Clarify that name in CFLH can be NULL. 14133 Released as part of <tm>J2SE</tm> 5.0. 14134 </change> 14135 <change date="24 April 2005" version="1.1.47"> 14136 Bump major.minor version numbers to "1.1". 14137 Add ForceEarlyReturn* functions. 14138 Add GetOwnedMonitorStackDepthInfo function. 14139 Add GetCurrentThread function. 14140 Add "since" version marker. 14141 Add AddToSystemClassLoaderSearch. 14142 Allow AddToBootstrapClassLoaderSearch be used in live phase. 14143 Fix historic rubbish in the descriptions of the heap_object_callback 14144 parameter of IterateOverHeap and IterateOverInstancesOfClass functions; 14145 disallow NULL for this parameter. 14146 Clarify, correct and make consistent: wording about current thread, 14147 opaque frames and insufficient number of frames in PopFrame. 14148 Consistently use "current frame" rather than "topmost". 14149 Clarify the JVMTI_ERROR_TYPE_MISMATCH errors in GetLocal* and SetLocal* 14150 by making them compatible with those in ForceEarlyReturn*. 14151 Many other clarifications and wording clean ups. 14152 </change> 14153 <change date="25 April 2005" version="1.1.48"> 14154 Add GetConstantPool. 14155 Switch references to the first edition of the VM Spec, to the seconds edition. 14156 </change> 14157 <change date="26 April 2005" version="1.1.49"> 14158 Clarify minor/major version order in GetConstantPool. 14159 </change> 14160 <change date="26 April 2005" version="1.1.50"> 14161 Add SetNativeMethodPrefix and SetNativeMethodPrefixes. 14162 Reassign GetOwnedMonitorStackDepthInfo to position 153. 14163 Break out Class Loader Search in its own documentation category. 14164 Deal with overly long lines in XML source. 14165 </change> 14166 <change date="29 April 2005" version="1.1.51"> 14167 Allow agents be started in the live phase. 14168 Added paragraph about deploying agents. 14169 </change> 14170 <change date="30 April 2005" version="1.1.52"> 14171 Add specification description to SetNativeMethodPrefix(es). 14172 Better define the conditions on GetConstantPool. 14173 </change> 14174 <change date="30 April 2005" version="1.1.53"> 14175 Break out the GetClassVersionNumber function from GetConstantPool. 14176 Clean-up the references to the VM Spec. 14177 </change> 14178 <change date="1 May 2005" version="1.1.54"> 14179 Allow SetNativeMethodPrefix(es) in any phase. 14180 Add clarifications about the impact of redefinition on GetConstantPool. 14181 </change> 14182 <change date="2 May 2005" version="1.1.56"> 14183 Various clarifications to SetNativeMethodPrefix(es). 14184 </change> 14185 <change date="2 May 2005" version="1.1.57"> 14186 Add missing performance warning to the method entry event. 14187 </change> 14188 <change date="5 May 2005" version="1.1.58"> 14189 Remove internal JVMDI support. 14190 </change> 14191 <change date="8 May 2005" version="1.1.59"> 14192 Add <functionlink id="RetransformClasses"/>. 14193 Revamp the bytecode instrumentation documentation. 14194 Change <functionlink id="IsMethodObsolete"/> to no longer 14195 require the can_redefine_classes capability. 14196 </change> 14197 <change date="11 May 2005" version="1.1.63"> 14198 Clarifications for retransformation. 14199 </change> 14200 <change date="11 May 2005" version="1.1.64"> 14201 Clarifications for retransformation, per review. 14202 Lock "retransformation (in)capable" at class load enable time. 14203 </change> 14204 <change date="4 June 2005" version="1.1.67"> 14205 Add new heap functionity which supports reporting primitive values, 14206 allows setting the referrer tag, and has more powerful filtering: 14207 FollowReferences, IterateThroughHeap, and their associated 14208 callbacks, structs, enums, and constants. 14209 </change> 14210 <change date="4 June 2005" version="1.1.68"> 14211 Clarification. 14212 </change> 14213 <change date="6 June 2005" version="1.1.69"> 14214 FollowReferences, IterateThroughHeap: Put callbacks in a struct; 14215 Add missing error codes; reduce bits in the visit control flags. 14216 </change> 14217 <change date="14 June 2005" version="1.1.70"> 14218 More on new heap functionity: spec clean-up per review. 14219 </change> 14220 <change date="15 June 2005" version="1.1.71"> 14221 More on new heap functionity: Rename old heap section to Heap (1.0). 14222 </change> 14223 <change date="21 June 2005" version="1.1.72"> 14224 Fix typos. 14225 </change> 14226 <change date="27 June 2005" version="1.1.73"> 14227 Make referrer info structure a union. 14228 </change> 14229 <change date="9 September 2005" version="1.1.74"> 14230 In new heap functions: 14231 Add missing superclass reference kind. 14232 Use a single scheme for computing field indexes. 14233 Remove outdated references to struct based referrer info. 14234 </change> 14235 <change date="12 September 2005" version="1.1.75"> 14236 Don't callback during FollowReferences on frivolous java.lang.Object superclass. 14237 </change> 14238 <change date="13 September 2005" version="1.1.76"> 14239 In string primitive callback, length now Unicode length. 14240 In array and string primitive callbacks, value now "const". 14241 Note possible compiler impacts on setting JNI function table. 14242 </change> 14243 <change date="13 September 2005" version="1.1.77"> 14244 GetClassVersionNumbers() and GetConstantPool() should return 14245 error on array or primitive class. 14246 </change> 14247 <change date="14 September 2005" version="1.1.78"> 14248 Grammar fixes. 14249 </change> 14250 <change date="26 September 2005" version="1.1.79"> 14251 Add IsModifiableClass query. 14252 </change> 14253 <change date="9 February 2006" version="1.1.81"> 14254 Add referrer_class_tag parameter to jvmtiHeapReferenceCallback. 14255 </change> 14256 <change date="13 February 2006" version="1.1.82"> 14257 Doc fixes: update can_redefine_any_class to include retransform. 14258 Clarify that exception events cover all Throwables. 14259 In GetStackTrace, no test is done for start_depth too big if start_depth is zero, 14260 Clarify fields reported in Primitive Field Callback -- static vs instance. 14261 Repair confusing names of heap types, including callback names. 14262 Require consistent usage of stack depth in the face of thread launch methods. 14263 Note incompatibility of <jvmti/> memory management with other systems. 14264 </change> 14265 <change date="14 February 2006" version="1.1.85"> 14266 Fix typos and missing renames. 14267 </change> 14268 <change date="13 March 2006" version="1.1.86"> 14269 Clarify that jmethodIDs and jfieldIDs can be saved. 14270 Clarify that Iterate Over Instances Of Class includes subclasses. 14271 </change> 14272 <change date="14 March 2006" version="1.1.87"> 14273 Better phrasing. 14274 </change> 14275 <change date="16 March 2006" version="1.1.88"> 14276 Match the referrer_index for static fields in Object Reference Callback 14277 with the Reference Implementation (and all other known implementations); 14278 that is, make it match the definition for instance fields. 14279 In GetThreadListStackTraces, add JVMTI_ERROR_INVALID_THREAD to cover 14280 an invalid thread in the list; and specify that not started threads 14281 return empty stacks. 14282 </change> 14283 <change date="17 March 2006" version="1.1.89"> 14284 Typo. 14285 </change> 14286 <change date="25 March 2006" version="1.1.90"> 14287 Typo. 14288 </change> 14289 <change date="6 April 2006" version="1.1.91"> 14290 Remove restrictions on AddToBootstrapClassLoaderSearch and 14291 AddToSystemClassLoaderSearch. 14292 </change> 14293 <change date="1 May 2006" version="1.1.93"> 14294 Changed spec to return -1 for monitor stack depth for the 14295 implementation which can not determine stack depth. 14296 </change> 14297 <change date="3 May 2006" version="1.1.94"> 14298 Corrections for readability and accuracy courtesy of Alan Pratt of IBM. 14299 List the object relationships reported in FollowReferences. 14300 </change> 14301 <change date="5 May 2006" version="1.1.95"> 14302 Clarify the object relationships reported in FollowReferences. 14303 </change> 14304 <change date="28 June 2006" version="1.1.98"> 14305 Clarify DisposeEnvironment; add warning. 14306 Fix typos in SetLocalXXX "retrieve" => "set". 14307 Clarify that native method prefixes must remain set while used. 14308 Clarify that exactly one Agent_OnXXX is called per agent. 14309 Clarify that library loading is independent from start-up. 14310 Remove ambiguous reference to Agent_OnLoad in the Agent_OnUnload spec. 14311 </change> 14312 <change date="31 July 2006" version="1.1.99"> 14313 Clarify the interaction between functions and exceptions. 14314 Clarify and give examples of field indices. 14315 Remove confusing "That is" sentence from MonitorWait and MonitorWaited events. 14316 Update links to point to Java 6. 14317 </change> 14318 <change date="6 August 2006" version="1.1.102"> 14319 Add ResourceExhaustedEvent. 14320 </change> 14321 <change date="11 October 2012" version="1.2.2"> 14322 Fixed the "HTTP" and "Missing Anchor" errors reported by the LinkCheck tool. 14323 </change> 14324 <change date="19 June 2013" version="1.2.3"> 14325 Added support for statically linked agents. 14326 </change> 14327 </changehistory> 14328 14329 </specification> 14330 <!-- Keep this comment at the end of the file 14331 Local variables: 14332 mode: sgml 14333 sgml-omittag:t 14334 sgml-shorttag:t 14335 sgml-namecase-general:t 14336 sgml-general-insert-case:lower 14337 sgml-minimize-attributes:nil 14338 sgml-always-quote-attributes:t 14339 sgml-indent-step:2 14340 sgml-indent-data:t 14341 sgml-parent-document:nil 14342 sgml-exposed-tags:nil 14343 sgml-local-catalogs:nil 14344 sgml-local-ecat-files:nil 14345 End: 14346 -->