1 <?xml version="1.0" encoding="ISO-8859-1"?> 2 <?xml-stylesheet type="text/xsl" href="jvmti.xsl"?> 3 <!-- 4 Copyright (c) 2002, 2015, 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="3" 361 microversion="2"> 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 VM execution as it would 462 have called the dynamic entry point Agent_OnUnLoad. A statically loaded 463 agent cannot be unloaded. The Agent_OnUnload_L function will still be 464 called to do any other agent shutdown related tasks. 465 If a <i>statically linked</i> agent L exports a function called 466 Agent_OnUnLoad_L and a function called Agent_OnUnLoad, the Agent_OnUnLoad 467 function will be ignored. 468 <p/> 469 If an agent L is <i>statically linked</i>, an Agent_OnAttach_L function 470 will be invoked with the same arguments and expected return value as 471 specified for the Agent_OnAttach function. 472 If a <i>statically linked</i> agent L exports a function called 473 Agent_OnAttach_L and a function called Agent_OnAttach, the Agent_OnAttach 474 function will be ignored. 475 </intro> 476 477 <intro id="starting" label="Agent Command Line Options"> 478 The term "command-line option" is used below to 479 mean options supplied in the <code>JavaVMInitArgs</code> argument 480 to the <code>JNI_CreateJavaVM</code> function of the JNI 481 Invocation API. 482 <p/> 483 One of the two following 484 command-line options is used on VM startup to 485 properly load and run agents. 486 These arguments identify the library containing 487 the agent as well as an options 488 string to be passed in at startup. 489 <dl> 490 <dt><code>-agentlib:</code><i><agent-lib-name></i><code>=</code><i><options></i></dt> 491 <dd> 492 The name following <code>-agentlib:</code> is the name of the 493 library to load. Lookup of the library, both its full name and location, 494 proceeds in a platform-specific manner. 495 Typically, the <i><agent-lib-name></i> is expanded to an 496 operating system specific file name. 497 The <i><options></i> will be passed to the agent on start-up. 498 For example, if the option 499 <code>-agentlib:foo=opt1,opt2</code> is specified, the VM will attempt to 500 load the shared library <code>foo.dll</code> from the system <code>PATH</code> 501 under <tm>Windows</tm> or <code>libfoo.so</code> from the 502 <code>LD_LIBRARY_PATH</code> under the <tm>Solaris</tm> operating 503 environment. 504 If the agent library is statically linked into the executable 505 then no actual loading takes place. 506 <p/> 507 </dd> 508 <dt><code>-agentpath:</code><i><path-to-agent></i><code>=</code><i><options></i></dt> 509 <dd> 510 The path following <code>-agentpath:</code> is the absolute path from which 511 to load the library. 512 No library name expansion will occur. 513 The <i><options></i> will be passed to the agent on start-up. 514 For example, if the option 515 <code>-agentpath:c:\myLibs\foo.dll=opt1,opt2</code> is specified, the VM will attempt to 516 load the shared library <code>c:\myLibs\foo.dll</code>. If the agent 517 library is statically linked into the executable 518 then no actual loading takes place. 519 <p/> 520 </dd> 521 </dl> 522 For a dynamic shared library agent, the start-up routine 523 <internallink id="onload"><code>Agent_OnLoad</code></internallink> 524 in the library will be invoked. If the agent library is statically linked 525 into the executable then the system will attempt to invoke the 526 <code>Agent_OnLoad_<agent-lib-name></code> entry point where 527 <agent-lib-name> is the basename of the 528 agent. In the above example <code>-agentpath:c:\myLibs\foo.dll=opt1,opt2</code>, 529 the system will attempt to find and call the <code>Agent_OnLoad_foo</code> start-up routine. 530 <p/> 531 Libraries loaded with <code>-agentlib:</code> or <code>-agentpath:</code> 532 will be searched for JNI native method implementations to facilitate the 533 use of Java programming language code in tools, as is needed for 534 <internallink id="bci">bytecode instrumentation</internallink>. 535 <p/> 536 The agent libraries will be searched after all other libraries have been 537 searched (agents wishing to override or intercept the native method 538 implementations of non-agent methods can use the 539 <eventlink id="NativeMethodBind">NativeMethodBind event</eventlink>). 540 <p/> 541 These switches do the above and nothing more - they do not change the 542 state of the VM or <jvmti/>. No command line options are needed 543 to enable <jvmti/> 544 or aspects of <jvmti/>, this is handled programmatically 545 by the use of 546 <internallink id="capability">capabilities</internallink>. 547 </intro> 548 549 <intro id="startup" label="Agent Start-Up"> 550 The VM starts each agent by invoking a start-up function. 551 If the agent is started in the <code>OnLoad</code> 552 <functionlink id="GetPhase">phase</functionlink> the function 553 <internallink id="onload"><code>Agent_OnLoad</code></internallink> 554 or <internallink id="onload"><code>Agent_OnLoad_L</code></internallink> 555 for statically linked agents will be invoked. 556 If the agent is started in the live 557 <functionlink id="GetPhase">phase</functionlink> the function 558 <internallink id="onattach"><code>Agent_OnAttach</code></internallink> 559 or <internallink id="onattach"><code>Agent_OnAttach_L</code></internallink> 560 for statically linked agents will be invoked. 561 Exactly one call to a start-up function is made per agent. 562 </intro> 563 564 <intro id="onload" label="Agent Start-Up (OnLoad phase)"> 565 If an agent is started during the <code>OnLoad</code> phase then its 566 agent library must export a start-up function with the following prototype: 567 <example> 568 JNIEXPORT jint JNICALL 569 Agent_OnLoad(JavaVM *vm, char *options, void *reserved)</example> 570 Or for a statically linked agent named 'L': 571 <example> 572 JNIEXPORT jint JNICALL 573 Agent_OnLoad_L(JavaVM *vm, char *options, void *reserved)</example> 574 575 The VM will start the agent by calling this function. 576 It will be called early enough in VM initialization that: 577 <ul> 578 <li><functionlink id="SetSystemProperty">system properties</functionlink> 579 may be set before they have been used in the start-up of the VM</li> 580 <li>the full set of 581 <internallink id="capability">capabilities</internallink> 582 is still available (note that capabilities that configure the VM 583 may only be available at this time--see the 584 <internallink id="capability">Capability function section</internallink>)</li> 585 <li>no bytecodes have executed</li> 586 <li>no classes have been loaded</li> 587 <li>no objects have been created</li> 588 </ul> 589 <p/> 590 The VM will call the <code>Agent_OnLoad</code> or 591 <code>Agent_OnLoad_<agent-lib-name></code> function with 592 <i><options></i> as the second argument - 593 that is, using the command-line option examples, 594 <code>"opt1,opt2"</code> will be passed to the <code>char *options</code> 595 argument of <code>Agent_OnLoad</code>. 596 The <code>options</code> argument is encoded as a 597 <internallink id="mUTF">modified UTF-8</internallink> string. 598 If <i>=<options></i> is not specified, 599 a zero length string is passed to <code>options</code>. 600 The lifespan of the <code>options</code> string is the 601 <code>Agent_OnLoad</code> or <code>Agent_OnLoad_<agent-lib-name></code> 602 call. If needed beyond this time the string or parts of the string must 603 be copied. 604 The period between when <code>Agent_OnLoad</code> is called and when it 605 returns is called the <i>OnLoad phase</i>. 606 Since the VM is not initialized during the OnLoad 607 <functionlink id="GetPhase">phase</functionlink>, 608 the set of allowed operations 609 inside <code>Agent_OnLoad</code> is restricted (see the function descriptions for the 610 functionality available at this time). 611 The agent can safely process the options and set 612 event callbacks with <functionlink id="SetEventCallbacks"></functionlink>. Once 613 the VM initialization event is received 614 (that is, the <eventlink id="VMInit">VMInit</eventlink> 615 callback is invoked), the agent 616 can complete its initialization. 617 <rationale> 618 Early startup is required so that agents can set the desired capabilities, 619 many of which must be set before the VM is initialized. 620 In JVMDI, the -Xdebug command-line option provided 621 very coarse-grain control of capabilities. 622 JVMPI implementations use various tricks to provide a single "JVMPI on" switch. 623 No reasonable command-line 624 option could provide the fine-grain of control required to balance needed capabilities vs 625 performance impact. 626 Early startup is also needed so that agents can control the execution 627 environment - modifying the file system and system properties to install 628 their functionality. 629 </rationale> 630 <p/> 631 The return value from <code>Agent_OnLoad</code> or 632 <code>Agent_OnLoad_<agent-lib-name></code> is used to indicate an error. 633 Any value other than zero indicates an error and causes termination of the VM. 634 </intro> 635 636 <intro id="onattach" label="Agent Start-Up (Live phase)"> 637 A VM may support a mechanism that allows agents to be started in the VM during the live 638 <functionlink id="GetPhase">phase</functionlink>. The details of how this is supported, 639 are implementation specific. For example, a tool may use some platform specific mechanism, 640 or implementation specific API, to attach to the running VM, and request it start a given 641 agent. 642 <p/> 643 If an agent is started during the live phase then its agent library 644 must export a start-up function 645 with the following prototype: 646 <example> 647 JNIEXPORT jint JNICALL 648 Agent_OnAttach(JavaVM* vm, char *options, void *reserved)</example> 649 Or for a statically linked agent named 'L': 650 <example> 651 JNIEXPORT jint JNICALL 652 Agent_OnAttach_L(JavaVM* vm, char *options, void *reserved)</example> 653 654 <p/> 655 The VM will start the agent by calling this function. 656 It will be called in the context of a thread 657 that is attached to the VM. The first argument <i><vm></i> is the Java VM. 658 The <i><options></i> argument is the startup options provided to the agent. 659 <i><options></i> is encoded as a <internallink id="mUTF">modified UTF-8 660 </internallink> string. 661 If startup options were not provided, a zero length string is passed to 662 <code>options</code>. The lifespan of the <code>options</code> string is the 663 <code>Agent_OnAttach</code> or <code>Agent_OnAttach_<agent-lib-name></code> call. 664 If needed beyond this time the string or parts of the string must be copied. 665 <p/> 666 Note that some <internallink id="capability">capabilities</internallink> 667 may not be available in the live phase. 668 <p/> 669 The <code>Agent_OnAttach</code> or <code>Agent_OnAttach_<agent-lib-name 670 ></code> function initializes the agent and returns a value 671 to the VM to indicate if an error occurred. Any value other than zero indicates an error. 672 An error does not cause the VM to terminate. Instead the VM ignores the error, or takes 673 some implementation specific action -- for example it might print an error to standard error, 674 or record the error in a system log. 675 </intro> 676 677 <intro id="onunload" label="Agent Shutdown"> 678 The library may optionally export a 679 shutdown function with the following prototype: 680 <example> 681 JNIEXPORT void JNICALL 682 Agent_OnUnload(JavaVM *vm)</example> 683 Or for a statically linked agent named 'L': 684 <example> 685 JNIEXPORT void JNICALL 686 Agent_OnUnload_L(JavaVM *vm)</example> 687 688 This function will be called by the VM when the library is about to be unloaded. 689 The library will be unloaded (unless it is statically linked into the 690 executable) and this function will be called if some platform specific 691 mechanism causes the unload (an unload mechanism is not specified in this document) 692 or the library is (in effect) unloaded by the termination of the VM whether through 693 normal termination or VM failure, including start-up failure. 694 Uncontrolled shutdown is, of couse, an exception to this rule. 695 Note the distinction between this function and the 696 <eventlink id="VMDeath">VM Death event</eventlink>: for the VM Death event 697 to be sent, the VM must have run at least to the point of initialization and a valid 698 <jvmti/> environment must exist which has set a callback for VMDeath 699 and enabled the event. 700 None of these are required for <code>Agent_OnUnload</code> or 701 <code>Agent_OnUnload_<agent-lib-name></code> and this function 702 is also called if the library is unloaded for other reasons. 703 In the case that a VM Death event is sent, it will be sent before this 704 function is called (assuming this function is called due to VM termination). 705 This function can be used to clean-up resources allocated by the agent. 706 </intro> 707 708 <intro id="tooloptions" label="JAVA_TOOL_OPTIONS"> 709 Since the command-line cannot always be accessed or modified, for example in embedded VMs 710 or simply VMs launched deep within scripts, a <code>JAVA_TOOL_OPTIONS</code> variable is 711 provided so that agents may be launched in these cases. 712 <p/> 713 Platforms which support environment variables or other named strings, may support the 714 <code>JAVA_TOOL_OPTIONS</code> variable. This variable will be broken into options at white-space 715 boundaries. White-space characters include space, tab, carriage-return, new-line, 716 vertical-tab, and form-feed. Sequences of white-space characters are considered 717 equivalent to a single white-space character. No white-space is included in the options 718 unless quoted. Quoting is as follows: 719 <ul> 720 <li>All characters enclosed between a pair of single quote marks (''), except a single 721 quote, are quoted.</li> 722 <li>Double quote characters have no special meaning inside a pair of single quote marks.</li> 723 <li>All characters enclosed between a pair of double quote marks (""), except a double 724 quote, are quoted.</li> 725 <li>Single quote characters have no special meaning inside a pair of double quote marks.</li> 726 <li>A quoted part can start or end anywhere in the variable.</li> 727 <li>White-space characters have no special meaning when quoted -- they are included in 728 the option like any other character and do not mark white-space boundaries.</li> 729 <li>The pair of quote marks is not included in the option.</li> 730 </ul> 731 <code>JNI_CreateJavaVM</code> (in the JNI Invocation API) will prepend these options to the options supplied 732 in its <code>JavaVMInitArgs</code> argument. Platforms may disable this feature in cases where security is 733 a concern; for example, the Reference Implementation disables this feature on Unix systems when 734 the effective user or group ID differs from the real ID. 735 This feature is intended to support the initialization of tools -- specifically including the 736 launching of native or Java programming language agents. Multiple tools may wish to use this 737 feature, so the variable should not be overwritten, instead, options should be appended to 738 the variable. Note that since the variable is processed at the time of the JNI Invocation 739 API create VM call, options processed by a launcher (e.g., VM selection options) will not be handled. 740 </intro> 741 742 <intro id="environments" label="Environments"> 743 The <jvmti/> specification supports the use of multiple simultaneous 744 <jvmti/> agents. 745 Each agent has its own <jvmti/> environment. 746 That is, the <jvmti/> state is 747 separate for each agent - changes to one environment do not affect the 748 others. The state of a <jvmti/> 749 environment includes: 750 <ul> 751 <li><functionlink id="SetEventCallbacks">the event callbacks</functionlink></li> 752 <li><functionlink id="SetEventNotificationMode">the set of events which are enabled</functionlink></li> 753 <li><internallink id="capability">the capabilities</internallink></li> 754 <li><internallink id="memory">the memory allocation/deallocation hooks</internallink></li> 755 </ul> 756 Although their <jvmti/> state 757 is separate, agents inspect and modify the shared state 758 of the VM, they also share the native environment in which they execute. 759 As such, an agent can perturb the results of other agents or cause them 760 to fail. It is the responsibility of the agent writer to specify the level 761 of compatibility with other agents. <jvmti/> implementations are not capable 762 of preventing destructive interactions between agents. Techniques to reduce 763 the likelihood of these occurrences are beyond the scope of this document. 764 <p/> 765 An agent creates a <jvmti/> environment 766 by passing a <jvmti/> version 767 as the interface ID to the JNI Invocation API function 768 <externallink id="http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/invocation.html#GetEnv"><code>GetEnv</code></externallink>. 769 See <internallink id="jvmtiEnvAccess">Accessing <jvmti/> Functions</internallink> 770 for more details on the creation and use of 771 <jvmti/> environments. 772 Typically, <jvmti/> environments are created by calling <code>GetEnv</code> from 773 <internallink id="onload"><code>Agent_OnLoad</code></internallink>. 774 </intro> 775 776 <intro id="bci" label="Bytecode Instrumentation"> 777 This interface does not include some events that one might expect in an interface with 778 profiling support. Some examples include object allocation events and full speed 779 method enter and exit events. The interface instead provides support for 780 <i>bytecode instrumentation</i>, the ability to alter the Java virtual machine 781 bytecode instructions which comprise the target program. Typically, these alterations 782 are to add "events" to the code of a method - for example, to add, at the beginning of a method, 783 a call to <code>MyProfiler.methodEntered()</code>. 784 Since the changes are purely additive, they do not modify application 785 state or behavior. 786 Because the inserted agent code is standard bytecodes, the VM can run at full speed, 787 optimizing not only the target program but also the instrumentation. If the 788 instrumentation does not involve switching from bytecode execution, no expensive 789 state transitions are needed. The result is high performance events. 790 This approach also provides complete control to the agent: instrumentation can be 791 restricted to "interesting" portions of the code (e.g., the end user's code) and 792 can be conditional. Instrumentation can run entirely in Java programming language 793 code or can call into the native agent. Instrumentation can simply maintain 794 counters or can statistically sample events. 795 <p/> 796 Instrumentation can be inserted in one of three ways: 797 <ul> 798 <li> 799 Static Instrumentation: The class file is instrumented before it 800 is loaded into the VM - for example, by creating a duplicate directory of 801 <code>*.class</code> files which have been modified to add the instrumentation. 802 This method is extremely awkward and, in general, an agent cannot know 803 the origin of the class files which will be loaded. 804 </li> 805 <li> 806 Load-Time Instrumentation: When a class file is loaded by the VM, the raw 807 bytes of the class file are sent for instrumentation to the agent. 808 The <eventlink id="ClassFileLoadHook"/> 809 event, triggered by the class load, 810 provides this functionality. This mechanism provides efficient 811 and complete access to one-time instrumentation. 812 </li> 813 <li> 814 Dynamic Instrumentation: A class which is already loaded (and possibly 815 even running) is modified. This optional feature is provided by the 816 <eventlink id="ClassFileLoadHook"/> event, triggered by calling the 817 <functionlink id="RetransformClasses"/> function. 818 Classes can be modified multiple times and can be returned to their 819 original state. 820 The mechanism allows instrumentation which changes during the 821 course of execution. 822 </li> 823 </ul> 824 <p/> 825 The class modification functionality provided in this interface 826 is intended to provide a mechanism for instrumentation 827 (the <eventlink id="ClassFileLoadHook"/> event 828 and the <functionlink id="RetransformClasses"/> function) 829 and, during development, for fix-and-continue debugging 830 (the <functionlink id="RedefineClasses"/> function). 831 <p/> 832 Care must be taken to avoid perturbing dependencies, especially when 833 instrumenting core classes. For example, an approach to getting notification 834 of every object allocation is to instrument the constructor on 835 <code>Object</code>. Assuming that the constructor is initially 836 empty, the constructor could be changed to: 837 <example> 838 public Object() { 839 MyProfiler.allocationTracker(this); 840 } 841 </example> 842 However, if this change was made using the 843 <eventlink id="ClassFileLoadHook"/> 844 event then this might impact a typical VM as follows: 845 the first created object will call the constructor causing a class load of 846 <code>MyProfiler</code>; which will then cause 847 object creation, and since <code>MyProfiler</code> isn't loaded yet, 848 infinite recursion; resulting in a stack overflow. A refinement of this 849 would be to delay invoking the tracking method until a safe time. For 850 example, <code>trackAllocations</code> could be set in the 851 handler for the <code>VMInit</code> event. 852 <example> 853 static boolean trackAllocations = false; 854 855 public Object() { 856 if (trackAllocations) { 857 MyProfiler.allocationTracker(this); 858 } 859 } 860 </example> 861 <p/> 862 The <functionlink id="SetNativeMethodPrefix"/> allows native methods 863 to be instrumented by the use of wrapper methods. 864 </intro> 865 866 <intro id="mUTF" label="Modified UTF-8 String Encoding"> 867 <jvmti/> uses modified UTF-8 to encode character strings. 868 This is the same encoding used by JNI. 869 Modified UTF-8 differs 870 from standard UTF-8 in the representation of supplementary characters 871 and of the null character. See the 872 <externallink id="http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/types.html#wp16542"> 873 Modified UTF-8 Strings</externallink> 874 section of the JNI specification for details. 875 </intro> 876 877 <intro id="context" label="Specification Context"> 878 Since this interface provides access to the state of applications running in the 879 Java virtual machine; 880 terminology refers to the Java platform and not the native 881 platform (unless stated otherwise). For example: 882 <ul> 883 <li>"thread" means Java programming language thread.</li> 884 <li>"stack frame" means Java virtual machine stack frame.</li> 885 <li>"class" means Java programming language class.</li> 886 <li>"heap" means Java virtual machine heap.</li> 887 <li>"monitor" means Java programming language object monitor.</li> 888 </ul> 889 <p/> 890 Sun, Sun Microsystems, the Sun logo, Java, and JVM 891 are trademarks or registered trademarks of Oracle 892 and/or its affiliates, in the U.S. and other countries. 893 </intro> 894 895 896 <functionsection label="Functions"> 897 <intro id="jvmtiEnvAccess" label="Accessing Functions"> 898 Native code accesses <jvmti/> features 899 by calling <jvmti/> functions. 900 Access to <jvmti/> functions is by use of an interface pointer 901 in the same manner as 902 <externallink id="http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/design.html">Java 903 Native Interface (JNI) functions</externallink> are accessed. 904 The <jvmti/> interface pointer is called the 905 <i>environment pointer</i>. 906 <p/> 907 An environment pointer is a pointer to an environment and has 908 the type <code>jvmtiEnv*</code>. 909 An environment has information about its <jvmti/> connection. 910 The first value in the environment is a pointer to the function table. 911 The function table is an array of pointers to <jvmti/> functions. 912 Every function pointer is at a predefined offset inside the 913 array. 914 <p/> 915 When used from the C language: 916 double indirection is used to access the functions; 917 the environment pointer provides context and is the first 918 parameter of each function call; for example: 919 <example> 920 jvmtiEnv *jvmti; 921 ... 922 jvmtiError err = (*jvmti)->GetLoadedClasses(jvmti, &class_count, &classes); 923 </example> 924 <p/> 925 When used from the C++ language: 926 functions are accessed as member functions of <code>jvmtiEnv</code>; 927 the environment pointer is not passed to the function call; for example: 928 <example> 929 jvmtiEnv *jvmti; 930 ... 931 jvmtiError err = jvmti->GetLoadedClasses(&class_count, &classes); 932 </example> 933 Unless otherwise stated, all examples and declarations in this 934 specification use the C language. 935 <p/> 936 A <jvmti/> environment can be obtained through the JNI Invocation API 937 <code>GetEnv</code> function: 938 <example> 939 jvmtiEnv *jvmti; 940 ... 941 (*jvm)->GetEnv(jvm, &jvmti, JVMTI_VERSION_1_0); 942 </example> 943 Each call to <code>GetEnv</code> 944 creates a new <jvmti/> connection and thus 945 a new <jvmti/> environment. 946 The <code>version</code> argument of <code>GetEnv</code> must be 947 a <jvmti/> version. 948 The returned environment may have a different version than the 949 requested version but the returned environment must be compatible. 950 <code>GetEnv</code> will return <code>JNI_EVERSION</code> if a 951 compatible version is not available, if <jvmti/> is not supported or 952 <jvmti/> is not supported in the current VM configuration. 953 Other interfaces may be added for creating <jvmti/> environments 954 in specific contexts. 955 Each environment has its own state (for example, 956 <functionlink id="SetEventNotificationMode">desired events</functionlink>, 957 <functionlink id="SetEventCallbacks">event handling functions</functionlink>, and 958 <functionlink id="AddCapabilities">capabilities</functionlink>). 959 An environment is released with 960 <functionlink id="DisposeEnvironment"></functionlink>. 961 Thus, unlike JNI which has one environment per thread, <jvmti/> environments work 962 across threads and are created dynamically. 963 </intro> 964 965 <intro id="functionReturn" label="Function Return Values"> 966 <jvmti/> functions always return an 967 <internallink id="ErrorSection">error code</internallink> via the 968 <datalink id="jvmtiError"/> function return value. 969 Some functions can return additional 970 values through pointers provided by the calling function. 971 In some cases, <jvmti/> functions allocate memory that your program must 972 explicitly deallocate. This is indicated in the individual <jvmti/> 973 function descriptions. Empty lists, arrays, sequences, etc are 974 returned as <code>NULL</code>. 975 <p/> 976 In the event that the <jvmti/> function encounters 977 an error (any return value other than <code>JVMTI_ERROR_NONE</code>) the values 978 of memory referenced by argument pointers is undefined, but no memory 979 will have been allocated and no global references will have been allocated. 980 If the error occurs because of invalid input, no action will have occurred. 981 </intro> 982 983 <intro id="refs" label="Managing JNI Object References"> 984 <jvmti/> functions identify objects with JNI references 985 (<datalink id="jobject"/> and <datalink id="jclass"/>) 986 and their derivatives 987 (<datalink id="jthread"/> and <datalink id="jthreadGroup"/>). 988 References passed to 989 <jvmti/> functions can be either global or local, but they must be 990 strong references. All references returned by <jvmti/> functions are 991 local references--these local references are created 992 during the <jvmti/> call. 993 Local references are a resource that must be managed (see the 994 <externallink id="http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/functions.html#wp18654">JNI Documentation</externallink>). 995 When threads return from native code all local references 996 are freed. Note that some threads, including typical 997 agent threads, will never return from native code. 998 A thread is ensured the ability to create sixteen local 999 references without the need for any explicit management. 1000 For threads executing a limited number of <jvmti/> calls before 1001 returning from native code 1002 (for example, threads processing events), 1003 it may be determined that no explicit management 1004 is needed. 1005 However, long running agent threads will need explicit 1006 local reference management--usually with the JNI functions 1007 <code>PushLocalFrame</code> and <code>PopLocalFrame</code>. 1008 Conversely, to preserve references beyond the 1009 return from native code, they must be converted to global references. 1010 These rules do not apply to <datalink id="jmethodID"/> and <datalink id="jfieldID"/> 1011 as they are not <datalink id="jobject"/>s. 1012 </intro> 1013 1014 <intro id="prereqState" label="Prerequisite State for Calling Functions"> 1015 Unless the function explicitly states that the agent must bring 1016 a thread or the VM to a particular state (for example, suspended), 1017 the <jvmti/> implementation is responsible for bringing the VM to a 1018 safe and consistent state for performing the function. 1019 </intro> 1020 1021 <intro id="functionsExceptions" label="Exceptions and Functions"> 1022 <jvmti/> functions never throw exceptions; error conditions are 1023 communicated via the 1024 <internallink id="functionReturn">function return value</internallink>. 1025 Any existing exception state is preserved across a call to a 1026 <jvmti/> function. 1027 See the 1028 <externallink 1029 id="http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/design.html#wp770" 1030 >Java Exceptions</externallink> 1031 section of the JNI specification for information on handling exceptions. 1032 </intro> 1033 1034 <category id="memory" label="Memory Management"> 1035 <intro> 1036 These functions provide for the allocation and deallocation of 1037 memory used by <jvmti/> functionality and can be used to provide 1038 working memory for agents. 1039 Memory managed by <jvmti/> is not compatible with other memory 1040 allocation libraries and mechanisms. 1041 </intro> 1042 1043 <function id="Allocate" jkernel="yes" phase="any" callbacksafe="safe" impl="notrace" num="46"> 1044 <synopsis>Allocate</synopsis> 1045 <description> 1046 Allocate an area of memory through the <jvmti/> allocator. 1047 The allocated 1048 memory should be freed with <functionlink id="Deallocate"></functionlink>. 1049 </description> 1050 <origin>jvmdi</origin> 1051 <capabilities> 1052 </capabilities> 1053 <parameters> 1054 <param id="size"> 1055 <jlong/> 1056 <description> 1057 The number of bytes to allocate. 1058 <rationale> 1059 <code>jlong</code> is used for compatibility with JVMDI. 1060 </rationale> 1061 </description> 1062 </param> 1063 <param id="mem_ptr"> 1064 <allocbuf incount="size"><uchar/></allocbuf> 1065 <description> 1066 On return, a pointer to the beginning of the allocated memory. 1067 If <code>size</code> is zero, <code>NULL</code> is returned. 1068 </description> 1069 </param> 1070 </parameters> 1071 <errors> 1072 <error id="JVMTI_ERROR_OUT_OF_MEMORY"> 1073 Memory request cannot be honored. 1074 </error> 1075 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 1076 <paramlink id="size"></paramlink> is less than zero. 1077 </error> 1078 </errors> 1079 </function> 1080 1081 <function id="Deallocate" jkernel="yes" phase="any" callbacksafe="safe" impl="notrace" num="47"> 1082 <synopsis>Deallocate</synopsis> 1083 <description> 1084 Deallocate <code>mem</code> using the <jvmti/> allocator. 1085 This function should 1086 be used to deallocate any memory allocated and returned 1087 by a <jvmti/> function 1088 (including memory allocated with <functionlink id="Allocate"></functionlink>). 1089 All allocated memory must be deallocated 1090 or the memory cannot be reclaimed. 1091 </description> 1092 <origin>jvmdi</origin> 1093 <capabilities> 1094 </capabilities> 1095 <parameters> 1096 <param id="mem"> 1097 <outbuf> 1098 <uchar/> 1099 <nullok>the call is ignored</nullok> 1100 </outbuf> 1101 <description> 1102 A pointer to the beginning of the allocated memory. 1103 Please ignore "On return, the elements are set." 1104 <todo>keep it from generating "On return, the elements are set"</todo> 1105 </description> 1106 </param> 1107 </parameters> 1108 <errors> 1109 </errors> 1110 </function> 1111 </category> 1112 1113 <category id="threadCategory" label="Thread"> 1114 <intro> 1115 </intro> 1116 1117 <function id="GetThreadState" num="17"> 1118 <synopsis>Get Thread State</synopsis> 1119 <description> 1120 Get the state of a thread. The state of the thread is represented by the 1121 answers to the hierarchical set of questions below: 1122 <ul type="circle"> 1123 <li><i>Alive?</i> 1124 <ul> 1125 <li>Not alive. 1126 <ul type="circle"> 1127 <li><i>Why not alive?</i> 1128 <ul> 1129 <li>New.</li> 1130 <li>Terminated (<datalink 1131 id="JVMTI_THREAD_STATE_TERMINATED"><code>JVMTI_THREAD_STATE_TERMINATED</code></datalink>)</li> 1132 </ul> 1133 </li> 1134 </ul> 1135 </li> 1136 <li>Alive (<datalink 1137 id="JVMTI_THREAD_STATE_ALIVE"><code>JVMTI_THREAD_STATE_ALIVE</code></datalink>) 1138 <ul type="circle"> 1139 <li><i>Suspended?</i> 1140 <ul> 1141 <li>Suspended (<datalink 1142 id="JVMTI_THREAD_STATE_SUSPENDED"><code>JVMTI_THREAD_STATE_SUSPENDED</code></datalink>)</li> 1143 <li>Not suspended</li> 1144 </ul> 1145 </li> 1146 <li><i>Interrupted?</i> 1147 <ul> 1148 <li>Interrupted (<datalink 1149 id="JVMTI_THREAD_STATE_INTERRUPTED"><code>JVMTI_THREAD_STATE_INTERRUPTED</code></datalink>)</li> 1150 <li>Not interrupted.</li> 1151 </ul> 1152 </li> 1153 <li><i>In native?</i> 1154 <ul> 1155 <li>In native code (<datalink 1156 id="JVMTI_THREAD_STATE_IN_NATIVE"><code>JVMTI_THREAD_STATE_IN_NATIVE</code></datalink>)</li> 1157 <li>In Java programming language code</li> 1158 </ul> 1159 </li> 1160 <li><i>What alive state?</i> 1161 <ul> 1162 <li>Runnable (<datalink 1163 id="JVMTI_THREAD_STATE_RUNNABLE"><code>JVMTI_THREAD_STATE_RUNNABLE</code></datalink>)</li> 1164 <li>Blocked (<datalink 1165 id="JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER"><code>JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER</code></datalink>)</li> 1166 <li>Waiting (<datalink 1167 id="JVMTI_THREAD_STATE_WAITING"><code>JVMTI_THREAD_STATE_WAITING</code></datalink>) 1168 <ul type="circle"> 1169 <li><i>Timed wait?</i> 1170 <ul> 1171 <li>Indefinite (<datalink 1172 id="JVMTI_THREAD_STATE_WAITING_INDEFINITELY"><code>JVMTI_THREAD_STATE_WAITING_INDEFINITELY</code></datalink></li> 1173 <li>Timed (<datalink 1174 id="JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT"><code>JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT</code></datalink>)</li> 1175 </ul> 1176 </li> 1177 <li><i>Why waiting?</i> 1178 <ul> 1179 <li>Object.wait (<datalink 1180 id="JVMTI_THREAD_STATE_IN_OBJECT_WAIT"><code>JVMTI_THREAD_STATE_IN_OBJECT_WAIT</code></datalink>)</li> 1181 <li>LockSupport.park (<datalink 1182 id="JVMTI_THREAD_STATE_PARKED"><code>JVMTI_THREAD_STATE_PARKED</code></datalink>)</li> 1183 <li>Sleeping (<datalink 1184 id="JVMTI_THREAD_STATE_SLEEPING"><code>JVMTI_THREAD_STATE_SLEEPING</code></datalink>)</li> 1185 </ul> 1186 </li> 1187 </ul> 1188 </li> 1189 </ul> 1190 </li> 1191 </ul> 1192 </li> 1193 </ul> 1194 </li> 1195 </ul> 1196 <p/> 1197 The answers are represented by the following bit vector. 1198 <constants id="jvmtiThreadState" label="Thread State Flags" kind="bits"> 1199 <constant id="JVMTI_THREAD_STATE_ALIVE" num="0x0001"> 1200 Thread is alive. Zero if thread is new (not started) or terminated. 1201 </constant> 1202 <constant id="JVMTI_THREAD_STATE_TERMINATED" num="0x0002"> 1203 Thread has completed execution. 1204 </constant> 1205 <constant id="JVMTI_THREAD_STATE_RUNNABLE" num="0x0004"> 1206 Thread is runnable. 1207 </constant> 1208 <constant id="JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER" num="0x0400"> 1209 Thread is waiting to enter a synchronization block/method or, 1210 after an <code>Object.wait()</code>, waiting to re-enter a 1211 synchronization block/method. 1212 </constant> 1213 <constant id="JVMTI_THREAD_STATE_WAITING" num="0x0080"> 1214 Thread is waiting. 1215 </constant> 1216 <constant id="JVMTI_THREAD_STATE_WAITING_INDEFINITELY" num="0x0010"> 1217 Thread is waiting without a timeout. 1218 For example, <code>Object.wait()</code>. 1219 </constant> 1220 <constant id="JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT" num="0x0020"> 1221 Thread is waiting with a maximum time to wait specified. 1222 For example, <code>Object.wait(long)</code>. 1223 </constant> 1224 <constant id="JVMTI_THREAD_STATE_SLEEPING" num="0x0040"> 1225 Thread is sleeping -- <code>Thread.sleep(long)</code>. 1226 </constant> 1227 <constant id="JVMTI_THREAD_STATE_IN_OBJECT_WAIT" num="0x0100"> 1228 Thread is waiting on an object monitor -- <code>Object.wait</code>. 1229 </constant> 1230 <constant id="JVMTI_THREAD_STATE_PARKED" num="0x0200"> 1231 Thread is parked, for example: <code>LockSupport.park</code>, 1232 <code>LockSupport.parkUtil</code> and <code>LockSupport.parkNanos</code>. 1233 </constant> 1234 <constant id="JVMTI_THREAD_STATE_SUSPENDED" num="0x100000"> 1235 Thread suspended. 1236 <code>java.lang.Thread.suspend()</code> 1237 or a <jvmti/> suspend function 1238 (such as <functionlink id="SuspendThread"></functionlink>) 1239 has been called on the thread. If this bit 1240 is set, the other bits refer to the thread state before suspension. 1241 </constant> 1242 <constant id="JVMTI_THREAD_STATE_INTERRUPTED" num="0x200000"> 1243 Thread has been interrupted. 1244 </constant> 1245 <constant id="JVMTI_THREAD_STATE_IN_NATIVE" num="0x400000"> 1246 Thread is in native code--that is, a native method is running 1247 which has not called back into the VM or Java programming 1248 language code. 1249 <p/> 1250 This flag is not set when running VM compiled Java programming 1251 language code nor is it set when running VM code or 1252 VM support code. Native VM interface functions, such as JNI and 1253 <jvmti/> functions, may be implemented as VM code. 1254 </constant> 1255 <constant id="JVMTI_THREAD_STATE_VENDOR_1" num="0x10000000"> 1256 Defined by VM vendor. 1257 </constant> 1258 <constant id="JVMTI_THREAD_STATE_VENDOR_2" num="0x20000000"> 1259 Defined by VM vendor. 1260 </constant> 1261 <constant id="JVMTI_THREAD_STATE_VENDOR_3" num="0x40000000"> 1262 Defined by VM vendor. 1263 </constant> 1264 </constants> 1265 The following definitions are used to convert <jvmti/> thread state 1266 to <code>java.lang.Thread.State</code> style states. 1267 <constants id="jvmtiJavaLangThreadState" label="java.lang.Thread.State Conversion Masks" kind="bits"> 1268 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_MASK" 1269 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"> 1270 Mask the state with this before comparison 1271 </constant> 1272 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_NEW" 1273 num="0"> 1274 <code>java.lang.Thread.State.NEW</code> 1275 </constant> 1276 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_TERMINATED" 1277 num="JVMTI_THREAD_STATE_TERMINATED"> 1278 <code>java.lang.Thread.State.TERMINATED</code> 1279 </constant> 1280 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_RUNNABLE" 1281 num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_RUNNABLE"> 1282 <code>java.lang.Thread.State.RUNNABLE</code> 1283 </constant> 1284 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_BLOCKED" 1285 num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER"> 1286 <code>java.lang.Thread.State.BLOCKED</code> 1287 </constant> 1288 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_WAITING" 1289 num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_INDEFINITELY"> 1290 <code>java.lang.Thread.State.WAITING</code> 1291 </constant> 1292 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_TIMED_WAITING" 1293 num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT"> 1294 <code>java.lang.Thread.State.TIMED_WAITING</code> 1295 </constant> 1296 </constants> 1297 <b>Rules</b> 1298 <p/> 1299 There can be no more than one answer to a question, although there can be no 1300 answer (because the answer is unknown, does not apply, or none of the answers is 1301 correct). An answer is set only when the enclosing answers match. 1302 That is, no more than one of 1303 <ul type="circle"> 1304 <li><code>JVMTI_THREAD_STATE_RUNNABLE</code></li> 1305 <li><code>JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER</code></li> 1306 <li><code>JVMTI_THREAD_STATE_WAITING</code></li> 1307 </ul> 1308 can be set (a <tm>J2SE</tm> compliant implementation will always set 1309 one of these if <code>JVMTI_THREAD_STATE_ALIVE</code> is set). 1310 And if any of these are set, the enclosing answer 1311 <code>JVMTI_THREAD_STATE_ALIVE</code> is set. 1312 No more than one of 1313 <ul type="circle"> 1314 <li><code>JVMTI_THREAD_STATE_WAITING_INDEFINITELY</code></li> 1315 <li><code>JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT</code></li> 1316 </ul> 1317 can be set (a <tm>J2SE</tm> compliant implementation will always set 1318 one of these if <code>JVMTI_THREAD_STATE_WAITING</code> is set). 1319 And if either is set, the enclosing answers 1320 <code>JVMTI_THREAD_STATE_ALIVE</code> and 1321 <code>JVMTI_THREAD_STATE_WAITING</code> are set. 1322 No more than one of 1323 <ul type="circle"> 1324 <li><code>JVMTI_THREAD_STATE_IN_OBJECT_WAIT</code></li> 1325 <li><code>JVMTI_THREAD_STATE_PARKED</code></li> 1326 <li><code>JVMTI_THREAD_STATE_SLEEPING</code></li> 1327 </ul> 1328 can be set. And if any of these is set, the enclosing answers 1329 <code>JVMTI_THREAD_STATE_ALIVE</code> and 1330 <code>JVMTI_THREAD_STATE_WAITING</code> are set. 1331 Also, if <code>JVMTI_THREAD_STATE_SLEEPING</code> is set, 1332 then <code>JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT</code> is set. 1333 If a state <i>A</i> is implemented using the mechanism of 1334 state <i>B</i> then it is state <i>A</i> which 1335 is returned by this function. 1336 For example, if <code>Thread.sleep(long)</code> 1337 is implemented using <code>Object.wait(long)</code> 1338 then it is still <code>JVMTI_THREAD_STATE_SLEEPING</code> 1339 which is returned. 1340 More than one of 1341 <ul type="circle"> 1342 <li><code>JVMTI_THREAD_STATE_SUSPENDED</code></li> 1343 <li><code>JVMTI_THREAD_STATE_INTERRUPTED</code></li> 1344 <li><code>JVMTI_THREAD_STATE_IN_NATIVE</code></li> 1345 </ul> 1346 can be set, but if any is set, 1347 <code>JVMTI_THREAD_STATE_ALIVE</code> is set. 1348 <p/> 1349 And finally, 1350 <code>JVMTI_THREAD_STATE_TERMINATED</code> cannot be set unless 1351 <code>JVMTI_THREAD_STATE_ALIVE</code> is not set. 1352 <p/> 1353 The thread state representation is designed for extension in future versions 1354 of the specification; thread state values should be used accordingly, that is 1355 they should not be used as ordinals. 1356 Most queries can be made by testing a single bit, if use in a switch statement is desired, 1357 the state bits should be masked with the interesting bits. 1358 All bits not defined above are reserved for future use. 1359 A VM, compliant to the current specification, must set reserved bits to zero. 1360 An agent should ignore reserved bits -- 1361 they should not be assumed to be zero and thus should not be included in comparisons. 1362 <p/> 1363 <b>Examples</b> 1364 <p/> 1365 Note that the values below exclude reserved and vendor bits. 1366 <p/> 1367 The state of a thread blocked at a <code>synchronized</code>-statement would be: 1368 <example> 1369 JVMTI_THREAD_STATE_ALIVE + JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER 1370 </example> 1371 The state of a thread which hasn't started yet would be: 1372 <example> 1373 0 1374 </example> 1375 The state of a thread at a <code>Object.wait(3000)</code> would be: 1376 <example> 1377 JVMTI_THREAD_STATE_ALIVE + JVMTI_THREAD_STATE_WAITING + 1378 JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT + 1379 JVMTI_THREAD_STATE_MONITOR_WAITING 1380 </example> 1381 The state of a thread suspended while runnable would be: 1382 <example> 1383 JVMTI_THREAD_STATE_ALIVE + JVMTI_THREAD_STATE_RUNNABLE + JVMTI_THREAD_STATE_SUSPENDED 1384 </example> 1385 <p/> 1386 <b>Testing the State</b> 1387 <p/> 1388 In most cases, the thread state can be determined by testing the one bit corresponding 1389 to that question. For example, the code to test if a thread is sleeping: 1390 <example> 1391 jint state; 1392 jvmtiError err; 1393 1394 err = (*jvmti)->GetThreadState(jvmti, thread, &state); 1395 if (err == JVMTI_ERROR_NONE) { 1396 if (state & JVMTI_THREAD_STATE_SLEEPING) { ... 1397 </example> 1398 <p/> 1399 For waiting (that is, in <code>Object.wait</code>, parked, or sleeping) it would be: 1400 <example> 1401 if (state & JVMTI_THREAD_STATE_WAITING) { ... 1402 </example> 1403 For some states, more than one bit will need to be tested as is the case 1404 when testing if a thread has not yet been started: 1405 <example> 1406 if ((state & (JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_TERMINATED)) == 0) { ... 1407 </example> 1408 To distinguish timed from untimed <code>Object.wait</code>: 1409 <example> 1410 if (state & JVMTI_THREAD_STATE_IN_OBJECT_WAIT) { 1411 if (state & JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT) { 1412 printf("in Object.wait(long timeout)\n"); 1413 } else { 1414 printf("in Object.wait()\n"); 1415 } 1416 } 1417 </example> 1418 <p/> 1419 <b>Relationship to <code>java.lang.Thread.State</code></b> 1420 <p/> 1421 The thread state represented by <code>java.lang.Thread.State</code> 1422 returned from <code>java.lang.Thread.getState()</code> is a subset of the 1423 information returned from this function. 1424 The corresponding <code>java.lang.Thread.State</code> can be determined 1425 by using the provided conversion masks. 1426 For example, this returns the name of the <code>java.lang.Thread.State</code> thread state: 1427 <example> 1428 err = (*jvmti)->GetThreadState(jvmti, thread, &state); 1429 abortOnError(err); 1430 switch (state & JVMTI_JAVA_LANG_THREAD_STATE_MASK) { 1431 case JVMTI_JAVA_LANG_THREAD_STATE_NEW: 1432 return "NEW"; 1433 case JVMTI_JAVA_LANG_THREAD_STATE_TERMINATED: 1434 return "TERMINATED"; 1435 case JVMTI_JAVA_LANG_THREAD_STATE_RUNNABLE: 1436 return "RUNNABLE"; 1437 case JVMTI_JAVA_LANG_THREAD_STATE_BLOCKED: 1438 return "BLOCKED"; 1439 case JVMTI_JAVA_LANG_THREAD_STATE_WAITING: 1440 return "WAITING"; 1441 case JVMTI_JAVA_LANG_THREAD_STATE_TIMED_WAITING: 1442 return "TIMED_WAITING"; 1443 } 1444 </example> 1445 </description> 1446 <origin>new</origin> 1447 <capabilities> 1448 </capabilities> 1449 <parameters> 1450 <param id="thread"> 1451 <jthread null="current" started="maybe" impl="noconvert"/> 1452 <description> 1453 The thread to query. 1454 </description> 1455 </param> 1456 <param id="thread_state_ptr"> 1457 <outptr><jint/></outptr> 1458 <description> 1459 On return, points to state flags, 1460 as defined by the <internallink id="jvmtiThreadState">Thread State Flags</internallink>. 1461 </description> 1462 </param> 1463 </parameters> 1464 <errors> 1465 </errors> 1466 </function> 1467 1468 <function id="GetCurrentThread" phase="start" num="18" since="1.1"> 1469 <synopsis>Get Current Thread</synopsis> 1470 <description> 1471 Get the current thread. 1472 The current thread is the Java programming language thread which has called the function. 1473 <p/> 1474 Note that most <jvmti/> functions that take a thread 1475 as an argument will accept <code>NULL</code> to mean 1476 the current thread. 1477 </description> 1478 <origin>new</origin> 1479 <capabilities> 1480 </capabilities> 1481 <parameters> 1482 <param id="thread_ptr"> 1483 <outptr><jthread/></outptr> 1484 <description> 1485 On return, points to the current thread. 1486 </description> 1487 </param> 1488 </parameters> 1489 <errors> 1490 </errors> 1491 </function> 1492 1493 <function id="GetAllThreads" num="4"> 1494 <synopsis>Get All Threads</synopsis> 1495 <description> 1496 Get all live threads. 1497 The threads are Java programming language threads; 1498 that is, threads that are attached to the VM. 1499 A thread is live if <code>java.lang.Thread.isAlive()</code> 1500 would return <code>true</code>, that is, the thread has 1501 been started and has not yet died. 1502 The universe of threads is determined by the context of the <jvmti/> 1503 environment, which typically is all threads attached to the VM. 1504 Note that this includes <jvmti/> agent threads 1505 (see <functionlink id="RunAgentThread"/>). 1506 </description> 1507 <origin>jvmdi</origin> 1508 <capabilities> 1509 </capabilities> 1510 <parameters> 1511 <param id="threads_count_ptr"> 1512 <outptr><jint/></outptr> 1513 <description> 1514 On return, points to the number of running threads. 1515 </description> 1516 </param> 1517 <param id="threads_ptr"> 1518 <allocbuf outcount="threads_count_ptr"><jthread/></allocbuf> 1519 <description> 1520 On return, points to an array of references, one 1521 for each running thread. 1522 </description> 1523 </param> 1524 </parameters> 1525 <errors> 1526 </errors> 1527 </function> 1528 1529 <function id="SuspendThread" num="5"> 1530 <synopsis>Suspend Thread</synopsis> 1531 <description> 1532 Suspend the specified thread. If the calling thread is specified, 1533 this function will not return until some other thread calls 1534 <functionlink id="ResumeThread"></functionlink>. 1535 If the thread is currently suspended, this function 1536 does nothing and returns an error. 1537 </description> 1538 <origin>jvmdi</origin> 1539 <capabilities> 1540 <required id="can_suspend"></required> 1541 </capabilities> 1542 <parameters> 1543 <param id="thread"> 1544 <jthread null="current"/> 1545 <description> 1546 The thread to suspend. 1547 </description> 1548 </param> 1549 </parameters> 1550 <errors> 1551 <error id="JVMTI_ERROR_THREAD_SUSPENDED"> 1552 Thread already suspended. 1553 </error> 1554 </errors> 1555 </function> 1556 1557 <elide> 1558 <function id="SuspendAllThreads" num="101"> 1559 <synopsis>Suspend All Threads</synopsis> 1560 <description> 1561 <issue> 1562 There has been no explicit call for this function, and it will 1563 thus be removed if there is no interest. 1564 </issue> 1565 Suspend all live threads except: 1566 <ul> 1567 <li>already suspended threads</li> 1568 <li>those listed in <paramlink id="except_list"></paramlink></li> 1569 <li>certain system (non application) threads, as determined 1570 by the VM implementation</li> 1571 </ul> 1572 The threads are Java programming language threads; 1573 native threads which are not attached to the VM are not 1574 Java programming language threads. 1575 A thread is live if <code>java.lang.Thread.isAlive()</code> 1576 would return <code>true</code>, that is, the thread has 1577 been started and has not yet died. 1578 The universe of threads is determined 1579 by the context of the <jvmti/> 1580 environment, which, typically, is all threads attached to the VM, 1581 except critical VM internal threads and <jvmti/> agent threads 1582 (see <functionlink id="RunAgentThread"/>). 1583 <p/> 1584 If the calling thread is specified, 1585 all other threads are suspended first then the caller thread is suspended - 1586 this function will not return until some other thread calls 1587 <functionlink id="ResumeThread"></functionlink>. 1588 <p/> 1589 The list of actually 1590 suspended threads is returned in 1591 <paramlink id="suspended_list_ptr"></paramlink>. 1592 Suspension is as defined in <functionlink id="SuspendThread"></functionlink>. 1593 <functionlink id="ResumeThreadList"></functionlink> 1594 can be used to resume the suspended threads. 1595 </description> 1596 <origin>new</origin> 1597 <capabilities> 1598 <required id="can_suspend"></required> 1599 </capabilities> 1600 <parameters> 1601 <param id="except_count"> 1602 <jint min="0"/> 1603 <description> 1604 The number of threads in the list of threads not to be suspended. 1605 </description> 1606 </param> 1607 <param id="except_list"> 1608 <inbuf incount="except_count"> 1609 <jthread/> 1610 <nullok>not an error if <code>except_count == 0</code></nullok> 1611 </inbuf> 1612 <description> 1613 The list of threads not to be suspended. 1614 </description> 1615 </param> 1616 <param id="suspended_count_ptr"> 1617 <outptr><jint/></outptr> 1618 <description> 1619 On return, points to the number of threads suspended by this call. 1620 </description> 1621 </param> 1622 <param id="suspended_list_ptr"> 1623 <allocbuf outcount="suspended_count_ptr"><jthread/></allocbuf> 1624 <description> 1625 On return, points to an array of references, one 1626 for each thread suspended. 1627 </description> 1628 </param> 1629 </parameters> 1630 <errors> 1631 <error id="JVMTI_ERROR_INVALID_THREAD"> 1632 A thread in <paramlink id="except_list"></paramlink> was invalid. 1633 </error> 1634 <error id="JVMTI_ERROR_NULL_POINTER"> 1635 Both <paramlink id="except_list"></paramlink> was <code>NULL</code> 1636 and <paramlink id="except_count"></paramlink> was non-zero. 1637 </error> 1638 </errors> 1639 </function> 1640 </elide> 1641 1642 <function id="SuspendThreadList" num="92"> 1643 <synopsis>Suspend Thread List</synopsis> 1644 <description> 1645 Suspend the <paramlink id="request_count"></paramlink> 1646 threads specified in the 1647 <paramlink id="request_list"></paramlink> array. 1648 Threads may be resumed with 1649 <functionlink id="ResumeThreadList"></functionlink> or 1650 <functionlink id="ResumeThread"></functionlink>. 1651 If the calling thread is specified in the 1652 <paramlink id="request_list"></paramlink> array, this function will 1653 not return until some other thread resumes it. 1654 Errors encountered in the suspension of a thread 1655 are returned in the <paramlink id="results"></paramlink> 1656 array, <b>not</b> in the return value of this function. 1657 Threads that are currently suspended do not change state. 1658 </description> 1659 <origin>jvmdi</origin> 1660 <capabilities> 1661 <required id="can_suspend"></required> 1662 </capabilities> 1663 <parameters> 1664 <param id="request_count"> 1665 <jint min="0"/> 1666 <description> 1667 The number of threads to suspend. 1668 </description> 1669 </param> 1670 <param id="request_list"> 1671 <inbuf incount="request_count"><jthread/></inbuf> 1672 <description> 1673 The list of threads to suspend. 1674 </description> 1675 </param> 1676 <param id="results"> 1677 <outbuf incount="request_count"><enum>jvmtiError</enum></outbuf> 1678 <description> 1679 An agent supplied array of 1680 <paramlink id="request_count"></paramlink> elements. 1681 On return, filled with the error code for 1682 the suspend of the corresponding thread. 1683 The error code will be 1684 <errorlink id="JVMTI_ERROR_NONE"></errorlink> 1685 if the thread was suspended by this call. 1686 Possible error codes are those specified 1687 for <functionlink id="SuspendThread"></functionlink>. 1688 </description> 1689 </param> 1690 </parameters> 1691 <errors> 1692 </errors> 1693 </function> 1694 1695 <function id="ResumeThread" num="6"> 1696 <synopsis>Resume Thread</synopsis> 1697 <description> 1698 Resume a suspended thread. 1699 Any threads currently suspended through 1700 a <jvmti/> suspend function (eg. 1701 <functionlink id="SuspendThread"></functionlink>) 1702 or <code>java.lang.Thread.suspend()</code> 1703 will resume execution; 1704 all other threads are unaffected. 1705 </description> 1706 <origin>jvmdi</origin> 1707 <capabilities> 1708 <required id="can_suspend"></required> 1709 </capabilities> 1710 <parameters> 1711 <param id="thread"> 1712 <jthread/> 1713 <description> 1714 The thread to resume. 1715 </description> 1716 </param> 1717 </parameters> 1718 <errors> 1719 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 1720 Thread was not suspended. 1721 </error> 1722 <error id="JVMTI_ERROR_INVALID_TYPESTATE"> 1723 The state of the thread has been modified, and is now inconsistent. 1724 </error> 1725 </errors> 1726 </function> 1727 1728 <function id="ResumeThreadList" num="93"> 1729 <synopsis>Resume Thread List</synopsis> 1730 <description> 1731 Resume the <paramlink id="request_count"></paramlink> 1732 threads specified in the 1733 <paramlink id="request_list"></paramlink> array. 1734 Any thread suspended through 1735 a <jvmti/> suspend function (eg. 1736 <functionlink id="SuspendThreadList"></functionlink>) 1737 or <code>java.lang.Thread.suspend()</code> 1738 will resume execution. 1739 </description> 1740 <origin>jvmdi</origin> 1741 <capabilities> 1742 <required id="can_suspend"></required> 1743 </capabilities> 1744 <parameters> 1745 <param id="request_count"> 1746 <jint min="0"/> 1747 <description> 1748 The number of threads to resume. 1749 </description> 1750 </param> 1751 <param id="request_list"> 1752 <inbuf incount="request_count"><jthread/></inbuf> 1753 <description> 1754 The threads to resume. 1755 </description> 1756 </param> 1757 <param id="results"> 1758 <outbuf incount="request_count"><enum>jvmtiError</enum></outbuf> 1759 <description> 1760 An agent supplied array of 1761 <paramlink id="request_count"></paramlink> elements. 1762 On return, filled with the error code for 1763 the resume of the corresponding thread. 1764 The error code will be 1765 <errorlink id="JVMTI_ERROR_NONE"></errorlink> 1766 if the thread was suspended by this call. 1767 Possible error codes are those specified 1768 for <functionlink id="ResumeThread"></functionlink>. 1769 </description> 1770 </param> 1771 </parameters> 1772 <errors> 1773 </errors> 1774 </function> 1775 1776 <function id="StopThread" num="7"> 1777 <synopsis>Stop Thread</synopsis> 1778 <description> 1779 Send the specified asynchronous exception to the specified thread 1780 (similar to <code>java.lang.Thread.stop</code>). 1781 Normally, this function is used to kill the specified thread with an 1782 instance of the exception <code>ThreadDeath</code>. 1783 </description> 1784 <origin>jvmdi</origin> 1785 <capabilities> 1786 <required id="can_signal_thread"></required> 1787 </capabilities> 1788 <parameters> 1789 <param id="thread"> 1790 <jthread/> 1791 <description> 1792 The thread to stop. 1793 </description> 1794 </param> 1795 <param id="exception"> 1796 <jobject/> 1797 <description> 1798 The asynchronous exception object. 1799 </description> 1800 </param> 1801 </parameters> 1802 <errors> 1803 </errors> 1804 </function> 1805 1806 <function id="InterruptThread" num="8"> 1807 <synopsis>Interrupt Thread</synopsis> 1808 <description> 1809 Interrupt the specified thread 1810 (similar to <code>java.lang.Thread.interrupt</code>). 1811 </description> 1812 <origin>jvmdi</origin> 1813 <capabilities> 1814 <required id="can_signal_thread"></required> 1815 </capabilities> 1816 <parameters> 1817 <param id="thread"> 1818 <jthread impl="noconvert"/> 1819 <description> 1820 The thread to interrupt. 1821 </description> 1822 </param> 1823 </parameters> 1824 <errors> 1825 </errors> 1826 </function> 1827 1828 <function id="GetThreadInfo" num="9"> 1829 <synopsis>Get Thread Info</synopsis> 1830 <typedef id="jvmtiThreadInfo" label="Thread information structure"> 1831 <field id="name"> 1832 <allocfieldbuf><char/></allocfieldbuf> 1833 <description> 1834 The thread name, encoded as a 1835 <internallink id="mUTF">modified UTF-8</internallink> string. 1836 </description> 1837 </field> 1838 <field id="priority"> 1839 <jint/> 1840 <description> 1841 The thread priority. See the thread priority constants: 1842 <datalink id="jvmtiThreadPriority"></datalink>. 1843 </description> 1844 </field> 1845 <field id="is_daemon"> 1846 <jboolean/> 1847 <description> 1848 Is this a daemon thread? 1849 </description> 1850 </field> 1851 <field id="thread_group"> 1852 <jthreadGroup/> 1853 <description> 1854 The thread group to which this thread belongs. 1855 <code>NULL</code> if the thread has died. 1856 </description> 1857 </field> 1858 <field id="context_class_loader"> 1859 <jobject/> 1860 <description> 1861 The context class loader associated with this thread. 1862 </description> 1863 </field> 1864 </typedef> 1865 <description> 1866 Get thread information. The fields of the <datalink id="jvmtiThreadInfo"/> structure 1867 are filled in with details of the specified thread. 1868 </description> 1869 <origin>jvmdi</origin> 1870 <capabilities> 1871 </capabilities> 1872 <parameters> 1873 <param id="thread"> 1874 <jthread null="current" impl="noconvert" started="maybe"/> 1875 <description> 1876 The thread to query. 1877 </description> 1878 </param> 1879 <param id="info_ptr"> 1880 <outptr><struct>jvmtiThreadInfo</struct></outptr> 1881 <description> 1882 On return, filled with information describing the specified thread. 1883 <p/> 1884 For JDK 1.1 implementations that don't 1885 recognize context class loaders, 1886 the <code>context_class_loader</code> field will be NULL. 1887 </description> 1888 </param> 1889 </parameters> 1890 <errors> 1891 </errors> 1892 </function> 1893 1894 <function id="GetOwnedMonitorInfo" num="10"> 1895 <synopsis>Get Owned Monitor Info</synopsis> 1896 <description> 1897 Get information about the monitors owned by the 1898 specified thread. 1899 </description> 1900 <origin>jvmdiClone</origin> 1901 <capabilities> 1902 <required id="can_get_owned_monitor_info"></required> 1903 </capabilities> 1904 <parameters> 1905 <param id="thread"> 1906 <jthread null="current"/> 1907 <description> 1908 The thread to query. 1909 </description> 1910 </param> 1911 <param id="owned_monitor_count_ptr"> 1912 <outptr><jint/></outptr> 1913 <description> 1914 The number of monitors returned. 1915 </description> 1916 </param> 1917 <param id="owned_monitors_ptr"> 1918 <allocbuf outcount="owned_monitor_count_ptr"><jobject/></allocbuf> 1919 <description> 1920 The array of owned monitors. 1921 </description> 1922 </param> 1923 </parameters> 1924 <errors> 1925 </errors> 1926 </function> 1927 1928 <function id="GetOwnedMonitorStackDepthInfo" num="153" since="1.1"> 1929 <synopsis>Get Owned Monitor Stack Depth Info</synopsis> 1930 <typedef id="jvmtiMonitorStackDepthInfo" 1931 label="Monitor stack depth information structure"> 1932 <field id="monitor"> 1933 <jobject/> 1934 <description> 1935 The owned monitor. 1936 </description> 1937 </field> 1938 <field id="stack_depth"> 1939 <jint/> 1940 <description> 1941 The stack depth. Corresponds to the stack depth used in the 1942 <internallink id="stack">Stack Frame functions</internallink>. 1943 That is, zero is the current frame, one is the frame which 1944 called the current frame. And it is negative one if the 1945 implementation cannot determine the stack depth (e.g., for 1946 monitors acquired by JNI <code>MonitorEnter</code>). 1947 </description> 1948 </field> 1949 </typedef> 1950 <description> 1951 Get information about the monitors owned by the 1952 specified thread and the depth of the stack frame which locked them. 1953 </description> 1954 <origin>new</origin> 1955 <capabilities> 1956 <required id="can_get_owned_monitor_stack_depth_info"></required> 1957 </capabilities> 1958 <parameters> 1959 <param id="thread"> 1960 <jthread null="current"/> 1961 <description> 1962 The thread to query. 1963 </description> 1964 </param> 1965 <param id="monitor_info_count_ptr"> 1966 <outptr><jint/></outptr> 1967 <description> 1968 The number of monitors returned. 1969 </description> 1970 </param> 1971 <param id="monitor_info_ptr"> 1972 <allocbuf outcount="monitor_info_count_ptr"> 1973 <struct>jvmtiMonitorStackDepthInfo</struct> 1974 </allocbuf> 1975 <description> 1976 The array of owned monitor depth information. 1977 </description> 1978 </param> 1979 </parameters> 1980 <errors> 1981 </errors> 1982 </function> 1983 1984 <function id="GetCurrentContendedMonitor" num="11"> 1985 <synopsis>Get Current Contended Monitor</synopsis> 1986 <description> 1987 Get the object, if any, whose monitor the specified thread is waiting to 1988 enter or waiting to regain through <code>java.lang.Object.wait</code>. 1989 </description> 1990 <origin>jvmdi</origin> 1991 <capabilities> 1992 <required id="can_get_current_contended_monitor"></required> 1993 </capabilities> 1994 <parameters> 1995 <param id="thread"> 1996 <jthread null="current"/> 1997 <description> 1998 The thread to query. 1999 </description> 2000 </param> 2001 <param id="monitor_ptr"> 2002 <outptr><jobject/></outptr> 2003 <description> 2004 On return, filled with the current contended monitor, or 2005 NULL if there is none. 2006 </description> 2007 </param> 2008 </parameters> 2009 <errors> 2010 </errors> 2011 </function> 2012 2013 <callback id="jvmtiStartFunction"> 2014 <void/> 2015 <synopsis>Agent Start Function</synopsis> 2016 <description> 2017 Agent supplied callback function. 2018 This function is the entry point for an agent thread 2019 started with 2020 <functionlink id="RunAgentThread"></functionlink>. 2021 </description> 2022 <parameters> 2023 <param id="jvmti_env"> 2024 <outptr> 2025 <struct>jvmtiEnv</struct> 2026 </outptr> 2027 <description> 2028 The <jvmti/> environment. 2029 </description> 2030 </param> 2031 <param id="jni_env"> 2032 <outptr> 2033 <struct>JNIEnv</struct> 2034 </outptr> 2035 <description> 2036 The JNI environment. 2037 </description> 2038 </param> 2039 <param id="arg"> 2040 <outptr> 2041 <void/> 2042 </outptr> 2043 <description> 2044 The <code>arg</code> parameter passed to 2045 <functionlink id="RunAgentThread"></functionlink>. 2046 </description> 2047 </param> 2048 </parameters> 2049 </callback> 2050 2051 <function id="RunAgentThread" num="12"> 2052 <synopsis>Run Agent Thread</synopsis> 2053 <description> 2054 Starts the execution of an agent thread. with the specified native function. 2055 The parameter <paramlink id="arg"></paramlink> is forwarded on to the 2056 <functionlink id="jvmtiStartFunction">start function</functionlink> 2057 (specified with <paramlink id="proc"></paramlink>) as its single argument. 2058 This function allows the creation of agent threads 2059 for handling communication with another process or for handling events 2060 without the need to load a special subclass of <code>java.lang.Thread</code> or 2061 implementer of <code>java.lang.Runnable</code>. 2062 Instead, the created thread can run entirely in native code. 2063 However, the created thread does require a newly created instance 2064 of <code>java.lang.Thread</code> (referenced by the argument <code>thread</code>) to 2065 which it will be associated. 2066 The thread object can be created with JNI calls. 2067 <p/> 2068 The following common thread priorities are provided for your convenience: 2069 <constants id="jvmtiThreadPriority" label="Thread Priority Constants" kind="const"> 2070 <constant id="JVMTI_THREAD_MIN_PRIORITY" num="1"> 2071 Minimum possible thread priority 2072 </constant> 2073 <constant id="JVMTI_THREAD_NORM_PRIORITY" num="5"> 2074 Normal thread priority 2075 </constant> 2076 <constant id="JVMTI_THREAD_MAX_PRIORITY" num="10"> 2077 Maximum possible thread priority 2078 </constant> 2079 </constants> 2080 <p/> 2081 The new thread is started as a daemon thread with the specified 2082 <paramlink id="priority"></paramlink>. 2083 If enabled, a <eventlink id="ThreadStart"/> event will be sent. 2084 <p/> 2085 Since the thread has been started, the thread will be live when this function 2086 returns, unless the thread has died immediately. 2087 <p/> 2088 The thread group of the thread is ignored -- specifically, the thread is not 2089 added to the thread group and the thread is not seen on queries of the thread 2090 group at either the Java programming language or <jvmti/> levels. 2091 <p/> 2092 The thread is not visible to Java programming language queries but is 2093 included in <jvmti/> queries (for example, 2094 <functionlink id="GetAllThreads"/> and 2095 <functionlink id="GetAllStackTraces"/>). 2096 <p/> 2097 Upon execution of <code>proc</code>, the new thread will be attached to the 2098 VM--see the JNI documentation on 2099 <externallink id="http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/invocation.html#wp1060" 2100 >Attaching to the VM</externallink>. 2101 </description> 2102 <origin>jvmdiClone</origin> 2103 <capabilities> 2104 </capabilities> 2105 <parameters> 2106 <param id="thread"> 2107 <jthread impl="noconvert" started="no"/> 2108 <description> 2109 The thread to run. 2110 </description> 2111 </param> 2112 <param id="proc"> 2113 <ptrtype> 2114 <struct>jvmtiStartFunction</struct> 2115 </ptrtype> 2116 <description> 2117 The start function. 2118 </description> 2119 </param> 2120 <param id="arg"> 2121 <inbuf> 2122 <void/> 2123 <nullok><code>NULL</code> is passed to the start function</nullok> 2124 </inbuf> 2125 <description> 2126 The argument to the start function. 2127 </description> 2128 </param> 2129 <param id="priority"> 2130 <jint/> 2131 <description> 2132 The priority of the started thread. Any thread 2133 priority allowed by <code>java.lang.Thread.setPriority</code> can be used including 2134 those in <datalink id="jvmtiThreadPriority"></datalink>. 2135 </description> 2136 </param> 2137 </parameters> 2138 <errors> 2139 <error id="JVMTI_ERROR_INVALID_PRIORITY"> 2140 <paramlink id="priority"/> is less than 2141 <datalink id="JVMTI_THREAD_MIN_PRIORITY"/> 2142 or greater than 2143 <datalink id="JVMTI_THREAD_MAX_PRIORITY"/> 2144 </error> 2145 </errors> 2146 </function> 2147 2148 <function id="SetThreadLocalStorage" jkernel="yes" impl="notrace" phase="start" num="103"> 2149 <synopsis>Set Thread Local Storage</synopsis> 2150 <description> 2151 The VM stores a pointer value associated with each environment-thread 2152 pair. This pointer value is called <i>thread-local storage</i>. 2153 This value is <code>NULL</code> unless set with this function. 2154 Agents can allocate memory in which they store thread specific 2155 information. By setting thread-local storage it can then be 2156 accessed with 2157 <functionlink id="GetThreadLocalStorage"></functionlink>. 2158 <p/> 2159 This function is called by the agent to set the value of the <jvmti/> 2160 thread-local storage. <jvmti/> supplies to the agent a pointer-size 2161 thread-local storage that can be used to record per-thread 2162 information. 2163 </description> 2164 <origin>jvmpi</origin> 2165 <capabilities> 2166 </capabilities> 2167 <parameters> 2168 <param id="thread"> 2169 <jthread null="current"/> 2170 <description> 2171 Store to this thread. 2172 </description> 2173 </param> 2174 <param id="data"> 2175 <inbuf> 2176 <void/> 2177 <nullok>value is set to <code>NULL</code></nullok> 2178 </inbuf> 2179 <description> 2180 The value to be entered into the thread-local storage. 2181 </description> 2182 </param> 2183 </parameters> 2184 <errors> 2185 </errors> 2186 </function> 2187 2188 <function id="GetThreadLocalStorage" jkernel="yes" impl="innative notrace" phase="start" num="102"> 2189 <synopsis>Get Thread Local Storage</synopsis> 2190 <description> 2191 Called by the agent to get the value of the <jvmti/> thread-local 2192 storage. 2193 </description> 2194 <origin>jvmpi</origin> 2195 <capabilities> 2196 </capabilities> 2197 <parameters> 2198 <param id="thread"> 2199 <jthread null="current" impl="noconvert"/> 2200 <description> 2201 Retrieve from this thread. 2202 </description> 2203 </param> 2204 <param id="data_ptr"> 2205 <agentbuf><void/></agentbuf> 2206 <description> 2207 Pointer through which the value of the thread local 2208 storage is returned. 2209 If thread-local storage has not been set with 2210 <functionlink id="SetThreadLocalStorage"></functionlink> the returned 2211 pointer is <code>NULL</code>. 2212 </description> 2213 </param> 2214 </parameters> 2215 <errors> 2216 </errors> 2217 </function> 2218 2219 </category> 2220 2221 <category id="thread_groups" label="Thread Group"> 2222 <intro> 2223 </intro> 2224 2225 <function id="GetTopThreadGroups" num="13"> 2226 <synopsis>Get Top Thread Groups</synopsis> 2227 <description> 2228 Return all top-level (parentless) thread groups in the VM. 2229 </description> 2230 <origin>jvmdi</origin> 2231 <capabilities> 2232 </capabilities> 2233 <parameters> 2234 <param id="group_count_ptr"> 2235 <outptr><jint/></outptr> 2236 <description> 2237 On return, points to the number of top-level thread groups. 2238 </description> 2239 </param> 2240 <param id="groups_ptr"> 2241 <allocbuf outcount="group_count_ptr"><jthreadGroup/></allocbuf> 2242 <description> 2243 On return, refers to a pointer to the top-level thread group array. 2244 </description> 2245 </param> 2246 </parameters> 2247 <errors> 2248 </errors> 2249 </function> 2250 2251 <function id="GetThreadGroupInfo" num="14"> 2252 <synopsis>Get Thread Group Info</synopsis> 2253 <typedef id="jvmtiThreadGroupInfo" label="Thread group information structure"> 2254 <field id="parent"> 2255 <jthreadGroup/> 2256 <description> 2257 The parent thread group. 2258 </description> 2259 </field> 2260 <field id="name"> 2261 <allocfieldbuf><char/></allocfieldbuf> 2262 <description> 2263 The thread group's name, encoded as a 2264 <internallink id="mUTF">modified UTF-8</internallink> string. 2265 </description> 2266 </field> 2267 <field id="max_priority"> 2268 <jint/> 2269 <description> 2270 The maximum priority for this thread group. 2271 </description> 2272 </field> 2273 <field id="is_daemon"> 2274 <jboolean/> 2275 <description> 2276 Is this a daemon thread group? 2277 </description> 2278 </field> 2279 </typedef> 2280 <description> 2281 Get information about the thread group. The fields of the 2282 <functionlink id="jvmtiThreadGroupInfo"></functionlink> structure 2283 are filled in with details of the specified thread group. 2284 </description> 2285 <origin>jvmdi</origin> 2286 <capabilities> 2287 </capabilities> 2288 <parameters> 2289 <param id="group"> 2290 <jthreadGroup/> 2291 <description> 2292 The thread group to query. 2293 </description> 2294 </param> 2295 <param id="info_ptr"> 2296 <outptr><struct>jvmtiThreadGroupInfo</struct></outptr> 2297 <description> 2298 On return, filled with information describing the specified 2299 thread group. 2300 </description> 2301 </param> 2302 </parameters> 2303 <errors> 2304 </errors> 2305 </function> 2306 2307 <function id="GetThreadGroupChildren" num="15"> 2308 <synopsis>Get Thread Group Children</synopsis> 2309 <description> 2310 Get the live threads and active subgroups in this thread group. 2311 </description> 2312 <origin>jvmdi</origin> 2313 <capabilities> 2314 </capabilities> 2315 <parameters> 2316 <param id="group"> 2317 <jthreadGroup/> 2318 <description> 2319 The group to query. 2320 </description> 2321 </param> 2322 <param id="thread_count_ptr"> 2323 <outptr><jint/></outptr> 2324 <description> 2325 On return, points to the number of live threads in this thread group. 2326 </description> 2327 </param> 2328 <param id="threads_ptr"> 2329 <allocbuf outcount="thread_count_ptr"><jthread/></allocbuf> 2330 <description> 2331 On return, points to an array of the live threads in this thread group. 2332 </description> 2333 </param> 2334 <param id="group_count_ptr"> 2335 <outptr><jint/></outptr> 2336 <description> 2337 On return, points to the number of active child thread groups 2338 </description> 2339 </param> 2340 <param id="groups_ptr"> 2341 <allocbuf outcount="group_count_ptr"><jthreadGroup/></allocbuf> 2342 <description> 2343 On return, points to an array of the active child thread groups. 2344 </description> 2345 </param> 2346 </parameters> 2347 <errors> 2348 </errors> 2349 </function> 2350 </category> 2351 2352 <category id="stack" label="Stack Frame"> 2353 <intro> 2354 These functions provide information about the stack of a thread. 2355 Stack frames are referenced by depth. 2356 The frame at depth zero is the current frame. 2357 <p/> 2358 Stack frames are as described in 2359 <vmspec chapter="3.6"/>, 2360 That is, they correspond to method 2361 invocations (including native methods) but do not correspond to platform native or 2362 VM internal frames. 2363 <p/> 2364 A <jvmti/> implementation may use method invocations to launch a thread and 2365 the corresponding frames may be included in the stack as presented by these functions -- 2366 that is, there may be frames shown 2367 deeper than <code>main()</code> and <code>run()</code>. 2368 However this presentation must be consistent across all <jvmti/> functionality which 2369 uses stack frames or stack depth. 2370 </intro> 2371 2372 <typedef id="jvmtiFrameInfo" label="Stack frame information structure"> 2373 <description> 2374 Information about a stack frame is returned in this structure. 2375 </description> 2376 <field id="method"> 2377 <jmethodID/> 2378 <description> 2379 The method executing in this frame. 2380 </description> 2381 </field> 2382 <field id="location"> 2383 <jlocation/> 2384 <description> 2385 The index of the instruction executing in this frame. 2386 <code>-1</code> if the frame is executing a native method. 2387 </description> 2388 </field> 2389 </typedef> 2390 2391 <typedef id="jvmtiStackInfo" label="Stack information structure"> 2392 <description> 2393 Information about a set of stack frames is returned in this structure. 2394 </description> 2395 <field id="thread"> 2396 <jthread/> 2397 <description> 2398 On return, the thread traced. 2399 </description> 2400 </field> 2401 <field id="state"> 2402 <jint/> 2403 <description> 2404 On return, the thread state. See <functionlink id="GetThreadState"></functionlink>. 2405 </description> 2406 </field> 2407 <field id="frame_buffer"> 2408 <outbuf incount="max_frame_count"> 2409 <struct>jvmtiFrameInfo</struct> 2410 </outbuf> 2411 <description> 2412 On return, this agent allocated buffer is filled 2413 with stack frame information. 2414 </description> 2415 </field> 2416 <field id="frame_count"> 2417 <jint/> 2418 <description> 2419 On return, the number of records filled into 2420 <code>frame_buffer</code>. 2421 This will be 2422 min(<code>max_frame_count</code>, <i>stackDepth</i>). 2423 </description> 2424 </field> 2425 </typedef> 2426 2427 <function id="GetStackTrace" num="104"> 2428 <synopsis>Get Stack Trace</synopsis> 2429 <description> 2430 Get information about the stack of a thread. 2431 If <paramlink id="max_frame_count"></paramlink> is less than the depth of the stack, 2432 the <paramlink id="max_frame_count"></paramlink> topmost frames are returned, 2433 otherwise the entire stack is returned. 2434 The topmost frames, those most recently invoked, are at the beginning of the returned buffer. 2435 <p/> 2436 The following example causes up to five of the topmost frames 2437 to be returned and (if there are any frames) the currently 2438 executing method name to be printed. 2439 <example> 2440 jvmtiFrameInfo frames[5]; 2441 jint count; 2442 jvmtiError err; 2443 2444 err = (*jvmti)->GetStackTrace(jvmti, aThread, 0, 5, 2445 frames, &count); 2446 if (err == JVMTI_ERROR_NONE && count >= 1) { 2447 char *methodName; 2448 err = (*jvmti)->GetMethodName(jvmti, frames[0].method, 2449 &methodName, NULL, NULL); 2450 if (err == JVMTI_ERROR_NONE) { 2451 printf("Executing method: %s", methodName); 2452 } 2453 } 2454 </example> 2455 <todo> 2456 check example code. 2457 </todo> 2458 <p/> 2459 The <paramlink id="thread"></paramlink> need not be suspended 2460 to call this function. 2461 <p/> 2462 The <functionlink id="GetLineNumberTable"></functionlink> 2463 function can be used to map locations to line numbers. Note that 2464 this mapping can be done lazily. 2465 </description> 2466 <origin>jvmpi</origin> 2467 <capabilities> 2468 </capabilities> 2469 <parameters> 2470 <param id="thread"> 2471 <jthread null="current"/> 2472 <description> 2473 Fetch the stack trace of this thread. 2474 </description> 2475 </param> 2476 <param id="start_depth"> 2477 <jint/> 2478 <description> 2479 Begin retrieving frames at this depth. 2480 If non-negative, count from the current frame, 2481 the first frame retrieved is at depth <code>start_depth</code>. 2482 For example, if zero, start from the current frame; if one, start from the 2483 caller of the current frame; if two, start from the caller of the 2484 caller of the current frame; and so on. 2485 If negative, count from below the oldest frame, 2486 the first frame retrieved is at depth <i>stackDepth</i><code> + start_depth</code>, 2487 where <i>stackDepth</i> is the count of frames on the stack. 2488 For example, if negative one, only the oldest frame is retrieved; 2489 if negative two, start from the frame called by the oldest frame. 2490 </description> 2491 </param> 2492 <param id="max_frame_count"> 2493 <jint min="0"/> 2494 <description> 2495 The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve. 2496 </description> 2497 </param> 2498 <param id="frame_buffer"> 2499 <outbuf incount="max_frame_count" outcount="count_ptr"> 2500 <struct>jvmtiFrameInfo</struct> 2501 </outbuf> 2502 <description> 2503 On return, this agent allocated buffer is filled 2504 with stack frame information. 2505 </description> 2506 </param> 2507 <param id="count_ptr"> 2508 <outptr><jint/></outptr> 2509 <description> 2510 On return, points to the number of records filled in. 2511 For non-negative <code>start_depth</code>, this will be 2512 min(<code>max_frame_count</code>, <i>stackDepth</i><code> - start_depth</code>). 2513 For negative <code>start_depth</code>, this will be 2514 min(<code>max_frame_count</code>, <code>-start_depth</code>). 2515 </description> 2516 </param> 2517 </parameters> 2518 <errors> 2519 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 2520 <paramlink id="start_depth"/> is positive and greater than or equal to <i>stackDepth</i>. 2521 Or <paramlink id="start_depth"/> is negative and less than <i>-stackDepth</i>. 2522 </error> 2523 </errors> 2524 </function> 2525 2526 2527 <function id="GetAllStackTraces" num="100"> 2528 <synopsis>Get All Stack Traces</synopsis> 2529 <description> 2530 Get information about the stacks of all live threads 2531 (including <internallink id="RunAgentThread">agent threads</internallink>). 2532 If <paramlink id="max_frame_count"/> is less than the depth of a stack, 2533 the <paramlink id="max_frame_count"/> topmost frames are returned for that thread, 2534 otherwise the entire stack is returned. 2535 The topmost frames, those most recently invoked, are at the beginning of the returned buffer. 2536 <p/> 2537 All stacks are collected simultaneously, that is, no changes will occur to the 2538 thread state or stacks between the sampling of one thread and the next. 2539 The threads need not be suspended. 2540 2541 <example> 2542 jvmtiStackInfo *stack_info; 2543 jint thread_count; 2544 int ti; 2545 jvmtiError err; 2546 2547 err = (*jvmti)->GetAllStackTraces(jvmti, MAX_FRAMES, &stack_info, &thread_count); 2548 if (err != JVMTI_ERROR_NONE) { 2549 ... 2550 } 2551 for (ti = 0; ti < thread_count; ++ti) { 2552 jvmtiStackInfo *infop = &stack_info[ti]; 2553 jthread thread = infop->thread; 2554 jint state = infop->state; 2555 jvmtiFrameInfo *frames = infop->frame_buffer; 2556 int fi; 2557 2558 myThreadAndStatePrinter(thread, state); 2559 for (fi = 0; fi < infop->frame_count; fi++) { 2560 myFramePrinter(frames[fi].method, frames[fi].location); 2561 } 2562 } 2563 /* this one Deallocate call frees all data allocated by GetAllStackTraces */ 2564 err = (*jvmti)->Deallocate(jvmti, stack_info); 2565 </example> 2566 <todo> 2567 check example code. 2568 </todo> 2569 2570 </description> 2571 <origin>new</origin> 2572 <capabilities> 2573 </capabilities> 2574 <parameters> 2575 <param id="max_frame_count"> 2576 <jint min="0"/> 2577 <description> 2578 The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve per thread. 2579 </description> 2580 </param> 2581 <param id="stack_info_ptr"> 2582 <allocbuf> 2583 <struct>jvmtiStackInfo</struct> 2584 </allocbuf> 2585 <description> 2586 On return, this buffer is filled 2587 with stack information for each thread. 2588 The number of <datalink id="jvmtiStackInfo"/> records is determined 2589 by <paramlink id="thread_count_ptr"/>. 2590 <p/> 2591 Note that this buffer is allocated to include the <datalink id="jvmtiFrameInfo"/> 2592 buffers pointed to by <datalink id="jvmtiStackInfo.frame_buffer"/>. 2593 These buffers must not be separately deallocated. 2594 </description> 2595 </param> 2596 <param id="thread_count_ptr"> 2597 <outptr><jint/></outptr> 2598 <description> 2599 The number of threads traced. 2600 </description> 2601 </param> 2602 </parameters> 2603 <errors> 2604 </errors> 2605 </function> 2606 2607 <function id="GetThreadListStackTraces" num="101"> 2608 <synopsis>Get Thread List Stack Traces</synopsis> 2609 <description> 2610 Get information about the stacks of the supplied threads. 2611 If <paramlink id="max_frame_count"/> is less than the depth of a stack, 2612 the <paramlink id="max_frame_count"/> topmost frames are returned for that thread, 2613 otherwise the entire stack is returned. 2614 The topmost frames, those most recently invoked, are at the beginning of the returned buffer. 2615 <p/> 2616 All stacks are collected simultaneously, that is, no changes will occur to the 2617 thread state or stacks between the sampling one thread and the next. 2618 The threads need not be suspended. 2619 <p/> 2620 If a thread has not yet started or terminates before the stack information is collected, 2621 a zero length stack (<datalink id="jvmtiStackInfo.frame_count"/> will be zero) 2622 will be returned and the thread <datalink id="jvmtiStackInfo.state"/> can be checked. 2623 <p/> 2624 See the example for the similar function 2625 <functionlink id="GetAllStackTraces"/>. 2626 </description> 2627 <origin>new</origin> 2628 <capabilities> 2629 </capabilities> 2630 <parameters> 2631 <param id="thread_count"> 2632 <jint min="0"/> 2633 <description> 2634 The number of threads to trace. 2635 </description> 2636 </param> 2637 <param id="thread_list"> 2638 <inbuf incount="thread_count"><jthread/></inbuf> 2639 <description> 2640 The list of threads to trace. 2641 </description> 2642 </param> 2643 <param id="max_frame_count"> 2644 <jint min="0"/> 2645 <description> 2646 The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve per thread. 2647 </description> 2648 </param> 2649 <param id="stack_info_ptr"> 2650 <allocbuf outcount="thread_count"> 2651 <struct>jvmtiStackInfo</struct> 2652 </allocbuf> 2653 <description> 2654 On return, this buffer is filled 2655 with stack information for each thread. 2656 The number of <datalink id="jvmtiStackInfo"/> records is determined 2657 by <paramlink id="thread_count"/>. 2658 <p/> 2659 Note that this buffer is allocated to include the <datalink id="jvmtiFrameInfo"/> 2660 buffers pointed to by <datalink id="jvmtiStackInfo.frame_buffer"/>. 2661 These buffers must not be separately deallocated. 2662 </description> 2663 </param> 2664 </parameters> 2665 <errors> 2666 <error id="JVMTI_ERROR_INVALID_THREAD"> 2667 An element in <paramlink id="thread_list"/> is not a thread object. 2668 </error> 2669 </errors> 2670 </function> 2671 2672 <elide> 2673 <function id="AsyncGetStackTrace" num="1000"> 2674 <synopsis>Get Stack Trace--Asynchronous</synopsis> 2675 <description> 2676 Get information about the entire stack of a thread (or a sub-section of it). 2677 This is the asynchronous version of <functionlink id="GetStackTrace"></functionlink> 2678 and is reentrant and safe to call 2679 from asynchronous signal handlers. 2680 The stack trace is returned only for the calling thread. 2681 <p/> 2682 The <functionlink id="GetLineNumberTable"></functionlink> 2683 function can be used to map locations to line numbers. Note that 2684 this mapping can be done lazily. 2685 </description> 2686 <origin>jvmpi</origin> 2687 <capabilities> 2688 <required id="can_get_async_stack_trace"></required> 2689 <capability id="can_show_JVM_spec_async_frames"> 2690 If <code>false</code>, 2691 <paramlink id="use_java_stack"></paramlink> 2692 must be <code>false</code>. 2693 </capability> 2694 </capabilities> 2695 <parameters> 2696 <param id="use_java_stack"> 2697 <jboolean/> 2698 <description> 2699 Return the stack showing <vmspec/> 2700 model of the stack; 2701 otherwise, show the internal representation of the stack with 2702 inlined and optimized methods missing. If the virtual machine 2703 is using the <i>Java Virtual Machine Specification</i> stack model 2704 internally, this flag is ignored. 2705 </description> 2706 </param> 2707 <param id="max_count"> 2708 <jint min="0"/> 2709 <description> 2710 The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve. 2711 Retrieve this many unless the stack depth is less than <code>max_count</code>. 2712 </description> 2713 </param> 2714 <param id="frame_buffer"> 2715 <outbuf incount="max_count" outcount="count_ptr"> 2716 <struct>jvmtiFrameInfo</struct> 2717 <nullok>this information is not returned</nullok> 2718 </outbuf> 2719 <description> 2720 The agent passes in a buffer 2721 large enough to hold <code>max_count</code> records of 2722 <datalink id="jvmtiFrameInfo"></datalink>. This buffer must be 2723 pre-allocated by the agent. 2724 </description> 2725 </param> 2726 <param id="count_ptr"> 2727 <outptr><jint/></outptr> 2728 <description> 2729 On return, points to the number of records filled in.. 2730 </description> 2731 </param> 2732 </parameters> 2733 <errors> 2734 <error id="JVMTI_ERROR_UNATTACHED_THREAD"> 2735 The thread being used to call this function is not attached 2736 to the virtual machine. Calls must be made from attached threads. 2737 </error> 2738 </errors> 2739 </function> 2740 </elide> 2741 2742 <function id="GetFrameCount" num="16"> 2743 <synopsis>Get Frame Count</synopsis> 2744 <description> 2745 Get the number of frames currently in the specified thread's call stack. 2746 <p/> 2747 If this function is called for a thread actively executing bytecodes (for example, 2748 not the current thread and not suspended), the information returned is transient. 2749 </description> 2750 <origin>jvmdi</origin> 2751 <capabilities> 2752 </capabilities> 2753 <parameters> 2754 <param id="thread"> 2755 <jthread null="current"/> 2756 <description> 2757 The thread to query. 2758 </description> 2759 </param> 2760 <param id="count_ptr"> 2761 <outptr><jint/></outptr> 2762 <description> 2763 On return, points to the number of frames in the call stack. 2764 </description> 2765 </param> 2766 </parameters> 2767 <errors> 2768 </errors> 2769 </function> 2770 2771 <function id="PopFrame" num="80"> 2772 <synopsis>Pop Frame</synopsis> 2773 <description> 2774 Pop the current frame of <code>thread</code>'s stack. 2775 Popping a frame takes you to the previous frame. 2776 When the thread is resumed, the execution 2777 state of the thread is reset to the state 2778 immediately before the called method was invoked. 2779 That is (using <vmspec/> terminology): 2780 <ul> 2781 <li>the current frame is discarded as the previous frame becomes the current one</li> 2782 <li>the operand stack is restored--the argument values are added back 2783 and if the invoke was not <code>invokestatic</code>, 2784 <code>objectref</code> is added back as well</li> 2785 <li>the Java virtual machine PC is restored to the opcode 2786 of the invoke instruction</li> 2787 </ul> 2788 Note however, that any changes to the arguments, which 2789 occurred in the called method, remain; 2790 when execution continues, the first instruction to 2791 execute will be the invoke. 2792 <p/> 2793 Between calling <code>PopFrame</code> and resuming the 2794 thread the state of the stack is undefined. 2795 To pop frames beyond the first, 2796 these three steps must be repeated: 2797 <ul> 2798 <li>suspend the thread via an event (step, breakpoint, ...)</li> 2799 <li>call <code>PopFrame</code></li> 2800 <li>resume the thread</li> 2801 </ul> 2802 <p/> 2803 A lock acquired by calling the called method 2804 (if it is a <code>synchronized</code> method) 2805 and locks acquired by entering <code>synchronized</code> 2806 blocks within the called method are released. 2807 Note: this does not apply to native locks or 2808 <code>java.util.concurrent.locks</code> locks. 2809 <p/> 2810 Finally blocks are not executed. 2811 <p/> 2812 Changes to global state are not addressed and thus remain changed. 2813 <p/> 2814 The specified thread must be suspended (which implies it cannot be the current thread). 2815 <p/> 2816 Both the called method and calling method must be non-native Java programming 2817 language methods. 2818 <p/> 2819 No <jvmti/> events are generated by this function. 2820 </description> 2821 <origin>jvmdi</origin> 2822 <capabilities> 2823 <required id="can_pop_frame"></required> 2824 </capabilities> 2825 <parameters> 2826 <param id="thread"> 2827 <jthread/> 2828 <description> 2829 The thread whose current frame is to be popped. 2830 </description> 2831 </param> 2832 </parameters> 2833 <errors> 2834 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 2835 Called or calling method is a native method. 2836 The implementation is unable to pop this frame. 2837 </error> 2838 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 2839 Thread was not suspended. 2840 </error> 2841 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 2842 There are less than two stack frames on the call stack. 2843 </error> 2844 </errors> 2845 </function> 2846 2847 <function id="GetFrameLocation" num="19"> 2848 <synopsis>Get Frame Location</synopsis> 2849 <description> 2850 <p/> 2851 For a Java programming language frame, return the location of the instruction 2852 currently executing. 2853 </description> 2854 <origin>jvmdiClone</origin> 2855 <capabilities> 2856 </capabilities> 2857 <parameters> 2858 <param id="thread"> 2859 <jthread null="current" frame="frame"/> 2860 <description> 2861 The thread of the frame to query. 2862 </description> 2863 </param> 2864 <param id="depth"> 2865 <jframeID thread="thread"/> 2866 <description> 2867 The depth of the frame to query. 2868 </description> 2869 </param> 2870 <param id="method_ptr"> 2871 <outptr><jmethodID/></outptr> 2872 <description> 2873 On return, points to the method for the current location. 2874 </description> 2875 </param> 2876 <param id="location_ptr"> 2877 <outptr><jlocation/></outptr> 2878 <description> 2879 On return, points to the index of the currently 2880 executing instruction. 2881 Is set to <code>-1</code> if the frame is executing 2882 a native method. 2883 </description> 2884 </param> 2885 </parameters> 2886 <errors> 2887 </errors> 2888 </function> 2889 2890 <function id="NotifyFramePop" num="20"> 2891 <synopsis>Notify Frame Pop</synopsis> 2892 <description> 2893 When the frame that is currently at <paramlink id="depth"></paramlink> 2894 is popped from the stack, generate a 2895 <eventlink id="FramePop"></eventlink> event. See the 2896 <eventlink id="FramePop"></eventlink> event for details. 2897 Only frames corresponding to non-native Java programming language 2898 methods can receive notification. 2899 <p/> 2900 The specified thread must either be the current thread 2901 or the thread must be suspended. 2902 </description> 2903 <origin>jvmdi</origin> 2904 <capabilities> 2905 <required id="can_generate_frame_pop_events"></required> 2906 </capabilities> 2907 <parameters> 2908 <param id="thread"> 2909 <jthread null="current" frame="depth"/> 2910 <description> 2911 The thread of the frame for which the frame pop event will be generated. 2912 </description> 2913 </param> 2914 <param id="depth"> 2915 <jframeID thread="thread"/> 2916 <description> 2917 The depth of the frame for which the frame pop event will be generated. 2918 </description> 2919 </param> 2920 </parameters> 2921 <errors> 2922 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 2923 The frame at <code>depth</code> is executing a 2924 native method. 2925 </error> 2926 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 2927 Thread was not suspended and was not the current thread. 2928 </error> 2929 </errors> 2930 </function> 2931 2932 </category> 2933 2934 <category id="ForceEarlyReturn" label="Force Early Return"> 2935 <intro> 2936 These functions allow an agent to force a method 2937 to return at any point during its execution. 2938 The method which will return early is referred to as the <i>called method</i>. 2939 The called method is the current method 2940 (as defined by 2941 <vmspec chapter="3.6"/>) 2942 for the specified thread at 2943 the time the function is called. 2944 <p/> 2945 The specified thread must be suspended or must be the current thread. 2946 The return occurs when execution of Java programming 2947 language code is resumed on this thread. 2948 Between calling one of these functions and resumption 2949 of thread execution, the state of the stack is undefined. 2950 <p/> 2951 No further instructions are executed in the called method. 2952 Specifically, finally blocks are not executed. 2953 Note: this can cause inconsistent states in the application. 2954 <p/> 2955 A lock acquired by calling the called method 2956 (if it is a <code>synchronized</code> method) 2957 and locks acquired by entering <code>synchronized</code> 2958 blocks within the called method are released. 2959 Note: this does not apply to native locks or 2960 <code>java.util.concurrent.locks</code> locks. 2961 <p/> 2962 Events, such as <eventlink id="MethodExit"></eventlink>, 2963 are generated as they would be in a normal return. 2964 <p/> 2965 The called method must be a non-native Java programming 2966 language method. 2967 Forcing return on a thread with only one frame on the 2968 stack causes the thread to exit when resumed. 2969 </intro> 2970 2971 <function id="ForceEarlyReturnObject" num="81" since="1.1"> 2972 <synopsis>Force Early Return - Object</synopsis> 2973 <description> 2974 This function can be used to return from a method whose 2975 result type is <code>Object</code> 2976 or a subclass of <code>Object</code>. 2977 </description> 2978 <origin>new</origin> 2979 <capabilities> 2980 <required id="can_force_early_return"></required> 2981 </capabilities> 2982 <parameters> 2983 <param id="thread"> 2984 <jthread null="current"/> 2985 <description> 2986 The thread whose current frame is to return early. 2987 </description> 2988 </param> 2989 <param id="value"> 2990 <jobject/> 2991 <description> 2992 The return value for the called frame. 2993 An object or <code>NULL</code>. 2994 </description> 2995 </param> 2996 </parameters> 2997 <errors> 2998 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 2999 Attempted to return early from a frame 3000 corresponding to a native method. 3001 Or the implementation is unable to provide 3002 this functionality on this frame. 3003 </error> 3004 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3005 The result type of the called method is not 3006 <code>Object</code> or a subclass of <code>Object</code>. 3007 </error> 3008 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3009 The supplied <paramlink id="value"/> is not compatible with the 3010 result type of the called method. 3011 </error> 3012 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3013 Thread was not the current thread and was not suspended. 3014 </error> 3015 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3016 There are no more frames on the call stack. 3017 </error> 3018 </errors> 3019 </function> 3020 3021 <function id="ForceEarlyReturnInt" num="82" since="1.1"> 3022 <synopsis>Force Early Return - Int</synopsis> 3023 <description> 3024 This function can be used to return from a method whose 3025 result type is <code>int</code>, <code>short</code>, 3026 <code>char</code>, <code>byte</code>, or 3027 <code>boolean</code>. 3028 </description> 3029 <origin>new</origin> 3030 <capabilities> 3031 <required id="can_force_early_return"></required> 3032 </capabilities> 3033 <parameters> 3034 <param id="thread"> 3035 <jthread null="current"/> 3036 <description> 3037 The thread whose current frame is to return early. 3038 </description> 3039 </param> 3040 <param id="value"> 3041 <jint/> 3042 <description> 3043 The return value for the called frame. 3044 </description> 3045 </param> 3046 </parameters> 3047 <errors> 3048 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3049 Attempted to return early from a frame 3050 corresponding to a native method. 3051 Or the implementation is unable to provide 3052 this functionality on this frame. 3053 </error> 3054 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3055 The result type of the called method is not 3056 <code>int</code>, <code>short</code>, 3057 <code>char</code>, <code>byte</code>, or 3058 <code>boolean</code>. 3059 </error> 3060 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3061 Thread was not the current thread and was not suspended. 3062 </error> 3063 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3064 There are no frames on the call stack. 3065 </error> 3066 </errors> 3067 </function> 3068 3069 <function id="ForceEarlyReturnLong" num="83" since="1.1"> 3070 <synopsis>Force Early Return - Long</synopsis> 3071 <description> 3072 This function can be used to return from a method whose 3073 result type is <code>long</code>. 3074 </description> 3075 <origin>new</origin> 3076 <capabilities> 3077 <required id="can_force_early_return"></required> 3078 </capabilities> 3079 <parameters> 3080 <param id="thread"> 3081 <jthread null="current"/> 3082 <description> 3083 The thread whose current frame is to return early. 3084 </description> 3085 </param> 3086 <param id="value"> 3087 <jlong/> 3088 <description> 3089 The return value for the called frame. 3090 </description> 3091 </param> 3092 </parameters> 3093 <errors> 3094 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3095 Attempted to return early from a frame 3096 corresponding to a native method. 3097 Or the implementation is unable to provide 3098 this functionality on this frame. 3099 </error> 3100 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3101 The result type of the called method is not <code>long</code>. 3102 </error> 3103 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3104 Thread was not the current thread and was not suspended. 3105 </error> 3106 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3107 There are no frames on the call stack. 3108 </error> 3109 </errors> 3110 </function> 3111 3112 <function id="ForceEarlyReturnFloat" num="84" since="1.1"> 3113 <synopsis>Force Early Return - Float</synopsis> 3114 <description> 3115 This function can be used to return from a method whose 3116 result type is <code>float</code>. 3117 </description> 3118 <origin>new</origin> 3119 <capabilities> 3120 <required id="can_force_early_return"></required> 3121 </capabilities> 3122 <parameters> 3123 <param id="thread"> 3124 <jthread null="current"/> 3125 <description> 3126 The thread whose current frame is to return early. 3127 </description> 3128 </param> 3129 <param id="value"> 3130 <jfloat/> 3131 <description> 3132 The return value for the called frame. 3133 </description> 3134 </param> 3135 </parameters> 3136 <errors> 3137 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3138 Attempted to return early from a frame 3139 corresponding to a native method. 3140 Or the implementation is unable to provide 3141 this functionality on this frame. 3142 </error> 3143 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3144 The result type of the called method is not <code>float</code>. 3145 </error> 3146 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3147 Thread was not the current thread and was not suspended. 3148 </error> 3149 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3150 There are no frames on the call stack. 3151 </error> 3152 </errors> 3153 </function> 3154 3155 <function id="ForceEarlyReturnDouble" num="85" since="1.1"> 3156 <synopsis>Force Early Return - Double</synopsis> 3157 <description> 3158 This function can be used to return from a method whose 3159 result type is <code>double</code>. 3160 </description> 3161 <origin>new</origin> 3162 <capabilities> 3163 <required id="can_force_early_return"></required> 3164 </capabilities> 3165 <parameters> 3166 <param id="thread"> 3167 <jthread null="current"/> 3168 <description> 3169 The thread whose current frame is to return early. 3170 </description> 3171 </param> 3172 <param id="value"> 3173 <jdouble/> 3174 <description> 3175 The return value for the called frame. 3176 </description> 3177 </param> 3178 </parameters> 3179 <errors> 3180 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3181 Attempted to return early from a frame corresponding to a native method. 3182 Or the implementation is unable to provide this functionality on this frame. 3183 </error> 3184 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3185 The result type of the called method is not <code>double</code>. 3186 </error> 3187 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3188 Thread was not the current thread and was not suspended. 3189 </error> 3190 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3191 There are no frames on the call stack. 3192 </error> 3193 </errors> 3194 </function> 3195 3196 <function id="ForceEarlyReturnVoid" num="86" since="1.1"> 3197 <synopsis>Force Early Return - Void</synopsis> 3198 <description> 3199 This function can be used to return from a method with no result type. 3200 That is, the called method must be declared <code>void</code>. 3201 </description> 3202 <origin>new</origin> 3203 <capabilities> 3204 <required id="can_force_early_return"></required> 3205 </capabilities> 3206 <parameters> 3207 <param id="thread"> 3208 <jthread null="current"/> 3209 <description> 3210 The thread whose current frame is to return early. 3211 </description> 3212 </param> 3213 </parameters> 3214 <errors> 3215 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3216 Attempted to return early from a frame 3217 corresponding to a native method. 3218 Or the implementation is unable to provide 3219 this functionality on this frame. 3220 </error> 3221 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3222 The called method has a result type. 3223 </error> 3224 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3225 Thread was not the current thread and was not suspended. 3226 </error> 3227 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3228 There are no frames on the call stack. 3229 </error> 3230 </errors> 3231 </function> 3232 3233 </category> 3234 3235 <category id="Heap" label="Heap"> 3236 <intro> 3237 These functions are used to analyze the heap. 3238 Functionality includes the ability to view the objects in the 3239 heap and to tag these objects. 3240 </intro> 3241 3242 <intro id="objectTags" label="Object Tags"> 3243 A <i>tag</i> is a value associated with an object. 3244 Tags are explicitly set by the agent using the 3245 <functionlink id="SetTag"></functionlink> function or by 3246 callback functions such as <functionlink id="jvmtiHeapIterationCallback"/>. 3247 <p/> 3248 Tags are local to the environment; that is, the tags of one 3249 environment are not visible in another. 3250 <p/> 3251 Tags are <code>jlong</code> values which can be used 3252 simply to mark an object or to store a pointer to more detailed 3253 information. Objects which have not been tagged have a 3254 tag of zero. 3255 Setting a tag to zero makes the object untagged. 3256 </intro> 3257 3258 <intro id="heapCallbacks" label="Heap Callback Functions"> 3259 Heap functions which iterate through the heap and recursively 3260 follow object references use agent supplied callback functions 3261 to deliver the information. 3262 <p/> 3263 These heap callback functions must adhere to the following restrictions -- 3264 These callbacks must not use JNI functions. 3265 These callbacks must not use <jvmti/> functions except 3266 <i>callback safe</i> functions which 3267 specifically allow such use (see the raw monitor, memory management, 3268 and environment local storage functions). 3269 <p/> 3270 An implementation may invoke a callback on an internal thread or 3271 the thread which called the iteration function. 3272 Heap callbacks are single threaded -- no more than one callback will 3273 be invoked at a time. 3274 <p/> 3275 The Heap Filter Flags can be used to prevent reporting 3276 based on the tag status of an object or its class. 3277 If no flags are set (the <code>jint</code> is zero), objects 3278 will not be filtered out. 3279 3280 <constants id="jvmtiHeapFilter" label="Heap Filter Flags" kind="bits"> 3281 <constant id="JVMTI_HEAP_FILTER_TAGGED" num="0x4"> 3282 Filter out tagged objects. Objects which are tagged are not included. 3283 </constant> 3284 <constant id="JVMTI_HEAP_FILTER_UNTAGGED" num="0x8"> 3285 Filter out untagged objects. Objects which are not tagged are not included. 3286 </constant> 3287 <constant id="JVMTI_HEAP_FILTER_CLASS_TAGGED" num="0x10"> 3288 Filter out objects with tagged classes. Objects whose class is tagged are not included. 3289 </constant> 3290 <constant id="JVMTI_HEAP_FILTER_CLASS_UNTAGGED" num="0x20"> 3291 Filter out objects with untagged classes. Objects whose class is not tagged are not included. 3292 </constant> 3293 </constants> 3294 3295 <p/> 3296 The Heap Visit Control Flags are returned by the heap callbacks 3297 and can be used to abort the iteration. For the 3298 <functionlink id="jvmtiHeapReferenceCallback">Heap 3299 Reference Callback</functionlink>, it can also be used 3300 to prune the graph of traversed references 3301 (<code>JVMTI_VISIT_OBJECTS</code> is not set). 3302 3303 <constants id="jvmtiHeapVisitControl" 3304 label="Heap Visit Control Flags" 3305 kind="bits" 3306 since="1.1"> 3307 <constant id="JVMTI_VISIT_OBJECTS" num="0x100"> 3308 If we are visiting an object and if this callback 3309 was initiated by <functionlink id="FollowReferences"/>, 3310 traverse the references of this object. 3311 Otherwise ignored. 3312 </constant> 3313 <constant id="JVMTI_VISIT_ABORT" num="0x8000"> 3314 Abort the iteration. Ignore all other bits. 3315 </constant> 3316 </constants> 3317 3318 <p/> 3319 The Heap Reference Enumeration is provided by the 3320 <functionlink id="jvmtiHeapReferenceCallback">Heap 3321 Reference Callback</functionlink> and 3322 <functionlink id="jvmtiPrimitiveFieldCallback">Primitive Field 3323 Callback</functionlink> to 3324 describe the kind of reference 3325 being reported. 3326 3327 <constants id="jvmtiHeapReferenceKind" 3328 label="Heap Reference Enumeration" 3329 kind="enum" 3330 since="1.1"> 3331 <constant id="JVMTI_HEAP_REFERENCE_CLASS" num="1"> 3332 Reference from an object to its class. 3333 </constant> 3334 <constant id="JVMTI_HEAP_REFERENCE_FIELD" num="2"> 3335 Reference from an object to the value of one of its instance fields. 3336 </constant> 3337 <constant id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT" num="3"> 3338 Reference from an array to one of its elements. 3339 </constant> 3340 <constant id="JVMTI_HEAP_REFERENCE_CLASS_LOADER" num="4"> 3341 Reference from a class to its class loader. 3342 </constant> 3343 <constant id="JVMTI_HEAP_REFERENCE_SIGNERS" num="5"> 3344 Reference from a class to its signers array. 3345 </constant> 3346 <constant id="JVMTI_HEAP_REFERENCE_PROTECTION_DOMAIN" num="6"> 3347 Reference from a class to its protection domain. 3348 </constant> 3349 <constant id="JVMTI_HEAP_REFERENCE_INTERFACE" num="7"> 3350 Reference from a class to one of its interfaces. 3351 Note: interfaces are defined via a constant pool reference, 3352 so the referenced interfaces may also be reported with a 3353 <code>JVMTI_HEAP_REFERENCE_CONSTANT_POOL</code> reference kind. 3354 </constant> 3355 <constant id="JVMTI_HEAP_REFERENCE_STATIC_FIELD" num="8"> 3356 Reference from a class to the value of one of its static fields. 3357 </constant> 3358 <constant id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL" num="9"> 3359 Reference from a class to a resolved entry in the constant pool. 3360 </constant> 3361 <constant id="JVMTI_HEAP_REFERENCE_SUPERCLASS" num="10"> 3362 Reference from a class to its superclass. 3363 A callback is bot sent if the superclass is <code>java.lang.Object</code>. 3364 Note: loaded classes define superclasses via a constant pool 3365 reference, so the referenced superclass may also be reported with 3366 a <code>JVMTI_HEAP_REFERENCE_CONSTANT_POOL</code> reference kind. 3367 </constant> 3368 <constant id="JVMTI_HEAP_REFERENCE_JNI_GLOBAL" num="21"> 3369 Heap root reference: JNI global reference. 3370 </constant> 3371 <constant id="JVMTI_HEAP_REFERENCE_SYSTEM_CLASS" num="22"> 3372 Heap root reference: System class. 3373 </constant> 3374 <constant id="JVMTI_HEAP_REFERENCE_MONITOR" num="23"> 3375 Heap root reference: monitor. 3376 </constant> 3377 <constant id="JVMTI_HEAP_REFERENCE_STACK_LOCAL" num="24"> 3378 Heap root reference: local variable on the stack. 3379 </constant> 3380 <constant id="JVMTI_HEAP_REFERENCE_JNI_LOCAL" num="25"> 3381 Heap root reference: JNI local reference. 3382 </constant> 3383 <constant id="JVMTI_HEAP_REFERENCE_THREAD" num="26"> 3384 Heap root reference: Thread. 3385 </constant> 3386 <constant id="JVMTI_HEAP_REFERENCE_OTHER" num="27"> 3387 Heap root reference: other heap root reference. 3388 </constant> 3389 </constants> 3390 3391 <p/> 3392 Definitions for the single character type descriptors of 3393 primitive types. 3394 3395 <constants id="jvmtiPrimitiveType" 3396 label="Primitive Type Enumeration" 3397 kind="enum" 3398 since="1.1"> 3399 <constant id="JVMTI_PRIMITIVE_TYPE_BOOLEAN" num="90"> 3400 'Z' - Java programming language <code>boolean</code> - JNI <code>jboolean</code> 3401 </constant> 3402 <constant id="JVMTI_PRIMITIVE_TYPE_BYTE" num="66"> 3403 'B' - Java programming language <code>byte</code> - JNI <code>jbyte</code> 3404 </constant> 3405 <constant id="JVMTI_PRIMITIVE_TYPE_CHAR" num="67"> 3406 'C' - Java programming language <code>char</code> - JNI <code>jchar</code> 3407 </constant> 3408 <constant id="JVMTI_PRIMITIVE_TYPE_SHORT" num="83"> 3409 'S' - Java programming language <code>short</code> - JNI <code>jshort</code> 3410 </constant> 3411 <constant id="JVMTI_PRIMITIVE_TYPE_INT" num="73"> 3412 'I' - Java programming language <code>int</code> - JNI <code>jint</code> 3413 </constant> 3414 <constant id="JVMTI_PRIMITIVE_TYPE_LONG" num="74"> 3415 'J' - Java programming language <code>long</code> - JNI <code>jlong</code> 3416 </constant> 3417 <constant id="JVMTI_PRIMITIVE_TYPE_FLOAT" num="70"> 3418 'F' - Java programming language <code>float</code> - JNI <code>jfloat</code> 3419 </constant> 3420 <constant id="JVMTI_PRIMITIVE_TYPE_DOUBLE" num="68"> 3421 'D' - Java programming language <code>double</code> - JNI <code>jdouble</code> 3422 </constant> 3423 </constants> 3424 </intro> 3425 3426 <typedef id="jvmtiHeapReferenceInfoField" 3427 label="Reference information structure for Field references" 3428 since="1.1"> 3429 <description> 3430 Reference information returned for 3431 <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/> and 3432 <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/> references. 3433 </description> 3434 <field id="index"> 3435 <jint/> 3436 <description> 3437 For <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/>, the 3438 referrer object is not a class or an inteface. 3439 In this case, <code>index</code> is the index of the field 3440 in the class of the referrer object. 3441 This class is referred to below as <i>C</i>. 3442 <p/> 3443 For <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/>, 3444 the referrer object is a class (referred to below as <i>C</i>) 3445 or an interface (referred to below as <i>I</i>). 3446 In this case, <code>index</code> is the index of the field in 3447 that class or interface. 3448 <p/> 3449 If the referrer object is not an interface, then the field 3450 indices are determined as follows: 3451 <ul> 3452 <li>make a list of all the fields in <i>C</i> and its 3453 superclasses, starting with all the fields in 3454 <code>java.lang.Object</code> and ending with all the 3455 fields in <i>C</i>.</li> 3456 <li>Within this list, put 3457 the fields for a given class in the order returned by 3458 <functionlink id="GetClassFields"/>.</li> 3459 <li>Assign the fields in this list indices 3460 <i>n</i>, <i>n</i>+1, ..., in order, where <i>n</i> 3461 is the count of the fields in all the interfaces 3462 implemented by <i>C</i>. 3463 Note that <i>C</i> implements all interfaces 3464 directly implemented by its superclasses; as well 3465 as all superinterfaces of these interfaces.</li> 3466 </ul> 3467 If the referrer object is an interface, then the field 3468 indices are determined as follows: 3469 <ul> 3470 <li>make a list of the fields directly declared in 3471 <i>I</i>.</li> 3472 <li>Within this list, put 3473 the fields in the order returned by 3474 <functionlink id="GetClassFields"/>.</li> 3475 <li>Assign the fields in this list indices 3476 <i>n</i>, <i>n</i>+1, ..., in order, where <i>n</i> 3477 is the count of the fields in all the superinterfaces 3478 of <i>I</i>.</li> 3479 </ul> 3480 All fields are included in this computation, regardless of 3481 field modifier (static, public, private, etc). 3482 <p/> 3483 For example, given the following classes and interfaces: 3484 <example> 3485 interface I0 { 3486 int p = 0; 3487 } 3488 3489 interface I1 extends I0 { 3490 int x = 1; 3491 } 3492 3493 interface I2 extends I0 { 3494 int y = 2; 3495 } 3496 3497 class C1 implements I1 { 3498 public static int a = 3; 3499 private int b = 4; 3500 } 3501 3502 class C2 extends C1 implements I2 { 3503 static int q = 5; 3504 final int r = 6; 3505 } 3506 </example> 3507 Assume that <functionlink id="GetClassFields"/> called on 3508 <code>C1</code> returns the fields of <code>C1</code> in the 3509 order: a, b; and that the fields of <code>C2</code> are 3510 returned in the order: q, r. 3511 An instance of class <code>C1</code> will have the 3512 following field indices: 3513 <dl><dd><table> 3514 <tr> 3515 <td> 3516 a 3517 </td> 3518 <td> 3519 2 3520 </td> 3521 <td align="left"> 3522 The count of the fields in the interfaces 3523 implemented by <code>C1</code> is two (<i>n</i>=2): 3524 <code>p</code> of <code>I0</code> 3525 and <code>x</code> of <code>I1</code>. 3526 </td> 3527 </tr> 3528 <tr> 3529 <td> 3530 b 3531 </td> 3532 <td> 3533 3 3534 </td> 3535 <td align="left"> 3536 the subsequent index. 3537 </td> 3538 </tr> 3539 </table></dd></dl> 3540 The class <code>C1</code> will have the same field indices. 3541 <p/> 3542 An instance of class <code>C2</code> will have the 3543 following field indices: 3544 <dl><dd><table> 3545 <tr> 3546 <td> 3547 a 3548 </td> 3549 <td> 3550 3 3551 </td> 3552 <td align="left"> 3553 The count of the fields in the interfaces 3554 implemented by <code>C2</code> is three (<i>n</i>=3): 3555 <code>p</code> of <code>I0</code>, 3556 <code>x</code> of <code>I1</code> and <code>y</code> of <code>I2</code> 3557 (an interface of <code>C2</code>). Note that the field <code>p</code> 3558 of <code>I0</code> is only included once. 3559 </td> 3560 </tr> 3561 <tr> 3562 <td> 3563 b 3564 </td> 3565 <td> 3566 4 3567 </td> 3568 <td align="left"> 3569 the subsequent index to "a". 3570 </td> 3571 </tr> 3572 <tr> 3573 <td> 3574 q 3575 </td> 3576 <td> 3577 5 3578 </td> 3579 <td align="left"> 3580 the subsequent index to "b". 3581 </td> 3582 </tr> 3583 <tr> 3584 <td> 3585 r 3586 </td> 3587 <td> 3588 6 3589 </td> 3590 <td align="left"> 3591 the subsequent index to "q". 3592 </td> 3593 </tr> 3594 </table></dd></dl> 3595 The class <code>C2</code> will have the same field indices. 3596 Note that a field may have a different index depending on the 3597 object that is viewing it -- for example field "a" above. 3598 Note also: not all field indices may be visible from the 3599 callbacks, but all indices are shown for illustrative purposes. 3600 <p/> 3601 The interface <code>I1</code> will have the 3602 following field indices: 3603 <dl><dd><table> 3604 <tr> 3605 <td> 3606 x 3607 </td> 3608 <td> 3609 1 3610 </td> 3611 <td align="left"> 3612 The count of the fields in the superinterfaces 3613 of <code>I1</code> is one (<i>n</i>=1): 3614 <code>p</code> of <code>I0</code>. 3615 </td> 3616 </tr> 3617 </table></dd></dl> 3618 </description> 3619 </field> 3620 </typedef> 3621 3622 <typedef id="jvmtiHeapReferenceInfoArray" 3623 label="Reference information structure for Array references" 3624 since="1.1"> 3625 <description> 3626 Reference information returned for 3627 <datalink id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT"/> references. 3628 </description> 3629 <field id="index"> 3630 <jint/> 3631 <description> 3632 The array index. 3633 </description> 3634 </field> 3635 </typedef> 3636 3637 <typedef id="jvmtiHeapReferenceInfoConstantPool" 3638 label="Reference information structure for Constant Pool references" 3639 since="1.1"> 3640 <description> 3641 Reference information returned for 3642 <datalink id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL"/> references. 3643 </description> 3644 <field id="index"> 3645 <jint/> 3646 <description> 3647 The index into the constant pool of the class. See the description in 3648 <vmspec chapter="4.4"/>. 3649 </description> 3650 </field> 3651 </typedef> 3652 3653 <typedef id="jvmtiHeapReferenceInfoStackLocal" 3654 label="Reference information structure for Local Variable references" 3655 since="1.1"> 3656 <description> 3657 Reference information returned for 3658 <datalink id="JVMTI_HEAP_REFERENCE_STACK_LOCAL"/> references. 3659 </description> 3660 <field id="thread_tag"> 3661 <jlong/> 3662 <description> 3663 The tag of the thread corresponding to this stack, zero if not tagged. 3664 </description> 3665 </field> 3666 <field id="thread_id"> 3667 <jlong/> 3668 <description> 3669 The unique thread ID of the thread corresponding to this stack. 3670 </description> 3671 </field> 3672 <field id="depth"> 3673 <jint/> 3674 <description> 3675 The depth of the frame. 3676 </description> 3677 </field> 3678 <field id="method"> 3679 <jmethodID/> 3680 <description> 3681 The method executing in this frame. 3682 </description> 3683 </field> 3684 <field id="location"> 3685 <jlocation/> 3686 <description> 3687 The currently executing location in this frame. 3688 </description> 3689 </field> 3690 <field id="slot"> 3691 <jint/> 3692 <description> 3693 The slot number of the local variable. 3694 </description> 3695 </field> 3696 </typedef> 3697 3698 <typedef id="jvmtiHeapReferenceInfoJniLocal" 3699 label="Reference information structure for JNI local references" 3700 since="1.1"> 3701 <description> 3702 Reference information returned for 3703 <datalink id="JVMTI_HEAP_REFERENCE_JNI_LOCAL"/> references. 3704 </description> 3705 <field id="thread_tag"> 3706 <jlong/> 3707 <description> 3708 The tag of the thread corresponding to this stack, zero if not tagged. 3709 </description> 3710 </field> 3711 <field id="thread_id"> 3712 <jlong/> 3713 <description> 3714 The unique thread ID of the thread corresponding to this stack. 3715 </description> 3716 </field> 3717 <field id="depth"> 3718 <jint/> 3719 <description> 3720 The depth of the frame. 3721 </description> 3722 </field> 3723 <field id="method"> 3724 <jmethodID/> 3725 <description> 3726 The method executing in this frame. 3727 </description> 3728 </field> 3729 </typedef> 3730 3731 <typedef id="jvmtiHeapReferenceInfoReserved" 3732 label="Reference information structure for Other references" 3733 since="1.1"> 3734 <description> 3735 Reference information returned for other references. 3736 </description> 3737 <field id="reserved1"> 3738 <jlong/> 3739 <description> 3740 reserved for future use. 3741 </description> 3742 </field> 3743 <field id="reserved2"> 3744 <jlong/> 3745 <description> 3746 reserved for future use. 3747 </description> 3748 </field> 3749 <field id="reserved3"> 3750 <jlong/> 3751 <description> 3752 reserved for future use. 3753 </description> 3754 </field> 3755 <field id="reserved4"> 3756 <jlong/> 3757 <description> 3758 reserved for future use. 3759 </description> 3760 </field> 3761 <field id="reserved5"> 3762 <jlong/> 3763 <description> 3764 reserved for future use. 3765 </description> 3766 </field> 3767 <field id="reserved6"> 3768 <jlong/> 3769 <description> 3770 reserved for future use. 3771 </description> 3772 </field> 3773 <field id="reserved7"> 3774 <jlong/> 3775 <description> 3776 reserved for future use. 3777 </description> 3778 </field> 3779 <field id="reserved8"> 3780 <jlong/> 3781 <description> 3782 reserved for future use. 3783 </description> 3784 </field> 3785 </typedef> 3786 3787 <uniontypedef id="jvmtiHeapReferenceInfo" 3788 label="Reference information structure" 3789 since="1.1"> 3790 <description> 3791 The information returned about referrers. 3792 Represented as a union of the various kinds of reference information. 3793 </description> 3794 <field id="field"> 3795 <struct>jvmtiHeapReferenceInfoField</struct> 3796 <description> 3797 The referrer information for 3798 <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/> 3799 and <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/> references. 3800 </description> 3801 </field> 3802 <field id="array"> 3803 <struct>jvmtiHeapReferenceInfoArray</struct> 3804 <description> 3805 The referrer information for 3806 For <datalink id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT"/> references. 3807 </description> 3808 </field> 3809 <field id="constant_pool"> 3810 <struct>jvmtiHeapReferenceInfoConstantPool</struct> 3811 <description> 3812 The referrer information for 3813 For <datalink id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL"/> references. 3814 </description> 3815 </field> 3816 <field id="stack_local"> 3817 <struct>jvmtiHeapReferenceInfoStackLocal</struct> 3818 <description> 3819 The referrer information for 3820 For <datalink id="JVMTI_HEAP_REFERENCE_STACK_LOCAL"/> references. 3821 </description> 3822 </field> 3823 <field id="jni_local"> 3824 <struct>jvmtiHeapReferenceInfoJniLocal</struct> 3825 <description> 3826 The referrer information for 3827 For <datalink id="JVMTI_HEAP_REFERENCE_JNI_LOCAL"/> references. 3828 </description> 3829 </field> 3830 <field id="other"> 3831 <struct>jvmtiHeapReferenceInfoReserved</struct> 3832 <description> 3833 reserved for future use. 3834 </description> 3835 </field> 3836 </uniontypedef> 3837 3838 <typedef id="jvmtiHeapCallbacks" 3839 label="Heap callback function structure" 3840 since="1.1"> 3841 <field id="heap_iteration_callback"> 3842 <ptrtype> 3843 <struct>jvmtiHeapIterationCallback</struct> 3844 </ptrtype> 3845 <description> 3846 The callback to be called to describe an 3847 object in the heap. Used by the 3848 <functionlink id="IterateThroughHeap"/> function, ignored by the 3849 <functionlink id="FollowReferences"/> function. 3850 </description> 3851 </field> 3852 <field id="heap_reference_callback"> 3853 <ptrtype> 3854 <struct>jvmtiHeapReferenceCallback</struct> 3855 </ptrtype> 3856 <description> 3857 The callback to be called to describe an 3858 object reference. Used by the 3859 <functionlink id="FollowReferences"/> function, ignored by the 3860 <functionlink id="IterateThroughHeap"/> function. 3861 </description> 3862 </field> 3863 <field id="primitive_field_callback"> 3864 <ptrtype> 3865 <struct>jvmtiPrimitiveFieldCallback</struct> 3866 </ptrtype> 3867 <description> 3868 The callback to be called to describe a 3869 primitive field. 3870 </description> 3871 </field> 3872 <field id="array_primitive_value_callback"> 3873 <ptrtype> 3874 <struct>jvmtiArrayPrimitiveValueCallback</struct> 3875 </ptrtype> 3876 <description> 3877 The callback to be called to describe an 3878 array of primitive values. 3879 </description> 3880 </field> 3881 <field id="string_primitive_value_callback"> 3882 <ptrtype> 3883 <struct>jvmtiStringPrimitiveValueCallback</struct> 3884 </ptrtype> 3885 <description> 3886 The callback to be called to describe a String value. 3887 </description> 3888 </field> 3889 <field id="reserved5"> 3890 <ptrtype> 3891 <struct>jvmtiReservedCallback</struct> 3892 </ptrtype> 3893 <description> 3894 Reserved for future use.. 3895 </description> 3896 </field> 3897 <field id="reserved6"> 3898 <ptrtype> 3899 <struct>jvmtiReservedCallback</struct> 3900 </ptrtype> 3901 <description> 3902 Reserved for future use.. 3903 </description> 3904 </field> 3905 <field id="reserved7"> 3906 <ptrtype> 3907 <struct>jvmtiReservedCallback</struct> 3908 </ptrtype> 3909 <description> 3910 Reserved for future use.. 3911 </description> 3912 </field> 3913 <field id="reserved8"> 3914 <ptrtype> 3915 <struct>jvmtiReservedCallback</struct> 3916 </ptrtype> 3917 <description> 3918 Reserved for future use.. 3919 </description> 3920 </field> 3921 <field id="reserved9"> 3922 <ptrtype> 3923 <struct>jvmtiReservedCallback</struct> 3924 </ptrtype> 3925 <description> 3926 Reserved for future use.. 3927 </description> 3928 </field> 3929 <field id="reserved10"> 3930 <ptrtype> 3931 <struct>jvmtiReservedCallback</struct> 3932 </ptrtype> 3933 <description> 3934 Reserved for future use.. 3935 </description> 3936 </field> 3937 <field id="reserved11"> 3938 <ptrtype> 3939 <struct>jvmtiReservedCallback</struct> 3940 </ptrtype> 3941 <description> 3942 Reserved for future use.. 3943 </description> 3944 </field> 3945 <field id="reserved12"> 3946 <ptrtype> 3947 <struct>jvmtiReservedCallback</struct> 3948 </ptrtype> 3949 <description> 3950 Reserved for future use.. 3951 </description> 3952 </field> 3953 <field id="reserved13"> 3954 <ptrtype> 3955 <struct>jvmtiReservedCallback</struct> 3956 </ptrtype> 3957 <description> 3958 Reserved for future use.. 3959 </description> 3960 </field> 3961 <field id="reserved14"> 3962 <ptrtype> 3963 <struct>jvmtiReservedCallback</struct> 3964 </ptrtype> 3965 <description> 3966 Reserved for future use.. 3967 </description> 3968 </field> 3969 <field id="reserved15"> 3970 <ptrtype> 3971 <struct>jvmtiReservedCallback</struct> 3972 </ptrtype> 3973 <description> 3974 Reserved for future use.. 3975 </description> 3976 </field> 3977 </typedef> 3978 3979 3980 <intro> 3981 <rationale> 3982 The heap dumping functionality (below) uses a callback 3983 for each object. While it would seem that a buffered approach 3984 would provide better throughput, tests do 3985 not show this to be the case--possibly due to locality of 3986 memory reference or array access overhead. 3987 </rationale> 3988 3989 <issue> 3990 Still under investigation as to if java.lang.ref references 3991 are reported as a different type of reference. 3992 </issue> 3993 3994 <issue> 3995 Should or can an indication of the cost or relative cost of 3996 these operations be included? 3997 </issue> 3998 3999 </intro> 4000 4001 <callback id="jvmtiHeapIterationCallback" since="1.1"> 4002 <jint/> 4003 <synopsis>Heap Iteration Callback</synopsis> 4004 <description> 4005 Agent supplied callback function. 4006 Describes (but does not pass in) an object in the heap. 4007 <p/> 4008 This function should return a bit vector of the desired 4009 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>. 4010 This will determine if the entire iteration should be aborted 4011 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored). 4012 <p/> 4013 See the <internallink id="heapCallbacks">heap callback 4014 function restrictions</internallink>. 4015 </description> 4016 <parameters> 4017 <param id="class_tag"> 4018 <jlong/> 4019 <description> 4020 The tag of the class of object (zero if the class is not tagged). 4021 If the object represents a runtime class, 4022 the <code>class_tag</code> is the tag 4023 associated with <code>java.lang.Class</code> 4024 (zero if <code>java.lang.Class</code> is not tagged). 4025 </description> 4026 </param> 4027 <param id="size"> 4028 <jlong/> 4029 <description> 4030 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 4031 </description> 4032 </param> 4033 <param id="tag_ptr"> 4034 <outptr><jlong/></outptr> 4035 <description> 4036 The object tag value, or zero if the object is not tagged. 4037 To set the tag value to be associated with the object 4038 the agent sets the <code>jlong</code> pointed to by the parameter. 4039 </description> 4040 </param> 4041 <param id="length"> 4042 <jint/> 4043 <description> 4044 If this object is an array, the length of the array. Otherwise negative one (-1). 4045 </description> 4046 </param> 4047 <param id="user_data"> 4048 <outptr><void/></outptr> 4049 <description> 4050 The user supplied data that was passed into the iteration function. 4051 </description> 4052 </param> 4053 </parameters> 4054 </callback> 4055 4056 <callback id="jvmtiHeapReferenceCallback" since="1.1"> 4057 <jint/> 4058 <synopsis>Heap Reference Callback</synopsis> 4059 <description> 4060 Agent supplied callback function. 4061 Describes a reference from an object or the VM (the referrer) to another object 4062 (the referree) or a heap root to a referree. 4063 <p/> 4064 This function should return a bit vector of the desired 4065 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>. 4066 This will determine if the objects referenced by the referree 4067 should be visited or if the entire iteration should be aborted. 4068 <p/> 4069 See the <internallink id="heapCallbacks">heap callback 4070 function restrictions</internallink>. 4071 </description> 4072 <parameters> 4073 <param id="reference_kind"> 4074 <enum>jvmtiHeapReferenceKind</enum> 4075 <description> 4076 The kind of reference. 4077 </description> 4078 </param> 4079 <param id="reference_info"> 4080 <inptr> 4081 <struct>jvmtiHeapReferenceInfo</struct> 4082 </inptr> 4083 <description> 4084 Details about the reference. 4085 Set when the <datalink id="jvmtiHeapReferenceCallback.reference_kind">reference_kind</datalink> is 4086 <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/>, 4087 <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/>, 4088 <datalink id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT"/>, 4089 <datalink id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL"/>, 4090 <datalink id="JVMTI_HEAP_REFERENCE_STACK_LOCAL"/>, 4091 or <datalink id="JVMTI_HEAP_REFERENCE_JNI_LOCAL"/>. 4092 Otherwise <code>NULL</code>. 4093 </description> 4094 </param> 4095 <param id="class_tag"> 4096 <jlong/> 4097 <description> 4098 The tag of the class of referree object (zero if the class is not tagged). 4099 If the referree object represents a runtime class, 4100 the <code>class_tag</code> is the tag 4101 associated with <code>java.lang.Class</code> 4102 (zero if <code>java.lang.Class</code> is not tagged). 4103 </description> 4104 </param> 4105 <param id="referrer_class_tag"> 4106 <jlong/> 4107 <description> 4108 The tag of the class of the referrer object (zero if the class is not tagged 4109 or the referree is a heap root). If the referrer object represents a runtime 4110 class, the <code>referrer_class_tag</code> is the tag associated with 4111 the <code>java.lang.Class</code> 4112 (zero if <code>java.lang.Class</code> is not tagged). 4113 </description> 4114 </param> 4115 <param id="size"> 4116 <jlong/> 4117 <description> 4118 Size of the referree object (in bytes). 4119 See <functionlink id="GetObjectSize"/>. 4120 </description> 4121 </param> 4122 <param id="tag_ptr"> 4123 <outptr><jlong/></outptr> 4124 <description> 4125 Points to the referree object tag value, or zero if the object is not 4126 tagged. 4127 To set the tag value to be associated with the object 4128 the agent sets the <code>jlong</code> pointed to by the parameter. 4129 </description> 4130 </param> 4131 <param id="referrer_tag_ptr"> 4132 <outptr><jlong/></outptr> 4133 <description> 4134 Points to the tag of the referrer object, or 4135 points to the zero if the referrer 4136 object is not tagged. 4137 <code>NULL</code> if the referrer in not an object (that is, 4138 this callback is reporting a heap root). 4139 To set the tag value to be associated with the referrer object 4140 the agent sets the <code>jlong</code> pointed to by the parameter. 4141 If this callback is reporting a reference from an object to itself, 4142 <code>referrer_tag_ptr == tag_ptr</code>. 4143 </description> 4144 </param> 4145 <param id="length"> 4146 <jint/> 4147 <description> 4148 If this object is an array, the length of the array. Otherwise negative one (-1). 4149 </description> 4150 </param> 4151 <param id="user_data"> 4152 <outptr><void/></outptr> 4153 <description> 4154 The user supplied data that was passed into the iteration function. 4155 </description> 4156 </param> 4157 </parameters> 4158 </callback> 4159 4160 <callback id="jvmtiPrimitiveFieldCallback" since="1.1"> 4161 <jint/> 4162 <synopsis>Primitive Field Callback</synopsis> 4163 <description> 4164 Agent supplied callback function which 4165 describes a primitive field of an object (<i>the object</i>). 4166 A primitive field is a field whose type is a primitive type. 4167 This callback will describe a static field if the object is a class, 4168 and otherwise will describe an instance field. 4169 <p/> 4170 This function should return a bit vector of the desired 4171 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>. 4172 This will determine if the entire iteration should be aborted 4173 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored). 4174 <p/> 4175 See the <internallink id="heapCallbacks">heap callback 4176 function restrictions</internallink>. 4177 </description> 4178 <parameters> 4179 <param id="kind"> 4180 <enum>jvmtiHeapReferenceKind</enum> 4181 <description> 4182 The kind of field -- instance or static (<datalink id="JVMTI_HEAP_REFERENCE_FIELD"/> or 4183 <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/>). 4184 </description> 4185 </param> 4186 <param id="info"> 4187 <inptr> 4188 <struct>jvmtiHeapReferenceInfo</struct> 4189 </inptr> 4190 <description> 4191 Which field (the field index). 4192 </description> 4193 </param> 4194 <param id="object_class_tag"> 4195 <jlong/> 4196 <description> 4197 The tag of the class of the object (zero if the class is not tagged). 4198 If the object represents a runtime class, the 4199 <code>object_class_tag</code> is the tag 4200 associated with <code>java.lang.Class</code> 4201 (zero if <code>java.lang.Class</code> is not tagged). 4202 </description> 4203 </param> 4204 <param id="object_tag_ptr"> 4205 <outptr><jlong/></outptr> 4206 <description> 4207 Points to the tag of the object, or zero if the object is not 4208 tagged. 4209 To set the tag value to be associated with the object 4210 the agent sets the <code>jlong</code> pointed to by the parameter. 4211 </description> 4212 </param> 4213 <param id="value"> 4214 <jvalue/> 4215 <description> 4216 The value of the field. 4217 </description> 4218 </param> 4219 <param id="value_type"> 4220 <enum>jvmtiPrimitiveType</enum> 4221 <description> 4222 The type of the field. 4223 </description> 4224 </param> 4225 <param id="user_data"> 4226 <outptr><void/></outptr> 4227 <description> 4228 The user supplied data that was passed into the iteration function. 4229 </description> 4230 </param> 4231 </parameters> 4232 </callback> 4233 4234 <callback id="jvmtiArrayPrimitiveValueCallback" since="1.1"> 4235 <jint/> 4236 <synopsis>Array Primitive Value Callback</synopsis> 4237 <description> 4238 Agent supplied callback function. 4239 Describes the values in an array of a primitive type. 4240 <p/> 4241 This function should return a bit vector of the desired 4242 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>. 4243 This will determine if the entire iteration should be aborted 4244 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored). 4245 <p/> 4246 See the <internallink id="heapCallbacks">heap callback 4247 function restrictions</internallink>. 4248 </description> 4249 <parameters> 4250 <param id="class_tag"> 4251 <jlong/> 4252 <description> 4253 The tag of the class of the array object (zero if the class is not tagged). 4254 </description> 4255 </param> 4256 <param id="size"> 4257 <jlong/> 4258 <description> 4259 Size of the array (in bytes). 4260 See <functionlink id="GetObjectSize"/>. 4261 </description> 4262 </param> 4263 <param id="tag_ptr"> 4264 <outptr><jlong/></outptr> 4265 <description> 4266 Points to the tag of the array object, or zero if the object is not 4267 tagged. 4268 To set the tag value to be associated with the object 4269 the agent sets the <code>jlong</code> pointed to by the parameter. 4270 </description> 4271 </param> 4272 <param id="element_count"> 4273 <jint/> 4274 <description> 4275 The length of the primitive array. 4276 </description> 4277 </param> 4278 <param id="element_type"> 4279 <enum>jvmtiPrimitiveType</enum> 4280 <description> 4281 The type of the elements of the array. 4282 </description> 4283 </param> 4284 <param id="elements"> 4285 <vmbuf><void/></vmbuf> 4286 <description> 4287 The elements of the array in a packed array of <code>element_count</code> 4288 items of <code>element_type</code> size each. 4289 </description> 4290 </param> 4291 <param id="user_data"> 4292 <outptr><void/></outptr> 4293 <description> 4294 The user supplied data that was passed into the iteration function. 4295 </description> 4296 </param> 4297 </parameters> 4298 </callback> 4299 4300 <callback id="jvmtiStringPrimitiveValueCallback" since="1.1"> 4301 <jint/> 4302 <synopsis>String Primitive Value Callback</synopsis> 4303 <description> 4304 Agent supplied callback function. 4305 Describes the value of a java.lang.String. 4306 <p/> 4307 This function should return a bit vector of the desired 4308 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>. 4309 This will determine if the entire iteration should be aborted 4310 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored). 4311 <p/> 4312 See the <internallink id="heapCallbacks">heap callback 4313 function restrictions</internallink>. 4314 </description> 4315 <parameters> 4316 <param id="class_tag"> 4317 <jlong/> 4318 <description> 4319 The tag of the class of the String class (zero if the class is not tagged). 4320 <issue>Is this needed?</issue> 4321 </description> 4322 </param> 4323 <param id="size"> 4324 <jlong/> 4325 <description> 4326 Size of the string (in bytes). 4327 See <functionlink id="GetObjectSize"/>. 4328 </description> 4329 </param> 4330 <param id="tag_ptr"> 4331 <outptr><jlong/></outptr> 4332 <description> 4333 Points to the tag of the String object, or zero if the object is not 4334 tagged. 4335 To set the tag value to be associated with the object 4336 the agent sets the <code>jlong</code> pointed to by the parameter. 4337 </description> 4338 </param> 4339 <param id="value"> 4340 <vmbuf><jchar/></vmbuf> 4341 <description> 4342 The value of the String, encoded as a Unicode string. 4343 </description> 4344 </param> 4345 <param id="value_length"> 4346 <jint/> 4347 <description> 4348 The length of the string. 4349 The length is equal to the number of 16-bit Unicode 4350 characters in the string. 4351 </description> 4352 </param> 4353 <param id="user_data"> 4354 <outptr><void/></outptr> 4355 <description> 4356 The user supplied data that was passed into the iteration function. 4357 </description> 4358 </param> 4359 </parameters> 4360 </callback> 4361 4362 4363 <callback id="jvmtiReservedCallback" since="1.1"> 4364 <jint/> 4365 <synopsis>reserved for future use Callback</synopsis> 4366 <description> 4367 Placeholder -- reserved for future use. 4368 </description> 4369 <parameters> 4370 </parameters> 4371 </callback> 4372 4373 <function id="FollowReferences" num="115" since="1.1"> 4374 <synopsis>Follow References</synopsis> 4375 <description> 4376 This function initiates a traversal over the objects that are 4377 directly and indirectly reachable from the specified object or, 4378 if <code>initial_object</code> is not specified, all objects 4379 reachable from the heap roots. 4380 The heap root are the set of system classes, 4381 JNI globals, references from thread stacks, and other objects used as roots 4382 for the purposes of garbage collection. 4383 <p/> 4384 This function operates by traversing the reference graph. 4385 Let <i>A</i>, <i>B</i>, ... represent objects. 4386 When a reference from <i>A</i> to <i>B</i> is traversed, 4387 when a reference from a heap root to <i>B</i> is traversed, 4388 or when <i>B</i> is specified as the <paramlink id="initial_object"/>, 4389 then <i>B</i> is said to be <i>visited</i>. 4390 A reference from <i>A</i> to <i>B</i> is not traversed until <i>A</i> 4391 is visited. 4392 References are reported in the same order that the references are traversed. 4393 Object references are reported by invoking the agent supplied 4394 callback function <functionlink id="jvmtiHeapReferenceCallback"/>. 4395 In a reference from <i>A</i> to <i>B</i>, <i>A</i> is known 4396 as the <i>referrer</i> and <i>B</i> as the <i>referree</i>. 4397 The callback is invoked exactly once for each reference from a referrer; 4398 this is true even if there are reference cycles or multiple paths to 4399 the referrer. 4400 There may be more than one reference between a referrer and a referree, 4401 each reference is reported. 4402 These references may be distinguished by examining the 4403 <datalink 4404 id="jvmtiHeapReferenceCallback.reference_kind"><code>reference_kind</code></datalink> 4405 and 4406 <datalink 4407 id="jvmtiHeapReferenceCallback.reference_info"><code>reference_info</code></datalink> 4408 parameters of the <functionlink id="jvmtiHeapReferenceCallback"/> callback. 4409 <p/> 4410 This function reports a Java programming language view of object references, 4411 not a virtual machine implementation view. The following object references 4412 are reported when they are non-null: 4413 <ul> 4414 <li>Instance objects report references to each non-primitive instance fields 4415 (including inherited fields).</li> 4416 <li>Instance objects report a reference to the object type (class).</li> 4417 <li>Classes report a reference to the superclass and directly 4418 implemented/extended interfaces.</li> 4419 <li>Classes report a reference to the class loader, protection domain, 4420 signers, and resolved entries in the constant pool.</li> 4421 <li>Classes report a reference to each directly declared non-primitive 4422 static field.</li> 4423 <li>Arrays report a reference to the array type (class) and each 4424 array element.</li> 4425 <li>Primitive arrays report a reference to the array type.</li> 4426 </ul> 4427 <p/> 4428 This function can also be used to examine primitive (non-object) values. 4429 The primitive value of an array or String 4430 is reported after the object has been visited; 4431 it is reported by invoking the agent supplied callback function 4432 <functionlink id="jvmtiArrayPrimitiveValueCallback"/> or 4433 <functionlink id="jvmtiStringPrimitiveValueCallback"/>. 4434 A primitive field 4435 is reported after the object with that field is visited; 4436 it is reported by invoking the agent supplied callback function 4437 <functionlink id="jvmtiPrimitiveFieldCallback"/>. 4438 <p/> 4439 Whether a callback is provided or is <code>NULL</code> only determines 4440 whether the callback will be invoked, it does not influence 4441 which objects are visited nor does it influence whether other callbacks 4442 will be invoked. 4443 However, the 4444 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink> 4445 returned by <functionlink id="jvmtiHeapReferenceCallback"/> 4446 do determine if the objects referenced by the 4447 current object as visited. 4448 The <datalink id="jvmtiHeapFilter">heap filter flags</datalink> 4449 and <paramlink id="klass"/> provided as parameters to this function 4450 do not control which objects are visited but they do control which 4451 objects and primitive values are reported by the callbacks. 4452 For example, if the only callback that was set is 4453 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> and <code>klass</code> 4454 is set to the array of bytes class, then only arrays of byte will be 4455 reported. 4456 The table below summarizes this: 4457 <p/> 4458 <table> 4459 <tr> 4460 <th/> 4461 <th> 4462 Controls objects visited 4463 </th> 4464 <th> 4465 Controls objects reported 4466 </th> 4467 <th> 4468 Controls primitives reported 4469 </th> 4470 </tr> 4471 <tr> 4472 <th align="left"> 4473 the 4474 <datalink id="jvmtiHeapVisitControl">Heap Visit Control Flags</datalink> 4475 returned by <functionlink id="jvmtiHeapReferenceCallback"/> 4476 </th> 4477 <td> 4478 <b>Yes</b> 4479 </td> 4480 <td> 4481 <b>Yes</b>, since visits are controlled 4482 </td> 4483 <td> 4484 <b>Yes</b>, since visits are controlled 4485 </td> 4486 </tr> 4487 <tr> 4488 <th align="left"> 4489 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> 4490 in <paramlink id="callbacks"/> set 4491 </th> 4492 <td> 4493 No 4494 </td> 4495 <td> 4496 <b>Yes</b> 4497 </td> 4498 <td> 4499 No 4500 </td> 4501 </tr> 4502 <tr> 4503 <th align="left"> 4504 <paramlink id="heap_filter"/> 4505 </th> 4506 <td> 4507 No 4508 </td> 4509 <td> 4510 <b>Yes</b> 4511 </td> 4512 <td> 4513 <b>Yes</b> 4514 </td> 4515 </tr> 4516 <tr> 4517 <th align="left"> 4518 <paramlink id="klass"/> 4519 </th> 4520 <td> 4521 No 4522 </td> 4523 <td> 4524 <b>Yes</b> 4525 </td> 4526 <td> 4527 <b>Yes</b> 4528 </td> 4529 </tr> 4530 </table> 4531 <p/> 4532 During the execution of this function the state of the heap 4533 does not change: no objects are allocated, no objects are 4534 garbage collected, and the state of objects (including 4535 held values) does not change. 4536 As a result, threads executing Java 4537 programming language code, threads attempting to resume the 4538 execution of Java programming language code, and threads 4539 attempting to execute JNI functions are typically stalled. 4540 </description> 4541 <origin>new</origin> 4542 <capabilities> 4543 <required id="can_tag_objects"></required> 4544 </capabilities> 4545 <parameters> 4546 <param id="heap_filter"> 4547 <jint/> 4548 <description> 4549 This bit vector of 4550 <datalink id="jvmtiHeapFilter">heap filter flags</datalink>. 4551 restricts the objects for which the callback function is called. 4552 This applies to both the object and primitive callbacks. 4553 </description> 4554 </param> 4555 <param id="klass"> 4556 <ptrtype> 4557 <jclass/> 4558 <nullok>callbacks are not limited to instances of a particular 4559 class</nullok> 4560 </ptrtype> 4561 <description> 4562 Callbacks are only reported when the object is an instance of 4563 this class. 4564 Objects which are instances of a subclass of <code>klass</code> 4565 are not reported. 4566 If <code>klass</code> is an interface, no objects are reported. 4567 This applies to both the object and primitive callbacks. 4568 </description> 4569 </param> 4570 <param id="initial_object"> 4571 <ptrtype> 4572 <jobject/> 4573 <nullok>references are followed from the heap roots</nullok> 4574 </ptrtype> 4575 <description> 4576 The object to follow 4577 </description> 4578 </param> 4579 <param id="callbacks"> 4580 <inptr> 4581 <struct>jvmtiHeapCallbacks</struct> 4582 </inptr> 4583 <description> 4584 Structure defining the set of callback functions. 4585 </description> 4586 </param> 4587 <param id="user_data"> 4588 <inbuf> 4589 <void/> 4590 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 4591 </inbuf> 4592 <description> 4593 User supplied data to be passed to the callback. 4594 </description> 4595 </param> 4596 </parameters> 4597 <errors> 4598 <error id="JVMTI_ERROR_INVALID_CLASS"> 4599 <paramlink id="klass"/> is not a valid class. 4600 </error> 4601 <error id="JVMTI_ERROR_INVALID_OBJECT"> 4602 <paramlink id="initial_object"/> is not a valid object. 4603 </error> 4604 </errors> 4605 </function> 4606 4607 4608 <function id="IterateThroughHeap" num="116" since="1.1"> 4609 <synopsis>Iterate Through Heap</synopsis> 4610 <description> 4611 Initiate an iteration over all objects in the heap. 4612 This includes both reachable and 4613 unreachable objects. Objects are visited in no particular order. 4614 <p/> 4615 Heap objects are reported by invoking the agent supplied 4616 callback function <functionlink id="jvmtiHeapIterationCallback"/>. 4617 References between objects are not reported. 4618 If only reachable objects are desired, or if object reference information 4619 is needed, use <functionlink id="FollowReferences"/>. 4620 <p/> 4621 This function can also be used to examine primitive (non-object) values. 4622 The primitive value of an array or String 4623 is reported after the object has been visited; 4624 it is reported by invoking the agent supplied callback function 4625 <functionlink id="jvmtiArrayPrimitiveValueCallback"/> or 4626 <functionlink id="jvmtiStringPrimitiveValueCallback"/>. 4627 A primitive field 4628 is reported after the object with that field is visited; 4629 it is reported by invoking the agent supplied 4630 callback function 4631 <functionlink id="jvmtiPrimitiveFieldCallback"/>. 4632 <p/> 4633 Unless the iteration is aborted by the 4634 <datalink id="jvmtiHeapVisitControl">Heap Visit Control Flags</datalink> 4635 returned by a callback, all objects in the heap are visited. 4636 Whether a callback is provided or is <code>NULL</code> only determines 4637 whether the callback will be invoked, it does not influence 4638 which objects are visited nor does it influence whether other callbacks 4639 will be invoked. 4640 The <datalink id="jvmtiHeapFilter">heap filter flags</datalink> 4641 and <paramlink id="klass"/> provided as parameters to this function 4642 do not control which objects are visited but they do control which 4643 objects and primitive values are reported by the callbacks. 4644 For example, if the only callback that was set is 4645 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> and <code>klass</code> 4646 is set to the array of bytes class, then only arrays of byte will be 4647 reported. The table below summarizes this (contrast this with 4648 <functionlink id="FollowReferences"/>): 4649 <p/> 4650 <table> 4651 <tr> 4652 <th/> 4653 <th> 4654 Controls objects visited 4655 </th> 4656 <th> 4657 Controls objects reported 4658 </th> 4659 <th> 4660 Controls primitives reported 4661 </th> 4662 </tr> 4663 <tr> 4664 <th align="left"> 4665 the 4666 <datalink id="jvmtiHeapVisitControl">Heap Visit Control Flags</datalink> 4667 returned by <functionlink id="jvmtiHeapIterationCallback"/> 4668 </th> 4669 <td> 4670 No<br/>(unless they abort the iteration) 4671 </td> 4672 <td> 4673 No<br/>(unless they abort the iteration) 4674 </td> 4675 <td> 4676 No<br/>(unless they abort the iteration) 4677 </td> 4678 </tr> 4679 <tr> 4680 <th align="left"> 4681 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> 4682 in <paramlink id="callbacks"/> set 4683 </th> 4684 <td> 4685 No 4686 </td> 4687 <td> 4688 <b>Yes</b> 4689 </td> 4690 <td> 4691 No 4692 </td> 4693 </tr> 4694 <tr> 4695 <th align="left"> 4696 <paramlink id="heap_filter"/> 4697 </th> 4698 <td> 4699 No 4700 </td> 4701 <td> 4702 <b>Yes</b> 4703 </td> 4704 <td> 4705 <b>Yes</b> 4706 </td> 4707 </tr> 4708 <tr> 4709 <th align="left"> 4710 <paramlink id="klass"/> 4711 </th> 4712 <td> 4713 No 4714 </td> 4715 <td> 4716 <b>Yes</b> 4717 </td> 4718 <td> 4719 <b>Yes</b> 4720 </td> 4721 </tr> 4722 </table> 4723 <p/> 4724 During the execution of this function the state of the heap 4725 does not change: no objects are allocated, no objects are 4726 garbage collected, and the state of objects (including 4727 held values) does not change. 4728 As a result, threads executing Java 4729 programming language code, threads attempting to resume the 4730 execution of Java programming language code, and threads 4731 attempting to execute JNI functions are typically stalled. 4732 </description> 4733 <origin>new</origin> 4734 <capabilities> 4735 <required id="can_tag_objects"></required> 4736 </capabilities> 4737 <parameters> 4738 <param id="heap_filter"> 4739 <jint/> 4740 <description> 4741 This bit vector of 4742 <datalink id="jvmtiHeapFilter">heap filter flags</datalink>. 4743 restricts the objects for which the callback function is called. 4744 This applies to both the object and primitive callbacks. 4745 </description> 4746 </param> 4747 <param id="klass"> 4748 <ptrtype> 4749 <jclass/> 4750 <nullok>callbacks are not limited to instances of a particular class</nullok> 4751 </ptrtype> 4752 <description> 4753 Callbacks are only reported when the object is an instance of 4754 this class. 4755 Objects which are instances of a subclass of <code>klass</code> 4756 are not reported. 4757 If <code>klass</code> is an interface, no objects are reported. 4758 This applies to both the object and primitive callbacks. 4759 </description> 4760 </param> 4761 <param id="callbacks"> 4762 <inptr> 4763 <struct>jvmtiHeapCallbacks</struct> 4764 </inptr> 4765 <description> 4766 Structure defining the set callback functions. 4767 </description> 4768 </param> 4769 <param id="user_data"> 4770 <inbuf> 4771 <void/> 4772 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 4773 </inbuf> 4774 <description> 4775 User supplied data to be passed to the callback. 4776 </description> 4777 </param> 4778 </parameters> 4779 <errors> 4780 <error id="JVMTI_ERROR_INVALID_CLASS"> 4781 <paramlink id="klass"/> is not a valid class. 4782 </error> 4783 </errors> 4784 </function> 4785 4786 <function id="GetTag" phase="start" num="106"> 4787 <synopsis>Get Tag</synopsis> 4788 <description> 4789 Retrieve the tag associated with an object. 4790 The tag is a long value typically used to store a 4791 unique identifier or pointer to object information. 4792 The tag is set with 4793 <functionlink id="SetTag"></functionlink>. 4794 Objects for which no tags have been set return a 4795 tag value of zero. 4796 </description> 4797 <origin>new</origin> 4798 <capabilities> 4799 <required id="can_tag_objects"></required> 4800 </capabilities> 4801 <parameters> 4802 <param id="object"> 4803 <jobject/> 4804 <description> 4805 The object whose tag is to be retrieved. 4806 </description> 4807 </param> 4808 <param id="tag_ptr"> 4809 <outptr><jlong/></outptr> 4810 <description> 4811 On return, the referenced long is set to the value 4812 of the tag. 4813 </description> 4814 </param> 4815 </parameters> 4816 <errors> 4817 </errors> 4818 </function> 4819 4820 <function id="SetTag" phase="start" num="107"> 4821 <synopsis>Set Tag</synopsis> 4822 <description> 4823 Set the tag associated with an object. 4824 The tag is a long value typically used to store a 4825 unique identifier or pointer to object information. 4826 The tag is visible with 4827 <functionlink id="GetTag"></functionlink>. 4828 </description> 4829 <origin>new</origin> 4830 <capabilities> 4831 <required id="can_tag_objects"></required> 4832 </capabilities> 4833 <parameters> 4834 <param id="object"> 4835 <jobject/> 4836 <description> 4837 The object whose tag is to be set. 4838 </description> 4839 </param> 4840 <param id="tag"> 4841 <jlong/> 4842 <description> 4843 The new value of the tag. 4844 </description> 4845 </param> 4846 </parameters> 4847 <errors> 4848 </errors> 4849 </function> 4850 4851 <function id="GetObjectsWithTags" num="114"> 4852 <synopsis>Get Objects With Tags</synopsis> 4853 <description> 4854 Return objects in the heap with the specified tags. 4855 The format is parallel arrays of objects and tags. 4856 </description> 4857 <origin>new</origin> 4858 <capabilities> 4859 <required id="can_tag_objects"></required> 4860 </capabilities> 4861 <parameters> 4862 <param id="tag_count"> 4863 <jint min="0"/> 4864 <description> 4865 Number of tags to scan for. 4866 </description> 4867 </param> 4868 <param id="tags"> 4869 <inbuf incount="tag_count"> 4870 <jlong/> 4871 </inbuf> 4872 <description> 4873 Scan for objects with these tags. 4874 Zero is not permitted in this array. 4875 </description> 4876 </param> 4877 <param id="count_ptr"> 4878 <outptr> 4879 <jint/> 4880 </outptr> 4881 <description> 4882 Return the number of objects with any of the tags 4883 in <paramlink id="tags"/>. 4884 </description> 4885 </param> 4886 <param id="object_result_ptr"> 4887 <allocbuf outcount="count_ptr"> 4888 <jobject/> 4889 <nullok>this information is not returned</nullok> 4890 </allocbuf> 4891 <description> 4892 Returns the array of objects with any of the tags 4893 in <paramlink id="tags"/>. 4894 </description> 4895 </param> 4896 <param id="tag_result_ptr"> 4897 <allocbuf outcount="count_ptr"> 4898 <jlong/> 4899 <nullok>this information is not returned</nullok> 4900 </allocbuf> 4901 <description> 4902 For each object in <paramlink id="object_result_ptr"/>, 4903 return the tag at the corresponding index. 4904 </description> 4905 </param> 4906 </parameters> 4907 <errors> 4908 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 4909 Zero is present in <paramlink id="tags"></paramlink>. 4910 </error> 4911 </errors> 4912 </function> 4913 4914 <function id="ForceGarbageCollection" num="108"> 4915 <synopsis>Force Garbage Collection</synopsis> 4916 <description> 4917 Force the VM to perform a garbage collection. 4918 The garbage collection is as complete as possible. 4919 This function does not cause finalizers to be run. 4920 This function does not return until the garbage collection 4921 is finished. 4922 <p/> 4923 Although garbage collection is as complete 4924 as possible there is no guarantee that all 4925 <eventlink id="ObjectFree"/> 4926 events will have been 4927 sent by the time that this function 4928 returns. In particular, an object may be 4929 prevented from being freed because it 4930 is awaiting finalization. 4931 </description> 4932 <origin>new</origin> 4933 <capabilities> 4934 </capabilities> 4935 <parameters> 4936 </parameters> 4937 <errors> 4938 </errors> 4939 </function> 4940 4941 4942 </category> 4943 4944 <category id="Heap_1_0" label="Heap (1.0)"> 4945 <intro> 4946 <b> 4947 These functions and data types were introduced in the original 4948 <jvmti/> version 1.0 and have been superseded by more 4949 </b> 4950 <internallink id="Heap"><b>powerful and flexible versions</b></internallink> 4951 <b> 4952 which: 4953 </b> 4954 <ul> 4955 <li> 4956 <b> 4957 Allow access to primitive values (the value of Strings, arrays, 4958 and primitive fields) 4959 </b> 4960 </li> 4961 <li> 4962 <b> 4963 Allow the tag of the referrer to be set, thus enabling more 4964 efficient localized reference graph building 4965 </b> 4966 </li> 4967 <li> 4968 <b> 4969 Provide more extensive filtering abilities 4970 </b> 4971 </li> 4972 <li> 4973 <b> 4974 Are extensible, allowing their abilities to grow in future versions of <jvmti/> 4975 </b> 4976 </li> 4977 </ul> 4978 <p/> 4979 <b>Please use the </b> 4980 <internallink id="Heap"><b>current Heap functions</b></internallink>. 4981 <p/> 4982 <constants id="jvmtiHeapObjectFilter" label="Heap Object Filter Enumeration" kind="enum"> 4983 <constant id="JVMTI_HEAP_OBJECT_TAGGED" num="1"> 4984 Tagged objects only. 4985 </constant> 4986 <constant id="JVMTI_HEAP_OBJECT_UNTAGGED" num="2"> 4987 Untagged objects only. 4988 </constant> 4989 <constant id="JVMTI_HEAP_OBJECT_EITHER" num="3"> 4990 Either tagged or untagged objects. 4991 </constant> 4992 </constants> 4993 4994 <constants id="jvmtiHeapRootKind" label="Heap Root Kind Enumeration" kind="enum"> 4995 <constant id="JVMTI_HEAP_ROOT_JNI_GLOBAL" num="1"> 4996 JNI global reference. 4997 </constant> 4998 <constant id="JVMTI_HEAP_ROOT_SYSTEM_CLASS" num="2"> 4999 System class. 5000 </constant> 5001 <constant id="JVMTI_HEAP_ROOT_MONITOR" num="3"> 5002 Monitor. 5003 </constant> 5004 <constant id="JVMTI_HEAP_ROOT_STACK_LOCAL" num="4"> 5005 Stack local. 5006 </constant> 5007 <constant id="JVMTI_HEAP_ROOT_JNI_LOCAL" num="5"> 5008 JNI local reference. 5009 </constant> 5010 <constant id="JVMTI_HEAP_ROOT_THREAD" num="6"> 5011 Thread. 5012 </constant> 5013 <constant id="JVMTI_HEAP_ROOT_OTHER" num="7"> 5014 Other. 5015 </constant> 5016 </constants> 5017 5018 <constants id="jvmtiObjectReferenceKind" label="Object Reference Enumeration" kind="enum"> 5019 <constant id="JVMTI_REFERENCE_CLASS" num="1"> 5020 Reference from an object to its class. 5021 </constant> 5022 <constant id="JVMTI_REFERENCE_FIELD" num="2"> 5023 Reference from an object to the value of one of its instance fields. 5024 For references of this kind the <code>referrer_index</code> 5025 parameter to the <internallink id="jvmtiObjectReferenceCallback"> 5026 jvmtiObjectReferenceCallback</internallink> is the index of the 5027 the instance field. The index is based on the order of all the 5028 object's fields. This includes all fields of the directly declared 5029 static and instance fields in the class, and includes all fields (both 5030 public and private) fields declared in superclasses and superinterfaces. 5031 The index is thus calculated by summing the index of the field in the directly 5032 declared class (see <functionlink id="GetClassFields"/>), with the total 5033 number of fields (both public and private) declared in all superclasses 5034 and superinterfaces. The index starts at zero. 5035 </constant> 5036 <constant id="JVMTI_REFERENCE_ARRAY_ELEMENT" num="3"> 5037 Reference from an array to one of its elements. 5038 For references of this kind the <code>referrer_index</code> 5039 parameter to the <internallink id="jvmtiObjectReferenceCallback"> 5040 jvmtiObjectReferenceCallback</internallink> is the array index. 5041 </constant> 5042 <constant id="JVMTI_REFERENCE_CLASS_LOADER" num="4"> 5043 Reference from a class to its class loader. 5044 </constant> 5045 <constant id="JVMTI_REFERENCE_SIGNERS" num="5"> 5046 Reference from a class to its signers array. 5047 </constant> 5048 <constant id="JVMTI_REFERENCE_PROTECTION_DOMAIN" num="6"> 5049 Reference from a class to its protection domain. 5050 </constant> 5051 <constant id="JVMTI_REFERENCE_INTERFACE" num="7"> 5052 Reference from a class to one of its interfaces. 5053 </constant> 5054 <constant id="JVMTI_REFERENCE_STATIC_FIELD" num="8"> 5055 Reference from a class to the value of one of its static fields. 5056 For references of this kind the <code>referrer_index</code> 5057 parameter to the <internallink id="jvmtiObjectReferenceCallback"> 5058 jvmtiObjectReferenceCallback</internallink> is the index of the 5059 the static field. The index is based on the order of all the 5060 object's fields. This includes all fields of the directly declared 5061 static and instance fields in the class, and includes all fields (both 5062 public and private) fields declared in superclasses and superinterfaces. 5063 The index is thus calculated by summing the index of the field in the directly 5064 declared class (see <functionlink id="GetClassFields"/>), with the total 5065 number of fields (both public and private) declared in all superclasses 5066 and superinterfaces. The index starts at zero. 5067 Note: this definition differs from that in the <jvmti/> 1.0 Specification. 5068 <rationale>No known implementations used the 1.0 definition.</rationale> 5069 </constant> 5070 <constant id="JVMTI_REFERENCE_CONSTANT_POOL" num="9"> 5071 Reference from a class to a resolved entry in the constant pool. 5072 For references of this kind the <code>referrer_index</code> 5073 parameter to the <internallink id="jvmtiObjectReferenceCallback"> 5074 jvmtiObjectReferenceCallback</internallink> is the index into 5075 constant pool table of the class, starting at 1. See 5076 <vmspec chapter="4.4"/>. 5077 </constant> 5078 </constants> 5079 5080 <constants id="jvmtiIterationControl" label="Iteration Control Enumeration" kind="enum"> 5081 <constant id="JVMTI_ITERATION_CONTINUE" num="1"> 5082 Continue the iteration. 5083 If this is a reference iteration, follow the references of this object. 5084 </constant> 5085 <constant id="JVMTI_ITERATION_IGNORE" num="2"> 5086 Continue the iteration. 5087 If this is a reference iteration, ignore the references of this object. 5088 </constant> 5089 <constant id="JVMTI_ITERATION_ABORT" num="0"> 5090 Abort the iteration. 5091 </constant> 5092 </constants> 5093 </intro> 5094 5095 <callback id="jvmtiHeapObjectCallback"> 5096 <enum>jvmtiIterationControl</enum> 5097 <synopsis>Heap Object Callback</synopsis> 5098 <description> 5099 Agent supplied callback function. 5100 Describes (but does not pass in) an object in the heap. 5101 <p/> 5102 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration, 5103 or <code>JVMTI_ITERATION_ABORT</code> to stop iteration. 5104 <p/> 5105 See the <internallink id="heapCallbacks">heap callback 5106 function restrictions</internallink>. 5107 </description> 5108 <parameters> 5109 <param id="class_tag"> 5110 <jlong/> 5111 <description> 5112 The tag of the class of object (zero if the class is not tagged). 5113 If the object represents a runtime class, 5114 the <code>class_tag</code> is the tag 5115 associated with <code>java.lang.Class</code> 5116 (zero if <code>java.lang.Class</code> is not tagged). 5117 </description> 5118 </param> 5119 <param id="size"> 5120 <jlong/> 5121 <description> 5122 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 5123 </description> 5124 </param> 5125 <param id="tag_ptr"> 5126 <outptr><jlong/></outptr> 5127 <description> 5128 The object tag value, or zero if the object is not tagged. 5129 To set the tag value to be associated with the object 5130 the agent sets the <code>jlong</code> pointed to by the parameter. 5131 </description> 5132 </param> 5133 <param id="user_data"> 5134 <outptr><void/></outptr> 5135 <description> 5136 The user supplied data that was passed into the iteration function. 5137 </description> 5138 </param> 5139 </parameters> 5140 </callback> 5141 5142 <callback id="jvmtiHeapRootCallback"> 5143 <enum>jvmtiIterationControl</enum> 5144 <synopsis>Heap Root Object Callback</synopsis> 5145 <description> 5146 Agent supplied callback function. 5147 Describes (but does not pass in) an object that is a root for the purposes 5148 of garbage collection. 5149 <p/> 5150 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration, 5151 <code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing 5152 references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration. 5153 <p/> 5154 See the <internallink id="heapCallbacks">heap callback 5155 function restrictions</internallink>. 5156 </description> 5157 <parameters> 5158 <param id="root_kind"> 5159 <enum>jvmtiHeapRootKind</enum> 5160 <description> 5161 The kind of heap root. 5162 </description> 5163 </param> 5164 <param id="class_tag"> 5165 <jlong/> 5166 <description> 5167 The tag of the class of object (zero if the class is not tagged). 5168 If the object represents a runtime class, the <code>class_tag</code> is the tag 5169 associated with <code>java.lang.Class</code> 5170 (zero if <code>java.lang.Class</code> is not tagged). 5171 </description> 5172 </param> 5173 <param id="size"> 5174 <jlong/> 5175 <description> 5176 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 5177 </description> 5178 </param> 5179 <param id="tag_ptr"> 5180 <outptr><jlong/></outptr> 5181 <description> 5182 The object tag value, or zero if the object is not tagged. 5183 To set the tag value to be associated with the object 5184 the agent sets the <code>jlong</code> pointed to by the parameter. 5185 </description> 5186 </param> 5187 <param id="user_data"> 5188 <outptr><void/></outptr> 5189 <description> 5190 The user supplied data that was passed into the iteration function. 5191 </description> 5192 </param> 5193 </parameters> 5194 </callback> 5195 5196 <callback id="jvmtiStackReferenceCallback"> 5197 <enum>jvmtiIterationControl</enum> 5198 <synopsis>Stack Reference Object Callback</synopsis> 5199 <description> 5200 Agent supplied callback function. 5201 Describes (but does not pass in) an object on the stack that is a root for 5202 the purposes of garbage collection. 5203 <p/> 5204 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration, 5205 <code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing 5206 references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration. 5207 <p/> 5208 See the <internallink id="heapCallbacks">heap callback 5209 function restrictions</internallink>. 5210 </description> 5211 <parameters> 5212 <param id="root_kind"> 5213 <enum>jvmtiHeapRootKind</enum> 5214 <description> 5215 The kind of root (either <code>JVMTI_HEAP_ROOT_STACK_LOCAL</code> or 5216 <code>JVMTI_HEAP_ROOT_JNI_LOCAL</code>). 5217 </description> 5218 </param> 5219 <param id="class_tag"> 5220 <jlong/> 5221 <description> 5222 The tag of the class of object (zero if the class is not tagged). 5223 If the object represents a runtime class, the <code>class_tag</code> is the tag 5224 associated with <code>java.lang.Class</code> 5225 (zero if <code>java.lang.Class</code> is not tagged). 5226 </description> 5227 </param> 5228 <param id="size"> 5229 <jlong/> 5230 <description> 5231 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 5232 </description> 5233 </param> 5234 <param id="tag_ptr"> 5235 <outptr><jlong/></outptr> 5236 <description> 5237 The object tag value, or zero if the object is not tagged. 5238 To set the tag value to be associated with the object 5239 the agent sets the <code>jlong</code> pointed to by the parameter. 5240 </description> 5241 </param> 5242 <param id="thread_tag"> 5243 <jlong/> 5244 <description> 5245 The tag of the thread corresponding to this stack, zero if not tagged. 5246 </description> 5247 </param> 5248 <param id="depth"> 5249 <jint/> 5250 <description> 5251 The depth of the frame. 5252 </description> 5253 </param> 5254 <param id="method"> 5255 <jmethodID/> 5256 <description> 5257 The method executing in this frame. 5258 </description> 5259 </param> 5260 <param id="slot"> 5261 <jint/> 5262 <description> 5263 The slot number. 5264 </description> 5265 </param> 5266 <param id="user_data"> 5267 <outptr><void/></outptr> 5268 <description> 5269 The user supplied data that was passed into the iteration function. 5270 </description> 5271 </param> 5272 </parameters> 5273 </callback> 5274 5275 <callback id="jvmtiObjectReferenceCallback"> 5276 <enum>jvmtiIterationControl</enum> 5277 <synopsis>Object Reference Callback</synopsis> 5278 <description> 5279 Agent supplied callback function. 5280 Describes a reference from an object (the referrer) to another object 5281 (the referree). 5282 <p/> 5283 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration, 5284 <code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing 5285 references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration. 5286 <p/> 5287 See the <internallink id="heapCallbacks">heap callback 5288 function restrictions</internallink>. 5289 </description> 5290 <parameters> 5291 <param id="reference_kind"> 5292 <enum>jvmtiObjectReferenceKind</enum> 5293 <description> 5294 The type of reference. 5295 </description> 5296 </param> 5297 <param id="class_tag"> 5298 <jlong/> 5299 <description> 5300 The tag of the class of referree object (zero if the class is not tagged). 5301 If the referree object represents a runtime class, 5302 the <code>class_tag</code> is the tag 5303 associated with <code>java.lang.Class</code> 5304 (zero if <code>java.lang.Class</code> is not tagged). 5305 </description> 5306 </param> 5307 <param id="size"> 5308 <jlong/> 5309 <description> 5310 Size of the referree object (in bytes). 5311 See <functionlink id="GetObjectSize"/>. 5312 </description> 5313 </param> 5314 <param id="tag_ptr"> 5315 <outptr><jlong/></outptr> 5316 <description> 5317 The referree object tag value, or zero if the object is not 5318 tagged. 5319 To set the tag value to be associated with the object 5320 the agent sets the <code>jlong</code> pointed to by the parameter. 5321 </description> 5322 </param> 5323 <param id="referrer_tag"> 5324 <jlong/> 5325 <description> 5326 The tag of the referrer object, or zero if the referrer 5327 object is not tagged. 5328 </description> 5329 </param> 5330 <param id="referrer_index"> 5331 <jint/> 5332 <description> 5333 For references of type <code>JVMTI_REFERENCE_FIELD</code> or 5334 <code>JVMTI_REFERENCE_STATIC_FIELD</code> the index 5335 of the field in the referrer object. The index is based on the 5336 order of all the object's fields - see <internallink 5337 id="JVMTI_REFERENCE_FIELD">JVMTI_REFERENCE_FIELD</internallink> 5338 or <internallink 5339 id="JVMTI_REFERENCE_STATIC_FIELD">JVMTI_REFERENCE_STATIC_FIELD 5340 </internallink> for further description. 5341 <p/> 5342 For references of type <code>JVMTI_REFERENCE_ARRAY_ELEMENT</code> 5343 the array index - see <internallink id="JVMTI_REFERENCE_ARRAY_ELEMENT"> 5344 JVMTI_REFERENCE_ARRAY_ELEMENT</internallink> for further description. 5345 <p/> 5346 For references of type <code>JVMTI_REFERENCE_CONSTANT_POOL</code> 5347 the index into the constant pool of the class - see 5348 <internallink id="JVMTI_REFERENCE_CONSTANT_POOL"> 5349 JVMTI_REFERENCE_CONSTANT_POOL</internallink> for further 5350 description. 5351 <p/> 5352 For references of other kinds the <code>referrer_index</code> is 5353 <code>-1</code>. 5354 </description> 5355 </param> 5356 <param id="user_data"> 5357 <outptr><void/></outptr> 5358 <description> 5359 The user supplied data that was passed into the iteration function. 5360 </description> 5361 </param> 5362 </parameters> 5363 </callback> 5364 5365 <function id="IterateOverObjectsReachableFromObject" num="109"> 5366 <synopsis>Iterate Over Objects Reachable From Object</synopsis> 5367 <description> 5368 This function iterates over all objects that are directly 5369 and indirectly reachable from the specified object. 5370 For each object <i>A</i> (known 5371 as the referrer) with a reference to object <i>B</i> the specified 5372 callback function is called to describe the object reference. 5373 The callback is called exactly once for each reference from a referrer; 5374 this is true even if there are reference cycles or multiple paths to 5375 the referrer. 5376 There may be more than one reference between a referrer and a referree, 5377 These may be distinguished by the 5378 <datalink id="jvmtiObjectReferenceCallback.reference_kind"></datalink> and 5379 <datalink id="jvmtiObjectReferenceCallback.referrer_index"></datalink>. 5380 The callback for an object will always occur after the callback for 5381 its referrer. 5382 <p/> 5383 See <functionlink id="FollowReferences"/> for the object 5384 references which are reported. 5385 <p/> 5386 During the execution of this function the state of the heap 5387 does not change: no objects are allocated, no objects are 5388 garbage collected, and the state of objects (including 5389 held values) does not change. 5390 As a result, threads executing Java 5391 programming language code, threads attempting to resume the 5392 execution of Java programming language code, and threads 5393 attempting to execute JNI functions are typically stalled. 5394 </description> 5395 <origin>new</origin> 5396 <capabilities> 5397 <required id="can_tag_objects"></required> 5398 </capabilities> 5399 <parameters> 5400 <param id="object"> 5401 <jobject/> 5402 <description> 5403 The object 5404 </description> 5405 </param> 5406 <param id="object_reference_callback"> 5407 <ptrtype> 5408 <struct>jvmtiObjectReferenceCallback</struct> 5409 </ptrtype> 5410 <description> 5411 The callback to be called to describe each 5412 object reference. 5413 </description> 5414 </param> 5415 <param id="user_data"> 5416 <inbuf> 5417 <void/> 5418 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 5419 </inbuf> 5420 <description> 5421 User supplied data to be passed to the callback. 5422 </description> 5423 </param> 5424 </parameters> 5425 <errors> 5426 </errors> 5427 </function> 5428 5429 <function id="IterateOverReachableObjects" num="110"> 5430 <synopsis>Iterate Over Reachable Objects</synopsis> 5431 <description> 5432 This function iterates over the root objects and all objects that 5433 are directly and indirectly reachable from the root objects. 5434 The root objects comprise the set of system classes, 5435 JNI globals, references from thread stacks, and other objects used as roots 5436 for the purposes of garbage collection. 5437 <p/> 5438 For each root the <paramlink id="heap_root_callback"></paramlink> 5439 or <paramlink id="stack_ref_callback"></paramlink> callback is called. 5440 An object can be a root object for more than one reason and in that case 5441 the appropriate callback is called for each reason. 5442 <p/> 5443 For each object reference the <paramlink id="object_ref_callback"></paramlink> 5444 callback function is called to describe the object reference. 5445 The callback is called exactly once for each reference from a referrer; 5446 this is true even if there are reference cycles or multiple paths to 5447 the referrer. 5448 There may be more than one reference between a referrer and a referree, 5449 These may be distinguished by the 5450 <datalink id="jvmtiObjectReferenceCallback.reference_kind"></datalink> and 5451 <datalink id="jvmtiObjectReferenceCallback.referrer_index"></datalink>. 5452 The callback for an object will always occur after the callback for 5453 its referrer. 5454 <p/> 5455 See <functionlink id="FollowReferences"/> for the object 5456 references which are reported. 5457 <p/> 5458 Roots are always reported to the profiler before any object references 5459 are reported. In other words, the <paramlink id="object_ref_callback"></paramlink> 5460 callback will not be called until the appropriate callback has been called 5461 for all roots. If the <paramlink id="object_ref_callback"></paramlink> callback is 5462 specified as <code>NULL</code> then this function returns after 5463 reporting the root objects to the profiler. 5464 <p/> 5465 During the execution of this function the state of the heap 5466 does not change: no objects are allocated, no objects are 5467 garbage collected, and the state of objects (including 5468 held values) does not change. 5469 As a result, threads executing Java 5470 programming language code, threads attempting to resume the 5471 execution of Java programming language code, and threads 5472 attempting to execute JNI functions are typically stalled. 5473 </description> 5474 <origin>new</origin> 5475 <capabilities> 5476 <required id="can_tag_objects"></required> 5477 </capabilities> 5478 <parameters> 5479 <param id="heap_root_callback"> 5480 <ptrtype> 5481 <struct>jvmtiHeapRootCallback</struct> 5482 <nullok>do not report heap roots</nullok> 5483 </ptrtype> 5484 <description> 5485 The callback function to be called for each heap root of type 5486 <code>JVMTI_HEAP_ROOT_JNI_GLOBAL</code>, 5487 <code>JVMTI_HEAP_ROOT_SYSTEM_CLASS</code>, 5488 <code>JVMTI_HEAP_ROOT_MONITOR</code>, 5489 <code>JVMTI_HEAP_ROOT_THREAD</code>, or 5490 <code>JVMTI_HEAP_ROOT_OTHER</code>. 5491 </description> 5492 </param> 5493 <param id="stack_ref_callback"> 5494 <ptrtype> 5495 <struct>jvmtiStackReferenceCallback</struct> 5496 <nullok>do not report stack references</nullok> 5497 </ptrtype> 5498 <description> 5499 The callback function to be called for each heap root of 5500 <code>JVMTI_HEAP_ROOT_STACK_LOCAL</code> or 5501 <code>JVMTI_HEAP_ROOT_JNI_LOCAL</code>. 5502 </description> 5503 </param> 5504 <param id="object_ref_callback"> 5505 <ptrtype> 5506 <struct>jvmtiObjectReferenceCallback</struct> 5507 <nullok>do not follow references from the root objects</nullok> 5508 </ptrtype> 5509 <description> 5510 The callback function to be called for each object reference. 5511 </description> 5512 </param> 5513 <param id="user_data"> 5514 <inbuf> 5515 <void/> 5516 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 5517 </inbuf> 5518 <description> 5519 User supplied data to be passed to the callback. 5520 </description> 5521 </param> 5522 </parameters> 5523 <errors> 5524 </errors> 5525 </function> 5526 5527 <function id="IterateOverHeap" num="111"> 5528 <synopsis>Iterate Over Heap</synopsis> 5529 <description> 5530 Iterate over all objects in the heap. This includes both reachable and 5531 unreachable objects. 5532 <p/> 5533 The <paramlink id="object_filter"></paramlink> parameter indicates the 5534 objects for which the callback function is called. If this parameter 5535 is <code>JVMTI_HEAP_OBJECT_TAGGED</code> then the callback will only be 5536 called for every object that is tagged. If the parameter is 5537 <code>JVMTI_HEAP_OBJECT_UNTAGGED</code> then the callback will only be 5538 for objects that are not tagged. If the parameter 5539 is <code>JVMTI_HEAP_OBJECT_EITHER</code> then the callback will be 5540 called for every object in the heap, irrespective of whether it is 5541 tagged or not. 5542 <p/> 5543 During the execution of this function the state of the heap 5544 does not change: no objects are allocated, no objects are 5545 garbage collected, and the state of objects (including 5546 held values) does not change. 5547 As a result, threads executing Java 5548 programming language code, threads attempting to resume the 5549 execution of Java programming language code, and threads 5550 attempting to execute JNI functions are typically stalled. 5551 </description> 5552 <origin>new</origin> 5553 <capabilities> 5554 <required id="can_tag_objects"></required> 5555 </capabilities> 5556 <parameters> 5557 <param id="object_filter"> 5558 <enum>jvmtiHeapObjectFilter</enum> 5559 <description> 5560 Indicates the objects for which the callback function is called. 5561 </description> 5562 </param> 5563 <param id="heap_object_callback"> 5564 <ptrtype> 5565 <struct>jvmtiHeapObjectCallback</struct> 5566 </ptrtype> 5567 <description> 5568 The iterator function to be called for each 5569 object matching the <paramlink id="object_filter"/>. 5570 </description> 5571 </param> 5572 <param id="user_data"> 5573 <inbuf> 5574 <void/> 5575 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 5576 </inbuf> 5577 <description> 5578 User supplied data to be passed to the callback. 5579 </description> 5580 </param> 5581 </parameters> 5582 <errors> 5583 </errors> 5584 </function> 5585 5586 <function id="IterateOverInstancesOfClass" num="112"> 5587 <synopsis>Iterate Over Instances Of Class</synopsis> 5588 <description> 5589 Iterate over all objects in the heap that are instances of the specified class. 5590 This includes direct instances of the specified class and 5591 instances of all subclasses of the specified class. 5592 This includes both reachable and unreachable objects. 5593 <p/> 5594 The <paramlink id="object_filter"></paramlink> parameter indicates the 5595 objects for which the callback function is called. If this parameter 5596 is <code>JVMTI_HEAP_OBJECT_TAGGED</code> then the callback will only be 5597 called for every object that is tagged. If the parameter is 5598 <code>JVMTI_HEAP_OBJECT_UNTAGGED</code> then the callback will only be 5599 called for objects that are not tagged. If the parameter 5600 is <code>JVMTI_HEAP_OBJECT_EITHER</code> then the callback will be 5601 called for every object in the heap, irrespective of whether it is 5602 tagged or not. 5603 <p/> 5604 During the execution of this function the state of the heap 5605 does not change: no objects are allocated, no objects are 5606 garbage collected, and the state of objects (including 5607 held values) does not change. 5608 As a result, threads executing Java 5609 programming language code, threads attempting to resume the 5610 execution of Java programming language code, and threads 5611 attempting to execute JNI functions are typically stalled. 5612 </description> 5613 <origin>new</origin> 5614 <capabilities> 5615 <required id="can_tag_objects"></required> 5616 </capabilities> 5617 <parameters> 5618 <param id="klass"> 5619 <jclass/> 5620 <description> 5621 Iterate over objects of this class only. 5622 </description> 5623 </param> 5624 <param id="object_filter"> 5625 <enum>jvmtiHeapObjectFilter</enum> 5626 <description> 5627 Indicates the objects for which the callback function is called. 5628 </description> 5629 </param> 5630 <param id="heap_object_callback"> 5631 <ptrtype> 5632 <struct>jvmtiHeapObjectCallback</struct> 5633 </ptrtype> 5634 <description> 5635 The iterator function to be called for each 5636 <paramlink id="klass"/> instance matching 5637 the <paramlink id="object_filter"/>. 5638 </description> 5639 </param> 5640 <param id="user_data"> 5641 <inbuf> 5642 <void/> 5643 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 5644 </inbuf> 5645 <description> 5646 User supplied data to be passed to the callback. 5647 </description> 5648 </param> 5649 </parameters> 5650 <errors> 5651 </errors> 5652 </function> 5653 5654 </category> 5655 5656 <category id="local" label="Local Variable"> 5657 5658 <intro> 5659 These functions are used to retrieve or set the value of a local variable. 5660 The variable is identified by the depth of the frame containing its 5661 value and the variable's slot number within that frame. 5662 The mapping of variables to 5663 slot numbers can be obtained with the function 5664 <functionlink id="GetLocalVariableTable"></functionlink>. 5665 </intro> 5666 5667 <function id="GetLocalObject" num="21"> 5668 <synopsis>Get Local Variable - Object</synopsis> 5669 <description> 5670 This function can be used to retrieve the value of a local 5671 variable whose type is <code>Object</code> or a subclass of <code>Object</code>. 5672 </description> 5673 <origin>jvmdi</origin> 5674 <capabilities> 5675 <required id="can_access_local_variables"></required> 5676 </capabilities> 5677 <parameters> 5678 <param id="thread"> 5679 <jthread null="current" frame="frame"/> 5680 <description> 5681 The thread of the frame containing the variable's value. 5682 </description> 5683 </param> 5684 <param id="depth"> 5685 <jframeID thread="thread"/> 5686 <description> 5687 The depth of the frame containing the variable's value. 5688 </description> 5689 </param> 5690 <param id="slot"> 5691 <jint/> 5692 <description> 5693 The variable's slot number. 5694 </description> 5695 </param> 5696 <param id="value_ptr"> 5697 <outptr><jobject/></outptr> 5698 <description> 5699 On return, points to the variable's value. 5700 </description> 5701 </param> 5702 </parameters> 5703 <errors> 5704 <error id="JVMTI_ERROR_INVALID_SLOT"> 5705 Invalid <code>slot</code>. 5706 </error> 5707 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 5708 The variable type is not 5709 <code>Object</code> or a subclass of <code>Object</code>. 5710 </error> 5711 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 5712 Not a visible frame 5713 </error> 5714 </errors> 5715 </function> 5716 5717 <function id="GetLocalInstance" num="155" since="1.2"> 5718 <synopsis>Get Local Instance</synopsis> 5719 <description> 5720 This function can be used to retrieve the value of the local object 5721 variable at slot 0 (the "<code>this</code>" object) from non-static 5722 frames. This function can retrieve the "<code>this</code>" object from 5723 native method frames, whereas <code>GetLocalObject()</code> would 5724 return <code>JVMTI_ERROR_OPAQUE_FRAME</code> in those cases. 5725 </description> 5726 <origin>new</origin> 5727 <capabilities> 5728 <required id="can_access_local_variables"></required> 5729 </capabilities> 5730 <parameters> 5731 <param id="thread"> 5732 <jthread null="current" frame="frame"/> 5733 <description> 5734 The thread of the frame containing the variable's value. 5735 </description> 5736 </param> 5737 <param id="depth"> 5738 <jframeID thread="thread"/> 5739 <description> 5740 The depth of the frame containing the variable's value. 5741 </description> 5742 </param> 5743 <param id="value_ptr"> 5744 <outptr><jobject/></outptr> 5745 <description> 5746 On return, points to the variable's value. 5747 </description> 5748 </param> 5749 </parameters> 5750 <errors> 5751 <error id="JVMTI_ERROR_INVALID_SLOT"> 5752 If the specified frame is a static method frame. 5753 </error> 5754 </errors> 5755 </function> 5756 <function id="GetLocalInt" num="22"> 5757 <synopsis>Get Local Variable - Int</synopsis> 5758 <description> 5759 This function can be used to retrieve the value of a local 5760 variable whose type is <code>int</code>, 5761 <code>short</code>, <code>char</code>, <code>byte</code>, or 5762 <code>boolean</code>. 5763 </description> 5764 <origin>jvmdi</origin> 5765 <capabilities> 5766 <required id="can_access_local_variables"></required> 5767 </capabilities> 5768 <parameters> 5769 <param id="thread"> 5770 <jthread null="current" frame="frame"/> 5771 <description> 5772 The thread of the frame containing the variable's value. 5773 </description> 5774 </param> 5775 <param id="depth"> 5776 <jframeID thread="thread"/> 5777 <description> 5778 The depth of the frame containing the variable's value. 5779 </description> 5780 </param> 5781 <param id="slot"> 5782 <jint/> 5783 <description> 5784 The variable's slot number. 5785 </description> 5786 </param> 5787 <param id="value_ptr"> 5788 <outptr><jint/></outptr> 5789 <description> 5790 On return, points to the variable's value. 5791 </description> 5792 </param> 5793 </parameters> 5794 <errors> 5795 <error id="JVMTI_ERROR_INVALID_SLOT"> 5796 Invalid <code>slot</code>. 5797 </error> 5798 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 5799 The variable type is not 5800 <code>int</code>, <code>short</code>, 5801 <code>char</code>, <code>byte</code>, or 5802 <code>boolean</code>. 5803 </error> 5804 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 5805 Not a visible frame 5806 </error> 5807 </errors> 5808 </function> 5809 5810 <function id="GetLocalLong" num="23"> 5811 <synopsis>Get Local Variable - Long</synopsis> 5812 <description> 5813 This function can be used to retrieve the value of a local 5814 variable whose type is <code>long</code>. 5815 </description> 5816 <origin>jvmdi</origin> 5817 <capabilities> 5818 <required id="can_access_local_variables"></required> 5819 </capabilities> 5820 <parameters> 5821 <param id="thread"> 5822 <jthread null="current" frame="frame"/> 5823 <description> 5824 The thread of the frame containing the variable's value. 5825 </description> 5826 </param> 5827 <param id="depth"> 5828 <jframeID thread="thread"/> 5829 <description> 5830 The depth of the frame containing the variable's value. 5831 </description> 5832 </param> 5833 <param id="slot"> 5834 <jint/> 5835 <description> 5836 The variable's slot number. 5837 </description> 5838 </param> 5839 <param id="value_ptr"> 5840 <outptr><jlong/></outptr> 5841 <description> 5842 On return, points to the variable's value. 5843 </description> 5844 </param> 5845 </parameters> 5846 <errors> 5847 <error id="JVMTI_ERROR_INVALID_SLOT"> 5848 Invalid <code>slot</code>. 5849 </error> 5850 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 5851 The variable type is not <code>long</code>. 5852 </error> 5853 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 5854 Not a visible frame 5855 </error> 5856 </errors> 5857 </function> 5858 5859 <function id="GetLocalFloat" num="24"> 5860 <synopsis>Get Local Variable - Float</synopsis> 5861 <description> 5862 This function can be used to retrieve the value of a local 5863 variable whose type is <code>float</code>. 5864 </description> 5865 <origin>jvmdi</origin> 5866 <capabilities> 5867 <required id="can_access_local_variables"></required> 5868 </capabilities> 5869 <parameters> 5870 <param id="thread"> 5871 <jthread null="current" frame="frame"/> 5872 <description> 5873 The thread of the frame containing the variable's value. 5874 </description> 5875 </param> 5876 <param id="depth"> 5877 <jframeID thread="thread"/> 5878 <description> 5879 The depth of the frame containing the variable's value. 5880 </description> 5881 </param> 5882 <param id="slot"> 5883 <jint/> 5884 <description> 5885 The variable's slot number. 5886 </description> 5887 </param> 5888 <param id="value_ptr"> 5889 <outptr><jfloat/></outptr> 5890 <description> 5891 On return, points to the variable's value. 5892 </description> 5893 </param> 5894 </parameters> 5895 <errors> 5896 <error id="JVMTI_ERROR_INVALID_SLOT"> 5897 Invalid <code>slot</code>. 5898 </error> 5899 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 5900 The variable type is not <code>float</code>. 5901 </error> 5902 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 5903 Not a visible frame 5904 </error> 5905 </errors> 5906 </function> 5907 5908 <function id="GetLocalDouble" num="25"> 5909 <synopsis>Get Local Variable - Double</synopsis> 5910 <description> 5911 This function can be used to retrieve the value of a local 5912 variable whose type is <code>long</code>. 5913 </description> 5914 <origin>jvmdi</origin> 5915 <capabilities> 5916 <required id="can_access_local_variables"></required> 5917 </capabilities> 5918 <parameters> 5919 <param id="thread"> 5920 <jthread null="current" frame="frame"/> 5921 <description> 5922 The thread of the frame containing the variable's value. 5923 </description> 5924 </param> 5925 <param id="depth"> 5926 <jframeID thread="thread"/> 5927 <description> 5928 The depth of the frame containing the variable's value. 5929 </description> 5930 </param> 5931 <param id="slot"> 5932 <jint/> 5933 <description> 5934 The variable's slot number. 5935 </description> 5936 </param> 5937 <param id="value_ptr"> 5938 <outptr><jdouble/></outptr> 5939 <description> 5940 On return, points to the variable's value. 5941 </description> 5942 </param> 5943 </parameters> 5944 <errors> 5945 <error id="JVMTI_ERROR_INVALID_SLOT"> 5946 Invalid <code>slot</code>. 5947 </error> 5948 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 5949 The variable type is not <code>double</code>. 5950 </error> 5951 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 5952 Not a visible frame 5953 </error> 5954 </errors> 5955 </function> 5956 5957 <function id="SetLocalObject" num="26"> 5958 <synopsis>Set Local Variable - Object</synopsis> 5959 <description> 5960 This function can be used to set the value of a local 5961 variable whose type is <code>Object</code> or a subclass of <code>Object</code>. 5962 </description> 5963 <origin>jvmdi</origin> 5964 <capabilities> 5965 <required id="can_access_local_variables"></required> 5966 </capabilities> 5967 <parameters> 5968 <param id="thread"> 5969 <jthread null="current" frame="frame"/> 5970 <description> 5971 The thread of the frame containing the variable's value. 5972 </description> 5973 </param> 5974 <param id="depth"> 5975 <jframeID thread="thread"/> 5976 <description> 5977 The depth of the frame containing the variable's value. 5978 </description> 5979 </param> 5980 <param id="slot"> 5981 <jint/> 5982 <description> 5983 The variable's slot number. 5984 </description> 5985 </param> 5986 <param id="value"> 5987 <jobject/> 5988 <description> 5989 The new value for the variable. 5990 </description> 5991 </param> 5992 </parameters> 5993 <errors> 5994 <error id="JVMTI_ERROR_INVALID_SLOT"> 5995 Invalid <code>slot</code>. 5996 </error> 5997 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 5998 The variable type is not 5999 <code>Object</code> or a subclass of <code>Object</code>. 6000 </error> 6001 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6002 The supplied <paramlink id="value"/> is not compatible 6003 with the variable type. 6004 </error> 6005 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6006 Not a visible frame 6007 </error> 6008 </errors> 6009 </function> 6010 6011 <function id="SetLocalInt" num="27"> 6012 <synopsis>Set Local Variable - Int</synopsis> 6013 <description> 6014 This function can be used to set the value of a local 6015 variable whose type is <code>int</code>, 6016 <code>short</code>, <code>char</code>, <code>byte</code>, or 6017 <code>boolean</code>. 6018 </description> 6019 <origin>jvmdi</origin> 6020 <capabilities> 6021 <required id="can_access_local_variables"></required> 6022 </capabilities> 6023 <parameters> 6024 <param id="thread"> 6025 <jthread null="current" frame="frame"/> 6026 <description> 6027 The thread of the frame containing the variable's value. 6028 </description> 6029 </param> 6030 <param id="depth"> 6031 <jframeID thread="thread"/> 6032 <description> 6033 The depth of the frame containing the variable's value. 6034 </description> 6035 </param> 6036 <param id="slot"> 6037 <jint/> 6038 <description> 6039 The variable's slot number. 6040 </description> 6041 </param> 6042 <param id="value"> 6043 <jint/> 6044 <description> 6045 The new value for the variable. 6046 </description> 6047 </param> 6048 </parameters> 6049 <errors> 6050 <error id="JVMTI_ERROR_INVALID_SLOT"> 6051 Invalid <code>slot</code>. 6052 </error> 6053 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6054 The variable type is not 6055 <code>int</code>, <code>short</code>, 6056 <code>char</code>, <code>byte</code>, or 6057 <code>boolean</code>. 6058 </error> 6059 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6060 Not a visible frame 6061 </error> 6062 </errors> 6063 </function> 6064 6065 <function id="SetLocalLong" num="28"> 6066 <synopsis>Set Local Variable - Long</synopsis> 6067 <description> 6068 This function can be used to set the value of a local 6069 variable whose type is <code>long</code>. 6070 </description> 6071 <origin>jvmdi</origin> 6072 <capabilities> 6073 <required id="can_access_local_variables"></required> 6074 </capabilities> 6075 <parameters> 6076 <param id="thread"> 6077 <jthread null="current" frame="frame"/> 6078 <description> 6079 The thread of the frame containing the variable's value. 6080 </description> 6081 </param> 6082 <param id="depth"> 6083 <jframeID thread="thread"/> 6084 <description> 6085 The depth of the frame containing the variable's value. 6086 </description> 6087 </param> 6088 <param id="slot"> 6089 <jint/> 6090 <description> 6091 The variable's slot number. 6092 </description> 6093 </param> 6094 <param id="value"> 6095 <jlong/> 6096 <description> 6097 The new value for the variable. 6098 </description> 6099 </param> 6100 </parameters> 6101 <errors> 6102 <error id="JVMTI_ERROR_INVALID_SLOT"> 6103 Invalid <code>slot</code>. 6104 </error> 6105 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6106 The variable type is not <code>long</code>. 6107 </error> 6108 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6109 Not a visible frame 6110 </error> 6111 </errors> 6112 </function> 6113 6114 <function id="SetLocalFloat" num="29"> 6115 <synopsis>Set Local Variable - Float</synopsis> 6116 <description> 6117 This function can be used to set the value of a local 6118 variable whose type is <code>float</code>. 6119 </description> 6120 <origin>jvmdi</origin> 6121 <capabilities> 6122 <required id="can_access_local_variables"></required> 6123 </capabilities> 6124 <parameters> 6125 <param id="thread"> 6126 <jthread null="current" frame="frame"/> 6127 <description> 6128 The thread of the frame containing the variable's value. 6129 </description> 6130 </param> 6131 <param id="depth"> 6132 <jframeID thread="thread"/> 6133 <description> 6134 The depth of the frame containing the variable's value. 6135 </description> 6136 </param> 6137 <param id="slot"> 6138 <jint/> 6139 <description> 6140 The variable's slot number. 6141 </description> 6142 </param> 6143 <param id="value"> 6144 <jfloat/> 6145 <description> 6146 The new value for the variable. 6147 </description> 6148 </param> 6149 </parameters> 6150 <errors> 6151 <error id="JVMTI_ERROR_INVALID_SLOT"> 6152 Invalid <code>slot</code>. 6153 </error> 6154 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6155 The variable type is not <code>float</code>. 6156 </error> 6157 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6158 Not a visible frame 6159 </error> 6160 </errors> 6161 </function> 6162 6163 <function id="SetLocalDouble" num="30"> 6164 <synopsis>Set Local Variable - Double</synopsis> 6165 <description> 6166 This function can be used to set the value of a local 6167 variable whose type is <code>double</code>. 6168 </description> 6169 <origin>jvmdi</origin> 6170 <capabilities> 6171 <required id="can_access_local_variables"></required> 6172 </capabilities> 6173 <parameters> 6174 <param id="thread"> 6175 <jthread null="current" frame="frame"/> 6176 <description> 6177 The thread of the frame containing the variable's value. 6178 </description> 6179 </param> 6180 <param id="depth"> 6181 <jframeID thread="thread"/> 6182 <description> 6183 The depth of the frame containing the variable's value. 6184 </description> 6185 </param> 6186 <param id="slot"> 6187 <jint/> 6188 <description> 6189 The variable's slot number. 6190 </description> 6191 </param> 6192 <param id="value"> 6193 <jdouble/> 6194 <description> 6195 The new value for the variable. 6196 </description> 6197 </param> 6198 </parameters> 6199 <errors> 6200 <error id="JVMTI_ERROR_INVALID_SLOT"> 6201 Invalid <code>slot</code>. 6202 </error> 6203 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6204 The variable type is not <code>double</code>. 6205 </error> 6206 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6207 Not a visible frame 6208 </error> 6209 </errors> 6210 </function> 6211 </category> 6212 6213 <category id="breakpointCategory" label="Breakpoint"> 6214 6215 <intro> 6216 </intro> 6217 6218 <function id="SetBreakpoint" num="38"> 6219 <synopsis>Set Breakpoint</synopsis> 6220 <description> 6221 Set a breakpoint at the instruction indicated by 6222 <code>method</code> and <code>location</code>. 6223 An instruction can only have one breakpoint. 6224 <p/> 6225 Whenever the designated instruction is about to be executed, a 6226 <eventlink id="Breakpoint"></eventlink> event is generated. 6227 </description> 6228 <origin>jvmdi</origin> 6229 <capabilities> 6230 <required id="can_generate_breakpoint_events"></required> 6231 </capabilities> 6232 <parameters> 6233 <param id="klass"> 6234 <jclass method="method"/> 6235 <description> 6236 The class in which to set the breakpoint 6237 </description> 6238 </param> 6239 <param id="method"> 6240 <jmethodID class="klass"/> 6241 <description> 6242 The method in which to set the breakpoint 6243 </description> 6244 </param> 6245 <param id="location"> 6246 <jlocation/> 6247 <description> 6248 the index of the instruction at which to set the breakpoint 6249 6250 </description> 6251 </param> 6252 </parameters> 6253 <errors> 6254 <error id="JVMTI_ERROR_DUPLICATE"> 6255 The designated bytecode already has a breakpoint. 6256 </error> 6257 </errors> 6258 </function> 6259 6260 <function id="ClearBreakpoint" num="39"> 6261 <synopsis>Clear Breakpoint</synopsis> 6262 <description> 6263 Clear the breakpoint at the bytecode indicated by 6264 <code>method</code> and <code>location</code>. 6265 </description> 6266 <origin>jvmdi</origin> 6267 <capabilities> 6268 <required id="can_generate_breakpoint_events"></required> 6269 </capabilities> 6270 <parameters> 6271 <param id="klass"> 6272 <jclass method="method"/> 6273 <description> 6274 The class in which to clear the breakpoint 6275 </description> 6276 </param> 6277 <param id="method"> 6278 <jmethodID class="klass"/> 6279 <description> 6280 The method in which to clear the breakpoint 6281 </description> 6282 </param> 6283 <param id="location"> 6284 <jlocation/> 6285 <description> 6286 the index of the instruction at which to clear the breakpoint 6287 </description> 6288 </param> 6289 </parameters> 6290 <errors> 6291 <error id="JVMTI_ERROR_NOT_FOUND"> 6292 There's no breakpoint at the designated bytecode. 6293 </error> 6294 </errors> 6295 </function> 6296 6297 </category> 6298 6299 <category id="fieldWatch" label="Watched Field"> 6300 6301 <intro> 6302 </intro> 6303 6304 <function id="SetFieldAccessWatch" num="41"> 6305 <synopsis>Set Field Access Watch</synopsis> 6306 <description> 6307 Generate a <eventlink id="FieldAccess"></eventlink> event 6308 when the field specified 6309 by <code>klass</code> and 6310 <code>field</code> is about to be accessed. 6311 An event will be generated for each access of the field 6312 until it is canceled with 6313 <functionlink id="ClearFieldAccessWatch"></functionlink>. 6314 Field accesses from Java programming language code or from JNI code are watched, 6315 fields modified by other means are not watched. 6316 Note that <jvmti/> users should be aware that their own field accesses 6317 will trigger the watch. 6318 A field can only have one field access watch set. 6319 Modification of a field is not considered an access--use 6320 <functionlink id="SetFieldModificationWatch"></functionlink> 6321 to monitor modifications. 6322 </description> 6323 <origin>jvmdi</origin> 6324 <capabilities> 6325 <required id="can_generate_field_access_events"></required> 6326 </capabilities> 6327 <parameters> 6328 <param id="klass"> 6329 <jclass field="field"/> 6330 <description> 6331 The class containing the field to watch 6332 </description> 6333 </param> 6334 <param id="field"> 6335 <jfieldID class="klass"/> 6336 <description> 6337 The field to watch 6338 6339 </description> 6340 </param> 6341 </parameters> 6342 <errors> 6343 <error id="JVMTI_ERROR_DUPLICATE"> 6344 The designated field is already being watched for accesses. 6345 </error> 6346 </errors> 6347 </function> 6348 6349 <function id="ClearFieldAccessWatch" num="42"> 6350 <synopsis>Clear Field Access Watch</synopsis> 6351 <description> 6352 Cancel a field access watch previously set by 6353 <functionlink id="SetFieldAccessWatch"></functionlink>, on the 6354 field specified 6355 by <code>klass</code> and 6356 <code>field</code>. 6357 </description> 6358 <origin>jvmdi</origin> 6359 <capabilities> 6360 <required id="can_generate_field_access_events"></required> 6361 </capabilities> 6362 <parameters> 6363 <param id="klass"> 6364 <jclass field="field"/> 6365 <description> 6366 The class containing the field to watch 6367 </description> 6368 </param> 6369 <param id="field"> 6370 <jfieldID class="klass"/> 6371 <description> 6372 The field to watch 6373 6374 </description> 6375 </param> 6376 </parameters> 6377 <errors> 6378 <error id="JVMTI_ERROR_NOT_FOUND"> 6379 The designated field is not being watched for accesses. 6380 </error> 6381 </errors> 6382 </function> 6383 6384 <function id="SetFieldModificationWatch" num="43"> 6385 <synopsis>Set Field Modification Watch</synopsis> 6386 <description> 6387 Generate a <eventlink id="FieldModification"></eventlink> event 6388 when the field specified 6389 by <code>klass</code> and 6390 <code>field</code> is about to be modified. 6391 An event will be generated for each modification of the field 6392 until it is canceled with 6393 <functionlink id="ClearFieldModificationWatch"></functionlink>. 6394 Field modifications from Java programming language code or from JNI code are watched, 6395 fields modified by other means are not watched. 6396 Note that <jvmti/> users should be aware that their own field modifications 6397 will trigger the watch. 6398 A field can only have one field modification watch set. 6399 </description> 6400 <origin>jvmdi</origin> 6401 <capabilities> 6402 <required id="can_generate_field_modification_events"></required> 6403 </capabilities> 6404 <parameters> 6405 <param id="klass"> 6406 <jclass field="field"/> 6407 <description> 6408 The class containing the field to watch 6409 </description> 6410 </param> 6411 <param id="field"> 6412 <jfieldID class="klass"/> 6413 <description> 6414 The field to watch 6415 6416 </description> 6417 </param> 6418 </parameters> 6419 <errors> 6420 <error id="JVMTI_ERROR_DUPLICATE"> 6421 The designated field is already being watched for modifications. 6422 </error> 6423 </errors> 6424 </function> 6425 6426 <function id="ClearFieldModificationWatch" num="44"> 6427 <synopsis>Clear Field Modification Watch</synopsis> 6428 <description> 6429 6430 Cancel a field modification watch previously set by 6431 <functionlink id="SetFieldModificationWatch"></functionlink>, on the 6432 field specified 6433 by <code>klass</code> and 6434 <code>field</code>. 6435 </description> 6436 <origin>jvmdi</origin> 6437 <capabilities> 6438 <required id="can_generate_field_modification_events"></required> 6439 </capabilities> 6440 <parameters> 6441 <param id="klass"> 6442 <jclass field="field"/> 6443 <description> 6444 The class containing the field to watch 6445 </description> 6446 </param> 6447 <param id="field"> 6448 <jfieldID class="klass"/> 6449 <description> 6450 The field to watch 6451 6452 </description> 6453 </param> 6454 </parameters> 6455 <errors> 6456 <error id="JVMTI_ERROR_NOT_FOUND"> 6457 The designated field is not being watched for modifications. 6458 </error> 6459 </errors> 6460 </function> 6461 </category> 6462 6463 <category id="module" label="Module"> 6464 6465 <intro> 6466 </intro> 6467 6468 <function id="GetAllModules" num="3" since="9"> 6469 <synopsis>Get All Modules</synopsis> 6470 <description> 6471 Return an array of all modules loaded in the virtual machine. 6472 The number of modules in the array is returned via 6473 <code>module_count_ptr</code>, and the array itself via 6474 <code>modules_ptr</code>. 6475 <p/> 6476 </description> 6477 <origin>new</origin> 6478 <capabilities> 6479 <required id="can_get_modules_info"></required> 6480 </capabilities> 6481 <parameters> 6482 <param id="module_count_ptr"> 6483 <outptr><jint/></outptr> 6484 <description> 6485 On return, points to the number of returned modules. 6486 </description> 6487 </param> 6488 <param id="modules_ptr"> 6489 <allocbuf outcount="module_count_ptr"><jobject/></allocbuf> 6490 <description> 6491 On return, points to an array of references, one 6492 for each module. 6493 </description> 6494 </param> 6495 </parameters> 6496 <errors> 6497 </errors> 6498 </function> 6499 </category> 6500 6501 <category id="class" label="Class"> 6502 6503 <intro> 6504 </intro> 6505 6506 <function id="GetLoadedClasses" jkernel="yes" num="78"> 6507 <synopsis>Get Loaded Classes</synopsis> 6508 <description> 6509 Return an array of all classes loaded in the virtual machine. 6510 The number of classes in the array is returned via 6511 <code>class_count_ptr</code>, and the array itself via 6512 <code>classes_ptr</code>. 6513 <p/> 6514 Array classes of all types (including arrays of primitive types) are 6515 included in the returned list. Primitive classes (for example, 6516 <code>java.lang.Integer.TYPE</code>) are <i>not</i> included in this list. 6517 </description> 6518 <origin>jvmdi</origin> 6519 <capabilities> 6520 </capabilities> 6521 <parameters> 6522 <param id="class_count_ptr"> 6523 <outptr><jint/></outptr> 6524 <description> 6525 On return, points to the number of classes. 6526 </description> 6527 </param> 6528 <param id="classes_ptr"> 6529 <allocbuf outcount="class_count_ptr"><jclass/></allocbuf> 6530 <description> 6531 On return, points to an array of references, one 6532 for each class. 6533 </description> 6534 </param> 6535 </parameters> 6536 <errors> 6537 </errors> 6538 </function> 6539 6540 <function id="GetClassLoaderClasses" jkernel="yes" num="79"> 6541 <synopsis>Get Classloader Classes</synopsis> 6542 <description> 6543 Returns an array of those classes for which this class loader has 6544 been recorded as an initiating loader. Each 6545 class in the returned array was created by this class loader, 6546 either by defining it directly or by delegation to another class loader. 6547 See <vmspec chapter="5.3"/>. 6548 <p/> 6549 For JDK version 1.1 implementations that don't 6550 recognize the distinction between initiating and defining class loaders, 6551 this function should return all classes loaded in the virtual machine. 6552 The number of classes in the array is returned via 6553 <code>class_count_ptr</code>, and the array itself via 6554 <code>classes_ptr</code>. 6555 </description> 6556 <origin>jvmdi</origin> 6557 <capabilities> 6558 </capabilities> 6559 <parameters> 6560 <param id="initiating_loader"> 6561 <ptrtype> 6562 <jobject/> 6563 <nullok>the classes initiated by the bootstrap loader will be returned</nullok> 6564 </ptrtype> 6565 <description> 6566 An initiating class loader. 6567 </description> 6568 </param> 6569 <param id="class_count_ptr"> 6570 <outptr><jint/></outptr> 6571 <description> 6572 On return, points to the number of classes. 6573 </description> 6574 </param> 6575 <param id="classes_ptr"> 6576 <allocbuf outcount="class_count_ptr"><jclass/></allocbuf> 6577 <description> 6578 On return, points to an array of references, one 6579 for each class. 6580 </description> 6581 </param> 6582 </parameters> 6583 <errors> 6584 </errors> 6585 </function> 6586 6587 <function id="GetClassSignature" phase="start" num="48"> 6588 <synopsis>Get Class Signature</synopsis> 6589 <description> 6590 For the class indicated by <code>klass</code>, return the 6591 <externallink id="http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/types.html#wp16432">JNI 6592 type signature</externallink> 6593 and the generic signature of the class. 6594 For example, <code>java.util.List</code> is <code>"Ljava/util/List;"</code> 6595 and <code>int[]</code> is <code>"[I"</code> 6596 The returned name for primitive classes 6597 is the type signature character of the corresponding primitive type. 6598 For example, <code>java.lang.Integer.TYPE</code> is <code>"I"</code>. 6599 </description> 6600 <origin>jvmdiClone</origin> 6601 <capabilities> 6602 </capabilities> 6603 <parameters> 6604 <param id="klass"> 6605 <jclass/> 6606 <description> 6607 The class to query. 6608 </description> 6609 </param> 6610 <param id="signature_ptr"> 6611 <allocbuf> 6612 <char/> 6613 <nullok>the signature is not returned</nullok> 6614 </allocbuf> 6615 <description> 6616 On return, points to the JNI type signature of the class, encoded as a 6617 <internallink id="mUTF">modified UTF-8</internallink> string. 6618 </description> 6619 </param> 6620 <param id="generic_ptr"> 6621 <allocbuf> 6622 <char/> 6623 <nullok>the generic signature is not returned</nullok> 6624 </allocbuf> 6625 <description> 6626 On return, points to the generic signature of the class, encoded as a 6627 <internallink id="mUTF">modified UTF-8</internallink> string. 6628 If there is no generic signature attribute for the class, then, 6629 on return, points to <code>NULL</code>. 6630 </description> 6631 </param> 6632 </parameters> 6633 <errors> 6634 </errors> 6635 </function> 6636 6637 <function id="GetClassStatus" phase="start" num="49"> 6638 <synopsis>Get Class Status</synopsis> 6639 <description> 6640 Get the status of the class. Zero or more of the following bits can be 6641 set. 6642 <constants id="jvmtiClassStatus" label="Class Status Flags" kind="bits"> 6643 <constant id="JVMTI_CLASS_STATUS_VERIFIED" num="1"> 6644 Class bytecodes have been verified 6645 </constant> 6646 <constant id="JVMTI_CLASS_STATUS_PREPARED" num="2"> 6647 Class preparation is complete 6648 </constant> 6649 <constant id="JVMTI_CLASS_STATUS_INITIALIZED" num="4"> 6650 Class initialization is complete. Static initializer has been run. 6651 </constant> 6652 <constant id="JVMTI_CLASS_STATUS_ERROR" num="8"> 6653 Error during initialization makes class unusable 6654 </constant> 6655 <constant id="JVMTI_CLASS_STATUS_ARRAY" num="16"> 6656 Class is an array. If set, all other bits are zero. 6657 </constant> 6658 <constant id="JVMTI_CLASS_STATUS_PRIMITIVE" num="32"> 6659 Class is a primitive class (for example, <code>java.lang.Integer.TYPE</code>). 6660 If set, all other bits are zero. 6661 </constant> 6662 </constants> 6663 </description> 6664 <origin>jvmdi</origin> 6665 <capabilities> 6666 </capabilities> 6667 <parameters> 6668 <param id="klass"> 6669 <jclass/> 6670 <description> 6671 The class to query. 6672 </description> 6673 </param> 6674 <param id="status_ptr"> 6675 <outptr><jint/></outptr> 6676 <description> 6677 On return, points to the current state of this class as one or 6678 more of the <internallink id="jvmtiClassStatus">class status flags</internallink>. 6679 </description> 6680 </param> 6681 </parameters> 6682 <errors> 6683 </errors> 6684 </function> 6685 6686 <function id="GetSourceFileName" phase="start" num="50"> 6687 <synopsis>Get Source File Name</synopsis> 6688 <description> 6689 For the class indicated by <code>klass</code>, return the source file 6690 name via <code>source_name_ptr</code>. The returned string 6691 is a file name only and never contains a directory name. 6692 <p/> 6693 For primitive classes (for example, <code>java.lang.Integer.TYPE</code>) 6694 and for arrays this function returns 6695 <errorlink id="JVMTI_ERROR_ABSENT_INFORMATION"></errorlink>. 6696 </description> 6697 <origin>jvmdi</origin> 6698 <capabilities> 6699 <required id="can_get_source_file_name"></required> 6700 </capabilities> 6701 <parameters> 6702 <param id="klass"> 6703 <jclass/> 6704 <description> 6705 The class to query. 6706 </description> 6707 </param> 6708 <param id="source_name_ptr"> 6709 <allocbuf><char/></allocbuf> 6710 <description> 6711 On return, points to the class's source file name, encoded as a 6712 <internallink id="mUTF">modified UTF-8</internallink> string. 6713 </description> 6714 </param> 6715 </parameters> 6716 <errors> 6717 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 6718 Class information does not include a source file name. This includes 6719 cases where the class is an array class or primitive class. 6720 </error> 6721 </errors> 6722 </function> 6723 6724 <function id="GetClassModifiers" phase="start" num="51"> 6725 <synopsis>Get Class Modifiers</synopsis> 6726 <description> 6727 For the class indicated by <code>klass</code>, return the access 6728 flags 6729 via <code>modifiers_ptr</code>. 6730 Access flags are defined in <vmspec chapter="4"/>. 6731 <p/> 6732 If the class is an array class, then its public, private, and protected 6733 modifiers are the same as those of its component type. For arrays of 6734 primitives, this component type is represented by one of the primitive 6735 classes (for example, <code>java.lang.Integer.TYPE</code>). 6736 <p/> 6737 If the class is a primitive class, its public modifier is always true, 6738 and its protected and private modifiers are always false. 6739 <p/> 6740 If the class is an array class or a primitive class then its final 6741 modifier is always true and its interface modifier is always false. 6742 The values of its other modifiers are not determined by this specification. 6743 6744 </description> 6745 <origin>jvmdi</origin> 6746 <capabilities> 6747 </capabilities> 6748 <parameters> 6749 <param id="klass"> 6750 <jclass/> 6751 <description> 6752 The class to query. 6753 </description> 6754 </param> 6755 <param id="modifiers_ptr"> 6756 <outptr><jint/></outptr> 6757 <description> 6758 On return, points to the current access flags of this class. 6759 6760 </description> 6761 </param> 6762 </parameters> 6763 <errors> 6764 </errors> 6765 </function> 6766 6767 <function id="GetClassMethods" phase="start" num="52"> 6768 <synopsis>Get Class Methods</synopsis> 6769 <description> 6770 For the class indicated by <code>klass</code>, return a count of 6771 methods via <code>method_count_ptr</code> and a list of 6772 method IDs via <code>methods_ptr</code>. The method list contains 6773 constructors and static initializers as well as true methods. 6774 Only directly declared methods are returned (not inherited methods). 6775 An empty method list is returned for array classes and primitive classes 6776 (for example, <code>java.lang.Integer.TYPE</code>). 6777 </description> 6778 <origin>jvmdi</origin> 6779 <capabilities> 6780 <capability id="can_maintain_original_method_order"/> 6781 </capabilities> 6782 <parameters> 6783 <param id="klass"> 6784 <jclass/> 6785 <description> 6786 The class to query. 6787 </description> 6788 </param> 6789 <param id="method_count_ptr"> 6790 <outptr><jint/></outptr> 6791 <description> 6792 On return, points to the number of methods declared in this class. 6793 </description> 6794 </param> 6795 <param id="methods_ptr"> 6796 <allocbuf outcount="method_count_ptr"><jmethodID class="klass"/></allocbuf> 6797 <description> 6798 On return, points to the method ID array. 6799 </description> 6800 </param> 6801 </parameters> 6802 <errors> 6803 <error id="JVMTI_ERROR_CLASS_NOT_PREPARED"> 6804 <paramlink id="klass"></paramlink> is not prepared. 6805 </error> 6806 </errors> 6807 </function> 6808 6809 <function id="GetClassFields" phase="start" num="53"> 6810 <synopsis>Get Class Fields</synopsis> 6811 <description> 6812 For the class indicated by <code>klass</code>, return a count of fields 6813 via <code>field_count_ptr</code> and a list of field IDs via 6814 <code>fields_ptr</code>. 6815 Only directly declared fields are returned (not inherited fields). 6816 Fields are returned in the order they occur in the class file. 6817 An empty field list is returned for array classes and primitive classes 6818 (for example, <code>java.lang.Integer.TYPE</code>). 6819 Use JNI to determine the length of an array. 6820 </description> 6821 <origin>jvmdi</origin> 6822 <capabilities> 6823 </capabilities> 6824 <parameters> 6825 <param id="klass"> 6826 <jclass/> 6827 <description> 6828 The class to query. 6829 </description> 6830 </param> 6831 <param id="field_count_ptr"> 6832 <outptr><jint/></outptr> 6833 <description> 6834 On return, points to the number of fields declared in this class. 6835 </description> 6836 </param> 6837 <param id="fields_ptr"> 6838 <allocbuf outcount="field_count_ptr"><jfieldID/></allocbuf> 6839 <description> 6840 On return, points to the field ID array. 6841 </description> 6842 </param> 6843 </parameters> 6844 <errors> 6845 <error id="JVMTI_ERROR_CLASS_NOT_PREPARED"> 6846 <paramlink id="klass"></paramlink> is not prepared. 6847 </error> 6848 </errors> 6849 </function> 6850 6851 <function id="GetImplementedInterfaces" phase="start" num="54"> 6852 <synopsis>Get Implemented Interfaces</synopsis> 6853 <description> 6854 Return the direct super-interfaces of this class. For a class, this 6855 function returns the interfaces declared in its <code>implements</code> 6856 clause. For an interface, this function returns the interfaces declared in 6857 its <code>extends</code> clause. 6858 An empty interface list is returned for array classes and primitive classes 6859 (for example, <code>java.lang.Integer.TYPE</code>). 6860 </description> 6861 <origin>jvmdi</origin> 6862 <capabilities> 6863 </capabilities> 6864 <parameters> 6865 <param id="klass"> 6866 <jclass/> 6867 <description> 6868 The class to query. 6869 </description> 6870 </param> 6871 <param id="interface_count_ptr"> 6872 <outptr><jint/></outptr> 6873 <description> 6874 On return, points to the number of interfaces. 6875 </description> 6876 </param> 6877 <param id="interfaces_ptr"> 6878 <allocbuf outcount="interface_count_ptr"><jclass/></allocbuf> 6879 <description> 6880 On return, points to the interface array. 6881 </description> 6882 </param> 6883 </parameters> 6884 <errors> 6885 <error id="JVMTI_ERROR_CLASS_NOT_PREPARED"> 6886 <paramlink id="klass"></paramlink> is not prepared. 6887 </error> 6888 </errors> 6889 </function> 6890 6891 <function id="GetClassVersionNumbers" phase="start" num="145" since="1.1"> 6892 <synopsis>Get Class Version Numbers</synopsis> 6893 <description> 6894 For the class indicated by <code>klass</code>, 6895 return the minor and major version numbers, 6896 as defined in 6897 <vmspec chapter="4"/>. 6898 </description> 6899 <origin>new</origin> 6900 <capabilities> 6901 </capabilities> 6902 <parameters> 6903 <param id="klass"> 6904 <jclass/> 6905 <description> 6906 The class to query. 6907 </description> 6908 </param> 6909 <param id="minor_version_ptr"> 6910 <outptr><jint/></outptr> 6911 <description> 6912 On return, points to the value of the 6913 <code>minor_version</code> item of the 6914 Class File Format. 6915 Note: to be consistent with the Class File Format, 6916 the minor version number is the first parameter. 6917 </description> 6918 </param> 6919 <param id="major_version_ptr"> 6920 <outptr><jint/></outptr> 6921 <description> 6922 On return, points to the value of the 6923 <code>major_version</code> item of the 6924 Class File Format. 6925 </description> 6926 </param> 6927 </parameters> 6928 <errors> 6929 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 6930 The class is a primitive or array class. 6931 </error> 6932 </errors> 6933 </function> 6934 6935 <function id="GetConstantPool" phase="start" num="146" since="1.1"> 6936 <synopsis>Get Constant Pool</synopsis> 6937 <description> 6938 For the class indicated by <code>klass</code>, 6939 return the raw bytes of the constant pool in the format of the 6940 <code>constant_pool</code> item of 6941 <vmspec chapter="4"/>. 6942 The format of the constant pool may differ between versions 6943 of the Class File Format, so, the 6944 <functionlink id="GetClassVersionNumbers">minor and major 6945 class version numbers</functionlink> should be checked for 6946 compatibility. 6947 <p/> 6948 The returned constant pool might not have the same layout or 6949 contents as the constant pool in the defining class file. 6950 The constant pool returned by GetConstantPool() may have 6951 more or fewer entries than the defining constant pool. 6952 Entries may be in a different order. 6953 The constant pool returned by GetConstantPool() will match the 6954 constant pool used by 6955 <functionlink id="GetBytecodes">GetBytecodes()</functionlink>. 6956 That is, the bytecodes returned by GetBytecodes() will have 6957 constant pool indices which refer to constant pool entries returned 6958 by GetConstantPool(). 6959 Note that since <functionlink id="RetransformClasses"/> 6960 and <functionlink id="RedefineClasses"/> can change 6961 the constant pool, the constant pool returned by this function 6962 can change accordingly. Thus, the correspondence between 6963 GetConstantPool() and GetBytecodes() does not hold if there 6964 is an intervening class retransformation or redefinition. 6965 The value of a constant pool entry used by a given bytecode will 6966 match that of the defining class file (even if the indices don't match). 6967 Constant pool entries which are not used directly or indirectly by 6968 bytecodes (for example, UTF-8 strings associated with annotations) are 6969 not required to exist in the returned constant pool. 6970 </description> 6971 <origin>new</origin> 6972 <capabilities> 6973 <required id="can_get_constant_pool"></required> 6974 </capabilities> 6975 <parameters> 6976 <param id="klass"> 6977 <jclass/> 6978 <description> 6979 The class to query. 6980 </description> 6981 </param> 6982 <param id="constant_pool_count_ptr"> 6983 <outptr><jint/></outptr> 6984 <description> 6985 On return, points to the number of entries 6986 in the constant pool table plus one. 6987 This corresponds to the <code>constant_pool_count</code> 6988 item of the Class File Format. 6989 </description> 6990 </param> 6991 <param id="constant_pool_byte_count_ptr"> 6992 <outptr><jint/></outptr> 6993 <description> 6994 On return, points to the number of bytes 6995 in the returned raw constant pool. 6996 </description> 6997 </param> 6998 <param id="constant_pool_bytes_ptr"> 6999 <allocbuf outcount="constant_pool_byte_count_ptr"><uchar/></allocbuf> 7000 <description> 7001 On return, points to the raw constant pool, that is the bytes 7002 defined by the <code>constant_pool</code> item of the 7003 Class File Format 7004 </description> 7005 </param> 7006 </parameters> 7007 <errors> 7008 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 7009 The class is a primitive or array class. 7010 </error> 7011 </errors> 7012 </function> 7013 7014 <function id="IsInterface" phase="start" num="55"> 7015 <synopsis>Is Interface</synopsis> 7016 <description> 7017 Determines whether a class object reference represents an interface. 7018 The <code>jboolean</code> result is 7019 <code>JNI_TRUE</code> if the "class" is actually an interface, 7020 <code>JNI_FALSE</code> otherwise. 7021 </description> 7022 <origin>jvmdi</origin> 7023 <capabilities> 7024 </capabilities> 7025 <parameters> 7026 <param id="klass"> 7027 <jclass/> 7028 <description> 7029 The class to query. 7030 </description> 7031 </param> 7032 <param id="is_interface_ptr"> 7033 <outptr><jboolean/></outptr> 7034 <description> 7035 On return, points to the boolean result of this function. 7036 7037 </description> 7038 </param> 7039 </parameters> 7040 <errors> 7041 </errors> 7042 </function> 7043 7044 <function id="IsArrayClass" phase="start" num="56"> 7045 <synopsis>Is Array Class</synopsis> 7046 <description> 7047 Determines whether a class object reference represents an array. 7048 The <code>jboolean</code> result is 7049 <code>JNI_TRUE</code> if the class is an array, 7050 <code>JNI_FALSE</code> otherwise. 7051 </description> 7052 <origin>jvmdi</origin> 7053 <capabilities> 7054 </capabilities> 7055 <parameters> 7056 <param id="klass"> 7057 <jclass/> 7058 <description> 7059 The class to query. 7060 </description> 7061 </param> 7062 <param id="is_array_class_ptr"> 7063 <outptr><jboolean/></outptr> 7064 <description> 7065 On return, points to the boolean result of this function. 7066 7067 </description> 7068 </param> 7069 </parameters> 7070 <errors> 7071 </errors> 7072 </function> 7073 7074 <function id="IsModifiableClass" jkernel="yes" phase="start" num="45" since="1.1"> 7075 <synopsis>Is Modifiable Class</synopsis> 7076 <description> 7077 Determines whether a class is modifiable. 7078 If a class is modifiable (<paramlink id="is_modifiable_class_ptr"/> 7079 returns <code>JNI_TRUE</code>) the class can be 7080 redefined with <functionlink id="RedefineClasses"/> (assuming 7081 the agent possesses the 7082 <fieldlink id="can_redefine_classes" struct="jvmtiCapabilities"/> 7083 capability) or 7084 retransformed with <functionlink id="RetransformClasses"/> (assuming 7085 the agent possesses the 7086 <fieldlink id="can_retransform_classes" struct="jvmtiCapabilities"/> 7087 capability). 7088 If a class is not modifiable (<paramlink id="is_modifiable_class_ptr"/> 7089 returns <code>JNI_FALSE</code>) the class can be neither 7090 redefined nor retransformed. 7091 <p/> 7092 Primitive classes (for example, <code>java.lang.Integer.TYPE</code>) 7093 and array classes are never modifiable. 7094 <p/> 7095 </description> 7096 <origin>new</origin> 7097 <capabilities> 7098 <capability id="can_redefine_any_class"> 7099 If possessed then all classes (except primitive and array classes) 7100 are modifiable. 7101 </capability> 7102 <capability id="can_redefine_classes"> 7103 No effect on the result of the function. 7104 But must additionally be possessed to modify the class with 7105 <functionlink id="RedefineClasses"/>. 7106 </capability> 7107 <capability id="can_retransform_classes"> 7108 No effect on the result of the function. 7109 But must additionally be possessed to modify the class with 7110 <functionlink id="RetransformClasses"/>. 7111 </capability> 7112 </capabilities> 7113 <parameters> 7114 <param id="klass"> 7115 <jclass/> 7116 <description> 7117 The class to query. 7118 </description> 7119 </param> 7120 <param id="is_modifiable_class_ptr"> 7121 <outptr><jboolean/></outptr> 7122 <description> 7123 On return, points to the boolean result of this function. 7124 </description> 7125 </param> 7126 </parameters> 7127 <errors> 7128 </errors> 7129 </function> 7130 7131 <function id="GetClassLoader" phase="start" num="57"> 7132 <synopsis>Get Class Loader</synopsis> 7133 <description> 7134 For the class indicated by <code>klass</code>, return via 7135 <code>classloader_ptr</code> a reference to the class loader for the 7136 class. 7137 </description> 7138 <origin>jvmdi</origin> 7139 <capabilities> 7140 </capabilities> 7141 <parameters> 7142 <param id="klass"> 7143 <jclass/> 7144 <description> 7145 The class to query. 7146 </description> 7147 </param> 7148 <param id="classloader_ptr"> 7149 <outptr><jobject/></outptr> 7150 <description> 7151 On return, points to the class loader that loaded 7152 this class. 7153 If the class was not created by a class loader 7154 or if the class loader is the bootstrap class loader, 7155 points to <code>NULL</code>. 7156 </description> 7157 </param> 7158 </parameters> 7159 <errors> 7160 </errors> 7161 7162 </function> 7163 7164 <function id="GetSourceDebugExtension" phase="start" num="90"> 7165 <synopsis>Get Source Debug Extension</synopsis> 7166 <description> 7167 For the class indicated by <code>klass</code>, return the debug 7168 extension via <code>source_debug_extension_ptr</code>. 7169 The returned string 7170 contains exactly the debug extension information present in the 7171 class file of <code>klass</code>. 7172 </description> 7173 <origin>jvmdi</origin> 7174 <capabilities> 7175 <required id="can_get_source_debug_extension"></required> 7176 </capabilities> 7177 <parameters> 7178 <param id="klass"> 7179 <jclass/> 7180 <description> 7181 The class to query. 7182 </description> 7183 </param> 7184 <param id="source_debug_extension_ptr"> 7185 <allocbuf><char/></allocbuf> 7186 <description> 7187 On return, points to the class's debug extension, encoded as a 7188 <internallink id="mUTF">modified UTF-8</internallink> string. 7189 </description> 7190 </param> 7191 </parameters> 7192 <errors> 7193 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 7194 Class information does not include a debug extension. 7195 </error> 7196 </errors> 7197 </function> 7198 7199 <function id="RetransformClasses" jkernel="yes" num="152" since="1.1"> 7200 <synopsis>Retransform Classes</synopsis> 7201 <description> 7202 This function facilitates the 7203 <internallink id="bci">bytecode instrumentation</internallink> 7204 of already loaded classes. 7205 To replace the class definition without reference to the existing 7206 bytecodes, as one might do when recompiling from source for 7207 fix-and-continue debugging, <functionlink id="RedefineClasses"/> 7208 function should be used instead. 7209 <p/> 7210 When classes are initially loaded or when they are 7211 <functionlink id="RedefineClasses">redefined</functionlink>, 7212 the initial class file bytes can be transformed with the 7213 <eventlink id="ClassFileLoadHook"/> event. 7214 This function reruns the transformation process 7215 (whether or not a transformation has previously occurred). 7216 This retransformation follows these steps: 7217 <ul> 7218 <li>starting from the initial class file bytes 7219 </li> 7220 <li>for each <fieldlink id="can_retransform_classes" 7221 struct="jvmtiCapabilities">retransformation 7222 incapable</fieldlink> 7223 agent which received a 7224 <code>ClassFileLoadHook</code> event during the previous 7225 load or redefine, the bytes it returned 7226 (via the <code>new_class_data</code> parameter) 7227 are reused as the output of the transformation; 7228 note that this is equivalent to reapplying 7229 the previous transformation, unaltered. except that 7230 the <code>ClassFileLoadHook</code> event 7231 is <b>not</b> sent to these agents 7232 </li> 7233 <li>for each <fieldlink id="can_retransform_classes" 7234 struct="jvmtiCapabilities">retransformation 7235 capable</fieldlink> 7236 agent, the <code>ClassFileLoadHook</code> event is sent, 7237 allowing a new transformation to be applied 7238 </li> 7239 <li>the transformed class file bytes are installed as the new 7240 definition of the class 7241 </li> 7242 </ul> 7243 See the <eventlink id="ClassFileLoadHook"/> event for more details. 7244 <p/> 7245 The initial class file bytes represent the bytes passed to 7246 <code>ClassLoader.defineClass</code> 7247 or <code>RedefineClasses</code> (before any transformations 7248 were applied), however they may not exactly match them. 7249 The constant pool may differ in ways described in 7250 <functionlink id="GetConstantPool"/>. 7251 Constant pool indices in the bytecodes of methods will correspond. 7252 Some attributes may not be present. 7253 Where order is not meaningful, for example the order of methods, 7254 order may not be preserved. 7255 <p/> 7256 Retransformation can cause new versions of methods to be installed. 7257 Old method versions may become 7258 <internallink id="obsoleteMethods">obsolete</internallink> 7259 The new method version will be used on new invokes. 7260 If a method has active stack frames, those active frames continue to 7261 run the bytecodes of the original method version. 7262 <p/> 7263 This function does not cause any initialization except that which 7264 would occur under the customary JVM semantics. 7265 In other words, retransforming a class does not cause its initializers to be 7266 run. The values of static fields will remain as they were 7267 prior to the call. 7268 <p/> 7269 Threads need not be suspended. 7270 <p/> 7271 All breakpoints in the class are cleared. 7272 <p/> 7273 All attributes are updated. 7274 <p/> 7275 Instances of the retransformed class are not affected -- fields retain their 7276 previous values. 7277 <functionlink id="GetTag">Tags</functionlink> on the instances are 7278 also unaffected. 7279 <p/> 7280 In response to this call, no events other than the 7281 <eventlink id="ClassFileLoadHook"/> event 7282 will be sent. 7283 <p/> 7284 The retransformation may change method bodies, the constant pool and attributes. 7285 The retransformation must not add, remove or rename fields or methods, change the 7286 signatures of methods, change modifiers, or change inheritance. 7287 These restrictions may be lifted in future versions. 7288 See the error return description below for information on error codes 7289 returned if an unsupported retransformation is attempted. 7290 The class file bytes are not verified or installed until they have passed 7291 through the chain of <eventlink id="ClassFileLoadHook"/> events, thus the 7292 returned error code reflects the result of the transformations. 7293 If any error code is returned other than <code>JVMTI_ERROR_NONE</code>, 7294 none of the classes to be retransformed will have a new definition installed. 7295 When this function returns (with the error code of <code>JVMTI_ERROR_NONE</code>) 7296 all of the classes to be retransformed will have their new definitions installed. 7297 </description> 7298 <origin>new</origin> 7299 <capabilities> 7300 <required id="can_retransform_classes"></required> 7301 <capability id="can_retransform_any_class"></capability> 7302 </capabilities> 7303 <parameters> 7304 <param id="class_count"> 7305 <jint min="0"/> 7306 <description> 7307 The number of classes to be retransformed. 7308 </description> 7309 </param> 7310 <param id="classes"> 7311 <inbuf incount="class_count"><jclass/></inbuf> 7312 <description> 7313 The array of classes to be retransformed. 7314 </description> 7315 </param> 7316 </parameters> 7317 <errors> 7318 <error id="JVMTI_ERROR_UNMODIFIABLE_CLASS"> 7319 One of the <paramlink id="classes"/> cannot be modified. 7320 See <functionlink id="IsModifiableClass"/>. 7321 </error> 7322 <error id="JVMTI_ERROR_INVALID_CLASS"> 7323 One of the <paramlink id="classes"/> is not a valid class. 7324 </error> 7325 <error id="JVMTI_ERROR_UNSUPPORTED_VERSION"> 7326 A retransformed class file has a version number not supported by this VM. 7327 </error> 7328 <error id="JVMTI_ERROR_INVALID_CLASS_FORMAT"> 7329 A retransformed class file is malformed (The VM would return a <code>ClassFormatError</code>). 7330 </error> 7331 <error id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION"> 7332 The retransformed class file definitions would lead to a circular definition 7333 (the VM would return a <code>ClassCircularityError</code>). 7334 </error> 7335 <error id="JVMTI_ERROR_FAILS_VERIFICATION"> 7336 The retransformed class file bytes fail verification. 7337 </error> 7338 <error id="JVMTI_ERROR_NAMES_DONT_MATCH"> 7339 The class name defined in a retransformed class file is 7340 different from the name in the old class object. 7341 </error> 7342 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED"> 7343 A retransformed class file would require adding a method. 7344 </error> 7345 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED"> 7346 A retransformed class file changes a field. 7347 </error> 7348 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED"> 7349 A direct superclass is different for a retransformed class file, 7350 or the set of directly implemented 7351 interfaces is different. 7352 </error> 7353 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED"> 7354 A retransformed class file does not declare a method 7355 declared in the old class version. 7356 </error> 7357 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED"> 7358 A retransformed class file has different class modifiers. 7359 </error> 7360 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED"> 7361 A method in the retransformed class file has different modifiers 7362 than its counterpart in the old class version. 7363 </error> 7364 </errors> 7365 </function> 7366 7367 <function id="RedefineClasses" jkernel="yes" num="87"> 7368 <synopsis>Redefine Classes</synopsis> 7369 <typedef id="jvmtiClassDefinition" label="Class redefinition description"> 7370 <field id="klass"> 7371 <jclass/> 7372 <description> 7373 Class object for this class 7374 </description> 7375 </field> 7376 <field id="class_byte_count"> 7377 <jint/> 7378 <description> 7379 Number of bytes defining class (below) 7380 </description> 7381 </field> 7382 <field id="class_bytes"> 7383 <inbuf incount="class_byte_count"><uchar/></inbuf> 7384 <description> 7385 Bytes defining class (in <vmspec chapter="4"/>) 7386 </description> 7387 </field> 7388 </typedef> 7389 <description> 7390 All classes given are redefined according to the definitions 7391 supplied. 7392 This function is used to replace the definition of a class 7393 with a new definition, as might be needed in fix-and-continue 7394 debugging. 7395 Where the existing class file bytes are to be transformed, for 7396 example in 7397 <internallink id="bci">bytecode instrumentation</internallink>, 7398 <functionlink id="RetransformClasses"/> should be used. 7399 <p/> 7400 Redefinition can cause new versions of methods to be installed. 7401 Old method versions may become 7402 <internallink id="obsoleteMethods">obsolete</internallink> 7403 The new method version will be used on new invokes. 7404 If a method has active stack frames, those active frames continue to 7405 run the bytecodes of the original method version. 7406 If resetting of stack frames is desired, use 7407 <functionlink id="PopFrame"></functionlink> 7408 to pop frames with obsolete method versions. 7409 <p/> 7410 This function does not cause any initialization except that which 7411 would occur under the customary JVM semantics. 7412 In other words, redefining a class does not cause its initializers to be 7413 run. The values of static fields will remain as they were 7414 prior to the call. 7415 <p/> 7416 Threads need not be suspended. 7417 <p/> 7418 All breakpoints in the class are cleared. 7419 <p/> 7420 All attributes are updated. 7421 <p/> 7422 Instances of the redefined class are not affected -- fields retain their 7423 previous values. 7424 <functionlink id="GetTag">Tags</functionlink> on the instances are 7425 also unaffected. 7426 <p/> 7427 In response to this call, the <jvmti/> event 7428 <eventlink id="ClassFileLoadHook">Class File Load Hook</eventlink> 7429 will be sent (if enabled), but no other <jvmti/> events will be sent. 7430 <p/> 7431 The redefinition may change method bodies, the constant pool and attributes. 7432 The redefinition must not add, remove or rename fields or methods, change the 7433 signatures of methods, change modifiers, or change inheritance. 7434 These restrictions may be lifted in future versions. 7435 See the error return description below for information on error codes 7436 returned if an unsupported redefinition is attempted. 7437 The class file bytes are not verified or installed until they have passed 7438 through the chain of <eventlink id="ClassFileLoadHook"/> events, thus the 7439 returned error code reflects the result of the transformations applied 7440 to the bytes passed into <paramlink id="class_definitions"/>. 7441 If any error code is returned other than <code>JVMTI_ERROR_NONE</code>, 7442 none of the classes to be redefined will have a new definition installed. 7443 When this function returns (with the error code of <code>JVMTI_ERROR_NONE</code>) 7444 all of the classes to be redefined will have their new definitions installed. 7445 </description> 7446 <origin>jvmdi</origin> 7447 <capabilities> 7448 <required id="can_redefine_classes"></required> 7449 <capability id="can_redefine_any_class"></capability> 7450 </capabilities> 7451 <parameters> 7452 <param id="class_count"> 7453 <jint min="0"/> 7454 <description> 7455 The number of classes specified in <code>class_definitions</code> 7456 </description> 7457 </param> 7458 <param id="class_definitions"> 7459 <inbuf incount="class_count"><struct>jvmtiClassDefinition</struct></inbuf> 7460 <description> 7461 The array of new class definitions 7462 </description> 7463 </param> 7464 </parameters> 7465 <errors> 7466 <error id="JVMTI_ERROR_NULL_POINTER"> 7467 One of <code>class_bytes</code> is <code>NULL</code>. 7468 </error> 7469 <error id="JVMTI_ERROR_UNMODIFIABLE_CLASS"> 7470 An element of <code>class_definitions</code> cannot be modified. 7471 See <functionlink id="IsModifiableClass"/>. 7472 </error> 7473 <error id="JVMTI_ERROR_INVALID_CLASS"> 7474 An element of <code>class_definitions</code> is not a valid class. 7475 </error> 7476 <error id="JVMTI_ERROR_UNSUPPORTED_VERSION"> 7477 A new class file has a version number not supported by this VM. 7478 </error> 7479 <error id="JVMTI_ERROR_INVALID_CLASS_FORMAT"> 7480 A new class file is malformed (The VM would return a <code>ClassFormatError</code>). 7481 </error> 7482 <error id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION"> 7483 The new class file definitions would lead to a circular definition 7484 (the VM would return a <code>ClassCircularityError</code>). 7485 </error> 7486 <error id="JVMTI_ERROR_FAILS_VERIFICATION"> 7487 The class bytes fail verification. 7488 </error> 7489 <error id="JVMTI_ERROR_NAMES_DONT_MATCH"> 7490 The class name defined in a new class file is 7491 different from the name in the old class object. 7492 </error> 7493 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED"> 7494 A new class file would require adding a method. 7495 </error> 7496 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED"> 7497 A new class version changes a field. 7498 </error> 7499 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED"> 7500 A direct superclass is different for a new class 7501 version, or the set of directly implemented 7502 interfaces is different. 7503 </error> 7504 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED"> 7505 A new class version does not declare a method 7506 declared in the old class version. 7507 </error> 7508 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED"> 7509 A new class version has different modifiers. 7510 </error> 7511 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED"> 7512 A method in the new class version has different modifiers 7513 than its counterpart in the old class version. 7514 </error> 7515 </errors> 7516 </function> 7517 7518 </category> 7519 7520 <category id="object" label="Object"> 7521 7522 <function id="GetObjectSize" jkernel="yes" phase="start" num="154"> 7523 <synopsis>Get Object Size</synopsis> 7524 <description> 7525 For the object indicated by <code>object</code>, 7526 return via <code>size_ptr</code> the size of the object. 7527 This size is an implementation-specific approximation of 7528 the amount of storage consumed by this object. 7529 It may include some or all of the object's overhead, and thus 7530 is useful for comparison within an implementation but not 7531 between implementations. 7532 The estimate may change during a single invocation of the JVM. 7533 </description> 7534 <origin>new</origin> 7535 <capabilities> 7536 </capabilities> 7537 <parameters> 7538 <param id="object"> 7539 <jobject/> 7540 <description> 7541 The object to query. 7542 </description> 7543 </param> 7544 <param id="size_ptr"> 7545 <outptr><jlong/></outptr> 7546 <description> 7547 On return, points to the object's size in bytes. 7548 </description> 7549 </param> 7550 </parameters> 7551 <errors> 7552 </errors> 7553 </function> 7554 7555 <function id="GetObjectHashCode" phase="start" num="58"> 7556 <synopsis>Get Object Hash Code</synopsis> 7557 <description> 7558 For the object indicated by <code>object</code>, 7559 return via <code>hash_code_ptr</code> a hash code. 7560 This hash code could be used to maintain a hash table of object references, 7561 however, on some implementations this can cause significant performance 7562 impacts--in most cases 7563 <internallink id="Heap">tags</internallink> 7564 will be a more efficient means of associating information with objects. 7565 This function guarantees 7566 the same hash code value for a particular object throughout its life 7567 </description> 7568 <origin>jvmdi</origin> 7569 <capabilities> 7570 </capabilities> 7571 <parameters> 7572 <param id="object"> 7573 <jobject/> 7574 <description> 7575 The object to query. 7576 </description> 7577 </param> 7578 <param id="hash_code_ptr"> 7579 <outptr><jint/></outptr> 7580 <description> 7581 On return, points to the object's hash code. 7582 </description> 7583 </param> 7584 </parameters> 7585 <errors> 7586 </errors> 7587 </function> 7588 7589 <function id="GetObjectMonitorUsage" num="59"> 7590 <synopsis>Get Object Monitor Usage</synopsis> 7591 <typedef id="jvmtiMonitorUsage" label="Object monitor usage information"> 7592 <field id="owner"> 7593 <jthread/> 7594 <description> 7595 The thread owning this monitor, or <code>NULL</code> if unused 7596 </description> 7597 </field> 7598 <field id="entry_count"> 7599 <jint/> 7600 <description> 7601 The number of times the owning thread has entered the monitor 7602 </description> 7603 </field> 7604 <field id="waiter_count"> 7605 <jint/> 7606 <description> 7607 The number of threads waiting to own this monitor 7608 </description> 7609 </field> 7610 <field id="waiters"> 7611 <allocfieldbuf><jthread/></allocfieldbuf> 7612 <description> 7613 The <code>waiter_count</code> waiting threads 7614 </description> 7615 </field> 7616 <field id="notify_waiter_count"> 7617 <jint/> 7618 <description> 7619 The number of threads waiting to be notified by this monitor 7620 </description> 7621 </field> 7622 <field id="notify_waiters"> 7623 <allocfieldbuf><jthread/></allocfieldbuf> 7624 <description> 7625 The <code>notify_waiter_count</code> threads waiting to be notified 7626 </description> 7627 </field> 7628 </typedef> 7629 <description> 7630 Get information about the object's monitor. 7631 The fields of the <functionlink id="jvmtiMonitorUsage"></functionlink> structure 7632 are filled in with information about usage of the monitor. 7633 <todo> 7634 Decide and then clarify suspend requirements. 7635 </todo> 7636 </description> 7637 <origin>jvmdi</origin> 7638 <capabilities> 7639 <required id="can_get_monitor_info"></required> 7640 </capabilities> 7641 <parameters> 7642 <param id="object"> 7643 <jobject/> 7644 <description> 7645 The object to query. 7646 </description> 7647 </param> 7648 <param id="info_ptr"> 7649 <outptr><struct>jvmtiMonitorUsage</struct></outptr> 7650 <description> 7651 On return, filled with monitor information for the 7652 specified object. 7653 </description> 7654 </param> 7655 </parameters> 7656 <errors> 7657 </errors> 7658 </function> 7659 7660 <elide> 7661 <function id="GetObjectMonitors" num="116"> 7662 <synopsis>Get Object Monitors</synopsis> 7663 <description> 7664 Return the list of object monitors. 7665 <p/> 7666 Note: details about each monitor can be examined with 7667 <functionlink id="GetObjectMonitorUsage"></functionlink>. 7668 </description> 7669 <origin>new</origin> 7670 <capabilities> 7671 <required id="can_get_monitor_info"></required> 7672 </capabilities> 7673 <parameters> 7674 <param id="monitorCnt"> 7675 <outptr><jint/></outptr> 7676 <description> 7677 On return, pointer to the number 7678 of monitors returned in <code>monitors_ptr</code>. 7679 </description> 7680 </param> 7681 <param id="monitors_ptr"> 7682 <allocbuf outcount="monitorCnt"><jobject/></allocbuf> 7683 <description> 7684 On return, pointer to the monitor list. 7685 </description> 7686 </param> 7687 </parameters> 7688 <errors> 7689 </errors> 7690 </function> 7691 </elide> 7692 7693 </category> 7694 7695 <category id="fieldCategory" label="Field"> 7696 7697 <intro> 7698 </intro> 7699 7700 <function id="GetFieldName" phase="start" num="60"> 7701 <synopsis>Get Field Name (and Signature)</synopsis> 7702 <description> 7703 For the field indicated by <paramlink id="klass"/> and <paramlink id="field"/>, 7704 return the field name via <paramlink id="name_ptr"/> and field signature via 7705 <paramlink id="signature_ptr"/>. 7706 <p/> 7707 Field signatures are defined in the JNI Specification and 7708 are referred to as <code>field descriptors</code> in 7709 <vmspec chapter="4.3.2"/>. 7710 </description> 7711 <origin>jvmdiClone</origin> 7712 <capabilities> 7713 </capabilities> 7714 <parameters> 7715 <param id="klass"> 7716 <jclass field="field"/> 7717 <description> 7718 The class of the field to query. 7719 </description> 7720 </param> 7721 <param id="field"> 7722 <jfieldID class="klass"/> 7723 <description> 7724 The field to query. 7725 </description> 7726 </param> 7727 <param id="name_ptr"> 7728 <allocbuf> 7729 <char/> 7730 <nullok>the name is not returned</nullok> 7731 </allocbuf> 7732 <description> 7733 On return, points to the field name, encoded as a 7734 <internallink id="mUTF">modified UTF-8</internallink> string. 7735 </description> 7736 </param> 7737 <param id="signature_ptr"> 7738 <allocbuf> 7739 <char/> 7740 <nullok>the signature is not returned</nullok> 7741 </allocbuf> 7742 <description> 7743 On return, points to the field signature, encoded as a 7744 <internallink id="mUTF">modified UTF-8</internallink> string. 7745 </description> 7746 </param> 7747 <param id="generic_ptr"> 7748 <allocbuf> 7749 <char/> 7750 <nullok>the generic signature is not returned</nullok> 7751 </allocbuf> 7752 <description> 7753 On return, points to the generic signature of the field, encoded as a 7754 <internallink id="mUTF">modified UTF-8</internallink> string. 7755 If there is no generic signature attribute for the field, then, 7756 on return, points to <code>NULL</code>. 7757 </description> 7758 </param> 7759 </parameters> 7760 <errors> 7761 </errors> 7762 </function> 7763 7764 <function id="GetFieldDeclaringClass" phase="start" num="61"> 7765 <synopsis>Get Field Declaring Class</synopsis> 7766 <description> 7767 For the field indicated by <code>klass</code> and <code>field</code> 7768 return the class that defined it via <code>declaring_class_ptr</code>. 7769 The declaring class will either be <code>klass</code>, a superclass, or 7770 an implemented interface. 7771 </description> 7772 <origin>jvmdi</origin> 7773 <capabilities> 7774 </capabilities> 7775 <parameters> 7776 <param id="klass"> 7777 <jclass field="field"/> 7778 <description> 7779 The class to query. 7780 </description> 7781 </param> 7782 <param id="field"> 7783 <jfieldID class="klass"/> 7784 <description> 7785 The field to query. 7786 </description> 7787 </param> 7788 <param id="declaring_class_ptr"> 7789 <outptr><jclass/></outptr> 7790 <description> 7791 On return, points to the declaring class 7792 </description> 7793 </param> 7794 </parameters> 7795 <errors> 7796 </errors> 7797 </function> 7798 7799 <function id="GetFieldModifiers" phase="start" num="62"> 7800 <synopsis>Get Field Modifiers</synopsis> 7801 <description> 7802 For the field indicated by <code>klass</code> and <code>field</code> 7803 return the access flags via <code>modifiers_ptr</code>. 7804 Access flags are defined in <vmspec chapter="4"/>. 7805 </description> 7806 <origin>jvmdi</origin> 7807 <capabilities> 7808 </capabilities> 7809 <parameters> 7810 <param id="klass"> 7811 <jclass field="field"/> 7812 <description> 7813 The class to query. 7814 </description> 7815 </param> 7816 <param id="field"> 7817 <jfieldID class="klass"/> 7818 <description> 7819 The field to query. 7820 </description> 7821 </param> 7822 <param id="modifiers_ptr"> 7823 <outptr><jint/></outptr> 7824 <description> 7825 On return, points to the access flags. 7826 </description> 7827 </param> 7828 </parameters> 7829 <errors> 7830 </errors> 7831 </function> 7832 7833 <function id="IsFieldSynthetic" phase="start" num="63"> 7834 <synopsis>Is Field Synthetic</synopsis> 7835 <description> 7836 For the field indicated by <code>klass</code> and <code>field</code>, return a 7837 value indicating whether the field is synthetic via <code>is_synthetic_ptr</code>. 7838 Synthetic fields are generated by the compiler but not present in the 7839 original source code. 7840 </description> 7841 <origin>jvmdi</origin> 7842 <capabilities> 7843 <required id="can_get_synthetic_attribute"></required> 7844 </capabilities> 7845 <parameters> 7846 <param id="klass"> 7847 <jclass field="field"/> 7848 <description> 7849 The class of the field to query. 7850 </description> 7851 </param> 7852 <param id="field"> 7853 <jfieldID class="klass"/> 7854 <description> 7855 The field to query. 7856 </description> 7857 </param> 7858 <param id="is_synthetic_ptr"> 7859 <outptr><jboolean/></outptr> 7860 <description> 7861 On return, points to the boolean result of this function. 7862 </description> 7863 </param> 7864 </parameters> 7865 <errors> 7866 </errors> 7867 </function> 7868 7869 </category> 7870 7871 <category id="method" label="Method"> 7872 7873 <intro> 7874 These functions provide information about a method (represented as a 7875 <typelink id="jmethodID"/>) and set how methods are processed. 7876 </intro> 7877 7878 <intro id="obsoleteMethods" label="Obsolete Methods"> 7879 The functions <functionlink id="RetransformClasses"/> and 7880 <functionlink id="RedefineClasses"/> can cause new versions 7881 of methods to be installed. 7882 An original version of a method is considered equivalent 7883 to the new version if: 7884 <ul> 7885 <li>their bytecodes are the same except for indices into the 7886 constant pool and </li> 7887 <li>the referenced constants are equal.</li> 7888 </ul> 7889 An original method version which is not equivalent to the 7890 new method version is called obsolete and is assigned a new method ID; 7891 the original method ID now refers to the new method version. 7892 A method ID can be tested for obsolescence with 7893 <functionlink id="IsMethodObsolete"/>. 7894 </intro> 7895 7896 <function id="GetMethodName" phase="start" num="64"> 7897 <synopsis>Get Method Name (and Signature)</synopsis> 7898 <description> 7899 For the method indicated by <code>method</code>, 7900 return the method name via <code>name_ptr</code> and method signature via 7901 <code>signature_ptr</code>. 7902 <p/> 7903 Method signatures are defined in the JNI Specification and are 7904 referred to as <code>method descriptors</code> in 7905 <vmspec chapter="4.3.3"/>. 7906 Note this is different 7907 than method signatures as defined in the <i>Java Language Specification</i>. 7908 </description> 7909 <origin>jvmdiClone</origin> 7910 <capabilities> 7911 </capabilities> 7912 <parameters> 7913 <param id="method"> 7914 <jmethodID/> 7915 <description> 7916 The method to query. 7917 </description> 7918 </param> 7919 <param id="name_ptr"> 7920 <allocbuf> 7921 <char/> 7922 <nullok>the name is not returned</nullok> 7923 </allocbuf> 7924 <description> 7925 On return, points to the method name, encoded as a 7926 <internallink id="mUTF">modified UTF-8</internallink> string. 7927 </description> 7928 </param> 7929 <param id="signature_ptr"> 7930 <allocbuf> 7931 <char/> 7932 <nullok>the signature is not returned</nullok> 7933 </allocbuf> 7934 <description> 7935 On return, points to the method signature, encoded as a 7936 <internallink id="mUTF">modified UTF-8</internallink> string. 7937 </description> 7938 </param> 7939 <param id="generic_ptr"> 7940 <allocbuf> 7941 <char/> 7942 <nullok>the generic signature is not returned</nullok> 7943 </allocbuf> 7944 <description> 7945 On return, points to the generic signature of the method, encoded as a 7946 <internallink id="mUTF">modified UTF-8</internallink> string. 7947 If there is no generic signature attribute for the method, then, 7948 on return, points to <code>NULL</code>. 7949 </description> 7950 </param> 7951 </parameters> 7952 <errors> 7953 </errors> 7954 </function> 7955 7956 <function id="GetMethodDeclaringClass" phase="start" num="65"> 7957 <synopsis>Get Method Declaring Class</synopsis> 7958 <description> 7959 For the method indicated by <code>method</code>, 7960 return the class that defined it via <code>declaring_class_ptr</code>. 7961 </description> 7962 <origin>jvmdi</origin> 7963 <capabilities> 7964 </capabilities> 7965 <parameters> 7966 <param id="klass"> 7967 <jclass method="method"/> 7968 <description> 7969 The class to query. 7970 </description> 7971 </param> 7972 <param id="method"> 7973 <jmethodID class="klass"/> 7974 <description> 7975 The method to query. 7976 </description> 7977 </param> 7978 <param id="declaring_class_ptr"> 7979 <outptr><jclass/></outptr> 7980 <description> 7981 On return, points to the declaring class 7982 </description> 7983 </param> 7984 </parameters> 7985 <errors> 7986 </errors> 7987 </function> 7988 7989 <function id="GetMethodModifiers" phase="start" num="66"> 7990 <synopsis>Get Method Modifiers</synopsis> 7991 <description> 7992 For the method indicated by <code>method</code>, 7993 return the access flags via <code>modifiers_ptr</code>. 7994 Access flags are defined in <vmspec chapter="4"/>. 7995 </description> 7996 <origin>jvmdi</origin> 7997 <capabilities> 7998 </capabilities> 7999 <parameters> 8000 <param id="klass"> 8001 <jclass method="method"/> 8002 <description> 8003 The class to query. 8004 </description> 8005 </param> 8006 <param id="method"> 8007 <jmethodID class="klass"/> 8008 <description> 8009 The method to query. 8010 </description> 8011 </param> 8012 <param id="modifiers_ptr"> 8013 <outptr><jint/></outptr> 8014 <description> 8015 On return, points to the access flags. 8016 </description> 8017 </param> 8018 </parameters> 8019 <errors> 8020 </errors> 8021 </function> 8022 8023 <function id="GetMaxLocals" phase="start" num="68"> 8024 <synopsis>Get Max Locals</synopsis> 8025 <description> 8026 For the method indicated by <code>method</code>, 8027 return the number of local variable slots used by the method, 8028 including the local variables used to pass parameters to the 8029 method on its invocation. 8030 <p/> 8031 See <code>max_locals</code> in <vmspec chapter="4.7.3"/>. 8032 </description> 8033 <origin>jvmdi</origin> 8034 <capabilities> 8035 </capabilities> 8036 <parameters> 8037 <param id="klass"> 8038 <jclass method="method"/> 8039 <description> 8040 The class to query. 8041 </description> 8042 </param> 8043 <param id="method"> 8044 <jmethodID class="klass" native="error"/> 8045 <description> 8046 The method to query. 8047 </description> 8048 </param> 8049 <param id="max_ptr"> 8050 <outptr><jint/></outptr> 8051 <description> 8052 On return, points to the maximum number of local slots 8053 </description> 8054 </param> 8055 </parameters> 8056 <errors> 8057 </errors> 8058 </function> 8059 8060 <function id="GetArgumentsSize" phase="start" num="69"> 8061 <synopsis>Get Arguments Size</synopsis> 8062 <description> 8063 For the method indicated by <code>method</code>, 8064 return via <code>max_ptr</code> the number of local variable slots used 8065 by the method's arguments. 8066 Note that two-word arguments use two slots. 8067 </description> 8068 <origin>jvmdi</origin> 8069 <capabilities> 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="size_ptr"> 8085 <outptr><jint/></outptr> 8086 <description> 8087 On return, points to the number of argument slots 8088 </description> 8089 </param> 8090 </parameters> 8091 <errors> 8092 </errors> 8093 </function> 8094 8095 <function id="GetLineNumberTable" phase="start" num="70"> 8096 <synopsis>Get Line Number Table</synopsis> 8097 <typedef id="jvmtiLineNumberEntry" label="Line number table entry"> 8098 <field id="start_location"> 8099 <jlocation/> 8100 <description> 8101 the <datalink id="jlocation"></datalink> where the line begins 8102 </description> 8103 </field> 8104 <field id="line_number"> 8105 <jint/> 8106 <description> 8107 the line number 8108 </description> 8109 </field> 8110 </typedef> 8111 <description> 8112 For the method indicated by <code>method</code>, 8113 return a table of source line number entries. The size of the table is 8114 returned via <code>entry_count_ptr</code> and the table itself is 8115 returned via <code>table_ptr</code>. 8116 </description> 8117 <origin>jvmdi</origin> 8118 <capabilities> 8119 <required id="can_get_line_numbers"></required> 8120 </capabilities> 8121 <parameters> 8122 <param id="klass"> 8123 <jclass method="method"/> 8124 <description> 8125 The class to query. 8126 </description> 8127 </param> 8128 <param id="method"> 8129 <jmethodID class="klass" native="error"/> 8130 <description> 8131 The method to query. 8132 </description> 8133 </param> 8134 <param id="entry_count_ptr"> 8135 <outptr><jint/></outptr> 8136 <description> 8137 On return, points to the number of entries in the table 8138 </description> 8139 </param> 8140 <param id="table_ptr"> 8141 <allocbuf outcount="entry_count_ptr"><struct>jvmtiLineNumberEntry</struct></allocbuf> 8142 <description> 8143 On return, points to the line number table pointer. 8144 </description> 8145 </param> 8146 </parameters> 8147 <errors> 8148 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 8149 Class information does not include line numbers. 8150 </error> 8151 </errors> 8152 </function> 8153 8154 <function id="GetMethodLocation" phase="start" num="71"> 8155 <synopsis>Get Method Location</synopsis> 8156 <description> 8157 For the method indicated by <code>method</code>, 8158 return the beginning and ending addresses through 8159 <code>start_location_ptr</code> and <code>end_location_ptr</code>. In a 8160 conventional byte code indexing scheme, 8161 <code>start_location_ptr</code> will always point to zero 8162 and <code>end_location_ptr</code> 8163 will always point to the byte code count minus one. 8164 </description> 8165 <origin>jvmdi</origin> 8166 <capabilities> 8167 </capabilities> 8168 <parameters> 8169 <param id="klass"> 8170 <jclass method="method"/> 8171 <description> 8172 The class to query. 8173 </description> 8174 </param> 8175 <param id="method"> 8176 <jmethodID class="klass" native="error"/> 8177 <description> 8178 The method to query. 8179 </description> 8180 </param> 8181 <param id="start_location_ptr"> 8182 <outptr><jlocation/></outptr> 8183 <description> 8184 On return, points to the first location, or 8185 <code>-1</code> if location information is not available. 8186 If the information is available and 8187 <functionlink id="GetJLocationFormat"></functionlink> 8188 returns <datalink id="JVMTI_JLOCATION_JVMBCI"></datalink> 8189 then this will always be zero. 8190 </description> 8191 </param> 8192 <param id="end_location_ptr"> 8193 <outptr><jlocation/></outptr> 8194 <description> 8195 On return, points to the last location, 8196 or <code>-1</code> if location information is not available. 8197 </description> 8198 </param> 8199 </parameters> 8200 <errors> 8201 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 8202 Class information does not include method sizes. 8203 </error> 8204 </errors> 8205 </function> 8206 8207 <function id="GetLocalVariableTable" num="72"> 8208 <synopsis>Get Local Variable Table</synopsis> 8209 <typedef id="jvmtiLocalVariableEntry" label="Local variable table entry"> 8210 <field id="start_location"> 8211 <jlocation/> 8212 <description> 8213 The code array index where the local variable is first valid 8214 (that is, where it must have a value). 8215 </description> 8216 </field> 8217 <field id="length"> 8218 <jint/> 8219 <description> 8220 The length of the valid section for this local variable. 8221 The last code array index where the local variable is valid 8222 is <code>start_location + length</code>. 8223 </description> 8224 </field> 8225 <field id="name"> 8226 <allocfieldbuf><char/></allocfieldbuf> 8227 <description> 8228 The local variable name, encoded as a 8229 <internallink id="mUTF">modified UTF-8</internallink> string. 8230 </description> 8231 </field> 8232 <field id="signature"> 8233 <allocfieldbuf><char/></allocfieldbuf> 8234 <description> 8235 The local variable's type signature, encoded as a 8236 <internallink id="mUTF">modified UTF-8</internallink> string. 8237 The signature format is the same as that defined in 8238 <vmspec chapter="4.3.2"/>. 8239 </description> 8240 </field> 8241 <field id="generic_signature"> 8242 <allocfieldbuf><char/></allocfieldbuf> 8243 <description> 8244 The local variable's generic signature, encoded as a 8245 <internallink id="mUTF">modified UTF-8</internallink> string. 8246 The value of this field will be <code>NULL</code> for any local 8247 variable which does not have a generic type. 8248 </description> 8249 </field> 8250 <field id="slot"> 8251 <jint/> 8252 <description> 8253 The local variable's slot. See <internallink id="local">Local Variables</internallink>. 8254 </description> 8255 </field> 8256 </typedef> 8257 <description> 8258 Return local variable information. 8259 </description> 8260 <origin>jvmdiClone</origin> 8261 <capabilities> 8262 <required id="can_access_local_variables"></required> 8263 </capabilities> 8264 <parameters> 8265 <param id="method"> 8266 <jmethodID native="error"/> 8267 <description> 8268 The method to query. 8269 </description> 8270 </param> 8271 <param id="entry_count_ptr"> 8272 <outptr><jint/></outptr> 8273 <description> 8274 On return, points to the number of entries in the table 8275 </description> 8276 </param> 8277 <param id="table_ptr"> 8278 <allocbuf outcount="entry_count_ptr"><struct>jvmtiLocalVariableEntry</struct></allocbuf> 8279 <description> 8280 On return, points to an array of local variable table entries. 8281 </description> 8282 </param> 8283 </parameters> 8284 <errors> 8285 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 8286 Class information does not include local variable 8287 information. 8288 </error> 8289 </errors> 8290 </function> 8291 8292 <function id="GetBytecodes" phase="start" num="75"> 8293 <synopsis>Get Bytecodes</synopsis> 8294 <description> 8295 For the method indicated by <code>method</code>, 8296 return the byte codes that implement the method. The number of 8297 bytecodes is returned via <code>bytecode_count_ptr</code>. The byte codes 8298 themselves are returned via <code>bytecodes_ptr</code>. 8299 </description> 8300 <origin>jvmdi</origin> 8301 <capabilities> 8302 <required id="can_get_bytecodes"></required> 8303 </capabilities> 8304 <parameters> 8305 <param id="klass"> 8306 <jclass method="method"/> 8307 <description> 8308 The class to query. 8309 </description> 8310 </param> 8311 <param id="method"> 8312 <jmethodID class="klass" native="error"/> 8313 <description> 8314 The method to query. 8315 </description> 8316 </param> 8317 <param id="bytecode_count_ptr"> 8318 <outptr><jint/></outptr> 8319 <description> 8320 On return, points to the length of the byte code array 8321 </description> 8322 </param> 8323 <param id="bytecodes_ptr"> 8324 <allocbuf outcount="bytecode_count_ptr"><uchar/></allocbuf> 8325 <description> 8326 On return, points to the pointer to the byte code array 8327 </description> 8328 </param> 8329 </parameters> 8330 <errors> 8331 </errors> 8332 </function> 8333 8334 <function id="IsMethodNative" phase="start" num="76"> 8335 <synopsis>Is Method Native</synopsis> 8336 <description> 8337 For the method indicated by <code>method</code>, return a 8338 value indicating whether the method is native via <code>is_native_ptr</code> 8339 </description> 8340 <origin>jvmdi</origin> 8341 <capabilities> 8342 </capabilities> 8343 <parameters> 8344 <param id="klass"> 8345 <jclass method="method"/> 8346 <description> 8347 The class to query. 8348 </description> 8349 </param> 8350 <param id="method"> 8351 <jmethodID class="klass"/> 8352 <description> 8353 The method to query. 8354 </description> 8355 </param> 8356 <param id="is_native_ptr"> 8357 <outptr><jboolean/></outptr> 8358 <description> 8359 On return, points to the boolean result of this function. 8360 </description> 8361 </param> 8362 </parameters> 8363 <errors> 8364 </errors> 8365 </function> 8366 8367 <function id="IsMethodSynthetic" phase="start" num="77"> 8368 <synopsis>Is Method Synthetic</synopsis> 8369 <description> 8370 For the method indicated by <code>method</code>, return a 8371 value indicating whether the method is synthetic via <code>is_synthetic_ptr</code>. 8372 Synthetic methods are generated by the compiler but not present in the 8373 original source code. 8374 </description> 8375 <origin>jvmdi</origin> 8376 <capabilities> 8377 <required id="can_get_synthetic_attribute"></required> 8378 </capabilities> 8379 <parameters> 8380 <param id="klass"> 8381 <jclass method="method"/> 8382 <description> 8383 The class to query. 8384 </description> 8385 </param> 8386 <param id="method"> 8387 <jmethodID class="klass"/> 8388 <description> 8389 The method to query. 8390 </description> 8391 </param> 8392 <param id="is_synthetic_ptr"> 8393 <outptr><jboolean/></outptr> 8394 <description> 8395 On return, points to the boolean result of this function. 8396 </description> 8397 </param> 8398 </parameters> 8399 <errors> 8400 </errors> 8401 </function> 8402 8403 <function id="IsMethodObsolete" phase="start" num="91"> 8404 <synopsis>Is Method Obsolete</synopsis> 8405 <description> 8406 Determine if a method ID refers to an 8407 <internallink id="obsoleteMethods">obsolete</internallink> 8408 method version. 8409 </description> 8410 <origin>jvmdi</origin> 8411 <capabilities> 8412 </capabilities> 8413 <parameters> 8414 <param id="klass"> 8415 <jclass method="method"/> 8416 <description> 8417 The class to query. 8418 </description> 8419 </param> 8420 <param id="method"> 8421 <jmethodID class="klass"/> 8422 <description> 8423 The method ID to query. 8424 </description> 8425 </param> 8426 <param id="is_obsolete_ptr"> 8427 <outptr><jboolean/></outptr> 8428 <description> 8429 On return, points to the boolean result of this function. 8430 </description> 8431 </param> 8432 </parameters> 8433 <errors> 8434 </errors> 8435 </function> 8436 8437 <function id="SetNativeMethodPrefix" jkernel="yes" phase="any" num="73" since="1.1"> 8438 <synopsis>Set Native Method Prefix</synopsis> 8439 <description> 8440 This function modifies the failure handling of 8441 native method resolution by allowing retry 8442 with a prefix applied to the name. 8443 When used with the 8444 <eventlink id="ClassFileLoadHook">ClassFileLoadHook 8445 event</eventlink>, it enables native methods to be 8446 <internallink id="bci">instrumented</internallink>. 8447 <p/> 8448 Since native methods cannot be directly instrumented 8449 (they have no bytecodes), they must be wrapped with 8450 a non-native method which can be instrumented. 8451 For example, if we had: 8452 <example> 8453 native boolean foo(int x);</example> 8454 <p/> 8455 We could transform the class file (with the 8456 ClassFileLoadHook event) so that this becomes: 8457 <example> 8458 boolean foo(int x) { 8459 <i>... record entry to foo ...</i> 8460 return wrapped_foo(x); 8461 } 8462 8463 native boolean wrapped_foo(int x);</example> 8464 <p/> 8465 Where foo becomes a wrapper for the actual native method 8466 with the appended prefix "wrapped_". Note that 8467 "wrapped_" would be a poor choice of prefix since it 8468 might conceivably form the name of an existing method 8469 thus something like "$$$MyAgentWrapped$$$_" would be 8470 better but would make these examples less readable. 8471 <p/> 8472 The wrapper will allow data to be collected on the native 8473 method call, but now the problem becomes linking up the 8474 wrapped method with the native implementation. 8475 That is, the method <code>wrapped_foo</code> needs to be 8476 resolved to the native implementation of <code>foo</code>, 8477 which might be: 8478 <example> 8479 Java_somePackage_someClass_foo(JNIEnv* env, jint x)</example> 8480 <p/> 8481 This function allows the prefix to be specified and the 8482 proper resolution to occur. 8483 Specifically, when the standard resolution fails, the 8484 resolution is retried taking the prefix into consideration. 8485 There are two ways that resolution occurs, explicit 8486 resolution with the JNI function <code>RegisterNatives</code> 8487 and the normal automatic resolution. For 8488 <code>RegisterNatives</code>, the VM will attempt this 8489 association: 8490 <example> 8491 method(foo) -> nativeImplementation(foo)</example> 8492 <p/> 8493 When this fails, the resolution will be retried with 8494 the specified prefix prepended to the method name, 8495 yielding the correct resolution: 8496 <example> 8497 method(wrapped_foo) -> nativeImplementation(foo)</example> 8498 <p/> 8499 For automatic resolution, the VM will attempt: 8500 <example> 8501 method(wrapped_foo) -> nativeImplementation(wrapped_foo)</example> 8502 <p/> 8503 When this fails, the resolution will be retried with 8504 the specified prefix deleted from the implementation name, 8505 yielding the correct resolution: 8506 <example> 8507 method(wrapped_foo) -> nativeImplementation(foo)</example> 8508 <p/> 8509 Note that since the prefix is only used when standard 8510 resolution fails, native methods can be wrapped selectively. 8511 <p/> 8512 Since each <jvmti/> environment is independent and 8513 can do its own transformation of the bytecodes, more 8514 than one layer of wrappers may be applied. Thus each 8515 environment needs its own prefix. Since transformations 8516 are applied in order, the prefixes, if applied, will 8517 be applied in the same order. 8518 The order of transformation application is described in 8519 the <eventlink id="ClassFileLoadHook"/> event. 8520 Thus if three environments applied 8521 wrappers, <code>foo</code> might become 8522 <code>$env3_$env2_$env1_foo</code>. But if, say, 8523 the second environment did not apply a wrapper to 8524 <code>foo</code> it would be just 8525 <code>$env3_$env1_foo</code>. To be able to 8526 efficiently determine the sequence of prefixes, 8527 an intermediate prefix is only applied if its non-native 8528 wrapper exists. Thus, in the last example, even though 8529 <code>$env1_foo</code> is not a native method, the 8530 <code>$env1_</code> prefix is applied since 8531 <code>$env1_foo</code> exists. 8532 <p/> 8533 Since the prefixes are used at resolution time 8534 and since resolution may be arbitrarily delayed, a 8535 native method prefix must remain set as long as there 8536 are corresponding prefixed native methods. 8537 </description> 8538 <origin>new</origin> 8539 <capabilities> 8540 <required id="can_set_native_method_prefix"></required> 8541 </capabilities> 8542 <parameters> 8543 <param id="prefix"> 8544 <inbuf> 8545 <char/> 8546 <nullok> 8547 any existing prefix in this environment is cancelled 8548 </nullok> 8549 </inbuf> 8550 <description> 8551 The prefix to apply, encoded as a 8552 <internallink id="mUTF">modified UTF-8</internallink> string. 8553 </description> 8554 </param> 8555 </parameters> 8556 <errors> 8557 </errors> 8558 </function> 8559 8560 <function id="SetNativeMethodPrefixes" jkernel="yes" phase="any" num="74" since="1.1"> 8561 <synopsis>Set Native Method Prefixes</synopsis> 8562 <description> 8563 For a normal agent, <functionlink id="SetNativeMethodPrefix"/> 8564 will provide all needed native method prefixing. 8565 For a meta-agent that performs multiple independent class 8566 file transformations (for example as a proxy for another 8567 layer of agents) this function allows each transformation 8568 to have its own prefix. 8569 The prefixes are applied in the order supplied and are 8570 processed in the same manor as described for the 8571 application of prefixes from multiple <jvmti/> environments 8572 in <functionlink id="SetNativeMethodPrefix"/>. 8573 <p/> 8574 Any previous prefixes are replaced. Thus, calling this 8575 function with a <paramlink id="prefix_count"/> of <code>0</code> 8576 disables prefixing in this environment. 8577 <p/> 8578 <functionlink id="SetNativeMethodPrefix"/> and this function 8579 are the two ways to set the prefixes. 8580 Calling <code>SetNativeMethodPrefix</code> with 8581 a prefix is the same as calling this function with 8582 <paramlink id="prefix_count"/> of <code>1</code>. 8583 Calling <code>SetNativeMethodPrefix</code> with 8584 <code>NULL</code> is the same as calling this function with 8585 <paramlink id="prefix_count"/> of <code>0</code>. 8586 </description> 8587 <origin>new</origin> 8588 <capabilities> 8589 <required id="can_set_native_method_prefix"></required> 8590 </capabilities> 8591 <parameters> 8592 <param id="prefix_count"> 8593 <jint min="0"/> 8594 <description> 8595 The number of prefixes to apply. 8596 </description> 8597 </param> 8598 <param id="prefixes"> 8599 <agentbuf> 8600 <char/> 8601 </agentbuf> 8602 <description> 8603 The prefixes to apply for this environment, each encoded as a 8604 <internallink id="mUTF">modified UTF-8</internallink> string. 8605 </description> 8606 </param> 8607 </parameters> 8608 <errors> 8609 </errors> 8610 </function> 8611 8612 </category> 8613 8614 <category id="RawMonitors" label="Raw Monitor"> 8615 8616 <function id="CreateRawMonitor" phase="onload" callbacksafe="safe" num="31"> 8617 <synopsis>Create Raw Monitor</synopsis> 8618 <description> 8619 Create a raw monitor. 8620 </description> 8621 <origin>jvmdi</origin> 8622 <capabilities> 8623 </capabilities> 8624 <parameters> 8625 <param id="name"> 8626 <inbuf><char/></inbuf> 8627 <description> 8628 A name to identify the monitor, encoded as a 8629 <internallink id="mUTF">modified UTF-8</internallink> string. 8630 </description> 8631 </param> 8632 <param id="monitor_ptr"> 8633 <outptr><jrawMonitorID/></outptr> 8634 <description> 8635 On return, points to the created monitor. 8636 </description> 8637 </param> 8638 </parameters> 8639 <errors> 8640 </errors> 8641 </function> 8642 8643 <function id="DestroyRawMonitor" phase="onload" callbacksafe="safe" num="32"> 8644 <synopsis>Destroy Raw Monitor</synopsis> 8645 <description> 8646 Destroy the raw monitor. 8647 If the monitor being destroyed has been entered by this thread, it will be 8648 exited before it is destroyed. 8649 If the monitor being destroyed has been entered by another thread, 8650 an error will be returned and the monitor will not be destroyed. 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="RawMonitorEnter" phase="any" callbacksafe="safe" impl="innative notrace" num="33"> 8671 <synopsis>Raw Monitor Enter</synopsis> 8672 <description> 8673 Gain exclusive ownership of a raw monitor. 8674 The same thread may enter a monitor more then once. 8675 The thread must 8676 <functionlink id="RawMonitorExit">exit</functionlink> 8677 the monitor the same number of times as it is entered. 8678 If a monitor is entered during <code>OnLoad</code> (before attached threads exist) 8679 and has not exited when attached threads come into existence, the enter 8680 is considered to have occurred on the main thread. 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 </parameters> 8693 <errors> 8694 </errors> 8695 </function> 8696 8697 <function id="RawMonitorExit" phase="any" callbacksafe="safe" impl="innative notrace" num="34"> 8698 <synopsis>Raw Monitor Exit</synopsis> 8699 <description> 8700 Release exclusive ownership of a raw monitor. 8701 </description> 8702 <origin>jvmdi</origin> 8703 <capabilities> 8704 </capabilities> 8705 <parameters> 8706 <param id="monitor"> 8707 <jrawMonitorID/> 8708 <description> 8709 The monitor 8710 </description> 8711 </param> 8712 </parameters> 8713 <errors> 8714 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 8715 Not monitor owner 8716 </error> 8717 </errors> 8718 </function> 8719 8720 <function id="RawMonitorWait" phase="any" callbacksafe="safe" impl="innative notrace" num="35"> 8721 <synopsis>Raw Monitor Wait</synopsis> 8722 <description> 8723 Wait for notification of the raw monitor. 8724 <p/> 8725 Causes the current thread to wait until either another thread calls 8726 <functionlink id="RawMonitorNotify"/> or 8727 <functionlink id="RawMonitorNotifyAll"/> 8728 for the specified raw monitor, or the specified 8729 <paramlink id="millis">timeout</paramlink> 8730 has elapsed. 8731 </description> 8732 <origin>jvmdi</origin> 8733 <capabilities> 8734 </capabilities> 8735 <parameters> 8736 <param id="monitor"> 8737 <jrawMonitorID/> 8738 <description> 8739 The monitor 8740 </description> 8741 </param> 8742 <param id="millis"> 8743 <jlong/> 8744 <description> 8745 The timeout, in milliseconds. If the timeout is 8746 zero, then real time is not taken into consideration 8747 and the thread simply waits until notified. 8748 </description> 8749 </param> 8750 </parameters> 8751 <errors> 8752 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 8753 Not monitor owner 8754 </error> 8755 <error id="JVMTI_ERROR_INTERRUPT"> 8756 Wait was interrupted, try again 8757 </error> 8758 </errors> 8759 </function> 8760 8761 <function id="RawMonitorNotify" phase="any" callbacksafe="safe" impl="notrace" num="36"> 8762 <synopsis>Raw Monitor Notify</synopsis> 8763 <description> 8764 Notify a single thread waiting on the raw monitor. 8765 </description> 8766 <origin>jvmdi</origin> 8767 <capabilities> 8768 </capabilities> 8769 <parameters> 8770 <param id="monitor"> 8771 <jrawMonitorID/> 8772 <description> 8773 The monitor 8774 </description> 8775 </param> 8776 </parameters> 8777 <errors> 8778 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 8779 Not monitor owner 8780 </error> 8781 </errors> 8782 </function> 8783 8784 <function id="RawMonitorNotifyAll" phase="any" callbacksafe="safe" impl="notrace" num="37"> 8785 <synopsis>Raw Monitor Notify All</synopsis> 8786 <description> 8787 Notify all threads waiting on the raw monitor. 8788 </description> 8789 <origin>jvmdi</origin> 8790 <capabilities> 8791 </capabilities> 8792 <parameters> 8793 <param id="monitor"> 8794 <jrawMonitorID/> 8795 <description> 8796 The monitor 8797 </description> 8798 </param> 8799 </parameters> 8800 <errors> 8801 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 8802 Not monitor owner 8803 </error> 8804 </errors> 8805 </function> 8806 8807 <elide> 8808 <function id="GetRawMonitorUse" num="118"> 8809 <synopsis>Get Raw Monitor Use</synopsis> 8810 <description> 8811 The fields of the <functionlink id="jvmtiMonitorUsage"></functionlink> structure 8812 are filled in with information about usage of the raw monitor. 8813 </description> 8814 <origin>new</origin> 8815 <capabilities> 8816 <required id="can_get_raw_monitor_usage"></required> 8817 </capabilities> 8818 <parameters> 8819 <param id="monitor"> 8820 <jrawMonitorID/> 8821 <description> 8822 the raw monitor to query. 8823 </description> 8824 </param> 8825 <param id="info_ptr"> 8826 <outptr><struct>jvmtiMonitorUsage</struct></outptr> 8827 <description> 8828 On return, filled with monitor information for the 8829 specified raw monitor. 8830 </description> 8831 </param> 8832 </parameters> 8833 <errors> 8834 </errors> 8835 </function> 8836 8837 <function id="GetRawMonitors" num="119"> 8838 <synopsis>Get Raw Monitors</synopsis> 8839 <description> 8840 Return the list of raw monitors. 8841 <p/> 8842 Note: details about each monitor can be examined with 8843 <functionlink id="GetRawMonitorUse"></functionlink>. 8844 </description> 8845 <origin>new</origin> 8846 <capabilities> 8847 <required id="can_get_raw_monitor_usage"></required> 8848 </capabilities> 8849 <parameters> 8850 <param id="monitorCnt"> 8851 <outptr><jint/></outptr> 8852 <description> 8853 On return, pointer to the number 8854 of monitors returned in <code>monitors_ptr</code>. 8855 </description> 8856 </param> 8857 <param id="monitors_ptr"> 8858 <allocbuf outcount="monitorCnt"><jrawMonitorID/></allocbuf> 8859 <description> 8860 On return, pointer to the monitor list. 8861 </description> 8862 </param> 8863 </parameters> 8864 <errors> 8865 </errors> 8866 </function> 8867 </elide> 8868 </category> 8869 8870 <category id="jniIntercept" label="JNI Function Interception"> 8871 8872 <intro> 8873 Provides the ability to intercept and resend 8874 Java Native Interface (JNI) function calls 8875 by manipulating the JNI function table. 8876 See <externallink id="http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/functions.html">JNI 8877 Functions</externallink> in the <i>Java Native Interface Specification</i>. 8878 <p/> 8879 The following example illustrates intercepting the 8880 <code>NewGlobalRef</code> JNI call in order to count reference 8881 creation. 8882 <example> 8883 JNIEnv original_jni_Functions; 8884 JNIEnv redirected_jni_Functions; 8885 int my_global_ref_count = 0; 8886 8887 jobject 8888 MyNewGlobalRef(JNIEnv *jni_env, jobject lobj) { 8889 ++my_global_ref_count; 8890 return originalJNIFunctions->NewGlobalRef(env, lobj); 8891 } 8892 8893 void 8894 myInit() { 8895 jvmtiError err; 8896 8897 err = (*jvmti_env)->GetJNIFunctionTable(jvmti_env, &original_jni_Functions); 8898 if (err != JVMTI_ERROR_NONE) { 8899 die(); 8900 } 8901 err = (*jvmti_env)->GetJNIFunctionTable(jvmti_env, &redirected_jni_Functions); 8902 if (err != JVMTI_ERROR_NONE) { 8903 die(); 8904 } 8905 redirectedJNIFunctions->NewGlobalRef = MyNewGlobalRef; 8906 err = (*jvmti_env)->SetJNIFunctionTable(jvmti_env, redirected_jni_Functions); 8907 if (err != JVMTI_ERROR_NONE) { 8908 die(); 8909 } 8910 } 8911 </example> 8912 Sometime after <code>myInit</code> is called the user's JNI 8913 code is executed which makes the call to create a new global 8914 reference. Instead of going to the normal JNI implementation 8915 the call goes to <code>myNewGlobalRef</code>. Note that a 8916 copy of the original function table is kept so that the normal 8917 JNI function can be called after the data is collected. 8918 Note also that any JNI functions which are not overwritten 8919 will behave normally. 8920 <todo> 8921 check that the example compiles and executes. 8922 </todo> 8923 </intro> 8924 8925 <function id="SetJNIFunctionTable" phase="start" num="120"> 8926 <synopsis>Set JNI Function Table</synopsis> 8927 <description> 8928 Set the JNI function table 8929 in all current and future JNI environments. 8930 As a result, all future JNI calls are directed to the specified functions. 8931 Use <functionlink id="GetJNIFunctionTable"></functionlink> to get the 8932 function table to pass to this function. 8933 For this function to take effect the the updated table entries must be 8934 used by the JNI clients. 8935 Since the table is defined <code>const</code> some compilers may optimize 8936 away the access to the table, thus preventing this function from taking 8937 effect. 8938 The table is copied--changes to the local copy of the 8939 table have no effect. 8940 This function affects only the function table, all other aspects of the environment are 8941 unaffected. 8942 See the examples <internallink id="jniIntercept">above</internallink>. 8943 </description> 8944 <origin>new</origin> 8945 <capabilities> 8946 </capabilities> 8947 <parameters> 8948 <param id="function_table"> 8949 <inptr> 8950 <struct>jniNativeInterface</struct> 8951 </inptr> 8952 <description> 8953 Points to the new JNI function table. 8954 </description> 8955 </param> 8956 </parameters> 8957 <errors> 8958 </errors> 8959 </function> 8960 8961 <function id="GetJNIFunctionTable" phase="start" num="121"> 8962 <synopsis>Get JNI Function Table</synopsis> 8963 <description> 8964 Get the JNI function table. 8965 The JNI function table is copied into allocated memory. 8966 If <functionlink id="SetJNIFunctionTable"></functionlink> 8967 has been called, the modified (not the original) function 8968 table is returned. 8969 Only the function table is copied, no other aspects of the environment 8970 are copied. 8971 See the examples <internallink id="jniIntercept">above</internallink>. 8972 </description> 8973 <origin>new</origin> 8974 <capabilities> 8975 </capabilities> 8976 <parameters> 8977 <param id="function_table"> 8978 <allocbuf> 8979 <struct>jniNativeInterface</struct> 8980 </allocbuf> 8981 <description> 8982 On return, <code>*function_table</code> 8983 points a newly allocated copy of the JNI function table. 8984 </description> 8985 </param> 8986 </parameters> 8987 <errors> 8988 </errors> 8989 </function> 8990 8991 </category> 8992 8993 <category id="eventManagement" label="Event Management"> 8994 8995 <function id="SetEventCallbacks" jkernel="yes" phase="onload" num="122"> 8996 <synopsis>Set Event Callbacks</synopsis> 8997 <description> 8998 Set the functions to be called for each event. 8999 The callbacks are specified by supplying a replacement function table. 9000 The function table is copied--changes to the local copy of the 9001 table have no effect. 9002 This is an atomic action, all callbacks are set at once. 9003 No events are sent before this function is called. 9004 When an entry is <code>NULL</code> or when the event is beyond 9005 <paramlink id="size_of_callbacks"></paramlink> no event is sent. 9006 Details on events are 9007 described <internallink id="EventSection">later</internallink> in this document. 9008 An event must be enabled and have a callback in order to be 9009 sent--the order in which this function and 9010 <functionlink id="SetEventNotificationMode"></functionlink> 9011 are called does not affect the result. 9012 </description> 9013 <origin>new</origin> 9014 <capabilities> 9015 </capabilities> 9016 <parameters> 9017 <param id="callbacks"> 9018 <inptr> 9019 <struct>jvmtiEventCallbacks</struct> 9020 <nullok>remove the existing callbacks</nullok> 9021 </inptr> 9022 <description> 9023 The new event callbacks. 9024 </description> 9025 </param> 9026 <param id="size_of_callbacks"> 9027 <jint min="0"/> 9028 <description> 9029 <code>sizeof(jvmtiEventCallbacks)</code>--for version 9030 compatibility. 9031 </description> 9032 </param> 9033 </parameters> 9034 <errors> 9035 </errors> 9036 </function> 9037 9038 <function id="SetEventNotificationMode" jkernel="yes" phase="onload" num="2"> 9039 <synopsis>Set Event Notification Mode</synopsis> 9040 <description> 9041 Control the generation of events. 9042 <constants id="jvmtiEventMode" label="Event Enable/Disable" kind="enum"> 9043 <constant id="JVMTI_ENABLE" num="1"> 9044 If <paramlink id="mode"></paramlink> is <code>JVMTI_ENABLE</code>, 9045 the event <paramlink id="event_type"></paramlink> will be enabled 9046 </constant> 9047 <constant id="JVMTI_DISABLE" num="0"> 9048 If <paramlink id="mode"></paramlink> is <code>JVMTI_DISABLE</code>, 9049 the event <paramlink id="event_type"></paramlink> will be disabled 9050 </constant> 9051 </constants> 9052 If <code>thread</code> is <code>NULL</code>, 9053 the event is enabled or disabled globally; otherwise, it is 9054 enabled or disabled for a particular thread. 9055 An event is generated for 9056 a particular thread if it is enabled either at the thread or global 9057 levels. 9058 <p/> 9059 See <internallink id="EventIndex">below</internallink> for information on specific events. 9060 <p/> 9061 The following events cannot be controlled at the thread 9062 level through this function. 9063 <ul> 9064 <li><eventlink id="VMInit"></eventlink></li> 9065 <li><eventlink id="VMStart"></eventlink></li> 9066 <li><eventlink id="VMDeath"></eventlink></li> 9067 <li><eventlink id="ThreadStart"></eventlink></li> 9068 <li><eventlink id="CompiledMethodLoad"></eventlink></li> 9069 <li><eventlink id="CompiledMethodUnload"></eventlink></li> 9070 <li><eventlink id="DynamicCodeGenerated"></eventlink></li> 9071 <li><eventlink id="DataDumpRequest"></eventlink></li> 9072 </ul> 9073 <p/> 9074 Initially, no events are enabled at either the thread level 9075 or the global level. 9076 <p/> 9077 Any needed capabilities (see Event Enabling Capabilities below) must be possessed 9078 before calling this function. 9079 <p/> 9080 Details on events are 9081 described <internallink id="EventSection">below</internallink>. 9082 </description> 9083 <origin>jvmdiClone</origin> 9084 <eventcapabilities></eventcapabilities> 9085 <parameters> 9086 <param id="mode"> 9087 <enum>jvmtiEventMode</enum> 9088 <description> 9089 <code>JVMTI_ENABLE</code> or <code>JVMTI_DISABLE</code> 9090 </description> 9091 </param> 9092 <param id="event_type"> 9093 <enum>jvmtiEvent</enum> 9094 <description> 9095 the event to control 9096 </description> 9097 </param> 9098 <param id="event_thread"> 9099 <ptrtype> 9100 <jthread impl="noconvert"/> 9101 <nullok>event is controlled at the global level</nullok> 9102 </ptrtype> 9103 <description> 9104 The thread to control 9105 </description> 9106 </param> 9107 <param id="..."> 9108 <varargs/> 9109 <description> 9110 for future expansion 9111 </description> 9112 </param> 9113 </parameters> 9114 <errors> 9115 <error id="JVMTI_ERROR_INVALID_THREAD"> 9116 <paramlink id="event_thread"/> is non-<code>NULL</code> and is not a valid thread. 9117 </error> 9118 <error id="JVMTI_ERROR_THREAD_NOT_ALIVE"> 9119 <paramlink id="event_thread"/> is non-<code>NULL</code> and is not live (has not been started or is now dead). 9120 </error> 9121 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 9122 thread level control was attempted on events which do not 9123 permit thread level control. 9124 </error> 9125 <error id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY"> 9126 The Required Event Enabling Capability is not possessed. 9127 </error> 9128 </errors> 9129 </function> 9130 9131 <function id="GenerateEvents" num="123"> 9132 <synopsis>Generate Events</synopsis> 9133 <description> 9134 Generate events to represent the current state of the VM. 9135 For example, if <paramlink id="event_type"/> is 9136 <code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code>, 9137 a <eventlink id="CompiledMethodLoad"></eventlink> event will be 9138 sent for each currently compiled method. 9139 Methods that were loaded and now have been unloaded are not sent. 9140 The history of what events have previously been sent does not 9141 effect what events are sent by this function--for example, 9142 all currently compiled methods 9143 will be sent each time this function is called. 9144 <p/> 9145 This function is useful when 9146 events may have been missed due to the agent attaching after program 9147 execution begins; this function generates the missed events. 9148 <p/> 9149 Attempts to execute Java programming language code or 9150 JNI functions may be paused until this function returns - 9151 so neither should be called from the thread sending the event. 9152 This function returns only after the missed events have been 9153 sent, processed and have returned. 9154 The event may be sent on a different thread than the thread 9155 on which the event occurred. 9156 The callback for the event must be set with 9157 <functionlink id="SetEventCallbacks"></functionlink> 9158 and the event must be enabled with 9159 <functionlink id="SetEventNotificationMode"></functionlink> 9160 or the events will not occur. 9161 If the VM no longer has the information to generate some or 9162 all of the requested events, the events are simply not sent - 9163 no error is returned. 9164 <p/> 9165 Only the following events are supported: 9166 <ul> 9167 <li><eventlink id="CompiledMethodLoad"></eventlink></li> 9168 <li><eventlink id="DynamicCodeGenerated"></eventlink></li> 9169 </ul> 9170 </description> 9171 <origin>new</origin> 9172 <capabilities> 9173 <capability id="can_generate_compiled_method_load_events"></capability> 9174 </capabilities> 9175 <parameters> 9176 <param id="event_type"> 9177 <enum>jvmtiEvent</enum> 9178 <description> 9179 The type of event to generate. Must be one of these: 9180 <ul> 9181 <li><eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink></li> 9182 <li><eventlink id="DynamicCodeGenerated"><code>JVMTI_EVENT_DYNAMIC_CODE_GENERATED</code></eventlink></li> 9183 </ul> 9184 </description> 9185 </param> 9186 </parameters> 9187 <errors> 9188 <error id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY"> 9189 <paramlink id="event_type"/> is 9190 <eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink> 9191 and <fieldlink id="can_generate_compiled_method_load_events" struct="jvmtiCapabilities"></fieldlink> 9192 is <code>false</code>. 9193 </error> 9194 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 9195 <paramlink id="event_type"/> is other than 9196 <eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink> 9197 or <eventlink id="DynamicCodeGenerated"><code>JVMTI_EVENT_DYNAMIC_CODE_GENERATED</code></eventlink>. 9198 </error> 9199 </errors> 9200 </function> 9201 9202 </category> 9203 9204 <category id="extension" label="Extension Mechanism"> 9205 9206 <intro> 9207 These functions 9208 allow a <jvmti/> implementation to provide functions and events 9209 beyond those defined in this specification. 9210 <p/> 9211 Both extension functions and extension events have parameters 9212 each of which has a 'type' and 'kind' chosen from the following tables: 9213 9214 <constants id="jvmtiParamTypes" label="Extension Function/Event Parameter Types" kind="enum"> 9215 <constant id="JVMTI_TYPE_JBYTE" num="101"> 9216 Java programming language primitive type - <code>byte</code>. 9217 JNI type <code>jbyte</code>. 9218 </constant> 9219 <constant id="JVMTI_TYPE_JCHAR" num="102"> 9220 Java programming language primitive type - <code>char</code>. 9221 JNI type <code>jchar</code>. 9222 </constant> 9223 <constant id="JVMTI_TYPE_JSHORT" num="103"> 9224 Java programming language primitive type - <code>short</code>. 9225 JNI type <code>jshort</code>. 9226 </constant> 9227 <constant id="JVMTI_TYPE_JINT" num="104"> 9228 Java programming language primitive type - <code>int</code>. 9229 JNI type <datalink id="jint"></datalink>. 9230 </constant> 9231 <constant id="JVMTI_TYPE_JLONG" num="105"> 9232 Java programming language primitive type - <code>long</code>. 9233 JNI type <datalink id="jlong"></datalink>. 9234 </constant> 9235 <constant id="JVMTI_TYPE_JFLOAT" num="106"> 9236 Java programming language primitive type - <code>float</code>. 9237 JNI type <datalink id="jfloat"></datalink>. 9238 </constant> 9239 <constant id="JVMTI_TYPE_JDOUBLE" num="107"> 9240 Java programming language primitive type - <code>double</code>. 9241 JNI type <datalink id="jdouble"></datalink>. 9242 </constant> 9243 <constant id="JVMTI_TYPE_JBOOLEAN" num="108"> 9244 Java programming language primitive type - <code>boolean</code>. 9245 JNI type <datalink id="jboolean"></datalink>. 9246 </constant> 9247 <constant id="JVMTI_TYPE_JOBJECT" num="109"> 9248 Java programming language object type - <code>java.lang.Object</code>. 9249 JNI type <datalink id="jobject"></datalink>. 9250 Returned values are JNI local references and must be managed. 9251 </constant> 9252 <constant id="JVMTI_TYPE_JTHREAD" num="110"> 9253 Java programming language object type - <code>java.lang.Thread</code>. 9254 <jvmti/> type <datalink id="jthread"></datalink>. 9255 Returned values are JNI local references and must be managed. 9256 </constant> 9257 <constant id="JVMTI_TYPE_JCLASS" num="111"> 9258 Java programming language object type - <code>java.lang.Class</code>. 9259 JNI type <datalink id="jclass"></datalink>. 9260 Returned values are JNI local references and must be managed. 9261 </constant> 9262 <constant id="JVMTI_TYPE_JVALUE" num="112"> 9263 Union of all Java programming language primitive and object types - 9264 JNI type <datalink id="jvalue"></datalink>. 9265 Returned values which represent object types are JNI local references and must be managed. 9266 </constant> 9267 <constant id="JVMTI_TYPE_JFIELDID" num="113"> 9268 Java programming language field identifier - 9269 JNI type <datalink id="jfieldID"></datalink>. 9270 </constant> 9271 <constant id="JVMTI_TYPE_JMETHODID" num="114"> 9272 Java programming language method identifier - 9273 JNI type <datalink id="jmethodID"></datalink>. 9274 </constant> 9275 <constant id="JVMTI_TYPE_CCHAR" num="115"> 9276 C programming language type - <code>char</code>. 9277 </constant> 9278 <constant id="JVMTI_TYPE_CVOID" num="116"> 9279 C programming language type - <code>void</code>. 9280 </constant> 9281 <constant id="JVMTI_TYPE_JNIENV" num="117"> 9282 JNI environment - <code>JNIEnv</code>. 9283 Should be used with the correct <datalink id="jvmtiParamKind"/> to make it a pointer type. 9284 </constant> 9285 </constants> 9286 9287 <constants id="jvmtiParamKind" label="Extension Function/Event Parameter Kinds" kind="enum"> 9288 <constant id="JVMTI_KIND_IN" num="91"> 9289 Ingoing argument - <code>foo</code>. 9290 </constant> 9291 <constant id="JVMTI_KIND_IN_PTR" num="92"> 9292 Ingoing pointer argument - <code>const foo*</code>. 9293 </constant> 9294 <constant id="JVMTI_KIND_IN_BUF" num="93"> 9295 Ingoing array argument - <code>const foo*</code>. 9296 </constant> 9297 <constant id="JVMTI_KIND_ALLOC_BUF" num="94"> 9298 Outgoing allocated array argument - <code>foo**</code>. 9299 Free with <code>Deallocate</code>. 9300 </constant> 9301 <constant id="JVMTI_KIND_ALLOC_ALLOC_BUF" num="95"> 9302 Outgoing allocated array of allocated arrays argument - <code>foo***</code>. 9303 Free with <code>Deallocate</code>. 9304 </constant> 9305 <constant id="JVMTI_KIND_OUT" num="96"> 9306 Outgoing argument - <code>foo*</code>. 9307 </constant> 9308 <constant id="JVMTI_KIND_OUT_BUF" num="97"> 9309 Outgoing array argument (pre-allocated by agent) - <code>foo*</code>. 9310 Do not <code>Deallocate</code>. 9311 </constant> 9312 </constants> 9313 9314 </intro> 9315 9316 <typedef id="jvmtiParamInfo" label="Extension Function/Event Parameter Info"> 9317 <field id="name"> 9318 <allocfieldbuf><char/></allocfieldbuf> 9319 <description> 9320 The parameter name, encoded as a 9321 <internallink id="mUTF">modified UTF-8</internallink> string 9322 </description> 9323 </field> 9324 <field id="kind"> 9325 <enum>jvmtiParamKind</enum> 9326 <description> 9327 The kind of the parameter - type modifiers 9328 </description> 9329 </field> 9330 <field id="base_type"> 9331 <enum>jvmtiParamTypes</enum> 9332 <description> 9333 The base type of the parameter - modified by <code>kind</code> 9334 </description> 9335 </field> 9336 <field id="null_ok"> 9337 <jboolean/> 9338 <description> 9339 Is a <code>NULL</code> argument permitted? Applies only to pointer and object types. 9340 </description> 9341 </field> 9342 </typedef> 9343 9344 <callback id="jvmtiExtensionFunction"> 9345 <enum>jvmtiError</enum> 9346 <synopsis>Extension Function</synopsis> 9347 <description> 9348 This is the implementation-specific extension function. 9349 </description> 9350 <parameters> 9351 <param id="jvmti_env"> 9352 <outptr> 9353 <struct>jvmtiEnv</struct> 9354 </outptr> 9355 <description> 9356 The <jvmti/> environment is the only fixed parameter for extension functions. 9357 </description> 9358 </param> 9359 <param id="..."> 9360 <varargs/> 9361 <description> 9362 The extension function-specific parameters 9363 </description> 9364 </param> 9365 </parameters> 9366 </callback> 9367 9368 <function id="GetExtensionFunctions" phase="onload" num="124"> 9369 <synopsis>Get Extension Functions</synopsis> 9370 9371 <typedef id="jvmtiExtensionFunctionInfo" label="Extension Function Info"> 9372 <field id="func"> 9373 <ptrtype> 9374 <struct>jvmtiExtensionFunction</struct> 9375 </ptrtype> 9376 <description> 9377 The actual function to call 9378 </description> 9379 </field> 9380 <field id="id"> 9381 <allocfieldbuf><char/></allocfieldbuf> 9382 <description> 9383 The identifier for the extension function, encoded as a 9384 <internallink id="mUTF">modified UTF-8</internallink> string. 9385 Uses package name conventions. 9386 For example, <code>com.sun.hotspot.bar</code> 9387 </description> 9388 </field> 9389 <field id="short_description"> 9390 <allocfieldbuf><char/></allocfieldbuf> 9391 <description> 9392 A one sentence description of the function, encoded as a 9393 <internallink id="mUTF">modified UTF-8</internallink> string. 9394 </description> 9395 </field> 9396 <field id="param_count"> 9397 <jint/> 9398 <description> 9399 The number of parameters excluding <code>jvmtiEnv *jvmti_env</code> 9400 </description> 9401 </field> 9402 <field id="params"> 9403 <allocfieldbuf outcount="param_count"> 9404 <struct>jvmtiParamInfo</struct> 9405 </allocfieldbuf> 9406 <description> 9407 Array of 9408 <fieldlink id="param_count" struct="jvmtiExtensionFunctionInfo"></fieldlink> 9409 parameters (<code>jvmtiEnv *jvmti_env</code> excluded) 9410 </description> 9411 </field> 9412 <field id="error_count"> 9413 <jint/> 9414 <description> 9415 The number of possible error returns (excluding universal errors) 9416 </description> 9417 </field> 9418 <field id="errors"> 9419 <allocfieldbuf outcount="error_count"> 9420 <enum>jvmtiError</enum> 9421 </allocfieldbuf> 9422 <description> 9423 Array of <fieldlink id="error_count" struct="jvmtiExtensionFunctionInfo"></fieldlink> 9424 possible errors 9425 </description> 9426 </field> 9427 </typedef> 9428 9429 <description> 9430 Returns the set of extension functions. 9431 </description> 9432 <origin>new</origin> 9433 <capabilities> 9434 </capabilities> 9435 <parameters> 9436 <param id="extension_count_ptr"> 9437 <outptr><jint/></outptr> 9438 <description> 9439 On return, points to the number of extension functions 9440 </description> 9441 </param> 9442 <param id="extensions"> 9443 <allocbuf outcount="extension_count_ptr"><struct>jvmtiExtensionFunctionInfo</struct></allocbuf> 9444 <description> 9445 Returns an array of extension function info, one per function 9446 </description> 9447 </param> 9448 </parameters> 9449 <errors> 9450 </errors> 9451 </function> 9452 9453 <function id="GetExtensionEvents" phase="onload" num="125"> 9454 <synopsis>Get Extension Events</synopsis> 9455 9456 <typedef id="jvmtiExtensionEventInfo" label="Extension Event Info"> 9457 <field id="extension_event_index"> 9458 <jint/> 9459 <description> 9460 The identifying index of the event 9461 </description> 9462 </field> 9463 <field id="id"> 9464 <allocfieldbuf><char/></allocfieldbuf> 9465 <description> 9466 The identifier for the extension event, encoded as a 9467 <internallink id="mUTF">modified UTF-8</internallink> string. 9468 Uses package name conventions. 9469 For example, <code>com.sun.hotspot.bar</code> 9470 </description> 9471 </field> 9472 <field id="short_description"> 9473 <allocfieldbuf><char/></allocfieldbuf> 9474 <description> 9475 A one sentence description of the event, encoded as a 9476 <internallink id="mUTF">modified UTF-8</internallink> string. 9477 </description> 9478 </field> 9479 <field id="param_count"> 9480 <jint/> 9481 <description> 9482 The number of parameters excluding <code>jvmtiEnv *jvmti_env</code> 9483 </description> 9484 </field> 9485 <field id="params"> 9486 <allocfieldbuf outcount="param_count"> 9487 <struct>jvmtiParamInfo</struct> 9488 </allocfieldbuf> 9489 <description> 9490 Array of 9491 <fieldlink id="param_count" struct="jvmtiExtensionEventInfo"></fieldlink> 9492 parameters (<code>jvmtiEnv *jvmti_env</code> excluded) 9493 </description> 9494 </field> 9495 </typedef> 9496 9497 <description> 9498 Returns the set of extension events. 9499 </description> 9500 <origin>new</origin> 9501 <capabilities> 9502 </capabilities> 9503 <parameters> 9504 <param id="extension_count_ptr"> 9505 <outptr><jint/></outptr> 9506 <description> 9507 On return, points to the number of extension events 9508 </description> 9509 </param> 9510 <param id="extensions"> 9511 <allocbuf outcount="extension_count_ptr"><struct>jvmtiExtensionEventInfo</struct></allocbuf> 9512 <description> 9513 Returns an array of extension event info, one per event 9514 </description> 9515 </param> 9516 </parameters> 9517 <errors> 9518 </errors> 9519 </function> 9520 9521 <callback id="jvmtiExtensionEvent"> 9522 <void/> 9523 <synopsis>Extension Event</synopsis> 9524 <description> 9525 This is the implementation-specific event. 9526 The event handler is set with 9527 <functionlink id="SetExtensionEventCallback"/>. 9528 <p/> 9529 Event handlers for extension events must be declared varargs to match this definition. 9530 Failure to do so could result in calling convention mismatch and undefined behavior 9531 on some platforms. 9532 <p/> 9533 For example, if the <code>jvmtiParamInfo</code> 9534 returned by <functionlink id="GetExtensionEvents"/> indicates that 9535 there is a <code>jint</code> parameter, the event handler should be 9536 declared: 9537 <example> 9538 void JNICALL myHandler(jvmtiEnv* jvmti_env, jint myInt, ...) 9539 </example> 9540 Note the terminal "<code>...</code>" which indicates varargs. 9541 </description> 9542 <parameters> 9543 <param id="jvmti_env"> 9544 <outptr> 9545 <struct>jvmtiEnv</struct> 9546 </outptr> 9547 <description> 9548 The <jvmti/> environment is the only fixed parameter for extension events. 9549 </description> 9550 </param> 9551 <param id="..."> 9552 <varargs/> 9553 <description> 9554 The extension event-specific parameters 9555 </description> 9556 </param> 9557 </parameters> 9558 </callback> 9559 9560 <function id="SetExtensionEventCallback" phase="onload" num="126"> 9561 <synopsis>Set Extension Event Callback</synopsis> 9562 9563 <description> 9564 Sets the callback function for an extension event and 9565 enables the event. Or, if the callback is <code>NULL</code>, disables 9566 the event. Note that unlike standard events, setting 9567 the callback and enabling the event are a single operation. 9568 </description> 9569 <origin>new</origin> 9570 <capabilities> 9571 </capabilities> 9572 <parameters> 9573 <param id="extension_event_index"> 9574 <jint/> 9575 <description> 9576 Identifies which callback to set. 9577 This index is the 9578 <fieldlink id="extension_event_index" struct="jvmtiExtensionEventInfo"></fieldlink> 9579 field of 9580 <datalink id="jvmtiExtensionEventInfo"/>. 9581 </description> 9582 </param> 9583 <param id="callback"> 9584 <ptrtype> 9585 <struct>jvmtiExtensionEvent</struct> 9586 <nullok>disable the event</nullok> 9587 </ptrtype> 9588 <description> 9589 If <code>callback</code> is non-<code>NULL</code>, 9590 set <code>callback</code> to be the event callback function 9591 and enable the event. 9592 </description> 9593 </param> 9594 </parameters> 9595 <errors> 9596 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 9597 <paramlink id="extension_event_index"/> is not an 9598 <fieldlink id="extension_event_index" 9599 struct="jvmtiExtensionEventInfo"/> 9600 returned by 9601 <functionlink id="GetExtensionEvents"/> 9602 </error> 9603 </errors> 9604 </function> 9605 9606 </category> 9607 9608 <category id="capability" label="Capability"> 9609 9610 <intro> 9611 The capabilities functions allow you to change the 9612 functionality available to <jvmti/>--that is, 9613 which <jvmti/> 9614 functions can be called, what events can be generated, 9615 and what functionality these events and functions can 9616 provide. 9617 <p/> 9618 The "Capabilities" section of each function and event describe which 9619 capabilities, if any, they are associated with. "Required Functionality" 9620 means it is available for use and no capabilities must be added to use it. 9621 "Optional Functionality" means the agent must possess the capability 9622 before it can be used. 9623 To possess a capability, the agent must 9624 <functionlink id="AddCapabilities">add the capability</functionlink>. 9625 "Optional Features" describe capabilities which, 9626 if added, extend the feature set. 9627 <p/> 9628 The potentially available capabilities of each <jvmti/> implementation are different. 9629 Depending on the implementation, a capability: 9630 <ul> 9631 <li>may never be added</li> 9632 <li>may be added in either the <code>OnLoad</code> or live phase in any environment</li> 9633 <li>may be added only during the <code>OnLoad</code> phase</li> 9634 <li>may be possessed by only one environment at a time</li> 9635 <li>may be possessed by only one environment at a time, 9636 and only during the <code>OnLoad</code> phase</li> 9637 <li>and so on ...</li> 9638 </ul> 9639 Frequently, the addition of a capability may incur a cost in execution speed, start up 9640 time, and/or memory footprint. Note that the overhead of using a capability 9641 is completely different than the overhead of possessing a capability. 9642 Take single stepping as an example. When single stepping is on (that 9643 is, when the event is enabled and thus actively sending events) 9644 the overhead of sending and processing an event 9645 on each instruction is huge in any implementation. 9646 However, the overhead of possessing the capability may be small or large, 9647 depending on the implementation. Also, when and if a capability is potentially 9648 available depends on the implementation. Some examples: 9649 <ul> 9650 <li>One VM might perform all execution by compiling bytecodes into 9651 native code and be unable to generate single step instructions. 9652 In this implementation the capability can not be added.</li> 9653 <li>Another VM may be able to switch execution to a single stepping 9654 interpreter at any time. In this implementation, having the capability has no 9655 overhead and could be added at any time.</li> 9656 <li>Yet another VM might be able to choose a bytecode compiling or single stepping capable interpreted 9657 execution engine at start up, but be unable to switch between them. 9658 In this implementation the capability would need to be added 9659 during the <code>OnLoad</code> phase (before bytecode 9660 execution begins) and would have a large impact on execution speed 9661 even if single stepping was never used.</li> 9662 <li>Still another VM might be able to add an "is single stepping on" check 9663 into compiled bytecodes or a generated interpreter. Again in this implementation 9664 the capability would need to be added during the <code>OnLoad</code> phase but the overhead (a test 9665 and branch on each instruction) would be considerably less.</li> 9666 </ul> 9667 <p/> 9668 Each <jvmti/> <internallink id="environments">environment</internallink> 9669 has its own set of capabilities. 9670 Initially, that set is empty. 9671 Any desired capability must be added. 9672 If possible, capabilities should be added during the <code>OnLoad</code> phase. For most 9673 virtual machines certain capabilities require special set up for 9674 the virtual machine and this set up must happen 9675 during the <code>OnLoad</code> phase, before the virtual machine begins execution. 9676 Once a capability is added, it can 9677 only be removed if explicitly relinquished by the environment. 9678 <p/> 9679 The agent can, 9680 <functionlink id="GetPotentialCapabilities">determine what 9681 capabilities this VM can potentially provide</functionlink>, 9682 <functionlink id="AddCapabilities">add the capabilities 9683 to be used</functionlink>, 9684 <functionlink id="RelinquishCapabilities">release capabilities 9685 which are no longer needed</functionlink>, and 9686 <functionlink id="GetCapabilities">examine the currently available 9687 capabilities</functionlink>. 9688 </intro> 9689 9690 <intro id="capabilityExamples" label="Capability Examples"> 9691 For example, a freshly started agent (in the <code>OnLoad</code> function) 9692 wants to enable all possible capabilities. 9693 Note that, in general, this is not advisable as the agent may suffer 9694 a performance penalty for functionality it is not using. 9695 The code might look like this in C: 9696 <example> 9697 jvmtiCapabilities capa; 9698 jvmtiError err; 9699 9700 err = (*jvmti)->GetPotentialCapabilities(jvmti, &capa); 9701 if (err == JVMTI_ERROR_NONE) { 9702 err = (*jvmti)->AddCapabilities(jvmti, &capa); 9703 </example> 9704 For example, if an agent wants to check if it can get 9705 the bytecodes of a method (that is, it wants to check 9706 if it previously added this capability and has not 9707 relinquished it), the code might 9708 look like this in C: 9709 <example> 9710 jvmtiCapabilities capa; 9711 jvmtiError err; 9712 9713 err = (*jvmti)->GetCapabilities(jvmti, &capa); 9714 if (err == JVMTI_ERROR_NONE) { 9715 if (capa.can_get_bytecodes) { ... } } 9716 </example> 9717 </intro> 9718 9719 <capabilitiestypedef id="jvmtiCapabilities" label="The Capabilities Structure"> 9720 <description> 9721 The functions in this category use this capabilities structure 9722 which contains boolean flags corresponding to each capability: 9723 </description> 9724 <capabilityfield id="can_tag_objects"> 9725 <description> 9726 Can set and get tags, as described in the 9727 <internallink id="Heap">Heap category</internallink>. 9728 </description> 9729 </capabilityfield> 9730 <capabilityfield id="can_generate_field_modification_events"> 9731 <description> 9732 Can set watchpoints on field modification - 9733 <functionlink id="SetFieldModificationWatch"></functionlink> 9734 </description> 9735 </capabilityfield> 9736 <capabilityfield id="can_generate_field_access_events"> 9737 <description> 9738 Can set watchpoints on field access - 9739 <functionlink id="SetFieldAccessWatch"></functionlink> 9740 </description> 9741 </capabilityfield> 9742 <capabilityfield id="can_get_bytecodes"> 9743 <description> 9744 Can get bytecodes of a method <functionlink id="GetBytecodes"></functionlink> 9745 </description> 9746 </capabilityfield> 9747 <capabilityfield id="can_get_synthetic_attribute"> 9748 <description> 9749 Can test if a field or method is synthetic - 9750 <functionlink id="IsFieldSynthetic"></functionlink> and 9751 <functionlink id="IsMethodSynthetic"></functionlink> 9752 </description> 9753 </capabilityfield> 9754 <capabilityfield id="can_get_owned_monitor_info"> 9755 <description> 9756 Can get information about ownership of monitors - 9757 <functionlink id="GetOwnedMonitorInfo"></functionlink> 9758 </description> 9759 </capabilityfield> 9760 <capabilityfield id="can_get_current_contended_monitor"> 9761 <description> 9762 Can <functionlink id="GetCurrentContendedMonitor"></functionlink> 9763 </description> 9764 </capabilityfield> 9765 <capabilityfield id="can_get_monitor_info"> 9766 <description> 9767 Can <functionlink id="GetObjectMonitorUsage"></functionlink> 9768 </description> 9769 </capabilityfield> 9770 <capabilityfield id="can_pop_frame"> 9771 <description> 9772 Can pop frames off the stack - <functionlink id="PopFrame"></functionlink> 9773 </description> 9774 </capabilityfield> 9775 <capabilityfield id="can_redefine_classes"> 9776 <description> 9777 Can redefine classes with <functionlink id="RedefineClasses"/>. 9778 </description> 9779 </capabilityfield> 9780 <capabilityfield id="can_signal_thread"> 9781 <description> 9782 Can send stop or interrupt to threads 9783 </description> 9784 </capabilityfield> 9785 <capabilityfield id="can_get_source_file_name"> 9786 <description> 9787 Can get the source file name of a class 9788 </description> 9789 </capabilityfield> 9790 <capabilityfield id="can_get_line_numbers"> 9791 <description> 9792 Can get the line number table of a method 9793 </description> 9794 </capabilityfield> 9795 <capabilityfield id="can_get_source_debug_extension"> 9796 <description> 9797 Can get the source debug extension of a class 9798 </description> 9799 </capabilityfield> 9800 <capabilityfield id="can_access_local_variables"> 9801 <description> 9802 Can set and get local variables 9803 </description> 9804 </capabilityfield> 9805 <capabilityfield id="can_maintain_original_method_order"> 9806 <description> 9807 Can return methods in the order they occur in the class file 9808 </description> 9809 </capabilityfield> 9810 <capabilityfield id="can_generate_single_step_events"> 9811 <description> 9812 Can get <eventlink id="SingleStep">single step</eventlink> events 9813 </description> 9814 </capabilityfield> 9815 <capabilityfield id="can_generate_exception_events"> 9816 <description> 9817 Can get <eventlink id="Exception">exception thrown</eventlink> and 9818 <eventlink id="ExceptionCatch">exception catch</eventlink> events 9819 </description> 9820 </capabilityfield> 9821 <capabilityfield id="can_generate_frame_pop_events"> 9822 <description> 9823 Can <functionlink id="NotifyFramePop">set</functionlink> and thus get 9824 <eventlink id="FramePop"></eventlink> events 9825 </description> 9826 </capabilityfield> 9827 <capabilityfield id="can_generate_breakpoint_events"> 9828 <description> 9829 Can <functionlink id="SetBreakpoint">set</functionlink> and thus get 9830 <eventlink id="Breakpoint"></eventlink> events 9831 </description> 9832 </capabilityfield> 9833 <capabilityfield id="can_suspend"> 9834 <description> 9835 Can suspend and resume threads 9836 </description> 9837 </capabilityfield> 9838 <capabilityfield id="can_redefine_any_class"> 9839 <description> 9840 Can modify (retransform or redefine) any non-primitive non-array class. 9841 See <functionlink id="IsModifiableClass"/>. 9842 </description> 9843 </capabilityfield> 9844 <capabilityfield id="can_get_current_thread_cpu_time"> 9845 <description> 9846 Can <functionlink id="GetCurrentThreadCpuTime">get</functionlink> 9847 current thread CPU time 9848 </description> 9849 </capabilityfield> 9850 <capabilityfield id="can_get_thread_cpu_time"> 9851 <description> 9852 Can <functionlink id="GetThreadCpuTime">get</functionlink> 9853 thread CPU time 9854 </description> 9855 </capabilityfield> 9856 <capabilityfield id="can_generate_method_entry_events" 9857 disp1="can_generate" disp2="_method_entry_events" 9858 > 9859 <description> 9860 Can generate method entry events on entering a method 9861 </description> 9862 </capabilityfield> 9863 <capabilityfield id="can_generate_method_exit_events" 9864 disp1="can_generate" disp2="_method_exit_events" 9865 > 9866 <description> 9867 Can generate method exit events on leaving a method 9868 </description> 9869 </capabilityfield> 9870 <capabilityfield id="can_generate_all_class_hook_events" 9871 disp1="can_generate" disp2="_all_class_hook_events" 9872 > 9873 <description> 9874 Can generate ClassFileLoadHook events for every loaded class. 9875 </description> 9876 </capabilityfield> 9877 <capabilityfield id="can_generate_compiled_method_load_events" 9878 disp1="can_generate" disp2="_compiled_method_load_events" 9879 > 9880 <description> 9881 Can generate events when a method is compiled or unloaded 9882 </description> 9883 </capabilityfield> 9884 <capabilityfield id="can_generate_monitor_events" 9885 disp1="can_generate" disp2="_monitor_events" 9886 > 9887 <description> 9888 Can generate events on monitor activity 9889 </description> 9890 </capabilityfield> 9891 <capabilityfield id="can_generate_vm_object_alloc_events" 9892 disp1="can_generate" disp2="_vm_object_alloc_events" 9893 > 9894 <description> 9895 Can generate events on VM allocation of an object 9896 </description> 9897 </capabilityfield> 9898 <capabilityfield id="can_generate_native_method_bind_events" 9899 disp1="can_generate" disp2="_native_method_bind_events" 9900 > 9901 <description> 9902 Can generate events when a native method is bound to its 9903 implementation 9904 </description> 9905 </capabilityfield> 9906 <capabilityfield id="can_generate_garbage_collection_events" 9907 disp1="can_generate" disp2="_garbage_collection_events" 9908 > 9909 <description> 9910 Can generate events when garbage collection begins or ends 9911 </description> 9912 </capabilityfield> 9913 <capabilityfield id="can_generate_object_free_events" 9914 disp1="can_generate" disp2="_object_free_events" 9915 > 9916 <description> 9917 Can generate events when the garbage collector frees an object 9918 </description> 9919 </capabilityfield> 9920 <capabilityfield id="can_force_early_return" since="1.1"> 9921 <description> 9922 Can return early from a method, as described in the 9923 <internallink id="ForceEarlyReturn">Force Early Return category</internallink>. 9924 </description> 9925 </capabilityfield> 9926 <capabilityfield id="can_get_owned_monitor_stack_depth_info" since="1.1"> 9927 <description> 9928 Can get information about owned monitors with stack depth - 9929 <functionlink id="GetOwnedMonitorStackDepthInfo"></functionlink> 9930 </description> 9931 </capabilityfield> 9932 <capabilityfield id="can_get_constant_pool" since="1.1"> 9933 <description> 9934 Can get the constant pool of a class - 9935 <functionlink id="GetConstantPool"></functionlink> 9936 </description> 9937 </capabilityfield> 9938 <capabilityfield id="can_set_native_method_prefix" since="1.1"> 9939 <description> 9940 Can set prefix to be applied when native method cannot be resolved - 9941 <functionlink id="SetNativeMethodPrefix"/> and 9942 <functionlink id="SetNativeMethodPrefixes"/> 9943 </description> 9944 </capabilityfield> 9945 <capabilityfield id="can_retransform_classes" since="1.1"> 9946 <description> 9947 Can retransform classes with <functionlink id="RetransformClasses"/>. 9948 In addition to the restrictions imposed by the specific 9949 implementation on this capability (see the 9950 <internallink id="capability">Capability</internallink> section), 9951 this capability must be set before the 9952 <eventlink id="ClassFileLoadHook"/> event is enabled for the 9953 first time in this environment. 9954 An environment that possesses this capability at the time that 9955 <code>ClassFileLoadHook</code> is enabled for the first time is 9956 said to be <i>retransformation capable</i>. 9957 An environment that does not possess this capability at the time that 9958 <code>ClassFileLoadHook</code> is enabled for the first time is 9959 said to be <i>retransformation incapable</i>. 9960 </description> 9961 </capabilityfield> 9962 <capabilityfield id="can_retransform_any_class" since="1.1"> 9963 <description> 9964 <functionlink id="RetransformClasses"/> can be called on any class 9965 (<fieldlink id="can_retransform_classes" struct="jvmtiCapabilities"/> 9966 must also be set) 9967 </description> 9968 </capabilityfield> 9969 <capabilityfield id="can_generate_resource_exhaustion_heap_events" since="1.1"> 9970 <description> 9971 Can generate events when the VM is unable to allocate memory from 9972 the <tm>Java</tm> platform heap. 9973 See <eventlink id="ResourceExhausted"/>. 9974 </description> 9975 </capabilityfield> 9976 <capabilityfield id="can_generate_resource_exhaustion_threads_events" since="1.1"> 9977 <description> 9978 Can generate events when the VM is unable to create a thread. 9979 See <eventlink id="ResourceExhausted"/>. 9980 </description> 9981 </capabilityfield> 9982 <capabilityfield id="can_get_modules_info"> 9983 <description> 9984 Can get information about modules 9985 </description> 9986 </capabilityfield> 9987 </capabilitiestypedef> 9988 9989 <function id="GetPotentialCapabilities" jkernel="yes" phase="onload" num="140"> 9990 <synopsis>Get Potential Capabilities</synopsis> 9991 <description> 9992 Returns via <paramlink id="capabilities_ptr"></paramlink> the <jvmti/> 9993 features that can potentially be possessed by this environment 9994 at this time. 9995 The returned capabilities differ from the complete set of capabilities 9996 implemented by the VM in two cases: another environment possesses 9997 capabilities that can only be possessed by one environment, or the 9998 current <functionlink id="GetPhase">phase</functionlink> is live, 9999 and certain capabilities can only be added during the <code>OnLoad</code> phase. 10000 The <functionlink id="AddCapabilities"></functionlink> function 10001 may be used to set any or all or these capabilities. 10002 Currently possessed capabilities are included. 10003 <p/> 10004 Typically this function is used in the <code>OnLoad</code> function. 10005 Some virtual machines may allow a limited set of capabilities to be 10006 added in the live phase. 10007 In this case, the set of potentially available capabilities 10008 will likely differ from the <code>OnLoad</code> phase set. 10009 <p/> 10010 See the 10011 <internallink id="capabilityExamples">Capability Examples</internallink>. 10012 </description> 10013 <origin>new</origin> 10014 <capabilities> 10015 </capabilities> 10016 <parameters> 10017 <param id="capabilities_ptr"> 10018 <outptr><struct>jvmtiCapabilities</struct></outptr> 10019 <description> 10020 On return, points to the <jvmti/> capabilities that may be added. 10021 </description> 10022 </param> 10023 </parameters> 10024 <errors> 10025 </errors> 10026 </function> 10027 10028 <elide> 10029 <function id="EstimateCostOfCapabilities" phase="onload" num="141"> 10030 <synopsis>Estimate Cost Of Capabilities</synopsis> 10031 <description> 10032 <issue>There is strong opposition to this function. The concern is 10033 that it would be difficult or impossible to provide meaningful 10034 numbers, as the amount of impact is conditional on many factors 10035 that a single number could not represent. There is doubt that 10036 conditional implementations would be used or are even a good idea. 10037 The thought is that release documentation for the implementation 10038 would be the best means of exposing this information. 10039 Unless new arguments are presented, I intend to remove this 10040 function in the next revision. 10041 </issue> 10042 <p/> 10043 Return via the <paramlink id="time_impact_ptr"></paramlink> and 10044 <paramlink id="space_impact_ptr"></paramlink> an estimate of the impact 10045 of adding the capabilities pointed to by 10046 <paramlink id="capabilities_ptr"></paramlink>. 10047 The returned estimates are in percentage of additional overhead, thus 10048 a time impact of 100 mean the application might run 10049 at half the speed. 10050 The estimates are very rough approximations and are not guaranteed. 10051 Note also, that the estimates are of the impact of having the 10052 capability available--when and if it is used the impact may be 10053 much greater. 10054 Estimates can be for a single capability or for a set of 10055 capabilities. Note that the costs are not necessarily additive, 10056 adding support for one capability might make another available 10057 for free or conversely having two capabilities at once may 10058 have multiplicative impact. 10059 Estimates are relative to the current set of capabilities - 10060 that is, how much more impact given the currently possessed capabilities. 10061 <p/> 10062 Typically this function is used in the OnLoad function, 10063 some virtual machines may allow a limited set of capabilities to be 10064 added in the live phase. 10065 In this case, the set of potentially available capabilities 10066 will likely differ from the OnLoad phase set. 10067 <p/> 10068 See the 10069 <internallink id="capabilityExamples">Capability Examples</internallink>. 10070 </description> 10071 <origin>new</origin> 10072 <capabilities> 10073 </capabilities> 10074 <parameters> 10075 <param id="capabilities_ptr"> 10076 <inptr><struct>jvmtiCapabilities</struct></inptr> 10077 <description> 10078 points to the <jvmti/> capabilities to evaluate. 10079 </description> 10080 </param> 10081 <param id="time_impact_ptr"> 10082 <outptr><jint/></outptr> 10083 <description> 10084 On return, points to the estimated percentage increase in 10085 run time if this capability was added. 10086 </description> 10087 </param> 10088 <param id="space_impact_ptr"> 10089 <outptr><jint/></outptr> 10090 <description> 10091 On return, points to the estimated percentage increase in 10092 memory space used if this capability was added. 10093 </description> 10094 </param> 10095 </parameters> 10096 <errors> 10097 <error id="JVMTI_ERROR_NOT_AVAILABLE"> 10098 The desired capabilities are not even potentially available. 10099 </error> 10100 </errors> 10101 </function> 10102 </elide> 10103 10104 <function id="AddCapabilities" jkernel="yes" phase="onload" num="142"> 10105 <synopsis>Add Capabilities</synopsis> 10106 <description> 10107 Set new capabilities by adding the capabilities 10108 whose values are set to one (<code>1</code>) in 10109 <code>*</code><paramlink id="capabilities_ptr"></paramlink>. 10110 All previous capabilities are retained. 10111 Typically this function is used in the <code>OnLoad</code> function. 10112 Some virtual machines may allow a limited set of capabilities to be 10113 added in the live phase. 10114 <p/> 10115 See the 10116 <internallink id="capabilityExamples">Capability Examples</internallink>. 10117 </description> 10118 <origin>new</origin> 10119 <capabilities> 10120 </capabilities> 10121 <parameters> 10122 <param id="capabilities_ptr"> 10123 <inptr><struct>jvmtiCapabilities</struct></inptr> 10124 <description> 10125 Points to the <jvmti/> capabilities to add. 10126 </description> 10127 </param> 10128 </parameters> 10129 <errors> 10130 <error id="JVMTI_ERROR_NOT_AVAILABLE"> 10131 The desired capabilities are not even potentially available. 10132 </error> 10133 </errors> 10134 </function> 10135 10136 10137 <function id="RelinquishCapabilities" phase="onload" num="143"> 10138 <synopsis>Relinquish Capabilities</synopsis> 10139 <description> 10140 Relinquish the capabilities 10141 whose values are set to one (<code>1</code>) in 10142 <code>*</code><paramlink id="capabilities_ptr"></paramlink>. 10143 Some implementations may allow only one environment to have a capability 10144 (see the <internallink id="capability">capability introduction</internallink>). 10145 This function releases capabilities 10146 so that they may be used by other agents. 10147 All other capabilities are retained. 10148 The capability will no longer be present in <functionlink id="GetCapabilities"></functionlink>. 10149 Attempting to relinquish a capability that the agent does not possess is not an error. 10150 <issue> 10151 It is possible for the agent to be actively using capabilities 10152 which are being relinquished. For example, a thread is currently 10153 suspended and can_suspend is being relinquished or an event is currently 10154 enabled and can_generate_whatever is being relinquished. 10155 There are three possible ways we could spec this: 10156 <ul> 10157 <li>relinquish automatically releases them</li> 10158 <li>relinquish checks and returns some error code if held</li> 10159 <li>it is the agent's responsibility and it is not checked</li> 10160 </ul> 10161 One of these should be chosen. 10162 </issue> 10163 </description> 10164 <origin>new</origin> 10165 <capabilities> 10166 </capabilities> 10167 <parameters> 10168 <param id="capabilities_ptr"> 10169 <inptr><struct>jvmtiCapabilities</struct></inptr> 10170 <description> 10171 Points to the <jvmti/> capabilities to relinquish. 10172 </description> 10173 </param> 10174 </parameters> 10175 <errors> 10176 </errors> 10177 </function> 10178 10179 10180 10181 <function id="GetCapabilities" jkernel="yes" phase="any" num="89"> 10182 <synopsis>Get Capabilities</synopsis> 10183 <description> 10184 Returns via <paramlink id="capabilities_ptr"></paramlink> the optional <jvmti/> 10185 features which this environment currently possesses. 10186 Each possessed capability is indicated by a one (<code>1</code>) in the 10187 corresponding field of the <internallink id="jvmtiCapabilities">capabilities 10188 structure</internallink>. 10189 An environment does not possess a capability unless it has been successfully added with 10190 <functionlink id="AddCapabilities"/>. 10191 An environment only loses possession of a capability if it has been relinquished with 10192 <functionlink id="RelinquishCapabilities"/>. Thus, this function returns the net result 10193 of the <code>AddCapabilities</code> and <code>RelinquishCapabilities</code> calls which 10194 have been made. 10195 <p/> 10196 See the 10197 <internallink id="capabilityExamples">Capability Examples</internallink>. 10198 </description> 10199 <origin>jvmdiClone</origin> 10200 <capabilities> 10201 </capabilities> 10202 <parameters> 10203 <param id="capabilities_ptr"> 10204 <outptr><struct>jvmtiCapabilities</struct></outptr> 10205 <description> 10206 On return, points to the <jvmti/> capabilities. 10207 </description> 10208 </param> 10209 </parameters> 10210 <errors> 10211 </errors> 10212 </function> 10213 10214 </category> 10215 10216 10217 <category id="timers" label="Timers"> 10218 10219 <intro> 10220 These functions provide timing information. 10221 The resolution at which the time is updated is not specified. 10222 They provides nanosecond precision, but not necessarily nanosecond accuracy. 10223 Details about the timers, such as their maximum values, can be accessed with 10224 the timer information functions. 10225 </intro> 10226 10227 <typedef id="jvmtiTimerInfo" label="Timer Info"> 10228 <description> 10229 The information function for each timer returns this data structure. 10230 </description> 10231 <field id="max_value"> 10232 <jlong/> 10233 <description> 10234 The maximum value the timer can reach. 10235 After this value is reached the timer wraps back to zero. 10236 This is an unsigned value. If tested or printed as a jlong (signed value) 10237 it may appear to be a negative number. 10238 </description> 10239 </field> 10240 <field id="may_skip_forward"> 10241 <jboolean/> 10242 <description> 10243 If true, the timer can be externally adjusted and as a result skip forward. 10244 If false, the timer value will never increase faster than real time. 10245 </description> 10246 </field> 10247 <field id="may_skip_backward"> 10248 <jboolean/> 10249 <description> 10250 If true, the timer can be externally adjusted and as a result skip backward. 10251 If false, the timer value will be monotonically increasing. 10252 </description> 10253 </field> 10254 <field id="kind"> 10255 <enum>jvmtiTimerKind</enum> 10256 <description> 10257 The kind of timer. 10258 On a platform that does not distinguish between user and system time, <datalink 10259 id="JVMTI_TIMER_TOTAL_CPU"><code>JVMTI_TIMER_TOTAL_CPU</code></datalink> 10260 is returned. 10261 </description> 10262 </field> 10263 <field id="reserved1"> 10264 <jlong/> 10265 <description> 10266 Reserved for future use. 10267 </description> 10268 </field> 10269 <field id="reserved2"> 10270 <jlong/> 10271 <description> 10272 Reserved for future use. 10273 </description> 10274 </field> 10275 </typedef> 10276 10277 <intro> 10278 Where the timer kind is -- 10279 10280 <constants id="jvmtiTimerKind" label="Timer Kinds" kind="enum"> 10281 <constant id="JVMTI_TIMER_USER_CPU" num="30"> 10282 CPU time that a thread is in user mode. 10283 </constant> 10284 <constant id="JVMTI_TIMER_TOTAL_CPU" num="31"> 10285 CPU time that a thread is in user or system mode. 10286 </constant> 10287 <constant id="JVMTI_TIMER_ELAPSED" num="32"> 10288 Elapsed time. 10289 </constant> 10290 </constants> 10291 </intro> 10292 10293 <function id="GetCurrentThreadCpuTimerInfo" callbacksafe="safe" impl="innative notrace" phase="start" num="134"> 10294 <synopsis>Get Current Thread CPU Timer Information</synopsis> 10295 <description> 10296 Get information about the 10297 <functionlink id="GetCurrentThreadCpuTime"/> timer. 10298 The fields of the <datalink id="jvmtiTimerInfo"/> structure 10299 are filled in with details about the timer. 10300 This information is specific to the platform and the implementation of 10301 <functionlink id="GetCurrentThreadCpuTime"/> and thus 10302 does not vary by thread nor does it vary 10303 during a particular invocation of the VM. 10304 <p/> 10305 Note that the implementations of <functionlink id="GetCurrentThreadCpuTime"/> 10306 and <functionlink id="GetThreadCpuTime"/> may differ, and thus the values 10307 returned by <code>GetCurrentThreadCpuTimerInfo</code> 10308 and <functionlink id="GetThreadCpuTimerInfo"/> 10309 may differ -- see <functionlink id="GetCurrentThreadCpuTime"/> for more information. 10310 </description> 10311 <origin>new</origin> 10312 <capabilities> 10313 <required id="can_get_current_thread_cpu_time"> 10314 Can get current thread CPU time. 10315 </required> 10316 </capabilities> 10317 <parameters> 10318 <param id="info_ptr"> 10319 <outptr><struct>jvmtiTimerInfo</struct></outptr> 10320 <description> 10321 On return, filled with information describing the time 10322 returned by <functionlink id="GetCurrentThreadCpuTime"/>. 10323 </description> 10324 </param> 10325 </parameters> 10326 <errors> 10327 </errors> 10328 </function> 10329 10330 <function id="GetCurrentThreadCpuTime" callbacksafe="safe" impl="innative notrace" phase="start" num="135"> 10331 <synopsis>Get Current Thread CPU Time</synopsis> 10332 <description> 10333 Return the CPU time utilized by the current thread. 10334 <p/> 10335 Note that the <functionlink id="GetThreadCpuTime"/> 10336 function provides CPU time for any thread, including 10337 the current thread. <code>GetCurrentThreadCpuTime</code> 10338 exists to support platforms which cannot 10339 supply CPU time for threads other than the current 10340 thread or which have more accurate information for 10341 the current thread (see 10342 <functionlink id="GetCurrentThreadCpuTimerInfo"/> vs 10343 <functionlink id="GetThreadCpuTimerInfo"/>). 10344 On many platforms this call will be equivalent to: 10345 <example> 10346 GetThreadCpuTime(env, NULL, nanos_ptr) 10347 </example> 10348 </description> 10349 <origin>new</origin> 10350 <capabilities> 10351 <required id="can_get_current_thread_cpu_time"> 10352 Can get current thread CPU time. 10353 <p/> 10354 If this capability is enabled after threads have started, 10355 the implementation may choose any time up 10356 to and including the time that the capability is enabled 10357 as the point where CPU time collection starts. 10358 <p/> 10359 This capability must be potentially available on any 10360 platform where 10361 <internallink id="jvmtiCapabilities.can_get_thread_cpu_time"><code>can_get_thread_cpu_time</code></internallink> 10362 is potentially available. 10363 </required> 10364 </capabilities> 10365 <parameters> 10366 <param id="nanos_ptr"> 10367 <outptr><jlong/></outptr> 10368 <description> 10369 On return, points to the CPU time used by this thread 10370 in nanoseconds. 10371 This is an unsigned value. If tested or printed as a jlong (signed value) 10372 it may appear to be a negative number. 10373 </description> 10374 </param> 10375 </parameters> 10376 <errors> 10377 </errors> 10378 </function> 10379 10380 <function id="GetThreadCpuTimerInfo" num="136"> 10381 <synopsis>Get Thread CPU Timer Information</synopsis> 10382 <description> 10383 Get information about the 10384 <functionlink id="GetThreadCpuTime"/> timer. 10385 The fields of the <datalink id="jvmtiTimerInfo"/> structure 10386 are filled in with details about the timer. 10387 This information is specific to the platform and the implementation of 10388 <functionlink id="GetThreadCpuTime"/> and thus 10389 does not vary by thread nor does it vary 10390 during a particular invocation of the VM. 10391 <p/> 10392 Note that the implementations of <functionlink id="GetCurrentThreadCpuTime"/> 10393 and <functionlink id="GetThreadCpuTime"/> may differ, and thus the values 10394 returned by <functionlink id="GetCurrentThreadCpuTimerInfo"/> 10395 and <code>GetThreadCpuTimerInfo</code> 10396 may differ -- see <functionlink id="GetCurrentThreadCpuTime"/> for more information. 10397 </description> 10398 <origin>new</origin> 10399 <capabilities> 10400 <required id="can_get_thread_cpu_time"> 10401 Can get thread CPU time. 10402 </required> 10403 </capabilities> 10404 <parameters> 10405 <param id="info_ptr"> 10406 <outptr><struct>jvmtiTimerInfo</struct></outptr> 10407 <description> 10408 On return, filled with information describing the time 10409 returned by <functionlink id="GetThreadCpuTime"/>. 10410 </description> 10411 </param> 10412 </parameters> 10413 <errors> 10414 </errors> 10415 </function> 10416 10417 <function id="GetThreadCpuTime" num="137"> 10418 <synopsis>Get Thread CPU Time</synopsis> 10419 <description> 10420 Return the CPU time utilized by the specified thread. 10421 <p/> 10422 Get information about this timer with 10423 <functionlink id="GetThreadCpuTimerInfo"/>. 10424 </description> 10425 <origin>new</origin> 10426 <capabilities> 10427 <required id="can_get_thread_cpu_time"> 10428 Can get thread CPU time. 10429 <p/> 10430 If this capability is enabled after threads have started, 10431 the implementation may choose any time up 10432 to and including the time that the capability is enabled 10433 as the point where CPU time collection starts. 10434 </required> 10435 </capabilities> 10436 <parameters> 10437 <param id="thread"> 10438 <jthread null="current"/> 10439 <description> 10440 The thread to query. 10441 </description> 10442 </param> 10443 <param id="nanos_ptr"> 10444 <outptr><jlong/></outptr> 10445 <description> 10446 On return, points to the CPU time used by the specified thread 10447 in nanoseconds. 10448 This is an unsigned value. If tested or printed as a jlong (signed value) 10449 it may appear to be a negative number. 10450 </description> 10451 </param> 10452 </parameters> 10453 <errors> 10454 </errors> 10455 </function> 10456 10457 <function id="GetTimerInfo" phase="any" callbacksafe="safe" num="138"> 10458 <synopsis>Get Timer Information</synopsis> 10459 <description> 10460 Get information about the 10461 <functionlink id="GetTime"/> timer. 10462 The fields of the <datalink id="jvmtiTimerInfo"/> structure 10463 are filled in with details about the timer. 10464 This information will not change during a particular invocation of the VM. 10465 </description> 10466 <origin>new</origin> 10467 <capabilities> 10468 </capabilities> 10469 <parameters> 10470 <param id="info_ptr"> 10471 <outptr><struct>jvmtiTimerInfo</struct></outptr> 10472 <description> 10473 On return, filled with information describing the time 10474 returned by <functionlink id="GetTime"/>. 10475 </description> 10476 </param> 10477 </parameters> 10478 <errors> 10479 </errors> 10480 </function> 10481 10482 <function id="GetTime" phase="any" callbacksafe="safe" num="139"> 10483 <synopsis>Get Time</synopsis> 10484 <description> 10485 Return the current value of the system timer, in nanoseconds. 10486 <p/> 10487 The value returned represents nanoseconds since some fixed but 10488 arbitrary time (perhaps in the future, so values may be 10489 negative). This function provides nanosecond precision, but not 10490 necessarily nanosecond accuracy. No guarantees are made about 10491 how frequently values change. 10492 <p/> 10493 Get information about this timer with 10494 <functionlink id="GetTimerInfo"/>. 10495 </description> 10496 <origin>new</origin> 10497 <capabilities> 10498 </capabilities> 10499 <parameters> 10500 <param id="nanos_ptr"> 10501 <outptr><jlong/></outptr> 10502 <description> 10503 On return, points to the time in nanoseconds. 10504 This is an unsigned value. If tested or printed as a jlong (signed value) 10505 it may appear to be a negative number. 10506 </description> 10507 </param> 10508 </parameters> 10509 <errors> 10510 </errors> 10511 </function> 10512 10513 <function id="GetAvailableProcessors" phase="any" num="144"> 10514 <synopsis>Get Available Processors</synopsis> 10515 <description> 10516 Returns the number of processors available to the Java virtual machine. 10517 <p/> 10518 This value may change during a particular invocation of the virtual machine. 10519 Applications that are sensitive to the number of available processors should 10520 therefore occasionally poll this property. 10521 </description> 10522 <origin>new</origin> 10523 <capabilities> 10524 </capabilities> 10525 <parameters> 10526 <param id="processor_count_ptr"> 10527 <outptr><jint/></outptr> 10528 <description> 10529 On return, points to the maximum number of processors available to the 10530 virtual machine; never smaller than one. 10531 </description> 10532 </param> 10533 </parameters> 10534 <errors> 10535 </errors> 10536 </function> 10537 10538 </category> 10539 10540 10541 <category id="classLoaderSearch" label="Class Loader Search"> 10542 10543 <intro> 10544 These functions allow the agent to add to the locations that a class loader searches for a class. 10545 This is useful for installing instrumentation under the correct class loader. 10546 </intro> 10547 10548 <function id="AddToBootstrapClassLoaderSearch" jkernel="yes" phase="onload" num="149"> 10549 <synopsis>Add To Bootstrap Class Loader Search</synopsis> 10550 <description> 10551 This function can be used to cause instrumentation classes to be defined by the 10552 bootstrap class loader. See <vmspec chapter="5.3.1"/>. 10553 After the bootstrap 10554 class loader unsuccessfully searches for a class, the specified platform-dependent 10555 search path <paramlink id="segment"/> will be searched as well. Only one segment may be specified in 10556 the <paramlink id="segment"/>. This function may be called multiple times to add multiple segments, 10557 the segments will be searched in the order that this function was called. 10558 <p/> 10559 In the <code>OnLoad</code> phase the function may be used to specify any platform-dependent 10560 search path segment to be searched after the bootstrap class loader unsuccessfully searches 10561 for a class. The segment is typically a directory or JAR file. 10562 <p/> 10563 In the live phase the <paramlink id="segment"/> may be used to specify any platform-dependent 10564 path to a <externallink id="http://docs.oracle.com/javase/7/docs/technotes/guides/jar/jar.html"> 10565 JAR file</externallink>. The agent should take care that the JAR file does not 10566 contain any classes or resources other than those to be defined by the bootstrap 10567 class loader for the purposes of instrumentation. 10568 <p/> 10569 <vmspec/> specifies that a subsequent attempt to resolve a symbolic 10570 reference that the Java virtual machine has previously unsuccessfully attempted 10571 to resolve always fails with the same error that was thrown as a result of the 10572 initial resolution attempt. Consequently, if the JAR file contains an entry 10573 that corresponds to a class for which the Java virtual machine has 10574 unsuccessfully attempted to resolve a reference, then subsequent attempts to 10575 resolve that reference will fail with the same error as the initial attempt. 10576 </description> 10577 <origin>new</origin> 10578 <capabilities> 10579 </capabilities> 10580 <parameters> 10581 <param id="segment"> 10582 <inbuf><char/></inbuf> 10583 <description> 10584 The platform-dependent search path segment, encoded as a 10585 <internallink id="mUTF">modified UTF-8</internallink> string. 10586 </description> 10587 </param> 10588 </parameters> 10589 <errors> 10590 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 10591 <paramlink id="segment"/> is an invalid path. In the live phase, anything other than an 10592 existing JAR file is an invalid path. 10593 </error> 10594 </errors> 10595 </function> 10596 10597 <function id="AddToSystemClassLoaderSearch" jkernel="yes" phase="onload" num="151" since="1.1"> 10598 <synopsis>Add To System Class Loader Search</synopsis> 10599 <description> 10600 This function can be used to cause instrumentation classes to be 10601 defined by the system class loader. See <vmspec chapter="5.3.2"/>. 10602 After the class loader unsuccessfully searches for a class, the specified platform-dependent search 10603 path <paramlink id="segment"/> will be searched as well. Only one segment may be specified in the 10604 <paramlink id="segment"/>. This function may be called multiple times to add multiple segments, the 10605 segments will be searched in the order that this function was called. 10606 <p/> 10607 In the <code>OnLoad</code> phase the function may be used to specify any platform-dependent 10608 search path segment to be searched after the system class loader unsuccessfully searches 10609 for a class. The segment is typically a directory or JAR file. 10610 <p/> 10611 In the live phase the <paramlink id="segment"/> is a platform-dependent path to a <externallink 10612 id="http://docs.oracle.com/javase/7/docs/technotes/guides/jar/jar.html">JAR file</externallink> to be 10613 searched after the system class loader unsuccessfully searches for a class. The agent should 10614 take care that the JAR file does not contain any classes or resources other than those to be 10615 defined by the system class loader for the purposes of instrumentation. 10616 <p/> 10617 In the live phase the system class loader supports adding a JAR file to be searched if 10618 the system class loader implements a method name <code>appendToClassPathForInstrumentation</code> 10619 which takes a single parameter of type <code>java.lang.String</code>. The method is not required 10620 to have <code>public</code> access. 10621 <p/> 10622 <vmspec/> specifies that a subsequent attempt to resolve a symbolic 10623 reference that the Java virtual machine has previously unsuccessfully attempted 10624 to resolve always fails with the same error that was thrown as a result of the 10625 initial resolution attempt. Consequently, if the JAR file contains an entry 10626 that corresponds to a class for which the Java virtual machine has 10627 unsuccessfully attempted to resolve a reference, then subsequent attempts to 10628 resolve that reference will fail with the same error as the initial attempt. 10629 </description> 10630 <origin>new</origin> 10631 <capabilities> 10632 </capabilities> 10633 <parameters> 10634 <param id="segment"> 10635 <inbuf><char/></inbuf> 10636 <description> 10637 The platform-dependent search path segment, encoded as a 10638 <internallink id="mUTF">modified UTF-8</internallink> string. 10639 </description> 10640 </param> 10641 </parameters> 10642 <errors> 10643 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 10644 <paramlink id="segment"/> is an invalid path. In the live phase, anything other than an 10645 existing JAR file is an invalid path. 10646 </error> 10647 <error id="JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED"> 10648 Operation not supported by the system class loader. 10649 </error> 10650 </errors> 10651 </function> 10652 10653 </category> 10654 10655 10656 <category id="props" label="System Properties"> 10657 10658 <intro> 10659 These functions get and set system properties. 10660 </intro> 10661 10662 <function id="GetSystemProperties" phase="onload" num="130"> 10663 <synopsis>Get System Properties</synopsis> 10664 <description> 10665 The list of VM system property keys which may be used with 10666 <functionlink id="GetSystemProperty"/> is returned. 10667 It is strongly recommended that virtual machines provide the 10668 following property keys: 10669 <ul> 10670 <li><code>java.vm.vendor</code></li> 10671 <li><code>java.vm.version</code></li> 10672 <li><code>java.vm.name</code></li> 10673 <li><code>java.vm.info</code></li> 10674 <li><code>java.library.path</code></li> 10675 <li><code>java.class.path</code></li> 10676 </ul> 10677 Provides access to system properties defined by and used 10678 by the VM. 10679 Properties set on the command-line are included. 10680 This allows getting and setting of these properties 10681 before the VM even begins executing bytecodes. 10682 Since this is a VM view of system properties, the set of available 10683 properties will usually be different than that 10684 in <code>java.lang.System.getProperties</code>. 10685 JNI method invocation may be used to access 10686 <code>java.lang.System.getProperties</code>. 10687 <p/> 10688 The set of properties may grow during execution. 10689 </description> 10690 <origin>new</origin> 10691 <capabilities> 10692 </capabilities> 10693 <parameters> 10694 <param id="count_ptr"> 10695 <outptr><jint/></outptr> 10696 <description> 10697 On return, points to the number of property keys returned. 10698 </description> 10699 </param> 10700 <param id="property_ptr"> 10701 <allocallocbuf outcount="count_ptr"><char/></allocallocbuf> 10702 <description> 10703 On return, points to an array of property keys, encoded as 10704 <internallink id="mUTF">modified UTF-8</internallink> strings. 10705 </description> 10706 </param> 10707 </parameters> 10708 <errors> 10709 </errors> 10710 </function> 10711 10712 <function id="GetSystemProperty" phase="onload" num="131"> 10713 <synopsis>Get System Property</synopsis> 10714 <description> 10715 Return a VM system property value given the property key. 10716 <p/> 10717 The function <functionlink id="GetSystemProperties"/> 10718 returns the set of property keys which may be used. 10719 The properties which can be retrieved may grow during 10720 execution. 10721 <p/> 10722 Since this is a VM view of system properties, the values 10723 of properties may differ from that returned by 10724 <code>java.lang.System.getProperty(String)</code>. 10725 A typical VM might copy the values of the VM system 10726 properties into the <code>Properties</code> held by 10727 <code>java.lang.System</code> during the initialization 10728 of that class. Thereafter any changes to the VM system 10729 properties (with <functionlink id="SetSystemProperty"/>) 10730 or the <code>java.lang.System</code> system properties 10731 (with <code>java.lang.System.setProperty(String,String)</code>) 10732 would cause the values to diverge. 10733 JNI method invocation may be used to access 10734 <code>java.lang.System.getProperty(String)</code>. 10735 </description> 10736 <origin>new</origin> 10737 <capabilities> 10738 </capabilities> 10739 <parameters> 10740 <param id="property"> 10741 <inbuf><char/></inbuf> 10742 <description> 10743 The key of the property to retrieve, encoded as a 10744 <internallink id="mUTF">modified UTF-8</internallink> string. 10745 </description> 10746 </param> 10747 <param id="value_ptr"> 10748 <allocbuf><char/></allocbuf> 10749 <description> 10750 On return, points to the property value, encoded as a 10751 <internallink id="mUTF">modified UTF-8</internallink> string. 10752 </description> 10753 </param> 10754 </parameters> 10755 <errors> 10756 <error id="JVMTI_ERROR_NOT_AVAILABLE"> 10757 This property is not available. 10758 Use <functionlink id="GetSystemProperties"/> to find available properties. 10759 </error> 10760 </errors> 10761 </function> 10762 10763 <function id="SetSystemProperty" phase="onloadOnly" num="132"> 10764 <synopsis>Set System Property</synopsis> 10765 <description> 10766 Set a VM system property value. 10767 <p/> 10768 The function <functionlink id="GetSystemProperties"/> 10769 returns the set of property keys, some of these may be settable. 10770 See <functionlink id="GetSystemProperty"/>. 10771 </description> 10772 <origin>new</origin> 10773 <capabilities> 10774 </capabilities> 10775 <parameters> 10776 <param id="property"> 10777 <inbuf><char/></inbuf> 10778 <description> 10779 The key of the property, encoded as a 10780 <internallink id="mUTF">modified UTF-8</internallink> string. 10781 </description> 10782 </param> 10783 <param id="value_ptr"> 10784 <inbuf> 10785 <char/> 10786 <nullok> 10787 do not set the value, but return <errorlink id="JVMTI_ERROR_NOT_AVAILABLE"/> 10788 if the property is not writeable 10789 </nullok> 10790 </inbuf> 10791 <description> 10792 The property value to set, encoded as a 10793 <internallink id="mUTF">modified UTF-8</internallink> string. 10794 </description> 10795 </param> 10796 </parameters> 10797 <errors> 10798 <error id="JVMTI_ERROR_NOT_AVAILABLE"> 10799 This property is not available or is not writeable. 10800 </error> 10801 </errors> 10802 </function> 10803 10804 </category> 10805 10806 <category id="general" label="General"> 10807 10808 <intro> 10809 </intro> 10810 10811 <function id="GetPhase" jkernel="yes" phase="any" num="133"> 10812 <synopsis>Get Phase</synopsis> 10813 <description> 10814 Return the current phase of VM execution. 10815 The phases proceed in sequence: 10816 <constants id="jvmtiPhase" label="Phases of execution" kind="enum"> 10817 <constant id="JVMTI_PHASE_ONLOAD" num="1"> 10818 <code>OnLoad</code> phase: while in the 10819 <internallink id="onload"><code>Agent_OnLoad</code></internallink> 10820 or, for statically linked agents, the <internallink id="onload"> 10821 <code>Agent_OnLoad_<agent-lib-name> 10822 </code></internallink> function. 10823 </constant> 10824 <constant id="JVMTI_PHASE_PRIMORDIAL" num="2"> 10825 Primordial phase: between return from <code>Agent_OnLoad</code> 10826 or <code>Agent_OnLoad_<agent-lib-name></code> and the 10827 <code>VMStart</code> event. 10828 </constant> 10829 <constant id="JVMTI_PHASE_START" num="6"> 10830 Start phase: when the <eventlink id="VMStart"><code>VMStart</code></eventlink> event 10831 is sent and until the <code>VMInit</code> event is sent. 10832 </constant> 10833 <constant id="JVMTI_PHASE_LIVE" num="4"> 10834 Live phase: when the <eventlink id="VMInit"><code>VMInit</code></eventlink> event is sent 10835 and until the <eventlink id="VMDeath"></eventlink> event returns. 10836 </constant> 10837 <constant id="JVMTI_PHASE_DEAD" num="8"> 10838 Dead phase: after the <eventlink id="VMDeath"></eventlink> event returns or after 10839 start-up failure. 10840 </constant> 10841 </constants> 10842 In the case of start-up failure the VM will proceed directly to the dead 10843 phase skipping intermediate phases and neither a <code>VMInit</code> nor 10844 <code>VMDeath</code> event will be sent. 10845 <p/> 10846 Most <jvmti/> functions operate only in the live phase. 10847 The following functions operate in either the <code>OnLoad</code> or live phases: 10848 <functionphaselist phase="onload"/> 10849 The following functions operate in only the <code>OnLoad</code> phase: 10850 <functionphaselist phase="onloadOnly"/> 10851 The following functions operate in the start or live phases: 10852 <functionphaselist phase="start"/> 10853 The following functions operate in any phase: 10854 <functionphaselist phase="any"/> 10855 JNI functions (except the Invocation API) must only be used in the start or live phases. 10856 <p/> 10857 Most <jvmti/> events are sent only in the live phase. 10858 The following events operate in others phases: 10859 <eventphaselist phase="start"/> 10860 <eventphaselist phase="any"/> 10861 </description> 10862 <origin>new</origin> 10863 <capabilities> 10864 </capabilities> 10865 <parameters> 10866 <param id="phase_ptr"> 10867 <outptr><enum>jvmtiPhase</enum></outptr> 10868 <description> 10869 On return, points to the phase. 10870 </description> 10871 </param> 10872 </parameters> 10873 <errors> 10874 </errors> 10875 </function> 10876 10877 <function id="DisposeEnvironment" jkernel="yes" phase="any" num="127"> 10878 <synopsis>Dispose Environment</synopsis> 10879 <description> 10880 Shutdown a <jvmti/> connection created with JNI <code>GetEnv</code> 10881 (see <internallink id="environments"><jvmti/> Environments</internallink>). 10882 Dispose of any resources held by the environment. 10883 <issue> 10884 What resources are reclaimed? What is undone? 10885 Breakpoints,watchpoints removed? 10886 </issue> 10887 Threads suspended by this environment are not resumed by this call, 10888 this must be done explicitly by the agent. 10889 Memory allocated by this environment via calls to <jvmti/> functions 10890 is not released, this can be done explicitly by the agent 10891 by calling <functionlink id="Deallocate"/>. 10892 Raw monitors created by this environment are not destroyed, 10893 this can be done explicitly by the agent 10894 by calling <functionlink id="DestroyRawMonitor"/>. 10895 The state of threads waiting on raw monitors created by this environment 10896 are not affected. 10897 <p/> 10898 Any <functionlink id="SetNativeMethodPrefix">native method 10899 prefixes</functionlink> for this environment will be unset; 10900 the agent must remove any prefixed native methods before 10901 dispose is called. 10902 <p/> 10903 Any <internallink id="capability">capabilities</internallink> 10904 held by this environment are relinquished. 10905 <p/> 10906 Events enabled by this environment will no longer be sent, however 10907 event handlers currently running will continue to run. Caution must 10908 be exercised in the design of event handlers whose environment may 10909 be disposed and thus become invalid during their execution. 10910 <p/> 10911 This environment may not be used after this call. 10912 This call returns to the caller. 10913 </description> 10914 <origin>new</origin> 10915 <capabilities> 10916 </capabilities> 10917 <parameters> 10918 </parameters> 10919 <errors> 10920 </errors> 10921 </function> 10922 10923 <function id="SetEnvironmentLocalStorage" jkernel="yes" phase="any" callbacksafe="safe" impl="innative notrace" num="148"> 10924 <synopsis>Set Environment Local Storage</synopsis> 10925 <description> 10926 The VM stores a pointer value associated with each environment. 10927 This pointer value is called <i>environment-local storage</i>. 10928 This value is <code>NULL</code> unless set with this function. 10929 Agents can allocate memory in which they store environment specific 10930 information. By setting environment-local storage it can then be 10931 accessed with 10932 <functionlink id="GetEnvironmentLocalStorage"></functionlink>. 10933 <p/> 10934 Called by the agent to set the value of the <jvmti/> 10935 environment-local storage. <jvmti/> supplies to the agent a pointer-size 10936 environment-local storage that can be used to record per-environment 10937 information. 10938 </description> 10939 <origin>new</origin> 10940 <capabilities> 10941 </capabilities> 10942 <parameters> 10943 <param id="data"> 10944 <inbuf> 10945 <void/> 10946 <nullok>value is set to <code>NULL</code></nullok> 10947 </inbuf> 10948 <description> 10949 The value to be entered into the environment-local storage. 10950 </description> 10951 </param> 10952 </parameters> 10953 <errors> 10954 </errors> 10955 </function> 10956 10957 <function id="GetEnvironmentLocalStorage" jkernel="yes" phase="any" callbacksafe="safe" impl="innative notrace" num="147"> 10958 <synopsis>Get Environment Local Storage</synopsis> 10959 <description> 10960 Called by the agent to get the value of the <jvmti/> environment-local 10961 storage. 10962 </description> 10963 <origin>new</origin> 10964 <capabilities> 10965 </capabilities> 10966 <parameters> 10967 <param id="data_ptr"> 10968 <agentbuf><void/></agentbuf> 10969 <description> 10970 Pointer through which the value of the environment local 10971 storage is returned. 10972 If environment-local storage has not been set with 10973 <functionlink id="SetEnvironmentLocalStorage"></functionlink> returned 10974 pointer is <code>NULL</code>. 10975 </description> 10976 </param> 10977 </parameters> 10978 <errors> 10979 </errors> 10980 </function> 10981 10982 <function id="GetVersionNumber" jkernel="yes" phase="any" num="88"> 10983 <synopsis>Get Version Number</synopsis> 10984 <description> 10985 Return the <jvmti/> version via <code>version_ptr</code>. 10986 The return value is the version identifier. 10987 The version identifier includes major, minor and micro 10988 version as well as the interface type. 10989 <constants id="jvmtiVersionInterfaceTypes" label="Version Interface Types" kind="bits"> 10990 <constant id="JVMTI_VERSION_INTERFACE_JNI" num="0x00000000"> 10991 Value of <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> for JNI. 10992 </constant> 10993 <constant id="JVMTI_VERSION_INTERFACE_JVMTI" num="0x30000000"> 10994 Value of <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> for <jvmti/>. 10995 </constant> 10996 </constants> 10997 <constants id="jvmtiVersionMasks" label="Version Masks" kind="bits"> 10998 <constant id="JVMTI_VERSION_MASK_INTERFACE_TYPE" num="0x70000000"> 10999 Mask to extract interface type. 11000 The value of the version returned by this function masked with 11001 <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> is always 11002 <code>JVMTI_VERSION_INTERFACE_JVMTI</code> 11003 since this is a <jvmti/> function. 11004 </constant> 11005 <constant id="JVMTI_VERSION_MASK_MAJOR" num="0x0FFF0000"> 11006 Mask to extract major version number. 11007 </constant> 11008 <constant id="JVMTI_VERSION_MASK_MINOR" num="0x0000FF00"> 11009 Mask to extract minor version number. 11010 </constant> 11011 <constant id="JVMTI_VERSION_MASK_MICRO" num="0x000000FF"> 11012 Mask to extract micro version number. 11013 </constant> 11014 </constants> 11015 <constants id="jvmtiVersionShifts" label="Version Shifts" kind="bits"> 11016 <constant id="JVMTI_VERSION_SHIFT_MAJOR" num="16"> 11017 Shift to extract major version number. 11018 </constant> 11019 <constant id="JVMTI_VERSION_SHIFT_MINOR" num="8"> 11020 Shift to extract minor version number. 11021 </constant> 11022 <constant id="JVMTI_VERSION_SHIFT_MICRO" num="0"> 11023 Shift to extract micro version number. 11024 </constant> 11025 </constants> 11026 </description> 11027 <origin>jvmdi</origin> 11028 <capabilities> 11029 </capabilities> 11030 <parameters> 11031 <param id="version_ptr"> 11032 <outptr><jint/></outptr> 11033 <description> 11034 On return, points to the <jvmti/> version. 11035 </description> 11036 </param> 11037 </parameters> 11038 <errors> 11039 </errors> 11040 </function> 11041 11042 11043 <function id="GetErrorName" phase="any" num="128"> 11044 <synopsis>Get Error Name</synopsis> 11045 <description> 11046 Return the symbolic name for an 11047 <internallink id="ErrorSection">error code</internallink>. 11048 <p/> 11049 For example 11050 <code>GetErrorName(env, JVMTI_ERROR_NONE, &err_name)</code> 11051 would return in <code>err_name</code> the string 11052 <code>"JVMTI_ERROR_NONE"</code>. 11053 </description> 11054 <origin>new</origin> 11055 <capabilities> 11056 </capabilities> 11057 <parameters> 11058 <param id="error"> 11059 <enum>jvmtiError</enum> 11060 <description> 11061 The error code. 11062 </description> 11063 </param> 11064 <param id="name_ptr"> 11065 <allocbuf><char/></allocbuf> 11066 <description> 11067 On return, points to the error name. 11068 The name is encoded as a 11069 <internallink id="mUTF">modified UTF-8</internallink> string, 11070 but is restricted to the ASCII subset. 11071 </description> 11072 </param> 11073 </parameters> 11074 <errors> 11075 </errors> 11076 </function> 11077 11078 <function id="SetVerboseFlag" phase="any" num="150"> 11079 <synopsis>Set Verbose Flag</synopsis> 11080 <description> 11081 <constants id="jvmtiVerboseFlag" label="Verbose Flag Enumeration" kind="enum"> 11082 <constant id="JVMTI_VERBOSE_OTHER" num="0"> 11083 Verbose output other than the below. 11084 </constant> 11085 <constant id="JVMTI_VERBOSE_GC" num="1"> 11086 Verbose garbage collector output, like that specified with <code>-verbose:gc</code>. 11087 </constant> 11088 <constant id="JVMTI_VERBOSE_CLASS" num="2"> 11089 Verbose class loading output, like that specified with <code>-verbose:class</code>. 11090 </constant> 11091 <constant id="JVMTI_VERBOSE_JNI" num="4"> 11092 Verbose JNI output, like that specified with <code>-verbose:jni</code>. 11093 </constant> 11094 </constants> 11095 Control verbose output. 11096 This is the output which typically is sent to <code>stderr</code>. 11097 </description> 11098 <origin>new</origin> 11099 <capabilities> 11100 </capabilities> 11101 <parameters> 11102 <param id="flag"> 11103 <enum>jvmtiVerboseFlag</enum> 11104 <description> 11105 Which verbose flag to set. 11106 </description> 11107 </param> 11108 <param id="value"> 11109 <jboolean/> 11110 <description> 11111 New value of the flag. 11112 </description> 11113 </param> 11114 </parameters> 11115 <errors> 11116 </errors> 11117 </function> 11118 11119 11120 <function id="GetJLocationFormat" phase="any" num="129"> 11121 <synopsis>Get JLocation Format</synopsis> 11122 <description> 11123 Although the greatest functionality is achieved with location information 11124 referencing the virtual machine bytecode index, the definition of 11125 <code>jlocation</code> has intentionally been left unconstrained to allow VM 11126 implementations that do not have this information. 11127 <p/> 11128 This function describes the representation of <code>jlocation</code> used in this VM. 11129 If the returned format is <datalink id="JVMTI_JLOCATION_JVMBCI"></datalink>, 11130 <code>jlocation</code>s can 11131 be used as in indices into the array returned by 11132 <functionlink id="GetBytecodes"></functionlink>. 11133 <constants id="jvmtiJlocationFormat" label="JLocation Format Enumeration" kind="enum"> 11134 <constant id="JVMTI_JLOCATION_JVMBCI" num="1"> 11135 <code>jlocation</code> values represent virtual machine 11136 bytecode indices--that is, offsets into the 11137 virtual machine code for a method. 11138 </constant> 11139 <constant id="JVMTI_JLOCATION_MACHINEPC" num="2"> 11140 <code>jlocation</code> values represent native machine 11141 program counter values. 11142 </constant> 11143 <constant id="JVMTI_JLOCATION_OTHER" num="0"> 11144 <code>jlocation</code> values have some other representation. 11145 </constant> 11146 </constants> 11147 </description> 11148 <origin>new</origin> 11149 <capabilities> 11150 </capabilities> 11151 <parameters> 11152 <param id="format_ptr"> 11153 <outptr><enum>jvmtiJlocationFormat</enum></outptr> 11154 <description> 11155 On return, points to the format identifier for <code>jlocation</code> values. 11156 </description> 11157 </param> 11158 </parameters> 11159 <errors> 11160 </errors> 11161 </function> 11162 11163 </category> 11164 11165 </functionsection> 11166 11167 <errorsection label="Error Reference"> 11168 <intro> 11169 Every <jvmti/> function returns a <b><code>jvmtiError</code></b> error code. 11170 <p/> 11171 It is the responsibility of the agent to call <jvmti/> functions with 11172 valid parameters and in the proper context (calling thread is attached, 11173 phase is correct, etc.). 11174 Detecting some error conditions may be difficult, inefficient, or 11175 impossible for an implementation. 11176 The errors listed in 11177 <internallink id="reqerrors">Function Specific Required Errors</internallink> 11178 must be detected by the implementation. 11179 All other errors represent the recommended response to the error 11180 condition. 11181 </intro> 11182 11183 <errorcategory id="universal-error" label="Universal Errors"> 11184 <intro> 11185 The following errors may be returned by any function 11186 </intro> 11187 11188 <errorid id="JVMTI_ERROR_NONE" num="0"> 11189 No error has occurred. This is the error code that is returned 11190 on successful completion of the function. 11191 </errorid> 11192 <errorid id="JVMTI_ERROR_NULL_POINTER" num="100"> 11193 Pointer is unexpectedly <code>NULL</code>. 11194 </errorid> 11195 <errorid id="JVMTI_ERROR_OUT_OF_MEMORY" num="110"> 11196 The function attempted to allocate memory and no more memory was 11197 available for allocation. 11198 </errorid> 11199 <errorid id="JVMTI_ERROR_ACCESS_DENIED" num="111"> 11200 The desired functionality has not been enabled in this virtual machine. 11201 </errorid> 11202 <errorid id="JVMTI_ERROR_UNATTACHED_THREAD" num="115"> 11203 The thread being used to call this function is not attached 11204 to the virtual machine. Calls must be made from attached threads. 11205 See <code>AttachCurrentThread</code> in the JNI invocation API. 11206 </errorid> 11207 <errorid id="JVMTI_ERROR_INVALID_ENVIRONMENT" num="116"> 11208 The <jvmti/> environment provided is no longer connected or is 11209 not an environment. 11210 </errorid> 11211 <errorid id="JVMTI_ERROR_WRONG_PHASE" num="112"> 11212 The desired functionality is not available in the current 11213 <functionlink id="GetPhase">phase</functionlink>. 11214 Always returned if the virtual machine has completed running. 11215 </errorid> 11216 <errorid id="JVMTI_ERROR_INTERNAL" num="113"> 11217 An unexpected internal error has occurred. 11218 </errorid> 11219 </errorcategory> 11220 11221 <errorcategory id="reqerrors" label="Function Specific Required Errors"> 11222 <intro> 11223 The following errors are returned by some <jvmti/> functions and must 11224 be returned by the implementation when the condition occurs. 11225 </intro> 11226 11227 <errorid id="JVMTI_ERROR_INVALID_PRIORITY" num="12"> 11228 Invalid priority. 11229 </errorid> 11230 <errorid id="JVMTI_ERROR_THREAD_NOT_SUSPENDED" num="13"> 11231 Thread was not suspended. 11232 </errorid> 11233 <errorid id="JVMTI_ERROR_THREAD_SUSPENDED" num="14"> 11234 Thread already suspended. 11235 </errorid> 11236 <errorid id="JVMTI_ERROR_THREAD_NOT_ALIVE" num="15"> 11237 This operation requires the thread to be alive--that is, 11238 it must be started and not yet have died. 11239 </errorid> 11240 <errorid id="JVMTI_ERROR_CLASS_NOT_PREPARED" num="22"> 11241 The class has been loaded but not yet prepared. 11242 </errorid> 11243 <errorid id="JVMTI_ERROR_NO_MORE_FRAMES" num="31"> 11244 There are no Java programming language or JNI stack frames at the specified depth. 11245 </errorid> 11246 <errorid id="JVMTI_ERROR_OPAQUE_FRAME" num="32"> 11247 Information about the frame is not available (e.g. for native frames). 11248 </errorid> 11249 <errorid id="JVMTI_ERROR_DUPLICATE" num="40"> 11250 Item already set. 11251 </errorid> 11252 <errorid id="JVMTI_ERROR_NOT_FOUND" num="41"> 11253 Desired element (e.g. field or breakpoint) not found 11254 </errorid> 11255 <errorid id="JVMTI_ERROR_NOT_MONITOR_OWNER" num="51"> 11256 This thread doesn't own the raw monitor. 11257 </errorid> 11258 <errorid id="JVMTI_ERROR_INTERRUPT" num="52"> 11259 The call has been interrupted before completion. 11260 </errorid> 11261 <errorid id="JVMTI_ERROR_UNMODIFIABLE_CLASS" num="79"> 11262 The class cannot be modified. 11263 </errorid> 11264 <errorid id="JVMTI_ERROR_NOT_AVAILABLE" num="98"> 11265 The functionality is not available in this virtual machine. 11266 </errorid> 11267 <errorid id="JVMTI_ERROR_ABSENT_INFORMATION" num="101"> 11268 The requested information is not available. 11269 </errorid> 11270 <errorid id="JVMTI_ERROR_INVALID_EVENT_TYPE" num="102"> 11271 The specified event type ID is not recognized. 11272 </errorid> 11273 <errorid id="JVMTI_ERROR_NATIVE_METHOD" num="104"> 11274 The requested information is not available for native method. 11275 </errorid> 11276 <errorid id="JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED" num="106"> 11277 The class loader does not support this operation. 11278 </errorid> 11279 </errorcategory> 11280 11281 <errorcategory id="function-specific-errors" label="Function Specific Agent Errors"> 11282 <intro> 11283 The following errors are returned by some <jvmti/> functions. 11284 They are returned in the event of invalid parameters passed by the 11285 agent or usage in an invalid context. 11286 An implementation is not required to detect these errors. 11287 </intro> 11288 11289 <errorid id="JVMTI_ERROR_INVALID_THREAD" num="10"> 11290 The passed thread is not a valid thread. 11291 </errorid> 11292 <errorid id="JVMTI_ERROR_INVALID_FIELDID" num="25"> 11293 Invalid field. 11294 </errorid> 11295 <errorid id="JVMTI_ERROR_INVALID_METHODID" num="23"> 11296 Invalid method. 11297 </errorid> 11298 <errorid id="JVMTI_ERROR_INVALID_LOCATION" num="24"> 11299 Invalid location. 11300 </errorid> 11301 <errorid id="JVMTI_ERROR_INVALID_OBJECT" num="20"> 11302 Invalid object. 11303 </errorid> 11304 <errorid id="JVMTI_ERROR_INVALID_CLASS" num="21"> 11305 Invalid class. 11306 </errorid> 11307 <errorid id="JVMTI_ERROR_TYPE_MISMATCH" num="34"> 11308 The variable is not an appropriate type for the function used. 11309 </errorid> 11310 <errorid id="JVMTI_ERROR_INVALID_SLOT" num="35"> 11311 Invalid slot. 11312 </errorid> 11313 <errorid id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY" num="99"> 11314 The capability being used is false in this environment. 11315 </errorid> 11316 <errorid id="JVMTI_ERROR_INVALID_THREAD_GROUP" num="11"> 11317 Thread group invalid. 11318 </errorid> 11319 <errorid id="JVMTI_ERROR_INVALID_MONITOR" num="50"> 11320 Invalid raw monitor. 11321 </errorid> 11322 <errorid id="JVMTI_ERROR_ILLEGAL_ARGUMENT" num="103"> 11323 Illegal argument. 11324 </errorid> 11325 <errorid id="JVMTI_ERROR_INVALID_TYPESTATE" num="65"> 11326 The state of the thread has been modified, and is now inconsistent. 11327 </errorid> 11328 <errorid id="JVMTI_ERROR_UNSUPPORTED_VERSION" num="68"> 11329 A new class file has a version number not supported by this VM. 11330 </errorid> 11331 <errorid id="JVMTI_ERROR_INVALID_CLASS_FORMAT" num="60"> 11332 A new class file is malformed (the VM would return a <code>ClassFormatError</code>). 11333 </errorid> 11334 <errorid id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION" num="61"> 11335 The new class file definitions would lead to a circular 11336 definition (the VM would return a <code>ClassCircularityError</code>). 11337 </errorid> 11338 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED" num="63"> 11339 A new class file would require adding a method. 11340 </errorid> 11341 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED" num="64"> 11342 A new class version changes a field. 11343 </errorid> 11344 <errorid id="JVMTI_ERROR_FAILS_VERIFICATION" num="62"> 11345 The class bytes fail verification. 11346 </errorid> 11347 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED" num="66"> 11348 A direct superclass is different for the new class 11349 version, or the set of directly implemented 11350 interfaces is different. 11351 </errorid> 11352 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED" num="67"> 11353 A new class version does not declare a method 11354 declared in the old class version. 11355 </errorid> 11356 <errorid id="JVMTI_ERROR_NAMES_DONT_MATCH" num="69"> 11357 The class name defined in the new class file is 11358 different from the name in the old class object. 11359 </errorid> 11360 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED" num="70"> 11361 A new class version has different modifiers. 11362 </errorid> 11363 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED" num="71"> 11364 A method in the new class version has different modifiers 11365 than its counterpart in the old class version. 11366 </errorid> 11367 </errorcategory> 11368 </errorsection> 11369 11370 <eventsection label="Events"> 11371 <intro label="Handling Events" id="eventIntro"> 11372 Agents can be informed of many events that occur in application 11373 programs. 11374 <p/> 11375 To handle events, designate a set of callback functions with 11376 <functionlink id="SetEventCallbacks"></functionlink>. 11377 For each event the corresponding callback function will be 11378 called. 11379 Arguments to the callback function provide additional 11380 information about the event. 11381 <p/> 11382 The callback function is usually called from within an application 11383 thread. The <jvmti/> implementation does not 11384 queue events in any way. This means 11385 that event callback functions must be written 11386 carefully. Here are some general guidelines. See 11387 the individual event descriptions for further 11388 suggestions. 11389 <p/> 11390 <ul> 11391 <li>Any exception thrown during the execution of an event callback can 11392 overwrite any current pending exception in the current application thread. 11393 Care must be taken to preserve a pending exception 11394 when an event callback makes a JNI call that might generate an exception. 11395 </li> 11396 <li>Event callback functions must be re-entrant. The <jvmti/> implementation does 11397 not queue events. If an agent needs to process events one at a time, it 11398 can use a raw monitor inside the 11399 event callback functions to serialize event processing. 11400 </li> 11401 <li>Event callback functions that execute JNI's FindClass function to load 11402 classes need to note that FindClass locates the class loader associated 11403 with the current native method. For the purposes of class loading, an 11404 event callback that includes a JNI environment as a parameter to the 11405 callback will treated as if it is a native call, where the native method 11406 is in the class of the event thread's current frame. 11407 </li> 11408 </ul> 11409 <p/> 11410 Some <jvmti/> events identify objects with JNI references. 11411 All references 11412 in <jvmti/> events are JNI local references and will become invalid 11413 after the event callback returns. 11414 Unless stated otherwise, memory referenced by pointers sent in event 11415 callbacks may not be referenced after the event callback returns. 11416 <p/> 11417 Except where stated otherwise, events are delivered on the thread 11418 that caused the event. 11419 Events are sent at the time they occur. 11420 The specification for each event includes the set of 11421 <functionlink id="GetPhase">phases</functionlink> in which it can be sent; 11422 if an event triggering activity occurs during another phase, no event 11423 is sent. 11424 <p/> 11425 A thread that generates an event does not change its execution status 11426 (for example, the event does not cause the thread to be suspended). 11427 If an agent wishes the event to result in suspension, then the agent 11428 is responsible for explicitly suspending the thread with 11429 <functionlink id="SuspendThread"></functionlink>. 11430 <p/> 11431 If an event is enabled in multiple environments, the event will be sent 11432 to each agent in the order that the environments were created. 11433 </intro> 11434 11435 <intro label="Enabling Events" id="enablingevents"> 11436 All events are initially disabled. In order to receive any 11437 event: 11438 <ul> 11439 <li> 11440 If the event requires a capability, that capability must 11441 be added with 11442 <functionlink id="AddCapabilities"></functionlink>. 11443 </li> 11444 <li> 11445 A callback for the event must be set with 11446 <functionlink id="SetEventCallbacks"></functionlink>. 11447 </li> 11448 <li> 11449 The event must be enabled with 11450 <functionlink id="SetEventNotificationMode"></functionlink>. 11451 </li> 11452 </ul> 11453 </intro> 11454 11455 <intro label="Multiple Co-located Events" id="eventorder"> 11456 In many situations it is possible for multiple events to occur 11457 at the same location in one thread. When this happens, all the events 11458 are reported through the event callbacks in the order specified in this section. 11459 <p/> 11460 If the current location is at the entry point of a method, the 11461 <eventlink id="MethodEntry"></eventlink> event is reported before 11462 any other event at the current location in the same thread. 11463 <p/> 11464 If an exception catch has been detected at the current location, 11465 either because it is the beginning of a catch clause or a native method 11466 that cleared a pending exception has returned, the 11467 <code>exceptionCatch</code> event is reported before 11468 any other event at the current location in the same thread. 11469 <p/> 11470 If a <code>singleStep</code> event or 11471 <code>breakpoint</code> event is triggered at the 11472 current location, the event is defined to occur 11473 immediately before the code at the current location is executed. 11474 These events are reported before any events which are triggered 11475 by the execution of code at the current location in the same 11476 thread (specifically: 11477 <code>exception</code>, 11478 <code>fieldAccess</code>, and 11479 <code>fieldModification</code>). 11480 If both a step and breakpoint event are triggered for the same thread and 11481 location, the step event is reported before the breakpoint event. 11482 <p/> 11483 If the current location is the exit point of a method (that is, the last 11484 location before returning to the caller), the 11485 <eventlink id="MethodExit"></eventlink> event and 11486 the <eventlink id="FramePop"></eventlink> event (if requested) 11487 are reported after all other events at the current location in the same 11488 thread. There is no specified ordering of these two events 11489 with respect to each other. 11490 <p/> 11491 Co-located events can be triggered during the processing of some other 11492 event by the agent at the same location in the same thread. 11493 If such an event, of type <i>y</i>, is triggered during the processing of 11494 an event of type <i>x</i>, and if <i>x</i> 11495 precedes <i>y</i> in the ordering specified above, the co-located event 11496 <i>y</i> is reported for the current thread and location. If <i>x</i> does not precede 11497 <i>y</i>, <i>y</i> is not reported for the current thread and location. 11498 For example, if a breakpoint is set at the current location 11499 during the processing of <eventlink id="SingleStep"></eventlink>, 11500 that breakpoint will be reported before the thread moves off the current 11501 location. 11502 <p/>The following events are never considered to be co-located with 11503 other events. 11504 <ul> 11505 <li><eventlink id="VMStart"></eventlink></li> 11506 <li><eventlink id="VMInit"></eventlink></li> 11507 <li><eventlink id="VMDeath"></eventlink></li> 11508 <li><eventlink id="ThreadStart"></eventlink></li> 11509 <li><eventlink id="ThreadEnd"></eventlink></li> 11510 <li><eventlink id="ClassLoad"></eventlink></li> 11511 <li><eventlink id="ClassPrepare"></eventlink></li> 11512 </ul> 11513 </intro> 11514 11515 <intro label="Event Callbacks" id="jvmtiEventCallbacks"> 11516 The event callback structure below is used to specify the handler function 11517 for events. It is set with the 11518 <functionlink id="SetEventCallbacks"></functionlink> function. 11519 </intro> 11520 11521 <event label="Single Step" 11522 id="SingleStep" const="JVMTI_EVENT_SINGLE_STEP" filtered="thread" num="60"> 11523 <description> 11524 Single step events allow the agent to trace thread execution 11525 at the finest granularity allowed by the VM. A single step event is 11526 generated whenever a thread reaches a new location. 11527 Typically, single step events represent the completion of one VM 11528 instruction as defined in <vmspec/>. However, some implementations 11529 may define locations differently. In any case the 11530 <code>method</code> and <code>location</code> 11531 parameters uniquely identify the current location and allow 11532 the mapping to source file and line number when that information is 11533 available. 11534 <p/> 11535 No single step events are generated from within native methods. 11536 </description> 11537 <origin>jvmdi</origin> 11538 <capabilities> 11539 <required id="can_generate_single_step_events"></required> 11540 </capabilities> 11541 <parameters> 11542 <param id="jni_env"> 11543 <outptr> 11544 <struct>JNIEnv</struct> 11545 </outptr> 11546 <description> 11547 The JNI environment of the event (current) thread 11548 </description> 11549 </param> 11550 <param id="thread"> 11551 <jthread/> 11552 <description> 11553 Thread about to execution a new instruction 11554 </description> 11555 </param> 11556 <param id="klass"> 11557 <jclass method="method"/> 11558 <description> 11559 Class of the method about to execute a new instruction 11560 </description> 11561 </param> 11562 <param id="method"> 11563 <jmethodID class="klass"/> 11564 <description> 11565 Method about to execute a new instruction 11566 </description> 11567 </param> 11568 <param id="location"> 11569 <jlocation/> 11570 <description> 11571 Location of the new instruction 11572 </description> 11573 </param> 11574 </parameters> 11575 </event> 11576 11577 <event label="Breakpoint" 11578 id="Breakpoint" const="JVMTI_EVENT_BREAKPOINT" filtered="thread" num="62"> 11579 <description> 11580 Breakpoint events are generated whenever a thread reaches a location 11581 designated as a breakpoint with <functionlink id="SetBreakpoint"></functionlink>. 11582 The <code>method</code> and <code>location</code> 11583 parameters uniquely identify the current location and allow 11584 the mapping to source file and line number when that information is 11585 available. 11586 </description> 11587 <origin>jvmdi</origin> 11588 <capabilities> 11589 <required id="can_generate_breakpoint_events"></required> 11590 </capabilities> 11591 <parameters> 11592 <param id="jni_env"> 11593 <outptr> 11594 <struct>JNIEnv</struct> 11595 </outptr> 11596 <description> 11597 The JNI environment of the event (current) thread. 11598 </description> 11599 </param> 11600 <param id="thread"> 11601 <jthread/> 11602 <description> 11603 Thread that hit the breakpoint 11604 </description> 11605 </param> 11606 <param id="klass"> 11607 <jclass method="method"/> 11608 <description> 11609 Class of the method that hit the breakpoint 11610 </description> 11611 </param> 11612 <param id="method"> 11613 <jmethodID class="klass"/> 11614 <description> 11615 Method that hit the breakpoint 11616 </description> 11617 </param> 11618 <param id="location"> 11619 <jlocation/> 11620 <description> 11621 location of the breakpoint 11622 </description> 11623 </param> 11624 </parameters> 11625 </event> 11626 11627 <event label="Field Access" 11628 id="FieldAccess" const="JVMTI_EVENT_FIELD_ACCESS" filtered="thread" num="63"> 11629 <description> 11630 Field access events are generated whenever a thread accesses 11631 a field that was designated as a watchpoint 11632 with <functionlink id="SetFieldAccessWatch"></functionlink>. 11633 The <code>method</code> and <code>location</code> 11634 parameters uniquely identify the current location and allow 11635 the mapping to source file and line number when that information is 11636 available. 11637 </description> 11638 <origin>jvmdi</origin> 11639 <capabilities> 11640 <required id="can_generate_field_access_events"></required> 11641 </capabilities> 11642 <parameters> 11643 <param id="jni_env"> 11644 <outptr> 11645 <struct>JNIEnv</struct> 11646 </outptr> 11647 <description> 11648 The JNI environment of the event (current) thread 11649 </description> 11650 </param> 11651 <param id="thread"> 11652 <jthread/> 11653 <description> 11654 Thread accessing the field 11655 </description> 11656 </param> 11657 <param id="klass"> 11658 <jclass method="method"/> 11659 <description> 11660 Class of the method where the access is occurring 11661 </description> 11662 </param> 11663 <param id="method"> 11664 <jmethodID class="klass"/> 11665 <description> 11666 Method where the access is occurring 11667 </description> 11668 </param> 11669 <param id="location"> 11670 <jlocation/> 11671 <description> 11672 Location where the access is occurring 11673 </description> 11674 </param> 11675 <param id="field_klass"> 11676 <jclass field="field"/> 11677 <description> 11678 Class of the field being accessed 11679 </description> 11680 </param> 11681 <param id="object"> 11682 <jobject/> 11683 <description> 11684 Object with the field being accessed if the field is an 11685 instance field; <code>NULL</code> otherwise 11686 </description> 11687 </param> 11688 <param id="field"> 11689 <jfieldID class="field_klass"/> 11690 <description> 11691 Field being accessed 11692 </description> 11693 </param> 11694 </parameters> 11695 </event> 11696 11697 <event label="Field Modification" 11698 id="FieldModification" const="JVMTI_EVENT_FIELD_MODIFICATION" filtered="thread" num="64"> 11699 <description> 11700 Field modification events are generated whenever a thread modifies 11701 a field that was designated as a watchpoint 11702 with <functionlink id="SetFieldModificationWatch"></functionlink>. 11703 The <code>method</code> and <code>location</code> 11704 parameters uniquely identify the current location and allow 11705 the mapping to source file and line number when that information is 11706 available. 11707 </description> 11708 <origin>jvmdi</origin> 11709 <capabilities> 11710 <required id="can_generate_field_modification_events"></required> 11711 </capabilities> 11712 <parameters> 11713 <param id="jni_env"> 11714 <outptr> 11715 <struct>JNIEnv</struct> 11716 </outptr> 11717 <description> 11718 The JNI environment of the event (current) thread 11719 </description> 11720 </param> 11721 <param id="thread"> 11722 <jthread/> 11723 <description> 11724 Thread modifying the field 11725 </description> 11726 </param> 11727 <param id="klass"> 11728 <jclass method="method"/> 11729 <description> 11730 Class of the method where the modification is occurring 11731 </description> 11732 </param> 11733 <param id="method"> 11734 <jmethodID class="klass"/> 11735 <description> 11736 Method where the modification is occurring 11737 </description> 11738 </param> 11739 <param id="location"> 11740 <jlocation/> 11741 <description> 11742 Location where the modification is occurring 11743 </description> 11744 </param> 11745 <param id="field_klass"> 11746 <jclass field="field"/> 11747 <description> 11748 Class of the field being modified 11749 </description> 11750 </param> 11751 <param id="object"> 11752 <jobject/> 11753 <description> 11754 Object with the field being modified if the field is an 11755 instance field; <code>NULL</code> otherwise 11756 </description> 11757 </param> 11758 <param id="field"> 11759 <jfieldID class="field_klass"/> 11760 <description> 11761 Field being modified 11762 </description> 11763 </param> 11764 <param id="signature_type"> 11765 <char/> 11766 <description> 11767 Signature type of the new value 11768 </description> 11769 </param> 11770 <param id="new_value"> 11771 <jvalue/> 11772 <description> 11773 The new value 11774 </description> 11775 </param> 11776 </parameters> 11777 </event> 11778 11779 <event label="Frame Pop" 11780 id="FramePop" const="JVMTI_EVENT_FRAME_POP" filtered="thread" num="61"> 11781 <description> 11782 Frame pop events are generated upon exit from a single method 11783 in a single frame as specified 11784 in a call to <functionlink id="NotifyFramePop"></functionlink>. 11785 This is true whether termination is caused by 11786 executing its return instruction 11787 or by throwing an exception to its caller 11788 (see <paramlink id="was_popped_by_exception"></paramlink>). 11789 However, frame pops caused by the <functionlink id="PopFrame"/> 11790 function are not reported. 11791 <p/> 11792 The location reported by <functionlink id="GetFrameLocation"></functionlink> 11793 identifies the executable location in the returning method, 11794 immediately prior to the return. 11795 </description> 11796 <origin>jvmdi</origin> 11797 <capabilities> 11798 <required id="can_generate_frame_pop_events"></required> 11799 </capabilities> 11800 <parameters> 11801 <param id="jni_env"> 11802 <outptr> 11803 <struct>JNIEnv</struct> 11804 </outptr> 11805 <description> 11806 The JNI environment of the event (current) thread 11807 </description> 11808 </param> 11809 <param id="thread"> 11810 <jthread/> 11811 <description> 11812 Thread that is popping the frame 11813 </description> 11814 </param> 11815 <param id="klass"> 11816 <jclass method="method"/> 11817 <description> 11818 Class of the method being popped 11819 </description> 11820 </param> 11821 <param id="method"> 11822 <jmethodID class="klass"/> 11823 <description> 11824 Method being popped 11825 </description> 11826 </param> 11827 <param id="was_popped_by_exception"> 11828 <jboolean/> 11829 <description> 11830 True if frame was popped by a thrown exception. 11831 False if method exited through its return instruction. 11832 </description> 11833 </param> 11834 </parameters> 11835 </event> 11836 11837 <event label="Method Entry" 11838 id="MethodEntry" const="JVMTI_EVENT_METHOD_ENTRY" filtered="thread" num="65"> 11839 <description> 11840 Method entry events are generated upon entry of Java 11841 programming language methods (including native methods). 11842 <p/> 11843 The location reported by <functionlink id="GetFrameLocation"></functionlink> 11844 identifies the initial executable location in 11845 the method. 11846 <p/> 11847 Enabling method 11848 entry or exit events will significantly degrade performance on many platforms and is thus 11849 not advised for performance critical usage (such as profiling). 11850 <internallink id="bci">Bytecode instrumentation</internallink> should be 11851 used in these cases. 11852 </description> 11853 <origin>jvmdi</origin> 11854 <capabilities> 11855 <required id="can_generate_method_entry_events"></required> 11856 </capabilities> 11857 <parameters> 11858 <param id="jni_env"> 11859 <outptr> 11860 <struct>JNIEnv</struct> 11861 </outptr> 11862 <description> 11863 The JNI environment of the event (current) thread 11864 </description> 11865 </param> 11866 <param id="thread"> 11867 <jthread/> 11868 <description> 11869 Thread entering the method 11870 </description> 11871 </param> 11872 <param id="klass"> 11873 <jclass method="method"/> 11874 <description> 11875 Class of the method being entered 11876 </description> 11877 </param> 11878 <param id="method"> 11879 <jmethodID class="klass"/> 11880 <description> 11881 Method being entered 11882 </description> 11883 </param> 11884 </parameters> 11885 </event> 11886 11887 <event label="Method Exit" 11888 id="MethodExit" const="JVMTI_EVENT_METHOD_EXIT" filtered="thread" num="66"> 11889 <description> 11890 Method exit events are generated upon exit from Java 11891 programming language methods (including native methods). 11892 This is true whether termination is caused by 11893 executing its return instruction 11894 or by throwing an exception to its caller 11895 (see <paramlink id="was_popped_by_exception"></paramlink>). 11896 <p/> 11897 The <code>method</code> field uniquely identifies the 11898 method being entered or exited. The <code>frame</code> field provides 11899 access to the stack frame for the method. 11900 <p/> 11901 The location reported by <functionlink id="GetFrameLocation"></functionlink> 11902 identifies the executable location in the returning method 11903 immediately prior to the return. 11904 <p/> 11905 Enabling method 11906 entry or exit events will significantly degrade performance on many platforms and is thus 11907 not advised for performance critical usage (such as profiling). 11908 <internallink id="bci">Bytecode instrumentation</internallink> should be 11909 used in these cases. 11910 </description> 11911 <origin>jvmdi</origin> 11912 <capabilities> 11913 <required id="can_generate_method_exit_events"></required> 11914 </capabilities> 11915 <parameters> 11916 <param id="jni_env"> 11917 <outptr> 11918 <struct>JNIEnv</struct> 11919 </outptr> 11920 <description> 11921 The JNI environment of the event (current) thread 11922 </description> 11923 </param> 11924 <param id="thread"> 11925 <jthread/> 11926 <description> 11927 Thread exiting the method 11928 </description> 11929 </param> 11930 <param id="klass"> 11931 <jclass method="method"/> 11932 <description> 11933 Class of the method being exited 11934 </description> 11935 </param> 11936 <param id="method"> 11937 <jmethodID class="klass"/> 11938 <description> 11939 Method being exited 11940 </description> 11941 </param> 11942 <param id="was_popped_by_exception"> 11943 <jboolean/> 11944 <description> 11945 True if frame was popped by a thrown exception. 11946 False if method exited through its return instruction. 11947 </description> 11948 </param> 11949 <param id="return_value"> 11950 <jvalue/> 11951 <description> 11952 The return value of the method being exited. 11953 Undefined and should not be used if 11954 <paramlink id="was_popped_by_exception"></paramlink> 11955 is true. 11956 </description> 11957 </param> 11958 </parameters> 11959 </event> 11960 11961 <event label="Native Method Bind" phase="any" 11962 id="NativeMethodBind" const="JVMTI_EVENT_NATIVE_METHOD_BIND" num="67"> 11963 <description> 11964 A Native Method Bind event is sent when a VM binds a 11965 Java programming language native method 11966 to the address of a function that implements the native method. 11967 This will occur when the native method is called for the first time 11968 and also occurs when the JNI function <code>RegisterNatives</code> is called. 11969 This event allows the bind to be redirected to an agent-specified 11970 proxy function. 11971 This event is not sent when the native method is unbound. 11972 Typically, this proxy function will need to be specific to a 11973 particular method or, to handle the general case, automatically 11974 generated assembly code, since after instrumentation code is 11975 executed the function at the original binding 11976 address will usually be invoked. 11977 The original binding can be restored or the redirection changed 11978 by use of the JNI function <code>RegisterNatives</code>. 11979 Some events may be sent during the primordial phase, JNI and 11980 most of <jvmti/> cannot be used at this time but the method and 11981 address can be saved for use later. 11982 </description> 11983 <origin>new</origin> 11984 <capabilities> 11985 <required id="can_generate_native_method_bind_events"></required> 11986 </capabilities> 11987 <parameters> 11988 <param id="jni_env"> 11989 <outptr> 11990 <struct>JNIEnv</struct> 11991 </outptr> 11992 <description> 11993 The JNI environment of the event (current) thread 11994 Will be <code>NULL</code> if sent during the primordial 11995 <functionlink id="GetPhase">phase</functionlink>. 11996 </description> 11997 </param> 11998 <param id="thread"> 11999 <jthread/> 12000 <description> 12001 Thread requesting the bind 12002 </description> 12003 </param> 12004 <param id="klass"> 12005 <jclass method="method"/> 12006 <description> 12007 Class of the method being bound 12008 </description> 12009 </param> 12010 <param id="method"> 12011 <jmethodID class="klass"/> 12012 <description> 12013 Native method being bound 12014 </description> 12015 </param> 12016 <param id="address"> 12017 <outptr><void/></outptr> 12018 <description> 12019 The address the VM is about to bind to--that is, the 12020 address of the implementation of the native method 12021 </description> 12022 </param> 12023 <param id="new_address_ptr"> 12024 <agentbuf><void/></agentbuf> 12025 <description> 12026 if the referenced address is changed (that is, if 12027 <code>*new_address_ptr</code> is set), the binding 12028 will instead be made to the supplied address. 12029 </description> 12030 </param> 12031 </parameters> 12032 </event> 12033 12034 <event label="Exception" 12035 id="Exception" const="JVMTI_EVENT_EXCEPTION" filtered="thread" num="58"> 12036 <description> 12037 Exception events are generated whenever an exception is first detected 12038 in a Java programming language method. 12039 Where "exception" means any <code>java.lang.Throwable</code>. 12040 The exception may have been thrown by a Java programming language or native 12041 method, but in the case of native methods, the event is not generated 12042 until the exception is first seen by a Java programming language method. If an exception is 12043 set and cleared in a native method (and thus is never visible to Java programming language code), 12044 no exception event is generated. 12045 <p/> 12046 The <code>method</code> and <code>location</code> 12047 parameters uniquely identify the current location 12048 (where the exception was detected) and allow 12049 the mapping to source file and line number when that information is 12050 available. The <code>exception</code> field identifies the thrown 12051 exception object. The <code>catch_method</code> 12052 and <code>catch_location</code> identify the location of the catch clause, 12053 if any, that handles the thrown exception. If there is no such catch clause, 12054 each field is set to 0. There is no guarantee that the thread will ever 12055 reach this catch clause. If there are native methods on the call stack 12056 between the throw location and the catch clause, the exception may 12057 be reset by one of those native methods. 12058 Similarly, exceptions that are reported as uncaught (<code>catch_klass</code> 12059 et al. set to 0) may in fact be caught by native code. 12060 Agents can check for these occurrences by monitoring 12061 <eventlink id="ExceptionCatch"></eventlink> events. 12062 Note that finally clauses are implemented as catch and re-throw. Therefore they 12063 will be reported in the catch location. 12064 </description> 12065 <origin>jvmdi</origin> 12066 <capabilities> 12067 <required id="can_generate_exception_events"></required> 12068 </capabilities> 12069 <parameters> 12070 <param id="jni_env"> 12071 <outptr> 12072 <struct>JNIEnv</struct> 12073 </outptr> 12074 <description> 12075 The JNI environment of the event (current) thread 12076 </description> 12077 </param> 12078 <param id="thread"> 12079 <jthread/> 12080 <description> 12081 Thread generating the exception 12082 </description> 12083 </param> 12084 <param id="klass"> 12085 <jclass method="method"/> 12086 <description> 12087 Class generating the exception 12088 </description> 12089 </param> 12090 <param id="method"> 12091 <jmethodID class="klass"/> 12092 <description> 12093 Method generating the exception 12094 </description> 12095 </param> 12096 <param id="location"> 12097 <jlocation/> 12098 <description> 12099 Location where exception occurred 12100 </description> 12101 </param> 12102 <param id="exception"> 12103 <jobject/> 12104 <description> 12105 The exception being thrown 12106 </description> 12107 </param> 12108 <param id="catch_klass"> 12109 <jclass method="catch_method"/> 12110 <description> 12111 Class that will catch the exception, or <code>NULL</code> if no known catch 12112 </description> 12113 </param> 12114 <param id="catch_method"> 12115 <jmethodID class="catch_klass"/> 12116 <description> 12117 Method that will catch the exception, or <code>NULL</code> if no known catch 12118 </description> 12119 </param> 12120 <param id="catch_location"> 12121 <jlocation/> 12122 <description> 12123 location which will catch the exception or zero if no known catch 12124 </description> 12125 </param> 12126 </parameters> 12127 </event> 12128 12129 <event label="Exception Catch" 12130 id="ExceptionCatch" const="JVMTI_EVENT_EXCEPTION_CATCH" filtered="thread" num="59"> 12131 <description> 12132 Exception catch events are generated whenever a thrown exception is caught. 12133 Where "exception" means any <code>java.lang.Throwable</code>. 12134 If the exception is caught in a Java programming language method, the event is generated 12135 when the catch clause is reached. If the exception is caught in a native 12136 method, the event is generated as soon as control is returned to a Java programming language 12137 method. Exception catch events are generated for any exception for which 12138 a throw was detected in a Java programming language method. 12139 Note that finally clauses are implemented as catch and re-throw. Therefore they 12140 will generate exception catch events. 12141 <p/> 12142 The <code>method</code> and <code>location</code> 12143 parameters uniquely identify the current location 12144 and allow the mapping to source file and line number when that information is 12145 available. For exceptions caught in a Java programming language method, the 12146 <code>exception</code> object identifies the exception object. Exceptions 12147 caught in native methods are not necessarily available by the time the 12148 exception catch is reported, so the <code>exception</code> field is set 12149 to <code>NULL</code>. 12150 </description> 12151 <origin>jvmdi</origin> 12152 <capabilities> 12153 <required id="can_generate_exception_events"></required> 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 catching the exception 12168 </description> 12169 </param> 12170 <param id="klass"> 12171 <jclass method="method"/> 12172 <description> 12173 Class catching the exception 12174 </description> 12175 </param> 12176 <param id="method"> 12177 <jmethodID class="klass"/> 12178 <description> 12179 Method catching the exception 12180 </description> 12181 </param> 12182 <param id="location"> 12183 <jlocation/> 12184 <description> 12185 Location where exception is being caught 12186 </description> 12187 </param> 12188 <param id="exception"> 12189 <jobject/> 12190 <description> 12191 Exception being caught 12192 </description> 12193 </param> 12194 </parameters> 12195 </event> 12196 12197 <event label="Thread Start" 12198 id="ThreadStart" const="JVMTI_EVENT_THREAD_START" num="52" phase="start"> 12199 <description> 12200 Thread start events are generated by a new thread before its initial 12201 method executes. 12202 <p/> 12203 A thread may be listed in the array returned by 12204 <functionlink id="GetAllThreads"></functionlink> 12205 before its thread start event is generated. 12206 It is possible for other events to be generated 12207 on a thread before its thread start event. 12208 <p/> 12209 The event is sent on the newly started <paramlink id="thread"></paramlink>. 12210 </description> 12211 <origin>jvmdi</origin> 12212 <capabilities> 12213 </capabilities> 12214 <parameters> 12215 <param id="jni_env"> 12216 <outptr> 12217 <struct>JNIEnv</struct> 12218 </outptr> 12219 <description> 12220 The JNI environment of the event (current) thread. 12221 </description> 12222 </param> 12223 <param id="thread"> 12224 <jthread/> 12225 <description> 12226 Thread starting 12227 </description> 12228 </param> 12229 </parameters> 12230 </event> 12231 12232 <event label="Thread End" 12233 id="ThreadEnd" const="JVMTI_EVENT_THREAD_END" filtered="thread" num="53" phase="start"> 12234 <description> 12235 Thread end events are generated by a terminating thread 12236 after its initial method has finished execution. 12237 <p/> 12238 A thread may be listed in the array returned by 12239 <functionlink id="GetAllThreads"></functionlink> 12240 after its thread end event is generated. 12241 No events are generated on a thread 12242 after its thread end event. 12243 <p/> 12244 The event is sent on the dying <paramlink id="thread"></paramlink>. 12245 </description> 12246 <origin>jvmdi</origin> 12247 <capabilities> 12248 </capabilities> 12249 <parameters> 12250 <param id="jni_env"> 12251 <outptr> 12252 <struct>JNIEnv</struct> 12253 </outptr> 12254 <description> 12255 The JNI environment of the event (current) thread. 12256 </description> 12257 </param> 12258 <param id="thread"> 12259 <jthread/> 12260 <description> 12261 Thread ending 12262 </description> 12263 </param> 12264 </parameters> 12265 </event> 12266 12267 <event label="Class Load" 12268 id="ClassLoad" const="JVMTI_EVENT_CLASS_LOAD" filtered="thread" phase="start" num="55"> 12269 <description> 12270 A class load event is generated when a class is first loaded. The order 12271 of class load events generated by a particular thread are guaranteed 12272 to match the order of class loading within that thread. 12273 Array class creation does not generate a class load event. 12274 The creation of a primitive class (for example, java.lang.Integer.TYPE) 12275 does not generate a class load event. 12276 <p/> 12277 This event is sent at an early stage in loading the class. As 12278 a result the class should be used carefully. Note, for example, 12279 that methods and fields are not yet loaded, so queries for methods, 12280 fields, subclasses, and so on will not give correct results. 12281 See "Loading of Classes and Interfaces" in the <i>Java Language 12282 Specification</i>. For most 12283 purposes the <eventlink id="ClassPrepare"></eventlink> event will 12284 be more useful. 12285 </description> 12286 <origin>jvmdi</origin> 12287 <capabilities> 12288 </capabilities> 12289 <parameters> 12290 <param id="jni_env"> 12291 <outptr> 12292 <struct>JNIEnv</struct> 12293 </outptr> 12294 <description> 12295 The JNI environment of the event (current) thread 12296 </description> 12297 </param> 12298 <param id="thread"> 12299 <jthread/> 12300 <description> 12301 Thread loading the class 12302 </description> 12303 </param> 12304 <param id="klass"> 12305 <jclass/> 12306 <description> 12307 Class being loaded 12308 </description> 12309 </param> 12310 </parameters> 12311 </event> 12312 12313 <elide> 12314 <event label="Class Unload" 12315 id="ClassUnload" const="JVMTI_EVENT_CLASS_UNLOAD" num="57"> 12316 <description> 12317 A class unload event is generated when the class is about to be unloaded. 12318 Class unload events take place during garbage collection and must be 12319 handled extremely carefully. The garbage collector holds many locks 12320 and has suspended all other threads, so the event handler cannot depend 12321 on the ability to acquire any locks. The class unload event handler should 12322 do as little as possible, perhaps by queuing information to be processed 12323 later. In particular, the <code>jclass</code> should be used only in 12324 the JNI function <code>isSameObject</code> or in the following <jvmti/> functions: 12325 <ul> 12326 <li><functionlink id="GetClassSignature"></functionlink></li> 12327 <li><functionlink id="GetSourceFileName"></functionlink></li> 12328 <li><functionlink id="IsInterface"></functionlink></li> 12329 <li><functionlink id="IsArrayClass"></functionlink></li> 12330 </ul> 12331 </description> 12332 <origin>jvmdi</origin> 12333 <capabilities> 12334 </capabilities> 12335 <parameters> 12336 <param id="jni_env"> 12337 <outptr> 12338 <struct>JNIEnv</struct> 12339 </outptr> 12340 <description> 12341 The JNI environment of the event (current) thread 12342 </description> 12343 </param> 12344 <param id="thread"> 12345 <jthread/> 12346 <description> 12347 Thread generating the class unload 12348 </description> 12349 </param> 12350 <param id="klass"> 12351 <jclass/> 12352 <description> 12353 Class being unloaded 12354 </description> 12355 </param> 12356 </parameters> 12357 </event> 12358 </elide> 12359 12360 <event label="Class Prepare" 12361 id="ClassPrepare" const="JVMTI_EVENT_CLASS_PREPARE" filtered="thread" phase="start" num="56"> 12362 <description> 12363 A class prepare event is generated when class preparation is complete. 12364 At this point, class fields, methods, and implemented interfaces are 12365 available, and no code from the class has been executed. Since array 12366 classes never have fields or methods, class prepare events are not 12367 generated for them. Class prepare events are not generated for 12368 primitive classes (for example, <code>java.lang.Integer.TYPE</code>). 12369 </description> 12370 <origin>jvmdi</origin> 12371 <capabilities> 12372 </capabilities> 12373 <parameters> 12374 <param id="jni_env"> 12375 <outptr> 12376 <struct>JNIEnv</struct> 12377 </outptr> 12378 <description> 12379 The JNI environment of the event (current) thread 12380 </description> 12381 </param> 12382 <param id="thread"> 12383 <jthread/> 12384 <description> 12385 Thread generating the class prepare 12386 </description> 12387 </param> 12388 <param id="klass"> 12389 <jclass/> 12390 <description> 12391 Class being prepared 12392 </description> 12393 </param> 12394 </parameters> 12395 </event> 12396 12397 <event label="Class File Load Hook" phase="start" 12398 id="ClassFileLoadHook" const="JVMTI_EVENT_CLASS_FILE_LOAD_HOOK" num="54"> 12399 <description> 12400 This event is sent when the VM obtains class file data, 12401 but before it constructs 12402 the in-memory representation for that class. 12403 This event is also sent when the class is being modified by the 12404 <functionlink id="RetransformClasses"/> function or 12405 the <functionlink id="RedefineClasses"/> function, 12406 called in any <jvmti/> environment. 12407 The agent can instrument 12408 the existing class file data sent by the VM to include profiling/debugging hooks. 12409 See the description of 12410 <internallink id="bci">bytecode instrumentation</internallink> 12411 for usage information. 12412 <p/> 12413 This event may be sent before the VM is initialized (the start 12414 <functionlink id="GetPhase">phase</functionlink>). 12415 Some classes might not be compatible 12416 with the function (eg. ROMized classes) and this event will not be 12417 generated for these classes. 12418 <p/> 12419 The agent must allocate the space for the modified 12420 class file data buffer 12421 using the memory allocation function 12422 <functionlink id="Allocate"></functionlink> because the 12423 VM is responsible for freeing the new class file data buffer 12424 using <functionlink id="Deallocate"></functionlink>. 12425 <p/> 12426 If the agent wishes to modify the class file, it must set 12427 <code>new_class_data</code> to point 12428 to the newly instrumented class file data buffer and set 12429 <code>new_class_data_len</code> to the length of that 12430 buffer before returning 12431 from this call. If no modification is desired, the agent simply 12432 does not set <code>new_class_data</code>. If multiple agents 12433 have enabled this event the results are chained. That is, if 12434 <code>new_class_data</code> has been set, it becomes the 12435 <code>class_data</code> for the next agent. 12436 <p/> 12437 The order that this event is sent to each environment differs 12438 from other events. 12439 This event is sent to environments in the following order: 12440 <ul> 12441 <li><fieldlink id="can_retransform_classes" 12442 struct="jvmtiCapabilities">retransformation 12443 incapable</fieldlink> 12444 environments, in the 12445 order in which they were created 12446 </li> 12447 <li><fieldlink id="can_retransform_classes" 12448 struct="jvmtiCapabilities">retransformation 12449 capable</fieldlink> 12450 environments, in the 12451 order in which they were created 12452 </li> 12453 </ul> 12454 When triggered by <functionlink id="RetransformClasses"/>, 12455 this event is sent only to <fieldlink id="can_retransform_classes" 12456 struct="jvmtiCapabilities">retransformation 12457 capable</fieldlink> 12458 environments. 12459 </description> 12460 <origin>jvmpi</origin> 12461 <capabilities> 12462 <capability id="can_generate_all_class_hook_events"></capability> 12463 </capabilities> 12464 <parameters> 12465 <param id="jni_env"> 12466 <outptr> 12467 <struct>JNIEnv</struct> 12468 </outptr> 12469 <description> 12470 The JNI environment of the event (current) thread. 12471 </description> 12472 </param> 12473 <param id="class_being_redefined"> 12474 <jclass/> 12475 <description> 12476 The class being 12477 <functionlink id="RedefineClasses">redefined</functionlink> or 12478 <functionlink id="RetransformClasses">retransformed</functionlink>. 12479 <code>NULL</code> if sent by class load. 12480 </description> 12481 </param> 12482 <param id="loader"> 12483 <jobject/> 12484 <description> 12485 The class loader loading the class. 12486 <code>NULL</code> if the bootstrap class loader. 12487 </description> 12488 </param> 12489 <param id="name"> 12490 <vmbuf><char/></vmbuf> 12491 <description> 12492 Name of class being loaded as a VM internal qualified name 12493 (for example, "java/util/List"), encoded as a 12494 <internallink id="mUTF">modified UTF-8</internallink> string. 12495 Note: if the class is defined with a <code>NULL</code> name or 12496 without a name specified, <code>name</code> will be <code>NULL</code>. 12497 </description> 12498 </param> 12499 <param id="protection_domain"> 12500 <jobject/> 12501 <description> 12502 The <code>ProtectionDomain</code> of the class. 12503 </description> 12504 </param> 12505 <param id="class_data_len"> 12506 <jint/> 12507 <description> 12508 Length of current class file data buffer. 12509 </description> 12510 </param> 12511 <param id="class_data"> 12512 <vmbuf><uchar/></vmbuf> 12513 <description> 12514 Pointer to the current class file data buffer. 12515 </description> 12516 </param> 12517 <param id="new_class_data_len"> 12518 <outptr><jint/></outptr> 12519 <description> 12520 Pointer to the length of the new class file data buffer. 12521 </description> 12522 </param> 12523 <param id="new_class_data"> 12524 <agentbuf incount="new_class_data_len"><uchar/></agentbuf> 12525 <description> 12526 Pointer to the pointer to the instrumented class file data buffer. 12527 </description> 12528 </param> 12529 </parameters> 12530 </event> 12531 12532 <event label="VM Start Event" 12533 id="VMStart" const="JVMTI_EVENT_VM_START" num="57" phase="start"> 12534 <description> 12535 The VM initialization event signals the start of the VM. 12536 At this time JNI is live but the VM is not yet fully initialized. 12537 Once this event is generated, the agent is free to call any JNI function. 12538 This event signals the beginning of the start phase, 12539 <jvmti/> functions permitted in the start phase may be called. 12540 <p/> 12541 In the case of VM start-up failure, this event will not be sent. 12542 </description> 12543 <origin>jvmdi</origin> 12544 <capabilities> 12545 </capabilities> 12546 <parameters> 12547 <param id="jni_env"> 12548 <outptr> 12549 <struct>JNIEnv</struct> 12550 </outptr> 12551 <description> 12552 The JNI environment of the event (current) thread. 12553 </description> 12554 </param> 12555 </parameters> 12556 </event> 12557 12558 <event label="VM Initialization Event" 12559 id="VMInit" const="JVMTI_EVENT_VM_INIT" num="50"> 12560 <description> 12561 The VM initialization event signals the completion of VM initialization. Once 12562 this event is generated, the agent is free to call any JNI or <jvmti/> 12563 function. The VM initialization event can be preceded by or can be concurrent 12564 with other events, but 12565 the preceding events should be handled carefully, if at all, because the 12566 VM has not completed its initialization. The thread start event for the 12567 main application thread is guaranteed not to occur until after the 12568 handler for the VM initialization event returns. 12569 <p/> 12570 In the case of VM start-up failure, this event will not be sent. 12571 </description> 12572 <origin>jvmdi</origin> 12573 <capabilities> 12574 </capabilities> 12575 <parameters> 12576 <param id="jni_env"> 12577 <outptr> 12578 <struct>JNIEnv</struct> 12579 </outptr> 12580 <description> 12581 The JNI environment of the event (current) thread. 12582 </description> 12583 </param> 12584 <param id="thread"> 12585 <jthread/> 12586 <description> 12587 The initial thread 12588 </description> 12589 </param> 12590 </parameters> 12591 </event> 12592 12593 <event label="VM Death Event" 12594 id="VMDeath" const="JVMTI_EVENT_VM_DEATH" num="51"> 12595 <description> 12596 The VM death event notifies the agent of the termination of the VM. 12597 No events will occur after the VMDeath event. 12598 <p/> 12599 In the case of VM start-up failure, this event will not be sent. 12600 Note that <internallink id="onunload">Agent_OnUnload</internallink> 12601 will still be called in these cases. 12602 </description> 12603 <origin>jvmdi</origin> 12604 <capabilities> 12605 </capabilities> 12606 <parameters> 12607 <param id="jni_env"> 12608 <outptr> 12609 <struct>JNIEnv</struct> 12610 </outptr> 12611 <description> 12612 The JNI environment of the event (current) thread 12613 </description> 12614 </param> 12615 </parameters> 12616 </event> 12617 12618 <event label="Compiled Method Load" 12619 id="CompiledMethodLoad" const="JVMTI_EVENT_COMPILED_METHOD_LOAD" num="68"> 12620 <description> 12621 Sent when a method is compiled and loaded into memory by the VM. 12622 If it is unloaded, the <eventlink id="CompiledMethodUnload"/> event is sent. 12623 If it is moved, the <eventlink id="CompiledMethodUnload"/> event is sent, 12624 followed by a new <code>CompiledMethodLoad</code> event. 12625 Note that a single method may have multiple compiled forms, and that 12626 this event will be sent for each form. 12627 Note also that several methods may be inlined into a single 12628 address range, and that this event will be sent for each method. 12629 <p/> 12630 These events can be sent after their initial occurrence with 12631 <functionlink id="GenerateEvents"></functionlink>. 12632 </description> 12633 <origin>jvmpi</origin> 12634 <typedef id="jvmtiAddrLocationMap" label="Native address to location entry"> 12635 <field id="start_address"> 12636 <vmbuf><void/></vmbuf> 12637 <description> 12638 Starting native address of code corresponding to a location 12639 </description> 12640 </field> 12641 <field id="location"> 12642 <jlocation/> 12643 <description> 12644 Corresponding location. See 12645 <functionlink id="GetJLocationFormat"></functionlink> 12646 for the meaning of location. 12647 </description> 12648 </field> 12649 </typedef> 12650 <capabilities> 12651 <required id="can_generate_compiled_method_load_events"></required> 12652 </capabilities> 12653 <parameters> 12654 <param id="klass"> 12655 <jclass method="method"/> 12656 <description> 12657 Class of the method being compiled and loaded 12658 </description> 12659 </param> 12660 <param id="method"> 12661 <jmethodID class="klass"/> 12662 <description> 12663 Method being compiled and loaded 12664 </description> 12665 </param> 12666 <param id="code_size"> 12667 <jint/> 12668 <description> 12669 Size of compiled code 12670 </description> 12671 </param> 12672 <param id="code_addr"> 12673 <vmbuf><void/></vmbuf> 12674 <description> 12675 Address where compiled method code is loaded 12676 </description> 12677 </param> 12678 <param id="map_length"> 12679 <jint/> 12680 <description> 12681 Number of <typelink id="jvmtiAddrLocationMap"></typelink> 12682 entries in the address map. 12683 Zero if mapping information cannot be supplied. 12684 </description> 12685 </param> 12686 <param id="map"> 12687 <vmbuf><struct>jvmtiAddrLocationMap</struct></vmbuf> 12688 <description> 12689 Map from native addresses to location. 12690 The native address range of each entry is from 12691 <fieldlink id="start_address" struct="jvmtiAddrLocationMap"></fieldlink> 12692 to <code>start_address-1</code> of the next entry. 12693 <code>NULL</code> if mapping information cannot be supplied. 12694 </description> 12695 </param> 12696 <param id="compile_info"> 12697 <vmbuf><void/></vmbuf> 12698 <description> 12699 VM-specific compilation information. 12700 The referenced compile information is managed by the VM 12701 and must not depend on the agent for collection. 12702 A VM implementation defines the content and lifetime 12703 of the information. 12704 </description> 12705 </param> 12706 </parameters> 12707 </event> 12708 12709 <event label="Compiled Method Unload" 12710 id="CompiledMethodUnload" const="JVMTI_EVENT_COMPILED_METHOD_UNLOAD" num="69"> 12711 <description> 12712 Sent when a compiled method is unloaded from memory. 12713 This event might not be sent on the thread which performed the unload. 12714 This event may be sent sometime after the unload occurs, but 12715 will be sent before the memory is reused 12716 by a newly generated compiled method. This event may be sent after 12717 the class is unloaded. 12718 </description> 12719 <origin>jvmpi</origin> 12720 <capabilities> 12721 <required id="can_generate_compiled_method_load_events"></required> 12722 </capabilities> 12723 <parameters> 12724 <param id="klass"> 12725 <jclass method="method"/> 12726 <description> 12727 Class of the compiled method being unloaded. 12728 </description> 12729 </param> 12730 <param id="method"> 12731 <jmethodID class="klass"/> 12732 <description> 12733 Compiled method being unloaded. 12734 For identification of the compiled method only -- the class 12735 may be unloaded and therefore the method should not be used 12736 as an argument to further JNI or <jvmti/> functions. 12737 </description> 12738 </param> 12739 <param id="code_addr"> 12740 <vmbuf><void/></vmbuf> 12741 <description> 12742 Address where compiled method code was loaded. 12743 For identification of the compiled method only -- 12744 the space may have been reclaimed. 12745 </description> 12746 </param> 12747 </parameters> 12748 </event> 12749 12750 <event label="Dynamic Code Generated" phase="any" 12751 id="DynamicCodeGenerated" const="JVMTI_EVENT_DYNAMIC_CODE_GENERATED" num="70"> 12752 <description> 12753 Sent when a component of the virtual machine is generated dynamically. 12754 This does not correspond to Java programming language code that is 12755 compiled--see <eventlink id="CompiledMethodLoad"></eventlink>. 12756 This is for native code--for example, an interpreter that is generated 12757 differently depending on command-line options. 12758 <p/> 12759 Note that this event has no controlling capability. 12760 If a VM cannot generate these events, it simply does not send any. 12761 <p/> 12762 These events can be sent after their initial occurrence with 12763 <functionlink id="GenerateEvents"></functionlink>. 12764 </description> 12765 <origin>jvmpi</origin> 12766 <capabilities> 12767 </capabilities> 12768 <parameters> 12769 <param id="name"> 12770 <vmbuf><char/></vmbuf> 12771 <description> 12772 Name of the code, encoded as a 12773 <internallink id="mUTF">modified UTF-8</internallink> string. 12774 Intended for display to an end-user. 12775 The name might not be unique. 12776 </description> 12777 </param> 12778 <param id="address"> 12779 <vmbuf><void/></vmbuf> 12780 <description> 12781 Native address of the code 12782 </description> 12783 </param> 12784 <param id="length"> 12785 <jint/> 12786 <description> 12787 Length in bytes of the code 12788 </description> 12789 </param> 12790 </parameters> 12791 </event> 12792 12793 <event label="Data Dump Request" 12794 id="DataDumpRequest" const="JVMTI_EVENT_DATA_DUMP_REQUEST" num="71"> 12795 <description> 12796 Sent by the VM to request the agent to dump its data. This 12797 is just a hint and the agent need not react to this event. 12798 This is useful for processing command-line signals from users. For 12799 example, in the Java 2 SDK a CTRL-Break on Win32 and a CTRL-\ on Solaris 12800 causes the VM to send this event to the agent. 12801 </description> 12802 <origin>jvmpi</origin> 12803 <capabilities> 12804 </capabilities> 12805 <parameters> 12806 </parameters> 12807 </event> 12808 12809 <event label="Monitor Contended Enter" 12810 id="MonitorContendedEnter" const="JVMTI_EVENT_MONITOR_CONTENDED_ENTER" filtered="thread" num="75"> 12811 <description> 12812 Sent when a thread is attempting to enter a Java programming language 12813 monitor already acquired by another thread. 12814 </description> 12815 <origin>jvmpi</origin> 12816 <capabilities> 12817 <required id="can_generate_monitor_events"></required> 12818 </capabilities> 12819 <parameters> 12820 <param id="jni_env"> 12821 <outptr> 12822 <struct>JNIEnv</struct> 12823 </outptr> 12824 <description> 12825 The JNI environment of the event (current) thread 12826 </description> 12827 </param> 12828 <param id="thread"> 12829 <jthread/> 12830 <description> 12831 JNI local reference to the thread 12832 attempting to enter the monitor 12833 </description> 12834 </param> 12835 <param id="object"> 12836 <jobject/> 12837 <description> 12838 JNI local reference to the monitor 12839 </description> 12840 </param> 12841 </parameters> 12842 </event> 12843 12844 <event label="Monitor Contended Entered" 12845 id="MonitorContendedEntered" const="JVMTI_EVENT_MONITOR_CONTENDED_ENTERED" filtered="thread" num="76"> 12846 <description> 12847 Sent when a thread enters a Java programming language 12848 monitor after waiting for it to be released by another thread. 12849 </description> 12850 <origin>jvmpi</origin> 12851 <capabilities> 12852 <required id="can_generate_monitor_events"></required> 12853 </capabilities> 12854 <parameters> 12855 <param id="jni_env"> 12856 <outptr> 12857 <struct>JNIEnv</struct> 12858 </outptr> 12859 <description> 12860 The JNI environment of the event (current) thread 12861 </description> 12862 </param> 12863 <param id="thread"> 12864 <jthread/> 12865 <description> 12866 JNI local reference to the thread entering 12867 the monitor 12868 </description> 12869 </param> 12870 <param id="object"> 12871 <jobject/> 12872 <description> 12873 JNI local reference to the monitor 12874 </description> 12875 </param> 12876 </parameters> 12877 </event> 12878 12879 <event label="Monitor Wait" 12880 id="MonitorWait" const="JVMTI_EVENT_MONITOR_WAIT" filtered="thread" num="73"> 12881 <description> 12882 Sent when a thread is about to wait on an object. 12883 </description> 12884 <origin>jvmpi</origin> 12885 <capabilities> 12886 <required id="can_generate_monitor_events"></required> 12887 </capabilities> 12888 <parameters> 12889 <param id="jni_env"> 12890 <outptr> 12891 <struct>JNIEnv</struct> 12892 </outptr> 12893 <description> 12894 The JNI environment of the event (current) thread 12895 </description> 12896 </param> 12897 <param id="thread"> 12898 <jthread/> 12899 <description> 12900 JNI local reference to the thread about to wait 12901 </description> 12902 </param> 12903 <param id="object"> 12904 <jobject/> 12905 <description> 12906 JNI local reference to the monitor 12907 </description> 12908 </param> 12909 <param id="timeout"> 12910 <jlong/> 12911 <description> 12912 The number of milliseconds the thread will wait 12913 </description> 12914 </param> 12915 </parameters> 12916 </event> 12917 12918 <event label="Monitor Waited" 12919 id="MonitorWaited" const="JVMTI_EVENT_MONITOR_WAITED" filtered="thread" num="74"> 12920 <description> 12921 Sent when a thread finishes waiting on an object. 12922 </description> 12923 <origin>jvmpi</origin> 12924 <capabilities> 12925 <required id="can_generate_monitor_events"></required> 12926 </capabilities> 12927 <parameters> 12928 <param id="jni_env"> 12929 <outptr> 12930 <struct>JNIEnv</struct> 12931 </outptr> 12932 <description> 12933 The JNI environment of the event (current) thread 12934 </description> 12935 </param> 12936 <param id="thread"> 12937 <jthread/> 12938 <description> 12939 JNI local reference to the thread that was finished waiting 12940 </description> 12941 </param> 12942 <param id="object"> 12943 <jobject/> 12944 <description> 12945 JNI local reference to the monitor. 12946 </description> 12947 </param> 12948 <param id="timed_out"> 12949 <jboolean/> 12950 <description> 12951 True if the monitor timed out 12952 </description> 12953 </param> 12954 </parameters> 12955 </event> 12956 12957 <event label="Resource Exhausted" 12958 id="ResourceExhausted" const="JVMTI_EVENT_RESOURCE_EXHAUSTED" num="80" 12959 since="1.1"> 12960 <description> 12961 Sent when a VM resource needed by a running application has been exhausted. 12962 Except as required by the optional capabilities, the set of resources 12963 which report exhaustion is implementation dependent. 12964 <p/> 12965 The following bit flags define the properties of the resource exhaustion: 12966 <constants id="jvmtiResourceExhaustionFlags" 12967 label="Resource Exhaustion Flags" 12968 kind="bits" 12969 since="1.1"> 12970 <constant id="JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR" num="0x0001"> 12971 After this event returns, the VM will throw a 12972 <code>java.lang.OutOfMemoryError</code>. 12973 </constant> 12974 <constant id="JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP" num="0x0002"> 12975 The VM was unable to allocate memory from the <tm>Java</tm> 12976 platform <i>heap</i>. 12977 The <i>heap</i> is the runtime 12978 data area from which memory for all class instances and 12979 arrays are allocated. 12980 </constant> 12981 <constant id="JVMTI_RESOURCE_EXHAUSTED_THREADS" num="0x0004"> 12982 The VM was unable to create a thread. 12983 </constant> 12984 </constants> 12985 </description> 12986 <origin>new</origin> 12987 <capabilities> 12988 <capability id="can_generate_resource_exhaustion_heap_events"> 12989 Can generate events when the VM is unable to allocate memory from the 12990 <internallink id="JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP">heap</internallink>. 12991 </capability> 12992 <capability id="can_generate_resource_exhaustion_threads_events"> 12993 Can generate events when the VM is unable to 12994 <internallink id="JVMTI_RESOURCE_EXHAUSTED_THREADS">create 12995 a thread</internallink>. 12996 </capability> 12997 </capabilities> 12998 <parameters> 12999 <param id="jni_env"> 13000 <outptr> 13001 <struct>JNIEnv</struct> 13002 </outptr> 13003 <description> 13004 The JNI environment of the event (current) thread 13005 </description> 13006 </param> 13007 <param id="flags"> 13008 <jint/> 13009 <description> 13010 Flags defining the properties of the of resource exhaustion 13011 as specified by the 13012 <internallink id="jvmtiResourceExhaustionFlags">Resource 13013 Exhaustion Flags</internallink>. 13014 </description> 13015 </param> 13016 <param id="reserved"> 13017 <vmbuf><void/></vmbuf> 13018 <description> 13019 Reserved. 13020 </description> 13021 </param> 13022 <param id="description"> 13023 <vmbuf><char/></vmbuf> 13024 <description> 13025 Description of the resource exhaustion, encoded as a 13026 <internallink id="mUTF">modified UTF-8</internallink> string. 13027 </description> 13028 </param> 13029 </parameters> 13030 </event> 13031 13032 <event label="VM Object Allocation" 13033 id="VMObjectAlloc" const="JVMTI_EVENT_VM_OBJECT_ALLOC" num="84"> 13034 <description> 13035 Sent when a method causes the virtual machine to allocate an 13036 Object visible to Java programming language code and the 13037 allocation is not detectable by other intrumentation mechanisms. 13038 Generally object allocation should be detected by instrumenting 13039 the bytecodes of allocating methods. 13040 Object allocation generated in native code by JNI function 13041 calls should be detected using 13042 <internallink id="jniIntercept">JNI function interception</internallink>. 13043 Some methods might not have associated bytecodes and are not 13044 native methods, they instead are executed directly by the 13045 VM. These methods should send this event. 13046 Virtual machines which are incapable of bytecode instrumentation 13047 for some or all of their methods can send this event. 13048 <p/> 13049 Typical examples where this event might be sent: 13050 <ul> 13051 <li>Reflection -- for example, <code>java.lang.Class.newInstance()</code></li> 13052 <li>Methods not represented by bytecodes -- for example, VM intrinsics and 13053 J2ME preloaded classes</li> 13054 </ul> 13055 Cases where this event would not be generated: 13056 <ul> 13057 <li>Allocation due to bytecodes -- for example, the <code>new</code> 13058 and <code>newarray</code> VM instructions</li> 13059 <li>Allocation due to JNI function calls -- for example, 13060 <code>AllocObject</code></li> 13061 <li>Allocations during VM initialization</li> 13062 <li>VM internal objects</li> 13063 </ul> 13064 </description> 13065 <origin>new</origin> 13066 <capabilities> 13067 <required id="can_generate_vm_object_alloc_events"></required> 13068 </capabilities> 13069 <parameters> 13070 <param id="jni_env"> 13071 <outptr> 13072 <struct>JNIEnv</struct> 13073 </outptr> 13074 <description> 13075 The JNI environment of the event (current) thread 13076 </description> 13077 </param> 13078 <param id="thread"> 13079 <jthread/> 13080 <description> 13081 Thread allocating the object. 13082 </description> 13083 </param> 13084 <param id="object"> 13085 <jobject/> 13086 <description> 13087 JNI local reference to the object that was allocated 13088 </description> 13089 </param> 13090 <param id="object_klass"> 13091 <jclass/> 13092 <description> 13093 JNI local reference to the class of the object 13094 </description> 13095 </param> 13096 <param id="size"> 13097 <jlong/> 13098 <description> 13099 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 13100 </description> 13101 </param> 13102 </parameters> 13103 </event> 13104 13105 <event label="Object Free" 13106 id="ObjectFree" const="JVMTI_EVENT_OBJECT_FREE" num="83"> 13107 <description> 13108 An Object Free event is sent when the garbage collector frees an object. 13109 Events are only sent for tagged objects--see 13110 <internallink id="Heap">heap functions</internallink>. 13111 <p/> 13112 The event handler must not use JNI functions and 13113 must not use <jvmti/> functions except those which 13114 specifically allow such use (see the raw monitor, memory management, 13115 and environment local storage functions). 13116 </description> 13117 <origin>new</origin> 13118 <capabilities> 13119 <required id="can_generate_object_free_events"></required> 13120 </capabilities> 13121 <parameters> 13122 <param id="tag"> 13123 <jlong/> 13124 <description> 13125 The freed object's tag 13126 </description> 13127 </param> 13128 </parameters> 13129 </event> 13130 13131 <event label="Garbage Collection Start" 13132 id="GarbageCollectionStart" const="JVMTI_EVENT_GARBAGE_COLLECTION_START" num="81"> 13133 <description> 13134 A Garbage Collection Start event is sent when a 13135 garbage collection pause begins. 13136 Only stop-the-world collections are reported--that is, collections during 13137 which all threads cease to modify the state of the Java virtual machine. 13138 This means that some collectors will never generate these events. 13139 This event is sent while the VM is still stopped, thus 13140 the event handler must not use JNI functions and 13141 must not use <jvmti/> functions except those which 13142 specifically allow such use (see the raw monitor, memory management, 13143 and environment local storage functions). 13144 <p/> 13145 This event is always sent as a matched pair with 13146 <eventlink id="GarbageCollectionFinish"/> 13147 (assuming both events are enabled) and no garbage collection 13148 events will occur between them. 13149 </description> 13150 <origin>new</origin> 13151 <capabilities> 13152 <required id="can_generate_garbage_collection_events"></required> 13153 </capabilities> 13154 <parameters> 13155 </parameters> 13156 </event> 13157 13158 <event label="Garbage Collection Finish" 13159 id="GarbageCollectionFinish" const="JVMTI_EVENT_GARBAGE_COLLECTION_FINISH" num="82"> 13160 <description> 13161 A Garbage Collection Finish event is sent when a 13162 garbage collection pause ends. 13163 This event is sent while the VM is still stopped, thus 13164 the event handler must not use JNI functions and 13165 must not use <jvmti/> functions except those which 13166 specifically allow such use (see the raw monitor, memory management, 13167 and environment local storage functions). 13168 <p/> 13169 Some agents may need to do post garbage collection operations that 13170 require the use of the disallowed <jvmti/> or JNI functions. For these 13171 cases an agent thread can be created which waits on a raw monitor, 13172 and the handler for the Garbage Collection Finish event simply 13173 notifies the raw monitor 13174 <p/> 13175 This event is always sent as a matched pair with 13176 <eventlink id="GarbageCollectionStart"/> (assuming both events are enabled). 13177 <issue> 13178 The most important use of this event is to provide timing information, 13179 and thus additional information is not required. However, 13180 information about the collection which is "free" should be included - 13181 what that information is needs to be determined. 13182 </issue> 13183 </description> 13184 <origin>new</origin> 13185 <capabilities> 13186 <required id="can_generate_garbage_collection_events"></required> 13187 </capabilities> 13188 <parameters> 13189 </parameters> 13190 </event> 13191 13192 <elide> 13193 <event label="Verbose Output" phase="any" 13194 id="VerboseOutput" const="JVMTI_EVENT_VERBOSE_OUTPUT" num="85"> 13195 <description> 13196 Send verbose messages as strings. 13197 <issue> 13198 This format is extremely fragile, as it can change with each 13199 platform, collector and version. Alternatives include: 13200 <ul> 13201 <li>building off Java programming language M and M APIs</li> 13202 <li>XML</li> 13203 <li>key/value pairs</li> 13204 <li>removing it</li> 13205 </ul> 13206 </issue> 13207 <issue> 13208 Though this seemed trivial to implement. 13209 In the RI it appears this will be quite complex. 13210 </issue> 13211 </description> 13212 <origin>new</origin> 13213 <capabilities> 13214 </capabilities> 13215 <parameters> 13216 <param id="flag"> 13217 <enum>jvmtiVerboseFlag</enum> 13218 <description> 13219 Which verbose output is being sent. 13220 </description> 13221 </param> 13222 <param id="message"> 13223 <vmbuf><char/></vmbuf> 13224 <description> 13225 Message text, encoded as a 13226 <internallink id="mUTF">modified UTF-8</internallink> string. 13227 </description> 13228 </param> 13229 </parameters> 13230 </event> 13231 </elide> 13232 13233 </eventsection> 13234 13235 <datasection> 13236 <intro> 13237 <jvmti/> extends the data types defined by JNI. 13238 </intro> 13239 <basetypes id="jniTypes" label="JNI Types Used in the JVM Tool Interface"> 13240 <basetype id="jboolean"> 13241 <description> 13242 Holds a Java programming language <code>boolean</code>. 13243 Unsigned 8 bits. 13244 </description> 13245 </basetype> 13246 <basetype id="jchar"> 13247 <description> 13248 Holds a Java programming language <code>char</code>. 13249 Unsigned 16 bits. 13250 </description> 13251 </basetype> 13252 <basetype id="jint"> 13253 <description> 13254 Holds a Java programming language <code>int</code>. 13255 Signed 32 bits. 13256 </description> 13257 </basetype> 13258 <basetype id="jlong"> 13259 <description> 13260 Holds a Java programming language <code>long</code>. 13261 Signed 64 bits. 13262 </description> 13263 </basetype> 13264 <basetype id="jfloat"> 13265 <description> 13266 Holds a Java programming language <code>float</code>. 13267 32 bits. 13268 </description> 13269 </basetype> 13270 <basetype id="jdouble"> 13271 <description> 13272 Holds a Java programming language <code>double</code>. 13273 64 bits. 13274 </description> 13275 </basetype> 13276 <basetype id="jobject"> 13277 <description> 13278 Holds a Java programming language object. 13279 </description> 13280 </basetype> 13281 <basetype id="jclass"> 13282 <description> 13283 Holds a Java programming language class. 13284 </description> 13285 </basetype> 13286 <basetype id="jvalue"> 13287 <description> 13288 Is a union of all primitive types and <code>jobject</code>. Thus, holds any Java 13289 programming language value. 13290 </description> 13291 </basetype> 13292 <basetype id="jfieldID"> 13293 <description> 13294 Identifies a Java programming language field. 13295 <code>jfieldID</code>s returned by <jvmti/> functions and events may be 13296 safely stored. 13297 </description> 13298 </basetype> 13299 <basetype id="jmethodID"> 13300 <description> 13301 Identifies a Java programming language method, initializer, or constructor. 13302 <code>jmethodID</code>s returned by <jvmti/> functions and events may be 13303 safely stored. However, if the class is unloaded, they become invalid 13304 and must not be used. 13305 </description> 13306 </basetype> 13307 <basetype id="JNIEnv"> 13308 <description> 13309 Pointer to the JNI function table. Pointer to this (<code>JNIEnv *</code>) 13310 is a JNI environment. 13311 </description> 13312 </basetype> 13313 </basetypes> 13314 13315 <basetypes id="jvmtiTypes" label="JVM Tool Interface Base Types"> 13316 <basetype id="jvmtiEnv"> 13317 <description> 13318 The <jvmti/> <internallink id="environments">environment</internallink> pointer. 13319 See the <internallink id="FunctionSection">Function Section</internallink>. 13320 <code>jvmtiEnv</code> points to the 13321 <internallink id="FunctionTable">function table</internallink> pointer. 13322 </description> 13323 </basetype> 13324 <basetype id="jthread"> 13325 <definition>typedef jobject jthread;</definition> 13326 <description> 13327 Subtype of <datalink id="jobject"></datalink> that holds a thread. 13328 </description> 13329 </basetype> 13330 <basetype id="jthreadGroup"> 13331 <definition>typedef jobject jthreadGroup;</definition> 13332 <description> 13333 Subtype of <datalink id="jobject"></datalink> that holds a thread group. 13334 </description> 13335 </basetype> 13336 <basetype id="jlocation"> 13337 <definition>typedef jlong jlocation;</definition> 13338 <description> 13339 A 64 bit value, representing a monotonically increasing 13340 executable position within a method. 13341 <code>-1</code> indicates a native method. 13342 See <functionlink id="GetJLocationFormat"></functionlink> for the format on a 13343 given VM. 13344 </description> 13345 </basetype> 13346 <basetype id="jrawMonitorID"> 13347 <definition>struct _jrawMonitorID; 13348 typedef struct _jrawMonitorID *jrawMonitorID;</definition> 13349 <description> 13350 A raw monitor. 13351 </description> 13352 </basetype> 13353 <basetype id="jvmtiError"> 13354 <description> 13355 Holds an error return code. 13356 See the <internallink id="ErrorSection">Error section</internallink> for possible values. 13357 <example> 13358 typedef enum { 13359 JVMTI_ERROR_NONE = 0, 13360 JVMTI_ERROR_INVALID_THREAD = 10, 13361 ... 13362 } jvmtiError; 13363 </example> 13364 </description> 13365 </basetype> 13366 <basetype id="jvmtiEvent"> 13367 <description> 13368 An identifier for an event type. 13369 See the <internallink id="EventSection">Event section</internallink> for possible values. 13370 It is guaranteed that future versions of this specification will 13371 never assign zero as an event type identifier. 13372 <example> 13373 typedef enum { 13374 JVMTI_EVENT_SINGLE_STEP = 1, 13375 JVMTI_EVENT_BREAKPOINT = 2, 13376 ... 13377 } jvmtiEvent; 13378 </example> 13379 </description> 13380 </basetype> 13381 <basetype id="jvmtiEventCallbacks"> 13382 <description> 13383 The callbacks used for events. 13384 <example> 13385 typedef struct { 13386 jvmtiEventVMInit VMInit; 13387 jvmtiEventVMDeath VMDeath; 13388 ... 13389 } jvmtiEventCallbacks; 13390 </example> 13391 See <internallink id="jvmtiEventCallbacks">event callbacks</internallink> 13392 for the complete structure. 13393 <p/> 13394 Where, for example, the VM initialization callback is defined: 13395 <example> 13396 typedef void (JNICALL *jvmtiEventVMInit) 13397 (jvmtiEnv *jvmti_env, 13398 JNIEnv* jni_env, 13399 jthread thread); 13400 </example> 13401 See the individual events for the callback function definition. 13402 </description> 13403 </basetype> 13404 <basetype id="jniNativeInterface"> 13405 <definition>typedef struct JNINativeInterface_ jniNativeInterface;</definition> 13406 <description> 13407 Typedef for the JNI function table <code>JNINativeInterface</code> 13408 defined in the 13409 <externallink id="http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/functions.html#wp23720">JNI Specification</externallink>. 13410 The JNI reference implementation defines this with an underscore. 13411 </description> 13412 </basetype> 13413 </basetypes> 13414 13415 </datasection> 13416 13417 <issuessection label="Issues"> 13418 <intro id="suspendRequired" label="Resolved Issue: Suspend - Required or Automatic"> 13419 JVMDI requires that the agent suspend threads before calling 13420 certain sensitive functions. JVMPI requires garbage collection to be 13421 disabled before calling certain sensitive functions. 13422 It was suggested that rather than have this requirement, that 13423 VM place itself in a suitable state before performing an 13424 operation. This makes considerable sense since each VM 13425 knows its requirements and can most easily arrange a 13426 safe state. 13427 <p/> 13428 The ability to externally suspend/resume threads will, of 13429 course, remain. The ability to enable/disable garbage collection will not. 13430 <p/> 13431 This issue is resolved--suspend will not 13432 be required. The spec has been updated to reflect this. 13433 </intro> 13434 13435 <intro id="stackSampling" label="Resolved Issue: Call Stack Sampling"> 13436 There are a variety of approaches to sampling call stacks. 13437 The biggest bifurcation is between VM controlled and agent 13438 controlled. 13439 <p/> 13440 This issue is resolved--agent controlled 13441 sampling will be the approach. 13442 </intro> 13443 13444 <intro id="threadRepresentation" label="Resolved Issue: Thread Representation"> 13445 JVMDI represents threads as jthread. JVMPI primarily 13446 uses JNIEnv* to represent threads. 13447 <p/> 13448 The Expert Group has chosen jthread as the representation 13449 for threads in <jvmti/>. 13450 JNIEnv* is sent by 13451 events since it is needed to JNI functions. JNIEnv, per the 13452 JNI spec, are not supposed to be used outside their thread. 13453 </intro> 13454 13455 <intro id="design" label="Resolved Issue: Method Representation"> 13456 The JNI spec allows an implementation to depend on jclass/jmethodID 13457 pairs, rather than simply a jmethodID, to reference a method. 13458 JVMDI, for consistency, choose the same representation. 13459 JVMPI, however, specifies that a jmethodID alone maps to a 13460 method. Both of the Sun <tm>J2SE</tm> virtual machines (Classic and <tm>HotSpot</tm>) store 13461 pointers in jmethodIDs, and as a result, a jmethodID is sufficient. 13462 In fact, any JVM implementation that supports JVMPI must have 13463 such a representation. 13464 <jvmti/> will use jmethodID as a unique representation of a method 13465 (no jclass is used). 13466 There should be efficiency gains, particularly in 13467 functionality like stack dumping, to this representation. 13468 <p/> 13469 Note that fields were not used in JVMPI and that the access profile 13470 of fields differs from methods--for implementation efficiency 13471 reasons, a jclass/jfieldID pair will still be needed for field 13472 reference. 13473 </intro> 13474 13475 <intro id="localReferenceIssue" label="Resolved Issue: Local References"> 13476 Functions return local references. 13477 </intro> 13478 13479 <intro id="frameRep" label="Resolved Issue: Representation of frames"> 13480 In JVMDI, a frame ID is used to represent a frame. Problem with this 13481 is that a VM must track when a frame becomes invalid, a far better 13482 approach, and the one used in <jvmti/>, is to reference frames by depth. 13483 </intro> 13484 13485 <intro id="requiredCapabilities" label="Issue: Required Capabilities"> 13486 Currently, having a required capabilities means that the functionality 13487 is optional. Capabilities are useful even for required functionality 13488 since they can inform the VM is needed set-up. Thus, there should be 13489 a set of capabilities that a conformant implementation must provide 13490 (if requested during Agent_OnLoad). 13491 </intro> 13492 13493 <intro id="taghint" label="Proposal: add tag hint function"> 13494 A hint of the percentage of objects that will be tagged would 13495 help the VM pick a good implementation. 13496 </intro> 13497 13498 <intro id="moreMonitorQueries" label="Request: More Monitor Quires"> 13499 How difficult or easy would be to extend the monitor_info category to include 13500 <pre> 13501 - current number of monitors 13502 - enumeration of monitors 13503 - enumeration of threads waiting on a given monitor 13504 </pre> 13505 The reason for my question is the fact that current get_monitor_info support 13506 requires the agent to specify a given thread to get the info which is probably 13507 OK in the profiling/debugging space, while in the monitoring space the agent 13508 could be watching the monitor list and then decide which thread to ask for 13509 the info. You might ask why is this important for monitoring .... I think it 13510 can aid in the detection/prediction of application contention caused by hot-locks. 13511 </intro> 13512 </issuessection> 13513 13514 <changehistory id="ChangeHistory" update="09/05/07"> 13515 <intro> 13516 The <jvmti/> specification is an evolving document with major, minor, 13517 and micro version numbers. 13518 A released version of the specification is uniquely identified 13519 by its major and minor version. 13520 The functions, events, and capabilities in this specification 13521 indicate a "Since" value which is the major and minor version in 13522 which it was introduced. 13523 The version of the specification implemented by the VM can 13524 be retrieved at runtime with the <functionlink id="GetVersionNumber"/> 13525 function. 13526 </intro> 13527 <change date="14 Nov 2002"> 13528 Converted to XML document. 13529 </change> 13530 <change date="14 Nov 2002"> 13531 Elided heap dump functions (for now) since what was there 13532 was wrong. 13533 </change> 13534 <change date="18 Nov 2002"> 13535 Added detail throughout. 13536 </change> 13537 <change date="18 Nov 2002"> 13538 Changed JVMTI_THREAD_STATUS_RUNNING to JVMTI_THREAD_STATUS_RUNNABLE. 13539 </change> 13540 <change date="19 Nov 2002"> 13541 Added AsyncGetStackTrace. 13542 </change> 13543 <change date="19 Nov 2002"> 13544 Added jframeID return to GetStackTrace. 13545 </change> 13546 <change date="19 Nov 2002"> 13547 Elided GetCurrentFrame and GetCallingFrame functions (for now) since what was there 13548 since they are redundant with GetStackTrace. 13549 </change> 13550 <change date="19 Nov 2002"> 13551 Elided ClearAllBreakpoints since it has always been redundant. 13552 </change> 13553 <change date="19 Nov 2002"> 13554 Added GetSystemProperties. 13555 </change> 13556 <change date="19 Nov 2002"> 13557 Changed the thread local storage functions to use jthread. 13558 </change> 13559 <change date="20 Nov 2002"> 13560 Added GetJLocationFormat. 13561 </change> 13562 <change date="22 Nov 2002"> 13563 Added events and introductory text. 13564 </change> 13565 <change date="22 Nov 2002"> 13566 Cross reference type and constant definitions. 13567 </change> 13568 <change date="24 Nov 2002"> 13569 Added DTD. 13570 </change> 13571 <change date="24 Nov 2002"> 13572 Added capabilities function section. 13573 </change> 13574 <change date="29 Nov 2002"> 13575 Assign capabilities to each function and event. 13576 </change> 13577 <change date="29 Nov 2002"> 13578 Add <internallink id="jniIntercept">JNI interception functions</internallink>. 13579 </change> 13580 <change date="30 Nov 2002"> 13581 Auto generate SetEventNotificationMode capabilities. 13582 </change> 13583 <change date="30 Nov 2002"> 13584 Add <eventlink id="VMObjectAlloc"></eventlink> event. 13585 </change> 13586 <change date="30 Nov 2002"> 13587 Add <eventlink id="DynamicCodeGenerated"></eventlink> event. 13588 </change> 13589 <change date="30 Nov 2002"> 13590 Add const to declarations. 13591 </change> 13592 <change date="30 Nov 2002"> 13593 Change method exit and frame pop to send on exception. 13594 </change> 13595 <change date="1 Dec 2002"> 13596 Add ForceGarbageCollection. 13597 </change> 13598 <change date="2 Dec 2002"> 13599 Redo Xrun section; clarify GetStackTrace and add example; 13600 Fix width problems; use "agent" consistently. 13601 </change> 13602 <change date="8 Dec 2002"> 13603 Remove previous start-up intro. 13604 Add <internallink id="environments"><jvmti/> Environments</internallink> 13605 section. 13606 </change> 13607 <change date="8 Dec 2002"> 13608 Add <functionlink id="DisposeEnvironment"></functionlink>. 13609 </change> 13610 <change date="9 Dec 2002"> 13611 Numerous minor updates. 13612 </change> 13613 <change date="15 Dec 2002"> 13614 Add heap profiling functions added: 13615 get/set annotation, iterate live objects/heap. 13616 Add heap profiling functions place holder added: 13617 heap roots. 13618 Heap profiling event added: object free. 13619 Heap profiling event redesigned: vm object allocation. 13620 Heap profiling event placeholders added: garbage collection start/finish. 13621 Native method bind event added. 13622 </change> 13623 <change date="19 Dec 2002"> 13624 Revamp suspend/resume functions. 13625 Add origin information with jvmdi tag. 13626 Misc fixes. 13627 </change> 13628 <change date="24 Dec 2002"> 13629 Add semantics to types. 13630 </change> 13631 <change date="27 Dec 2002"> 13632 Add local reference section. 13633 Autogenerate parameter descriptions from types. 13634 </change> 13635 <change date="28 Dec 2002"> 13636 Document that RunAgentThread sends threadStart. 13637 </change> 13638 <change date="29 Dec 2002"> 13639 Remove redundant local ref and dealloc warning. 13640 Convert GetRawMonitorName to allocated buffer. 13641 Add GenerateEvents. 13642 </change> 13643 <change date="30 Dec 2002"> 13644 Make raw monitors a type and rename to "jrawMonitorID". 13645 </change> 13646 <change date="1 Jan 2003"> 13647 Include origin information. 13648 Clean-up JVMDI issue references. 13649 Remove Deallocate warnings which are now automatically generated. 13650 </change> 13651 <change date="2 Jan 2003"> 13652 Fix representation issues for jthread. 13653 </change> 13654 <change date="3 Jan 2003"> 13655 Make capabilities buffered out to 64 bits - and do it automatically. 13656 </change> 13657 <change date="4 Jan 2003"> 13658 Make constants which are enumeration into enum types. 13659 Parameters now of enum type. 13660 Clean-up and index type section. 13661 Replace remaining datadef entities with callback. 13662 </change> 13663 <change date="7 Jan 2003"> 13664 Correct GenerateEvents description. 13665 More internal semantics work. 13666 </change> 13667 <change date="9 Jan 2003"> 13668 Replace previous GetSystemProperties with two functions 13669 which use allocated information instead fixed. 13670 Add SetSystemProperty. 13671 More internal semantics work. 13672 </change> 13673 <change date="12 Jan 2003"> 13674 Add varargs to end of SetEventNotificationMode. 13675 </change> 13676 <change date="20 Jan 2003"> 13677 Finish fixing spec to reflect that alloc sizes are jlong. 13678 </change> 13679 <change date="22 Jan 2003"> 13680 Allow NULL as RunAgentThread arg. 13681 </change> 13682 <change date="22 Jan 2003"> 13683 Fixed names to standardized naming convention 13684 Removed AsyncGetStackTrace. 13685 </change> 13686 <change date="29 Jan 2003"> 13687 Since we are using jthread, removed GetThread. 13688 </change> 13689 <change date="31 Jan 2003"> 13690 Change GetFieldName to allow NULLs like GetMethodName. 13691 </change> 13692 <change date="29 Feb 2003" version="v40"> 13693 Rewrite the introductory text, adding sections on 13694 start-up, environments and bytecode instrumentation. 13695 Change the command line arguments per EG discussions. 13696 Add an introduction to the capabilities section. 13697 Add the extension mechanism category and functions. 13698 Mark for deletion, but clarified anyhow, SuspendAllThreads. 13699 Rename IterateOverLiveObjects to IterateOverReachableObjects and 13700 change the text accordingly. 13701 Clarify IterateOverHeap. 13702 Clarify CompiledMethodLoad. 13703 Discuss prerequisite state for Calling Functions. 13704 Clarify SetAllocationHooks. 13705 Added issues ("To be resolved:") through-out. 13706 And so on... 13707 </change> 13708 <change date="6 Mar 2003" version="v41"> 13709 Remove struct from the call to GetOwnedMonitorInfo. 13710 Automatically generate most error documentation, remove 13711 (rather broken) hand written error doc. 13712 Better describe capability use (empty initial set). 13713 Add min value to jint params. 13714 Remove the capability can_access_thread_local_storage. 13715 Rename error JVMTI_ERROR_NOT_IMPLEMENTED to JVMTI_ERROR_MUST_POSSESS_CAPABILITY; 13716 same for *NOT_IMPLEMENTED. 13717 Description fixes. 13718 </change> 13719 <change date="8 Mar 2003" version="v42"> 13720 Rename GetClassSignature to GetClassName. 13721 Rename IterateOverClassObjects to IterateOverInstancesOfClass. 13722 Remove GetMaxStack (operand stack isn't used in <jvmti/>). 13723 Description fixes: define launch-time, remove native frame pop 13724 from PopFrame, and assorted clarifications. 13725 </change> 13726 <change date="8 Mar 2003" version="v43"> 13727 Fix minor editing problem. 13728 </change> 13729 <change date="10 Mar 2003" version="v44"> 13730 Add phase information. 13731 Remap (compact) event numbers. 13732 </change> 13733 <change date="11 Mar 2003" version="v45"> 13734 More phase information - allow "any". 13735 Elide raw monitor queries and events. 13736 Minor description fixes. 13737 </change> 13738 <change date="12 Mar 2003" version="v46"> 13739 Add GetPhase. 13740 Use "phase" through document. 13741 Elide GetRawMonitorName. 13742 Elide GetObjectMonitors. 13743 </change> 13744 <change date="12 Mar 2003" version="v47"> 13745 Fixes from link, XML, and spell checking. 13746 Auto-generate the callback structure. 13747 </change> 13748 <change date="13 Mar 2003" version="v48"> 13749 One character XML fix. 13750 </change> 13751 <change date="13 Mar 2003" version="v49"> 13752 Change function parameter names to be consistent with 13753 event parameters (fooBarBaz becomes foo_bar_baz). 13754 </change> 13755 <change date="14 Mar 2003" version="v50"> 13756 Fix broken link. Fix thread markers. 13757 </change> 13758 <change date="14 Mar 2003" version="v51"> 13759 Change constants so they are under 128 to workaround 13760 compiler problems. 13761 </change> 13762 <change date="23 Mar 2003" version="v52"> 13763 Overhaul capabilities. Separate GetStackTrace into 13764 GetStackTrace and GetStackFrames. 13765 </change> 13766 <change date="8 Apr 2003" version="v54"> 13767 Use depth instead of jframeID to reference frames. 13768 Remove the now irrelevant GetCurrentFrame, GetCallerFrame and GetStackFrames. 13769 Remove frame arg from events. 13770 </change> 13771 <change date="9 Apr 2003" version="v55"> 13772 Remove GetObjectWithAnnotation since tests show bufferred approach more efficient. 13773 Add missing annotation_count to GetObjectsWithAnnotations 13774 </change> 13775 <change date="10 Apr 2003" version="v56"> 13776 Remove confusing parenthetical statement in GetObjectsWithAnnotations 13777 </change> 13778 <change date="13 Apr 2003" version="v58"> 13779 Replace jclass/jmethodID representation of method with simply jmethodID; 13780 Pass JvmtiEnv* as first arg of every event; remove JNIEnv* where inappropriate. 13781 Replace can_access_frames with can_access_local_variables; remove from purely stack access. 13782 Use can_get_synthetic_attribute; fix description. 13783 Clarify that zero length arrays must be deallocated. 13784 Clarify RelinquishCapabilities. 13785 Generalize JVMTI_ERROR_VM_DEAD to JVMTI_ERROR_WRONG_PHASE. 13786 </change> 13787 <change date="27 Apr 2003" version="v59"> 13788 Remove lingering indirect references to OBSOLETE_METHOD_ID. 13789 </change> 13790 <change date="4 May 2003" version="v60"> 13791 Allow DestroyRawMonitor during OnLoad. 13792 </change> 13793 <change date="7 May 2003" version="v61"> 13794 Added not monitor owner error return to DestroyRawMonitor. 13795 </change> 13796 <change date="13 May 2003" version="v62"> 13797 Clarify semantics of raw monitors. 13798 Change flags on <code>GetThreadStatus</code>. 13799 <code>GetClassLoader</code> return NULL for the bootstrap class loader. 13800 Add <code>GetClassName</code> issue. 13801 Define local variable signature. 13802 Disallow zero in annotations array of <code>GetObjectsWithAnnotations</code>. 13803 Remove over specification in <code>GetObjectsWithAnnotations</code>. 13804 Elide <code>SetAllocationHooks</code>. 13805 Elide <code>SuspendAllThreads</code>. 13806 </change> 13807 <change date="14 May 2003" version="v63"> 13808 Define the data type <code>jvmtiEventCallbacks</code>. 13809 Zero length allocations return NULL. 13810 Keep SetAllocationHooks in JVMDI, but remove from <jvmti/>. 13811 Add JVMTI_THREAD_STATUS_FLAG_INTERRUPTED. 13812 </change> 13813 <change date="15 May 2003" version="v64"> 13814 Better wording, per review. 13815 </change> 13816 <change date="15 May 2003" version="v65"> 13817 First Alpha. 13818 Make jmethodID and jfieldID unique, jclass not used. 13819 </change> 13820 <change date="27 May 2003" version="v66"> 13821 Fix minor XSLT errors. 13822 </change> 13823 <change date="13 June 2003" version="v67"> 13824 Undo making jfieldID unique (jmethodID still is). 13825 </change> 13826 <change date="17 June 2003" version="v68"> 13827 Changes per June 11th Expert Group meeting -- 13828 Overhaul Heap functionality: single callback, 13829 remove GetHeapRoots, add reachable iterators, 13830 and rename "annotation" to "tag". 13831 NULL thread parameter on most functions is current 13832 thread. 13833 Add timers. 13834 Remove ForceExit. 13835 Add GetEnvironmentLocalStorage. 13836 Add verbose flag and event. 13837 Add AddToBootstrapClassLoaderSearch. 13838 Update ClassFileLoadHook. 13839 </change> 13840 <change date="18 June 2003" version="v69"> 13841 Clean up issues sections. 13842 Rename GetClassName back to GetClassSignature and 13843 fix description. 13844 Add generic signature to GetClassSignature, 13845 GetFieldSignature, GetMethodSignature, and 13846 GetLocalVariableTable. 13847 Elide EstimateCostOfCapabilities. 13848 Clarify that the system property functions operate 13849 on the VM view of system properties. 13850 Clarify Agent_OnLoad. 13851 Remove "const" from JNIEnv* in events. 13852 Add metadata accessors. 13853 </change> 13854 <change date="18 June 2003" version="v70"> 13855 Add start_depth to GetStackTrace. 13856 Move system properties to a new category. 13857 Add GetObjectSize. 13858 Remove "X" from command line flags. 13859 XML, HTML, and spell check corrections. 13860 </change> 13861 <change date="19 June 2003" version="v71"> 13862 Fix JVMTI_HEAP_ROOT_THREAD to be 6. 13863 Make each synopsis match the function name. 13864 Fix unclear wording. 13865 </change> 13866 <change date="26 June 2003" version="v72"> 13867 SetThreadLocalStorage and SetEnvironmentLocalStorage should allow value 13868 to be set to NULL. 13869 NotifyFramePop, GetFrameLocationm and all the local variable operations 13870 needed to have their wording about frames fixed. 13871 Grammar and clarity need to be fixed throughout. 13872 Capitalization and puntuation need to be consistent. 13873 Need micro version number and masks for accessing major, minor, and micro. 13874 The error code lists should indicate which must be returned by 13875 an implementation. 13876 The command line properties should be visible in the properties functions. 13877 Disallow popping from the current thread. 13878 Allow implementations to return opaque frame error when they cannot pop. 13879 The NativeMethodBind event should be sent during any phase. 13880 The DynamicCodeGenerated event should be sent during any phase. 13881 The following functions should be allowed to operate before VMInit: 13882 Set/GetEnvironmentLocalStorage 13883 GetMethodDeclaringClass 13884 GetClassSignature 13885 GetClassModifiers 13886 IsInterface 13887 IsArrayClass 13888 GetMethodName 13889 GetMethodModifiers 13890 GetMaxLocals 13891 GetArgumentsSize 13892 GetLineNumberTable 13893 GetMethodLocation 13894 IsMethodNative 13895 IsMethodSynthetic. 13896 Other changes (to XSL): 13897 Argument description should show asterisk after not before pointers. 13898 NotifyFramePop, GetFrameLocationm and all the local variable operations 13899 should hsve the NO_MORE_FRAMES error added. 13900 Not alive threads should have a different error return than invalid thread. 13901 </change> 13902 <change date="7 July 2003" version="v73"> 13903 VerboseOutput event was missing message parameter. 13904 Minor fix-ups. 13905 </change> 13906 <change date="14 July 2003" version="v74"> 13907 Technical Publications Department corrections. 13908 Allow thread and environment local storage to be set to NULL. 13909 </change> 13910 <change date="23 July 2003" version="v75"> 13911 Use new Agent_OnLoad rather than overloaded JVM_OnLoad. 13912 Add JNICALL to callbacks (XSL). 13913 Document JNICALL requirement for both events and callbacks (XSL). 13914 Restrict RedefineClasses to methods and attributes. 13915 Elide the VerboseOutput event. 13916 VMObjectAlloc: restrict when event is sent and remove method parameter. 13917 Finish loose ends from Tech Pubs edit. 13918 </change> 13919 <change date="24 July 2003" version="v76"> 13920 Change ClassFileLoadHook event to send the class instead of a boolean of redefine. 13921 </change> 13922 <change date="24 July 2003" version="v77"> 13923 XML fixes. 13924 Minor text clarifications and corrections. 13925 </change> 13926 <change date="24 July 2003" version="v78"> 13927 Remove GetExceptionHandlerTable and GetThrownExceptions from <jvmti/>. 13928 Clarify that stack frames are JVM Spec frames. 13929 Split can_get_source_info into can_get_source_file_name, can_get_line_numbers, 13930 and can_get_source_debug_extension. 13931 PopFrame cannot have a native calling method. 13932 Removed incorrect statement in GetClassloaderClasses 13933 (see <vmspec chapter="4.4"/>). 13934 </change> 13935 <change date="24 July 2003" version="v79"> 13936 XML and text fixes. 13937 Move stack frame description into Stack Frame category. 13938 </change> 13939 <change date="26 July 2003" version="v80"> 13940 Allow NULL (means bootstrap loader) for GetClassloaderClasses. 13941 Add new heap reference kinds for references from classes. 13942 Add timer information struct and query functions. 13943 Add AvailableProcessors. 13944 Rename GetOtherThreadCpuTime to GetThreadCpuTime. 13945 Explicitly add JVMTI_ERROR_INVALID_THREAD and JVMTI_ERROR_THREAD_NOT_ALIVE 13946 to SetEventNotification mode. 13947 Add initial thread to the VM_INIT event. 13948 Remove platform assumptions from AddToBootstrapClassLoaderSearch. 13949 </change> 13950 <change date="26 July 2003" version="v81"> 13951 Grammar and clarity changes per review. 13952 </change> 13953 <change date="27 July 2003" version="v82"> 13954 More grammar and clarity changes per review. 13955 Add Agent_OnUnload. 13956 </change> 13957 <change date="28 July 2003" version="v83"> 13958 Change return type of Agent_OnUnload to void. 13959 </change> 13960 <change date="28 July 2003" version="v84"> 13961 Rename JVMTI_REFERENCE_ARRAY to JVMTI_REFERENCE_ARRAY_ELEMENT. 13962 </change> 13963 <change date="28 July 2003" version="v85"> 13964 Steal java.lang.Runtime.availableProcessors() wording for 13965 AvailableProcessors(). 13966 Guarantee that zero will never be an event ID. 13967 Remove some issues which are no longer issues. 13968 Per review, rename and more completely document the timer 13969 information functions. 13970 </change> 13971 <change date="29 July 2003" version="v86"> 13972 Non-spec visible change to XML controlled implementation: 13973 SetThreadLocalStorage must run in VM mode. 13974 </change> 13975 <change date="5 August 2003" version="0.1.87"> 13976 Add GetErrorName. 13977 Add varargs warning to jvmtiExtensionEvent. 13978 Remove "const" on the jvmtiEnv* of jvmtiExtensionEvent. 13979 Remove unused can_get_exception_info capability. 13980 Pass jvmtiEnv* and JNIEnv* to the jvmtiStartFunction. 13981 Fix jvmtiExtensionFunctionInfo.func declared type. 13982 Extension function returns error code. 13983 Use new version numbering. 13984 </change> 13985 <change date="5 August 2003" version="0.2.88"> 13986 Remove the ClassUnload event. 13987 </change> 13988 <change date="8 August 2003" version="0.2.89"> 13989 Heap reference iterator callbacks return an enum that 13990 allows outgoing object references to be ignored. 13991 Allow JNIEnv as a param type to extension events/functions. 13992 </change> 13993 <change date="15 August 2003" version="0.2.90"> 13994 Fix a typo. 13995 </change> 13996 <change date="2 September 2003" version="0.2.91"> 13997 Remove all metadata functions: GetClassMetadata, 13998 GetFieldMetadata, and GetMethodMetadata. 13999 </change> 14000 <change date="1 October 2003" version="0.2.92"> 14001 Mark the functions Allocate. Deallocate, RawMonitor*, 14002 SetEnvironmentLocalStorage, and GetEnvironmentLocalStorage 14003 as safe for use in heap callbacks and GC events. 14004 </change> 14005 <change date="24 November 2003" version="0.2.93"> 14006 Add pass through opaque user data pointer to heap iterate 14007 functions and callbacks. 14008 In the CompiledMethodUnload event, send the code address. 14009 Add GarbageCollectionOccurred event. 14010 Add constant pool reference kind. 14011 Mark the functions CreateRawMonitor and DestroyRawMonitor 14012 as safe for use in heap callbacks and GC events. 14013 Clarify: VMDeath, GetCurrentThreadCpuTimerInfo, 14014 GetThreadCpuTimerInfo, IterateOverReachableObjects, 14015 IterateOverObjectsReachableFromObject, GetTime and 14016 JVMTI_ERROR_NULL_POINTER. 14017 Add missing errors to: GenerateEvents and 14018 AddToBootstrapClassLoaderSearch. 14019 Fix description of ClassFileLoadHook name parameter. 14020 In heap callbacks and GC/ObjectFree events, specify 14021 that only explicitly allowed functions can be called. 14022 Allow GetCurrentThreadCpuTimerInfo, GetCurrentThreadCpuTime, 14023 GetTimerInfo, and GetTime during callback. 14024 Allow calling SetTag/GetTag during the onload phase. 14025 SetEventNotificationMode, add: error attempted inappropriate 14026 thread level control. 14027 Remove jvmtiExceptionHandlerEntry. 14028 Fix handling of native methods on the stack -- 14029 location_ptr param of GetFrameLocation, remove 14030 JVMTI_ERROR_OPAQUE_FRAME from GetFrameLocation, 14031 jvmtiFrameInfo.location, and jlocation. 14032 Remove typo (from JVMPI) implying that the MonitorWaited 14033 event is sent on sleep. 14034 </change> 14035 <change date="25 November 2003" version="0.2.94"> 14036 Clarifications and typos. 14037 </change> 14038 <change date="3 December 2003" version="0.2.95"> 14039 Allow NULL user_data in heap iterators. 14040 </change> 14041 <change date="28 January 2004" version="0.2.97"> 14042 Add GetThreadState, deprecate GetThreadStatus. 14043 </change> 14044 <change date="29 January 2004" version="0.2.98"> 14045 INVALID_SLOT and TYPE_MISMATCH errors should be optional. 14046 </change> 14047 <change date="12 February 2004" version="0.2.102"> 14048 Remove MonitorContendedExit. 14049 Added JNIEnv parameter to VMObjectAlloc. 14050 Clarified definition of class_tag and referrer_index 14051 parameters to heap callbacks. 14052 </change> 14053 <change date="16 Febuary 2004" version="0.2.103"> 14054 Document JAVA_TOOL_OPTIONS. 14055 </change> 14056 <change date="17 Febuary 2004" version="0.2.105"> 14057 Divide start phase into primordial and start. 14058 Add VMStart event 14059 Change phase associations of functions and events. 14060 </change> 14061 <change date="18 Febuary 2004" version="0.3.6"> 14062 Elide deprecated GetThreadStatus. 14063 Bump minor version, subtract 100 from micro version 14064 </change> 14065 <change date="18 Febuary 2004" version="0.3.7"> 14066 Document that timer nanosecond values are unsigned. 14067 Clarify text having to do with native methods. 14068 </change> 14069 <change date="19 Febuary 2004" version="0.3.8"> 14070 Fix typos. 14071 Remove elided deprecated GetThreadStatus. 14072 </change> 14073 <change date="23 Febuary 2004" version="0.3.9"> 14074 Require NotifyFramePop to act on suspended threads. 14075 </change> 14076 <change date="24 Febuary 2004" version="0.3.10"> 14077 Add capabilities 14078 (<internallink id="jvmtiCapabilities.can_redefine_any_class" 14079 ><code>can_redefine_any_class</code></internallink> 14080 and 14081 <internallink id="jvmtiCapabilities.can_generate_all_class_hook_events" 14082 ><code>can_generate_all_class_hook_events</code></internallink>) 14083 and an error (<errorlink id="JVMTI_ERROR_UNMODIFIABLE_CLASS"></errorlink>) 14084 which allow some classes to be unmodifiable. 14085 </change> 14086 <change date="28 Febuary 2004" version="0.3.11"> 14087 Add JVMTI_ERROR_MUST_POSSESS_CAPABILITY to SetEventNotificationMode. 14088 </change> 14089 <change date="8 March 2004" version="0.3.12"> 14090 Clarified CompiledMethodUnload so that it is clear the event 14091 may be posted after the class has been unloaded. 14092 </change> 14093 <change date="5 March 2004" version="0.3.13"> 14094 Change the size parameter of VMObjectAlloc to jlong to match GetObjectSize. 14095 </change> 14096 <change date="13 March 2004" version="0.3.14"> 14097 Added guideline for the use of the JNI FindClass function in event 14098 callback functions. 14099 </change> 14100 <change date="15 March 2004" version="0.3.15"> 14101 Add GetAllStackTraces and GetThreadListStackTraces. 14102 </change> 14103 <change date="19 March 2004" version="0.3.16"> 14104 ClassLoad and ClassPrepare events can be posted during start phase. 14105 </change> 14106 <change date="25 March 2004" version="0.3.17"> 14107 Add JVMTI_ERROR_NATIVE_METHOD to GetLineNumberTable, GetLocalVariableTable, 14108 GetMaxLocals, GetArgumentsSize, GetMethodLocation, GetBytecodes. 14109 </change> 14110 <change date="29 March 2004" version="0.3.18"> 14111 Return the timer kind in the timer information structure. 14112 </change> 14113 <change date="31 March 2004" version="0.3.19"> 14114 Spec clarifications: 14115 JVMTI_THREAD_STATE_IN_NATIVE might not include JNI or <jvmti/>. 14116 ForceGarbageCollection does not run finalizers. 14117 The context of the specification is the Java platform. 14118 Warn about early instrumentation. 14119 </change> 14120 <change date="1 April 2004" version="0.3.20"> 14121 Refinements to the above clarifications and 14122 Clarify that an error returned by Agent_OnLoad terminates the VM. 14123 </change> 14124 <change date="1 April 2004" version="0.3.21"> 14125 Array class creation does not generate a class load event. 14126 </change> 14127 <change date="7 April 2004" version="0.3.22"> 14128 Align thread state hierarchy more closely with java.lang.Thread.State. 14129 </change> 14130 <change date="12 April 2004" version="0.3.23"> 14131 Clarify the documentation of thread state. 14132 </change> 14133 <change date="19 April 2004" version="0.3.24"> 14134 Remove GarbageCollectionOccurred event -- can be done by agent. 14135 </change> 14136 <change date="22 April 2004" version="0.3.25"> 14137 Define "command-line option". 14138 </change> 14139 <change date="29 April 2004" version="0.3.26"> 14140 Describe the intended use of bytecode instrumentation. 14141 Fix description of extension event first parameter. 14142 </change> 14143 <change date="30 April 2004" version="0.3.27"> 14144 Clarification and typos. 14145 </change> 14146 <change date="18 May 2004" version="0.3.28"> 14147 Remove DataDumpRequest event. 14148 </change> 14149 <change date="18 May 2004" version="0.3.29"> 14150 Clarify RawMonitorWait with zero timeout. 14151 Clarify thread state after RunAgentThread. 14152 </change> 14153 <change date="24 May 2004" version="0.3.30"> 14154 Clean-up: fix bad/old links, etc. 14155 </change> 14156 <change date="30 May 2004" version="0.3.31"> 14157 Clarifications including: 14158 All character strings are modified UTF-8. 14159 Agent thread visibiity. 14160 Meaning of obsolete method version. 14161 Thread invoking heap callbacks, 14162 </change> 14163 <change date="1 June 2004" version="1.0.32"> 14164 Bump major.minor version numbers to "1.0". 14165 </change> 14166 <change date="2 June 2004" version="1.0.33"> 14167 Clarify interaction between ForceGarbageCollection 14168 and ObjectFree. 14169 </change> 14170 <change date="6 June 2004" version="1.0.34"> 14171 Restrict AddToBootstrapClassLoaderSearch and 14172 SetSystemProperty to the OnLoad phase only. 14173 </change> 14174 <change date="11 June 2004" version="1.0.35"> 14175 Fix typo in SetTag. 14176 </change> 14177 <change date="18 June 2004" version="1.0.36"> 14178 Fix trademarks. 14179 Add missing parameter in example GetThreadState usage. 14180 </change> 14181 <change date="4 August 2004" version="1.0.37"> 14182 Copyright updates. 14183 </change> 14184 <change date="5 November 2004" version="1.0.38"> 14185 Add missing function table layout. 14186 Add missing description of C++ member function format of functions. 14187 Clarify that name in CFLH can be NULL. 14188 Released as part of <tm>J2SE</tm> 5.0. 14189 </change> 14190 <change date="24 April 2005" version="1.1.47"> 14191 Bump major.minor version numbers to "1.1". 14192 Add ForceEarlyReturn* functions. 14193 Add GetOwnedMonitorStackDepthInfo function. 14194 Add GetCurrentThread function. 14195 Add "since" version marker. 14196 Add AddToSystemClassLoaderSearch. 14197 Allow AddToBootstrapClassLoaderSearch be used in live phase. 14198 Fix historic rubbish in the descriptions of the heap_object_callback 14199 parameter of IterateOverHeap and IterateOverInstancesOfClass functions; 14200 disallow NULL for this parameter. 14201 Clarify, correct and make consistent: wording about current thread, 14202 opaque frames and insufficient number of frames in PopFrame. 14203 Consistently use "current frame" rather than "topmost". 14204 Clarify the JVMTI_ERROR_TYPE_MISMATCH errors in GetLocal* and SetLocal* 14205 by making them compatible with those in ForceEarlyReturn*. 14206 Many other clarifications and wording clean ups. 14207 </change> 14208 <change date="25 April 2005" version="1.1.48"> 14209 Add GetConstantPool. 14210 Switch references to the first edition of the VM Spec, to the seconds edition. 14211 </change> 14212 <change date="26 April 2005" version="1.1.49"> 14213 Clarify minor/major version order in GetConstantPool. 14214 </change> 14215 <change date="26 April 2005" version="1.1.50"> 14216 Add SetNativeMethodPrefix and SetNativeMethodPrefixes. 14217 Reassign GetOwnedMonitorStackDepthInfo to position 153. 14218 Break out Class Loader Search in its own documentation category. 14219 Deal with overly long lines in XML source. 14220 </change> 14221 <change date="29 April 2005" version="1.1.51"> 14222 Allow agents be started in the live phase. 14223 Added paragraph about deploying agents. 14224 </change> 14225 <change date="30 April 2005" version="1.1.52"> 14226 Add specification description to SetNativeMethodPrefix(es). 14227 Better define the conditions on GetConstantPool. 14228 </change> 14229 <change date="30 April 2005" version="1.1.53"> 14230 Break out the GetClassVersionNumber function from GetConstantPool. 14231 Clean-up the references to the VM Spec. 14232 </change> 14233 <change date="1 May 2005" version="1.1.54"> 14234 Allow SetNativeMethodPrefix(es) in any phase. 14235 Add clarifications about the impact of redefinition on GetConstantPool. 14236 </change> 14237 <change date="2 May 2005" version="1.1.56"> 14238 Various clarifications to SetNativeMethodPrefix(es). 14239 </change> 14240 <change date="2 May 2005" version="1.1.57"> 14241 Add missing performance warning to the method entry event. 14242 </change> 14243 <change date="5 May 2005" version="1.1.58"> 14244 Remove internal JVMDI support. 14245 </change> 14246 <change date="8 May 2005" version="1.1.59"> 14247 Add <functionlink id="RetransformClasses"/>. 14248 Revamp the bytecode instrumentation documentation. 14249 Change <functionlink id="IsMethodObsolete"/> to no longer 14250 require the can_redefine_classes capability. 14251 </change> 14252 <change date="11 May 2005" version="1.1.63"> 14253 Clarifications for retransformation. 14254 </change> 14255 <change date="11 May 2005" version="1.1.64"> 14256 Clarifications for retransformation, per review. 14257 Lock "retransformation (in)capable" at class load enable time. 14258 </change> 14259 <change date="4 June 2005" version="1.1.67"> 14260 Add new heap functionity which supports reporting primitive values, 14261 allows setting the referrer tag, and has more powerful filtering: 14262 FollowReferences, IterateThroughHeap, and their associated 14263 callbacks, structs, enums, and constants. 14264 </change> 14265 <change date="4 June 2005" version="1.1.68"> 14266 Clarification. 14267 </change> 14268 <change date="6 June 2005" version="1.1.69"> 14269 FollowReferences, IterateThroughHeap: Put callbacks in a struct; 14270 Add missing error codes; reduce bits in the visit control flags. 14271 </change> 14272 <change date="14 June 2005" version="1.1.70"> 14273 More on new heap functionity: spec clean-up per review. 14274 </change> 14275 <change date="15 June 2005" version="1.1.71"> 14276 More on new heap functionity: Rename old heap section to Heap (1.0). 14277 </change> 14278 <change date="21 June 2005" version="1.1.72"> 14279 Fix typos. 14280 </change> 14281 <change date="27 June 2005" version="1.1.73"> 14282 Make referrer info structure a union. 14283 </change> 14284 <change date="9 September 2005" version="1.1.74"> 14285 In new heap functions: 14286 Add missing superclass reference kind. 14287 Use a single scheme for computing field indexes. 14288 Remove outdated references to struct based referrer info. 14289 </change> 14290 <change date="12 September 2005" version="1.1.75"> 14291 Don't callback during FollowReferences on frivolous java.lang.Object superclass. 14292 </change> 14293 <change date="13 September 2005" version="1.1.76"> 14294 In string primitive callback, length now Unicode length. 14295 In array and string primitive callbacks, value now "const". 14296 Note possible compiler impacts on setting JNI function table. 14297 </change> 14298 <change date="13 September 2005" version="1.1.77"> 14299 GetClassVersionNumbers() and GetConstantPool() should return 14300 error on array or primitive class. 14301 </change> 14302 <change date="14 September 2005" version="1.1.78"> 14303 Grammar fixes. 14304 </change> 14305 <change date="26 September 2005" version="1.1.79"> 14306 Add IsModifiableClass query. 14307 </change> 14308 <change date="9 February 2006" version="1.1.81"> 14309 Add referrer_class_tag parameter to jvmtiHeapReferenceCallback. 14310 </change> 14311 <change date="13 February 2006" version="1.1.82"> 14312 Doc fixes: update can_redefine_any_class to include retransform. 14313 Clarify that exception events cover all Throwables. 14314 In GetStackTrace, no test is done for start_depth too big if start_depth is zero, 14315 Clarify fields reported in Primitive Field Callback -- static vs instance. 14316 Repair confusing names of heap types, including callback names. 14317 Require consistent usage of stack depth in the face of thread launch methods. 14318 Note incompatibility of <jvmti/> memory management with other systems. 14319 </change> 14320 <change date="14 February 2006" version="1.1.85"> 14321 Fix typos and missing renames. 14322 </change> 14323 <change date="13 March 2006" version="1.1.86"> 14324 Clarify that jmethodIDs and jfieldIDs can be saved. 14325 Clarify that Iterate Over Instances Of Class includes subclasses. 14326 </change> 14327 <change date="14 March 2006" version="1.1.87"> 14328 Better phrasing. 14329 </change> 14330 <change date="16 March 2006" version="1.1.88"> 14331 Match the referrer_index for static fields in Object Reference Callback 14332 with the Reference Implementation (and all other known implementations); 14333 that is, make it match the definition for instance fields. 14334 In GetThreadListStackTraces, add JVMTI_ERROR_INVALID_THREAD to cover 14335 an invalid thread in the list; and specify that not started threads 14336 return empty stacks. 14337 </change> 14338 <change date="17 March 2006" version="1.1.89"> 14339 Typo. 14340 </change> 14341 <change date="25 March 2006" version="1.1.90"> 14342 Typo. 14343 </change> 14344 <change date="6 April 2006" version="1.1.91"> 14345 Remove restrictions on AddToBootstrapClassLoaderSearch and 14346 AddToSystemClassLoaderSearch. 14347 </change> 14348 <change date="1 May 2006" version="1.1.93"> 14349 Changed spec to return -1 for monitor stack depth for the 14350 implementation which can not determine stack depth. 14351 </change> 14352 <change date="3 May 2006" version="1.1.94"> 14353 Corrections for readability and accuracy courtesy of Alan Pratt of IBM. 14354 List the object relationships reported in FollowReferences. 14355 </change> 14356 <change date="5 May 2006" version="1.1.95"> 14357 Clarify the object relationships reported in FollowReferences. 14358 </change> 14359 <change date="28 June 2006" version="1.1.98"> 14360 Clarify DisposeEnvironment; add warning. 14361 Fix typos in SetLocalXXX "retrieve" => "set". 14362 Clarify that native method prefixes must remain set while used. 14363 Clarify that exactly one Agent_OnXXX is called per agent. 14364 Clarify that library loading is independent from start-up. 14365 Remove ambiguous reference to Agent_OnLoad in the Agent_OnUnload spec. 14366 </change> 14367 <change date="31 July 2006" version="1.1.99"> 14368 Clarify the interaction between functions and exceptions. 14369 Clarify and give examples of field indices. 14370 Remove confusing "That is" sentence from MonitorWait and MonitorWaited events. 14371 Update links to point to Java 6. 14372 </change> 14373 <change date="6 August 2006" version="1.1.102"> 14374 Add ResourceExhaustedEvent. 14375 </change> 14376 <change date="11 October 2012" version="1.2.2"> 14377 Fixed the "HTTP" and "Missing Anchor" errors reported by the LinkCheck tool. 14378 </change> 14379 <change date="19 June 2013" version="1.2.3"> 14380 Added support for statically linked agents. 14381 </change> 14382 <change date="1 July 2015" version="1.3.1"> 14383 The ClassFileLoadHook events are not sent during the primordial phase anymore. 14384 </change> 14385 <change date="21 December 2015" version="1.3.2"> 14386 Support for modules: add new function GetAllModules and capability can_get_modules_info. 14387 </change> 14388 </changehistory> 14389 14390 </specification> 14391 <!-- Keep this comment at the end of the file 14392 Local variables: 14393 mode: sgml 14394 sgml-omittag:t 14395 sgml-shorttag:t 14396 sgml-namecase-general:t 14397 sgml-general-insert-case:lower 14398 sgml-minimize-attributes:nil 14399 sgml-always-quote-attributes:t 14400 sgml-indent-step:2 14401 sgml-indent-data:t 14402 sgml-parent-document:nil 14403 sgml-exposed-tags:nil 14404 sgml-local-catalogs:nil 14405 sgml-local-ecat-files:nil 14406 End: 14407 -->