1 <?xml version="1.0" encoding="ISO-8859-1"?> 2 <?xml-stylesheet type="text/xsl" href="jvmti.xsl"?> 3 <!-- 4 Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved. 5 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 7 This code is free software; you can redistribute it and/or modify it 8 under the terms of the GNU General Public License version 2 only, as 9 published by the Free Software Foundation. 10 11 This code is distributed in the hope that it will be useful, but WITHOUT 12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 version 2 for more details (a copy is included in the LICENSE file that 15 accompanied this code). 16 17 You should have received a copy of the GNU General Public License version 18 2 along with this work; if not, write to the Free Software Foundation, 19 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 21 Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 or visit www.oracle.com if you need additional information or have any 23 questions. 24 --> 25 26 <!DOCTYPE specification [ 27 <!ELEMENT specification (title, intro*, functionsection, errorsection, 28 eventsection, datasection, issuessection, changehistory)> 29 <!ATTLIST specification label CDATA #REQUIRED> 30 31 <!ELEMENT title (#PCDATA|jvmti|tm)*> 32 <!ATTLIST title subtitle CDATA #REQUIRED> 33 34 <!ELEMENT intro ANY> 35 <!ATTLIST intro id CDATA #IMPLIED 36 label CDATA ""> 37 38 <!ELEMENT functionsection (intro*, category*)> 39 <!ATTLIST functionsection label CDATA #REQUIRED> 40 41 <!ELEMENT category ((intro|typedef|uniontypedef|capabilitiestypedef)*, 42 (function|callback|elide)*)> 43 <!ATTLIST category id CDATA #REQUIRED 44 label CDATA #REQUIRED> 45 46 <!ELEMENT function (synopsis, typedef*, description?, origin, 47 (capabilities|eventcapabilities), 48 parameters, errors)> 49 <!ATTLIST function id CDATA #REQUIRED 50 num CDATA #REQUIRED 51 phase (onload|onloadOnly|start|live|any) #IMPLIED 52 callbacksafe (safe|unsafe) #IMPLIED 53 impl CDATA #IMPLIED 54 hide CDATA #IMPLIED 55 jkernel (yes|no) #IMPLIED 56 since CDATA "1.0"> 57 58 <!ELEMENT callback ((jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|jthreadGroup|jobject| 59 jvalue|enum|jint|jlong|jfloat|jdouble|jlocation|jboolean|char|uchar|size_t|void), 60 synopsis, description?, parameters)> 61 <!ATTLIST callback id CDATA #REQUIRED 62 since CDATA "1.0"> 63 64 <!ELEMENT synopsis (#PCDATA|jvmti)*> 65 66 <!ELEMENT typedef (description?, field*)> 67 <!ATTLIST typedef id CDATA #REQUIRED 68 label CDATA #REQUIRED 69 since CDATA "1.0"> 70 71 <!ELEMENT uniontypedef (description?, field*)> 72 <!ATTLIST uniontypedef id CDATA #REQUIRED 73 label CDATA #REQUIRED 74 since CDATA "1.0"> 75 76 <!ELEMENT field ((jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|jthreadGroup|jobject| 77 jvalue|enum|jint|jlong|jfloat|jdouble|jlocation|jboolean|char|uchar|size_t|void|allocfieldbuf|inptr|inbuf|outbuf|vmbuf|ptrtype|struct), 78 description)> 79 <!ATTLIST field id CDATA #REQUIRED> 80 81 <!ELEMENT capabilitiestypedef (description?, capabilityfield*)> 82 <!ATTLIST capabilitiestypedef id CDATA #REQUIRED 83 label CDATA #REQUIRED> 84 85 <!ELEMENT capabilityfield (description)> 86 <!ATTLIST capabilityfield id CDATA #REQUIRED 87 disp1 CDATA "" 88 disp2 CDATA "" 89 since CDATA "1.0"> 90 91 <!ELEMENT description ANY> 92 93 <!ELEMENT capabilities (required*, capability*)> 94 95 <!ELEMENT eventcapabilities EMPTY> 96 97 <!ELEMENT required ANY> 98 <!ATTLIST required id CDATA #REQUIRED> 99 100 <!ELEMENT capability ANY> 101 <!ATTLIST capability id CDATA #REQUIRED> 102 103 <!ELEMENT parameters (param*)> 104 105 <!ELEMENT param ((jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|jthreadGroup|jobject| 106 jvalue|enum|jint|jlong|jfloat|jdouble|jlocation|jboolean|char|uchar|size_t|void|varargs|struct|ptrtype| 107 outptr|allocbuf|allocallocbuf|inptr|inbuf|outbuf|vmbuf|agentbuf), 108 description)> 109 <!ATTLIST param id CDATA #REQUIRED> 110 111 <!ELEMENT jmethodID EMPTY> 112 <!ATTLIST jmethodID class CDATA #IMPLIED 113 native CDATA #IMPLIED> 114 115 <!ELEMENT jfieldID EMPTY> 116 <!ATTLIST jfieldID class CDATA #IMPLIED> 117 118 <!ELEMENT jclass EMPTY> 119 <!ATTLIST jclass method CDATA #IMPLIED 120 field CDATA #IMPLIED> 121 122 <!ELEMENT jframeID EMPTY> 123 <!ATTLIST jframeID thread CDATA #IMPLIED> 124 125 <!ELEMENT jrawMonitorID EMPTY> 126 127 <!ELEMENT jthread EMPTY> 128 <!ATTLIST jthread started CDATA #IMPLIED 129 null CDATA #IMPLIED 130 frame CDATA #IMPLIED 131 impl CDATA #IMPLIED> 132 133 <!ELEMENT varargs EMPTY> 134 135 <!ELEMENT jthreadGroup EMPTY> 136 <!ELEMENT jobject EMPTY> 137 <!ELEMENT jvalue EMPTY> 138 <!ELEMENT jchar EMPTY> 139 <!ELEMENT jint EMPTY> 140 <!ATTLIST jint min CDATA #IMPLIED> 141 <!ELEMENT jlong EMPTY> 142 <!ELEMENT jfloat EMPTY> 143 <!ELEMENT jdouble EMPTY> 144 <!ELEMENT jlocation EMPTY> 145 <!ELEMENT jboolean EMPTY> 146 <!ELEMENT char EMPTY> 147 <!ELEMENT uchar EMPTY> 148 <!ELEMENT size_t EMPTY> 149 <!ELEMENT void EMPTY> 150 <!ELEMENT enum (#PCDATA)*> 151 <!ELEMENT struct (#PCDATA)*> 152 153 <!ELEMENT nullok ANY> 154 155 <!ELEMENT ptrtype ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread| 156 jthreadGroup|jobject|jvalue), nullok?)> 157 158 <!ELEMENT outptr ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread| 159 jthreadGroup|jobject|jvalue|enum|jchar|jint|jlong|jfloat|jdouble| 160 jlocation|jboolean|char|uchar|size_t|void), nullok?)> 161 162 <!ELEMENT allocbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread| 163 jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble| 164 jlocation|jboolean|char|uchar|size_t|void), nullok?)> 165 <!ATTLIST allocbuf incount CDATA #IMPLIED 166 outcount CDATA #IMPLIED> 167 168 <!ELEMENT allocallocbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread| 169 jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble| 170 jlocation|jboolean|char|uchar|size_t|void), nullok?)> 171 <!ATTLIST allocallocbuf incount CDATA #IMPLIED 172 outcount CDATA #IMPLIED> 173 174 <!ELEMENT inptr (struct, nullok?)> 175 176 <!ELEMENT inbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread| 177 jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble| 178 jlocation|jboolean|char|uchar|size_t|void), nullok?)> 179 <!ATTLIST inbuf incount CDATA #IMPLIED> 180 181 <!ELEMENT outbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread| 182 jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble| 183 jlocation|jboolean|char|uchar|size_t|void|outbuf), nullok?)> 184 <!ATTLIST outbuf incount CDATA #IMPLIED 185 outcount CDATA #IMPLIED> 186 187 <!ELEMENT vmbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread| 188 jthreadGroup|jobject|jvalue|enum|jchar|jint|jlong|jfloat|jdouble| 189 jlocation|jboolean|char|uchar|size_t|void), nullok?)> 190 <!ATTLIST vmbuf incount CDATA #IMPLIED 191 outcount CDATA #IMPLIED> 192 193 <!ELEMENT agentbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread| 194 jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble| 195 jlocation|jboolean|char|uchar|size_t|void), nullok?)> 196 <!ATTLIST agentbuf incount CDATA #IMPLIED 197 outcount CDATA #IMPLIED> 198 199 <!ELEMENT allocfieldbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread| 200 jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble| 201 jlocation|jboolean|char|uchar|size_t|void))> 202 <!ATTLIST allocfieldbuf outcount CDATA #IMPLIED> 203 204 <!ELEMENT errors (error*)> 205 206 <!ELEMENT error ANY> 207 <!ATTLIST error id CDATA #REQUIRED> 208 209 <!ELEMENT errorsection (intro*, errorcategory*)> 210 <!ATTLIST errorsection label CDATA #REQUIRED> 211 212 <!ELEMENT errorcategory (intro*, errorid*)> 213 <!ATTLIST errorcategory id CDATA #REQUIRED 214 label CDATA #REQUIRED> 215 216 <!ELEMENT errorid ANY> 217 <!ATTLIST errorid id CDATA #REQUIRED 218 num CDATA #REQUIRED> 219 220 <!ELEMENT datasection (intro*, basetypes*)> 221 222 <!ELEMENT basetypes (intro*, basetype*)> 223 <!ATTLIST basetypes id CDATA #REQUIRED 224 label CDATA #REQUIRED> 225 226 <!ELEMENT basetype (definition?,description)> 227 <!ATTLIST basetype id CDATA #REQUIRED 228 name CDATA #IMPLIED> 229 230 <!ELEMENT definition (#PCDATA|jvmti)*> 231 232 <!ELEMENT eventsection (intro*, (event|elide)*)> 233 <!ATTLIST eventsection label CDATA #REQUIRED> 234 235 <!ELEMENT event (description, origin, typedef*, capabilities, parameters)> 236 <!ATTLIST event id CDATA #REQUIRED 237 label CDATA #REQUIRED 238 const CDATA #REQUIRED 239 num CDATA #REQUIRED 240 phase (onload|start|live|any) #IMPLIED 241 filtered (thread|global) #IMPLIED 242 since CDATA "1.0"> 243 244 <!ELEMENT issuessection (intro*)> 245 <!ATTLIST issuessection label CDATA #REQUIRED> 246 247 <!ELEMENT changehistory (intro*, change*)> 248 <!ATTLIST changehistory update CDATA #REQUIRED 249 id CDATA #REQUIRED> 250 251 <!ELEMENT change ANY> 252 <!ATTLIST change date CDATA #REQUIRED 253 version CDATA #IMPLIED> 254 255 <!ELEMENT functionlink (#PCDATA|jvmti|code|i|b)*> 256 <!ATTLIST functionlink id CDATA #REQUIRED> 257 258 <!ELEMENT datalink (#PCDATA|jvmti|code|i|b)*> 259 <!ATTLIST datalink id CDATA #REQUIRED> 260 261 <!ELEMENT typelink (#PCDATA|jvmti|code|i|b)*> 262 <!ATTLIST typelink id CDATA #REQUIRED> 263 264 <!ELEMENT fieldlink (#PCDATA|jvmti|code|i|b)*> 265 <!ATTLIST fieldlink id CDATA #REQUIRED 266 struct CDATA #REQUIRED> 267 268 <!ELEMENT paramlink (#PCDATA|jvmti|code|i|b)*> 269 <!ATTLIST paramlink id CDATA #REQUIRED> 270 271 <!ELEMENT eventlink (#PCDATA|jvmti|code|i|b)*> 272 <!ATTLIST eventlink id CDATA #REQUIRED> 273 274 <!ELEMENT errorlink (#PCDATA|jvmti|code|i|b|tm)*> 275 <!ATTLIST errorlink id CDATA #REQUIRED> 276 277 <!ELEMENT externallink (#PCDATA|jvmti|code|i|b|tm)*> 278 <!ATTLIST externallink id CDATA #REQUIRED> 279 280 <!ELEMENT vmspec EMPTY> 281 <!ATTLIST vmspec chapter CDATA #IMPLIED> 282 283 <!ELEMENT internallink (#PCDATA|jvmti|code|i|b)*> 284 <!ATTLIST internallink id CDATA #REQUIRED> 285 286 <!ELEMENT functionphaselist EMPTY> 287 <!ATTLIST functionphaselist phase (onload|onloadOnly|start|live|any) #REQUIRED> 288 289 <!ELEMENT eventphaselist EMPTY> 290 <!ATTLIST eventphaselist phase (onload|start|live|any) #REQUIRED> 291 292 <!ELEMENT issue ANY> 293 294 <!ELEMENT rationale ANY> 295 296 <!ELEMENT todo ANY> 297 298 <!ELEMENT origin (#PCDATA)*> 299 300 <!ELEMENT elide (intro|function|callback|event)*> 301 <!ATTLIST elide why CDATA #IMPLIED> 302 303 <!ELEMENT constants (constant*)> 304 <!ATTLIST constants id CDATA #REQUIRED 305 label CDATA #REQUIRED 306 kind (enum|bits|const) #REQUIRED 307 since CDATA "1.0"> 308 309 <!ELEMENT constant ANY> 310 <!ATTLIST constant id CDATA #REQUIRED 311 num CDATA #REQUIRED> 312 313 <!ELEMENT tm (#PCDATA)> 314 315 <!ELEMENT i (#PCDATA|jvmti|tm)*> 316 317 <!ELEMENT b (#PCDATA|jvmti|code)*> 318 319 <!ELEMENT code (#PCDATA|space)*> 320 321 <!ELEMENT pre ANY> 322 323 <!ELEMENT space EMPTY> 324 325 <!ELEMENT jvmti EMPTY> 326 327 <!ELEMENT example (#PCDATA|i)*> 328 329 <!ELEMENT br EMPTY> 330 331 <!ELEMENT p EMPTY> 332 333 <!ELEMENT blockquote ANY> 334 335 <!ELEMENT dl (dt|dd)+> 336 337 <!ELEMENT dd ANY> 338 339 <!ELEMENT dt (#PCDATA|jvmti|code|i|b)*> 340 341 <!ELEMENT table (tr)+> 342 343 <!ELEMENT tr (td|th)*> 344 <!ATTLIST tr class CDATA #IMPLIED> 345 346 <!ELEMENT td ANY> 347 <!ATTLIST td class CDATA #IMPLIED> 348 349 <!ELEMENT th ANY> 350 <!ATTLIST th class CDATA #IMPLIED 351 scope (col|row) #IMPLIED> 352 353 <!ELEMENT ul (li)+> 354 <!ATTLIST ul type (disc|circle|square) "disc"> 355 356 <!ELEMENT li ANY> 357 ]> 358 359 <specification label="JVM(TM) Tool Interface"> 360 <title subtitle="Version"> 361 <tm>JVM</tm> Tool Interface 362 </title> 363 364 <intro id="whatIs" label="What is the JVM Tool Interface?"> 365 The <tm>JVM</tm> Tool Interface (<jvmti/>) 366 is a programming interface used by development and monitoring tools. 367 It provides both a way to inspect the state and 368 to control the execution of applications running in the 369 <tm>Java</tm> virtual machine (VM). 370 <p/> 371 <jvmti/> is intended to provide a VM interface for the full breadth of tools 372 that need access to VM state, including but not limited to: profiling, 373 debugging, monitoring, thread analysis, and coverage analysis tools. 374 <p/> 375 <jvmti/> may not be available in all implementations of the <tm>Java</tm> virtual 376 machine. 377 <p/> 378 <jvmti/> is a two-way interface. 379 A client of <jvmti/>, hereafter called an <i>agent</i>, 380 can be notified of 381 interesting occurrences through <internallink id="EventSection">events</internallink>. 382 <jvmti/> 383 can query and control the application through many 384 <internallink id="FunctionSection">functions</internallink>, 385 either in response to events or 386 independent of them. 387 <p/> 388 Agents run in the same process with and communicate directly with 389 the virtual machine executing 390 the application being examined. This communication is 391 through a native interface (<jvmti/>). The native in-process interface allows 392 maximal control with minimal intrusion on the part of a tool. 393 Typically, agents are relatively compact. They can be controlled 394 by a separate process which implements the bulk of a tool's 395 function without interfering with the target application's normal execution. 396 </intro> 397 398 <intro id="architecture" label="Architecture"> 399 Tools can be written directly to <jvmti/> or indirectly 400 through higher level interfaces. 401 The Java Platform Debugger Architecture includes <jvmti/>, but also 402 contains higher-level, out-of-process debugger interfaces. The higher-level 403 interfaces are more appropriate than <jvmti/> for many tools. 404 For more information on the Java Platform Debugger Architecture, 405 see the 406 <externallink id="jpda/architecture.html">Java 407 Platform Debugger Architecture website</externallink>. 408 </intro> 409 410 <intro id="writingAgents" label="Writing Agents"> 411 Agents can be written in any native language that supports C 412 language calling conventions and C or C++ 413 definitions. 414 <p/> 415 The function, event, data type, and constant definitions needed for 416 using <jvmti/> are defined in the include file <code>jvmti.h</code>. 417 To use these definitions add the <tm>J2SE</tm> include directory 418 to your include path and add 419 <example> 420 #include <jvmti.h> 421 </example> 422 to your source code. 423 </intro> 424 425 <intro id="deployingAgents" label="Deploying Agents"> 426 An agent is deployed in a platform specific manner but is typically the 427 platform equivalent of a dynamic library. On the <tm>Windows</tm> operating 428 system, for example, an agent library is a "Dynamic Linked Library" (DLL). 429 On the <tm>Solaris</tm> Operating Environment, an agent library is a shared 430 object (<code>.so</code> file). 431 <p/> 432 433 An agent may be started at VM startup by specifying the agent library 434 name using a <internallink id="starting">command line option</internallink>. 435 Some implementations may support a mechanism to <internallink id="onattach"> 436 start agents</internallink> in the live <functionlink id="GetPhase">phase</functionlink>. 437 The details of how this is initiated are implementation specific. 438 </intro> 439 440 <intro id="entryPoint" label="Statically Linked Agents (since version 1.2.3)"> 441 442 A native JVMTI Agent may be <i>statically linked</i> with the VM. 443 The manner in which the library and VM image are combined is 444 implementation-dependent. 445 An agent L whose image has been combined with the VM is defined as 446 <i>statically linked</i> if and only if the agent exports a function 447 called Agent_OnLoad_L. 448 <p/> 449 If a <i>statically linked</i> agent L exports a function called 450 Agent_OnLoad_L and a function called Agent_OnLoad, the Agent_OnLoad 451 function will be ignored. 452 If an agent L is <i>statically linked</i>, an Agent_OnLoad_L 453 function will be invoked with the same arguments and expected return 454 value as specified for the Agent_OnLoad function. 455 An agent L that is <i>statically linked</i> will prohibit an agent of 456 the same name from being loaded dynamically. 457 <p/> 458 The VM will invoke the Agent_OnUnload_L function of the agent, if such 459 a function is exported, at the same point during VM execution as it would 460 have called the dynamic entry point Agent_OnUnLoad. A statically loaded 461 agent cannot be unloaded. The Agent_OnUnload_L function will still be 462 called to do any other agent shutdown related tasks. 463 If a <i>statically linked</i> agent L exports a function called 464 Agent_OnUnLoad_L and a function called Agent_OnUnLoad, the Agent_OnUnLoad 465 function will be ignored. 466 <p/> 467 If an agent L is <i>statically linked</i>, an Agent_OnAttach_L function 468 will be invoked with the same arguments and expected return value as 469 specified for the Agent_OnAttach function. 470 If a <i>statically linked</i> agent L exports a function called 471 Agent_OnAttach_L and a function called Agent_OnAttach, the Agent_OnAttach 472 function will be ignored. 473 </intro> 474 475 <intro id="starting" label="Agent Command Line Options"> 476 The term "command-line option" is used below to 477 mean options supplied in the <code>JavaVMInitArgs</code> argument 478 to the <code>JNI_CreateJavaVM</code> function of the JNI 479 Invocation API. 480 <p/> 481 One of the two following 482 command-line options is used on VM startup to 483 properly load and run agents. 484 These arguments identify the library containing 485 the agent as well as an options 486 string to be passed in at startup. 487 <dl> 488 <dt><code>-agentlib:</code><i><agent-lib-name></i><code>=</code><i><options></i></dt> 489 <dd> 490 The name following <code>-agentlib:</code> is the name of the 491 library to load. Lookup of the library, both its full name and location, 492 proceeds in a platform-specific manner. 493 Typically, the <i><agent-lib-name></i> is expanded to an 494 operating system specific file name. 495 The <i><options></i> will be passed to the agent on start-up. 496 For example, if the option 497 <code>-agentlib:foo=opt1,opt2</code> is specified, the VM will attempt to 498 load the shared library <code>foo.dll</code> from the system <code>PATH</code> 499 under <tm>Windows</tm> or <code>libfoo.so</code> from the 500 <code>LD_LIBRARY_PATH</code> under the <tm>Solaris</tm> operating 501 environment. 502 If the agent library is statically linked into the executable 503 then no actual loading takes place. 504 <p/> 505 </dd> 506 <dt><code>-agentpath:</code><i><path-to-agent></i><code>=</code><i><options></i></dt> 507 <dd> 508 The path following <code>-agentpath:</code> is the absolute path from which 509 to load the library. 510 No library name expansion will occur. 511 The <i><options></i> will be passed to the agent on start-up. 512 For example, if the option 513 <code>-agentpath:c:\myLibs\foo.dll=opt1,opt2</code> is specified, the VM will attempt to 514 load the shared library <code>c:\myLibs\foo.dll</code>. If the agent 515 library is statically linked into the executable 516 then no actual loading takes place. 517 <p/> 518 </dd> 519 </dl> 520 For a dynamic shared library agent, the start-up routine 521 <internallink id="onload"><code>Agent_OnLoad</code></internallink> 522 in the library will be invoked. If the agent library is statically linked 523 into the executable then the system will attempt to invoke the 524 <code>Agent_OnLoad_<agent-lib-name></code> entry point where 525 <agent-lib-name> is the basename of the 526 agent. In the above example <code>-agentpath:c:\myLibs\foo.dll=opt1,opt2</code>, 527 the system will attempt to find and call the <code>Agent_OnLoad_foo</code> start-up routine. 528 <p/> 529 Libraries loaded with <code>-agentlib:</code> or <code>-agentpath:</code> 530 will be searched for JNI native method implementations to facilitate the 531 use of Java programming language code in tools, as is needed for 532 <internallink id="bci">bytecode instrumentation</internallink>. 533 <p/> 534 The agent libraries will be searched after all other libraries have been 535 searched (agents wishing to override or intercept the native method 536 implementations of non-agent methods can use the 537 <eventlink id="NativeMethodBind">NativeMethodBind event</eventlink>). 538 <p/> 539 These switches do the above and nothing more - they do not change the 540 state of the VM or <jvmti/>. No command line options are needed 541 to enable <jvmti/> 542 or aspects of <jvmti/>, this is handled programmatically 543 by the use of 544 <internallink id="capability">capabilities</internallink>. 545 </intro> 546 547 <intro id="startup" label="Agent Start-Up"> 548 The VM starts each agent by invoking a start-up function. 549 If the agent is started in the <code>OnLoad</code> 550 <functionlink id="GetPhase">phase</functionlink> the function 551 <internallink id="onload"><code>Agent_OnLoad</code></internallink> 552 or <internallink id="onload"><code>Agent_OnLoad_L</code></internallink> 553 for statically linked agents will be invoked. 554 If the agent is started in the live 555 <functionlink id="GetPhase">phase</functionlink> the function 556 <internallink id="onattach"><code>Agent_OnAttach</code></internallink> 557 or <internallink id="onattach"><code>Agent_OnAttach_L</code></internallink> 558 for statically linked agents will be invoked. 559 Exactly one call to a start-up function is made per agent. 560 </intro> 561 562 <intro id="onload" label="Agent Start-Up (OnLoad phase)"> 563 If an agent is started during the <code>OnLoad</code> phase then its 564 agent library must export a start-up function with the following prototype: 565 <example> 566 JNIEXPORT jint JNICALL 567 Agent_OnLoad(JavaVM *vm, char *options, void *reserved)</example> 568 Or for a statically linked agent named 'L': 569 <example> 570 JNIEXPORT jint JNICALL 571 Agent_OnLoad_L(JavaVM *vm, char *options, void *reserved)</example> 572 573 The VM will start the agent by calling this function. 574 It will be called early enough in VM initialization that: 575 <ul> 576 <li><functionlink id="SetSystemProperty">system properties</functionlink> 577 may be set before they have been used in the start-up of the VM</li> 578 <li>the full set of 579 <internallink id="capability">capabilities</internallink> 580 is still available (note that capabilities that configure the VM 581 may only be available at this time--see the 582 <internallink id="capability">Capability function section</internallink>)</li> 583 <li>no bytecodes have executed</li> 584 <li>no classes have been loaded</li> 585 <li>no objects have been created</li> 586 </ul> 587 <p/> 588 The VM will call the <code>Agent_OnLoad</code> or 589 <code>Agent_OnLoad_<agent-lib-name></code> function with 590 <i><options></i> as the second argument - 591 that is, using the command-line option examples, 592 <code>"opt1,opt2"</code> will be passed to the <code>char *options</code> 593 argument of <code>Agent_OnLoad</code>. 594 The <code>options</code> argument is encoded as a 595 <internallink id="mUTF">modified UTF-8</internallink> string. 596 If <i>=<options></i> is not specified, 597 a zero length string is passed to <code>options</code>. 598 The lifespan of the <code>options</code> string is the 599 <code>Agent_OnLoad</code> or <code>Agent_OnLoad_<agent-lib-name></code> 600 call. If needed beyond this time the string or parts of the string must 601 be copied. 602 The period between when <code>Agent_OnLoad</code> is called and when it 603 returns is called the <i>OnLoad phase</i>. 604 Since the VM is not initialized during the OnLoad 605 <functionlink id="GetPhase">phase</functionlink>, 606 the set of allowed operations 607 inside <code>Agent_OnLoad</code> is restricted (see the function descriptions for the 608 functionality available at this time). 609 The agent can safely process the options and set 610 event callbacks with <functionlink id="SetEventCallbacks"></functionlink>. Once 611 the VM initialization event is received 612 (that is, the <eventlink id="VMInit">VMInit</eventlink> 613 callback is invoked), the agent 614 can complete its initialization. 615 <rationale> 616 Early startup is required so that agents can set the desired capabilities, 617 many of which must be set before the VM is initialized. 618 In JVMDI, the -Xdebug command-line option provided 619 very coarse-grain control of capabilities. 620 JVMPI implementations use various tricks to provide a single "JVMPI on" switch. 621 No reasonable command-line 622 option could provide the fine-grain of control required to balance needed capabilities vs 623 performance impact. 624 Early startup is also needed so that agents can control the execution 625 environment - modifying the file system and system properties to install 626 their functionality. 627 </rationale> 628 <p/> 629 The return value from <code>Agent_OnLoad</code> or 630 <code>Agent_OnLoad_<agent-lib-name></code> is used to indicate an error. 631 Any value other than zero indicates an error and causes termination of the VM. 632 </intro> 633 634 <intro id="onattach" label="Agent Start-Up (Live phase)"> 635 A VM may support a mechanism that allows agents to be started in the VM during the live 636 <functionlink id="GetPhase">phase</functionlink>. The details of how this is supported, 637 are implementation specific. For example, a tool may use some platform specific mechanism, 638 or implementation specific API, to attach to the running VM, and request it start a given 639 agent. 640 <p/> 641 If an agent is started during the live phase then its agent library 642 must export a start-up function 643 with the following prototype: 644 <example> 645 JNIEXPORT jint JNICALL 646 Agent_OnAttach(JavaVM* vm, char *options, void *reserved)</example> 647 Or for a statically linked agent named 'L': 648 <example> 649 JNIEXPORT jint JNICALL 650 Agent_OnAttach_L(JavaVM* vm, char *options, void *reserved)</example> 651 652 <p/> 653 The VM will start the agent by calling this function. 654 It will be called in the context of a thread 655 that is attached to the VM. The first argument <i><vm></i> is the Java VM. 656 The <i><options></i> argument is the startup options provided to the agent. 657 <i><options></i> is encoded as a <internallink id="mUTF">modified UTF-8 658 </internallink> string. 659 If startup options were not provided, a zero length string is passed to 660 <code>options</code>. The lifespan of the <code>options</code> string is the 661 <code>Agent_OnAttach</code> or <code>Agent_OnAttach_<agent-lib-name></code> call. 662 If needed beyond this time the string or parts of the string must be copied. 663 <p/> 664 Note that some <internallink id="capability">capabilities</internallink> 665 may not be available in the live phase. 666 <p/> 667 The <code>Agent_OnAttach</code> or <code>Agent_OnAttach_<agent-lib-name 668 ></code> function initializes the agent and returns a value 669 to the VM to indicate if an error occurred. Any value other than zero indicates an error. 670 An error does not cause the VM to terminate. Instead the VM ignores the error, or takes 671 some implementation specific action -- for example it might print an error to standard error, 672 or record the error in a system log. 673 </intro> 674 675 <intro id="onunload" label="Agent Shutdown"> 676 The library may optionally export a 677 shutdown function with the following prototype: 678 <example> 679 JNIEXPORT void JNICALL 680 Agent_OnUnload(JavaVM *vm)</example> 681 Or for a statically linked agent named 'L': 682 <example> 683 JNIEXPORT void JNICALL 684 Agent_OnUnload_L(JavaVM *vm)</example> 685 686 This function will be called by the VM when the library is about to be unloaded. 687 The library will be unloaded (unless it is statically linked into the 688 executable) and this function will be called if some platform specific 689 mechanism causes the unload (an unload mechanism is not specified in this document) 690 or the library is (in effect) unloaded by the termination of the VM whether through 691 normal termination or VM failure, including start-up failure. 692 Uncontrolled shutdown is, of course, an exception to this rule. 693 Note the distinction between this function and the 694 <eventlink id="VMDeath">VM Death event</eventlink>: for the VM Death event 695 to be sent, the VM must have run at least to the point of initialization and a valid 696 <jvmti/> environment must exist which has set a callback for VMDeath 697 and enabled the event. 698 None of these are required for <code>Agent_OnUnload</code> or 699 <code>Agent_OnUnload_<agent-lib-name></code> and this function 700 is also called if the library is unloaded for other reasons. 701 In the case that a VM Death event is sent, it will be sent before this 702 function is called (assuming this function is called due to VM termination). 703 This function can be used to clean-up resources allocated by the agent. 704 </intro> 705 706 <intro id="tooloptions" label="JAVA_TOOL_OPTIONS"> 707 Since the command-line cannot always be accessed or modified, for example in embedded VMs 708 or simply VMs launched deep within scripts, a <code>JAVA_TOOL_OPTIONS</code> variable is 709 provided so that agents may be launched in these cases. 710 <p/> 711 Platforms which support environment variables or other named strings, may support the 712 <code>JAVA_TOOL_OPTIONS</code> variable. This variable will be broken into options at white-space 713 boundaries. White-space characters include space, tab, carriage-return, new-line, 714 vertical-tab, and form-feed. Sequences of white-space characters are considered 715 equivalent to a single white-space character. No white-space is included in the options 716 unless quoted. Quoting is as follows: 717 <ul> 718 <li>All characters enclosed between a pair of single quote marks (''), except a single 719 quote, are quoted.</li> 720 <li>Double quote characters have no special meaning inside a pair of single quote marks.</li> 721 <li>All characters enclosed between a pair of double quote marks (""), except a double 722 quote, are quoted.</li> 723 <li>Single quote characters have no special meaning inside a pair of double quote marks.</li> 724 <li>A quoted part can start or end anywhere in the variable.</li> 725 <li>White-space characters have no special meaning when quoted -- they are included in 726 the option like any other character and do not mark white-space boundaries.</li> 727 <li>The pair of quote marks is not included in the option.</li> 728 </ul> 729 <code>JNI_CreateJavaVM</code> (in the JNI Invocation API) will prepend these options to the options supplied 730 in its <code>JavaVMInitArgs</code> argument. Platforms may disable this feature in cases where security is 731 a concern; for example, the Reference Implementation disables this feature on Unix systems when 732 the effective user or group ID differs from the real ID. 733 This feature is intended to support the initialization of tools -- specifically including the 734 launching of native or Java programming language agents. Multiple tools may wish to use this 735 feature, so the variable should not be overwritten, instead, options should be appended to 736 the variable. Note that since the variable is processed at the time of the JNI Invocation 737 API create VM call, options processed by a launcher (e.g., VM selection options) will not be handled. 738 </intro> 739 740 <intro id="environments" label="Environments"> 741 The <jvmti/> specification supports the use of multiple simultaneous 742 <jvmti/> agents. 743 Each agent has its own <jvmti/> environment. 744 That is, the <jvmti/> state is 745 separate for each agent - changes to one environment do not affect the 746 others. The state of a <jvmti/> 747 environment includes: 748 <ul> 749 <li><functionlink id="SetEventCallbacks">the event callbacks</functionlink></li> 750 <li><functionlink id="SetEventNotificationMode">the set of events which are enabled</functionlink></li> 751 <li><internallink id="capability">the capabilities</internallink></li> 752 <li><internallink id="memory">the memory allocation/deallocation hooks</internallink></li> 753 </ul> 754 Although their <jvmti/> state 755 is separate, agents inspect and modify the shared state 756 of the VM, they also share the native environment in which they execute. 757 As such, an agent can perturb the results of other agents or cause them 758 to fail. It is the responsibility of the agent writer to specify the level 759 of compatibility with other agents. <jvmti/> implementations are not capable 760 of preventing destructive interactions between agents. Techniques to reduce 761 the likelihood of these occurrences are beyond the scope of this document. 762 <p/> 763 An agent creates a <jvmti/> environment 764 by passing a <jvmti/> version 765 as the interface ID to the JNI Invocation API function 766 <externallink id="jni/invocation.html#getenv"> 767 <code>GetEnv</code></externallink>. 768 See <internallink id="jvmtiEnvAccess">Accessing <jvmti/> Functions</internallink> 769 for more details on the creation and use of 770 <jvmti/> environments. 771 Typically, <jvmti/> environments are created by calling <code>GetEnv</code> from 772 <internallink id="onload"><code>Agent_OnLoad</code></internallink>. 773 </intro> 774 775 <intro id="bci" label="Bytecode Instrumentation"> 776 This interface does not include some events that one might expect in an interface with 777 profiling support. Some examples include full speed 778 method enter and exit events. The interface instead provides support for 779 <i>bytecode instrumentation</i>, the ability to alter the Java virtual machine 780 bytecode instructions which comprise the target program. Typically, these alterations 781 are to add "events" to the code of a method - for example, to add, at the beginning of a method, 782 a call to <code>MyProfiler.methodEntered()</code>. 783 Since the changes are purely additive, they do not modify application 784 state or behavior. 785 Because the inserted agent code is standard bytecodes, the VM can run at full speed, 786 optimizing not only the target program but also the instrumentation. If the 787 instrumentation does not involve switching from bytecode execution, no expensive 788 state transitions are needed. The result is high performance events. 789 This approach also provides complete control to the agent: instrumentation can be 790 restricted to "interesting" portions of the code (e.g., the end user's code) and 791 can be conditional. Instrumentation can run entirely in Java programming language 792 code or can call into the native agent. Instrumentation can simply maintain 793 counters or can statistically sample events. 794 <p/> 795 Instrumentation can be inserted in one of three ways: 796 <ul> 797 <li> 798 Static Instrumentation: The class file is instrumented before it 799 is loaded into the VM - for example, by creating a duplicate directory of 800 <code>*.class</code> files which have been modified to add the instrumentation. 801 This method is extremely awkward and, in general, an agent cannot know 802 the origin of the class files which will be loaded. 803 </li> 804 <li> 805 Load-Time Instrumentation: When a class file is loaded by the VM, the raw 806 bytes of the class file are sent for instrumentation to the agent. 807 The <eventlink id="ClassFileLoadHook"/> 808 event, triggered by the class load, 809 provides this functionality. This mechanism provides efficient 810 and complete access to one-time instrumentation. 811 </li> 812 <li> 813 Dynamic Instrumentation: A class which is already loaded (and possibly 814 even running) is modified. This optional feature is provided by the 815 <eventlink id="ClassFileLoadHook"/> event, triggered by calling the 816 <functionlink id="RetransformClasses"/> function. 817 Classes can be modified multiple times and can be returned to their 818 original state. 819 The mechanism allows instrumentation which changes during the 820 course of execution. 821 </li> 822 </ul> 823 <p/> 824 The class modification functionality provided in this interface 825 is intended to provide a mechanism for instrumentation 826 (the <eventlink id="ClassFileLoadHook"/> event 827 and the <functionlink id="RetransformClasses"/> function) 828 and, during development, for fix-and-continue debugging 829 (the <functionlink id="RedefineClasses"/> function). 830 <p/> 831 Care must be taken to avoid perturbing dependencies, especially when 832 instrumenting core classes. For example, an approach to getting notification 833 of every object allocation is to instrument the constructor on 834 <code>Object</code>. Assuming that the constructor is initially 835 empty, the constructor could be changed to: 836 <example> 837 public Object() { 838 MyProfiler.allocationTracker(this); 839 } 840 </example> 841 However, if this change was made using the 842 <eventlink id="ClassFileLoadHook"/> 843 event then this might impact a typical VM as follows: 844 the first created object will call the constructor causing a class load of 845 <code>MyProfiler</code>; which will then cause 846 object creation, and since <code>MyProfiler</code> isn't loaded yet, 847 infinite recursion; resulting in a stack overflow. A refinement of this 848 would be to delay invoking the tracking method until a safe time. For 849 example, <code>trackAllocations</code> could be set in the 850 handler for the <code>VMInit</code> event. 851 <example> 852 static boolean trackAllocations = false; 853 854 public Object() { 855 if (trackAllocations) { 856 MyProfiler.allocationTracker(this); 857 } 858 } 859 </example> 860 <p/> 861 The <functionlink id="SetNativeMethodPrefix"/> allows native methods 862 to be instrumented by the use of wrapper methods. 863 </intro> 864 865 <intro id="bcimodules" label="Bytecode Instrumentation of code in modules"> 866 Agents can use the functions <functionlink id="AddModuleReads"/>, 867 <functionlink id="AddModuleExports"/>, <functionlink id="AddModuleOpens"/>, 868 <functionlink id="AddModuleUses"/> and <functionlink id="AddModuleProvides"/> 869 to update a module to expand the set of modules that it reads, the set of 870 packages that it exports or opens to other modules, or the services that it 871 uses and provides. 872 <p/> 873 As an aid to agents that deploy supporting classes on the search path of 874 the bootstrap class loader, or the search path of the class loader that 875 loads the main class, the Java virtual machine arranges for the module 876 of classes transformed by the <eventlink id="ClassFileLoadHook"/> event to 877 read the unnamed module of both class loaders. 878 </intro> 879 880 <intro id="mUTF" label="Modified UTF-8 String Encoding"> 881 <jvmti/> uses modified UTF-8 to encode character strings. 882 This is the same encoding used by JNI. 883 Modified UTF-8 differs 884 from standard UTF-8 in the representation of supplementary characters 885 and of the null character. See the 886 <externallink id="jni/types.html#modified-utf-8-strings"> 887 Modified UTF-8 Strings</externallink> 888 section of the JNI specification for details. 889 </intro> 890 891 <intro id="context" label="Specification Context"> 892 Since this interface provides access to the state of applications running in the 893 Java virtual machine; 894 terminology refers to the Java platform and not the native 895 platform (unless stated otherwise). For example: 896 <ul> 897 <li>"thread" means Java programming language thread.</li> 898 <li>"stack frame" means Java virtual machine stack frame.</li> 899 <li>"class" means Java programming language class.</li> 900 <li>"heap" means Java virtual machine heap.</li> 901 <li>"monitor" means Java programming language object monitor.</li> 902 </ul> 903 <p/> 904 Sun, Sun Microsystems, the Sun logo, Java, and JVM 905 are trademarks or registered trademarks of Oracle 906 and/or its affiliates, in the U.S. and other countries. 907 </intro> 908 909 910 <functionsection label="Functions"> 911 <intro id="jvmtiEnvAccess" label="Accessing Functions"> 912 Native code accesses <jvmti/> features 913 by calling <jvmti/> functions. 914 Access to <jvmti/> functions is by use of an interface pointer 915 in the same manner as 916 <externallink id="jni/design.html">Java 917 Native Interface (JNI) functions</externallink> are accessed. 918 The <jvmti/> interface pointer is called the 919 <i>environment pointer</i>. 920 <p/> 921 An environment pointer is a pointer to an environment and has 922 the type <code>jvmtiEnv*</code>. 923 An environment has information about its <jvmti/> connection. 924 The first value in the environment is a pointer to the function table. 925 The function table is an array of pointers to <jvmti/> functions. 926 Every function pointer is at a predefined offset inside the 927 array. 928 <p/> 929 When used from the C language: 930 double indirection is used to access the functions; 931 the environment pointer provides context and is the first 932 parameter of each function call; for example: 933 <example> 934 jvmtiEnv *jvmti; 935 ... 936 jvmtiError err = (*jvmti)->GetLoadedClasses(jvmti, &class_count, &classes); 937 </example> 938 <p/> 939 When used from the C++ language: 940 functions are accessed as member functions of <code>jvmtiEnv</code>; 941 the environment pointer is not passed to the function call; for example: 942 <example> 943 jvmtiEnv *jvmti; 944 ... 945 jvmtiError err = jvmti->GetLoadedClasses(&class_count, &classes); 946 </example> 947 Unless otherwise stated, all examples and declarations in this 948 specification use the C language. 949 <p/> 950 A <jvmti/> environment can be obtained through the JNI Invocation API 951 <code>GetEnv</code> function: 952 <example> 953 jvmtiEnv *jvmti; 954 ... 955 (*jvm)->GetEnv(jvm, &jvmti, JVMTI_VERSION_1_0); 956 </example> 957 Each call to <code>GetEnv</code> 958 creates a new <jvmti/> connection and thus 959 a new <jvmti/> environment. 960 The <code>version</code> argument of <code>GetEnv</code> must be 961 a <jvmti/> version. 962 The returned environment may have a different version than the 963 requested version but the returned environment must be compatible. 964 <code>GetEnv</code> will return <code>JNI_EVERSION</code> if a 965 compatible version is not available, if <jvmti/> is not supported or 966 <jvmti/> is not supported in the current VM configuration. 967 Other interfaces may be added for creating <jvmti/> environments 968 in specific contexts. 969 Each environment has its own state (for example, 970 <functionlink id="SetEventNotificationMode">desired events</functionlink>, 971 <functionlink id="SetEventCallbacks">event handling functions</functionlink>, and 972 <functionlink id="AddCapabilities">capabilities</functionlink>). 973 An environment is released with 974 <functionlink id="DisposeEnvironment"></functionlink>. 975 Thus, unlike JNI which has one environment per thread, <jvmti/> environments work 976 across threads and are created dynamically. 977 </intro> 978 979 <intro id="functionReturn" label="Function Return Values"> 980 <jvmti/> functions always return an 981 <internallink id="ErrorSection">error code</internallink> via the 982 <datalink id="jvmtiError"/> function return value. 983 Some functions can return additional 984 values through pointers provided by the calling function. 985 In some cases, <jvmti/> functions allocate memory that your program must 986 explicitly deallocate. This is indicated in the individual <jvmti/> 987 function descriptions. Empty lists, arrays, sequences, etc are 988 returned as <code>NULL</code>. 989 <p/> 990 In the event that the <jvmti/> function encounters 991 an error (any return value other than <code>JVMTI_ERROR_NONE</code>) the values 992 of memory referenced by argument pointers is undefined, but no memory 993 will have been allocated and no global references will have been allocated. 994 If the error occurs because of invalid input, no action will have occurred. 995 </intro> 996 997 <intro id="refs" label="Managing JNI Object References"> 998 <jvmti/> functions identify objects with JNI references 999 (<datalink id="jobject"/> and <datalink id="jclass"/>) 1000 and their derivatives 1001 (<datalink id="jthread"/> and <datalink id="jthreadGroup"/>). 1002 References passed to 1003 <jvmti/> functions can be either global or local, but they must be 1004 strong references. All references returned by <jvmti/> functions are 1005 local references--these local references are created 1006 during the <jvmti/> call. 1007 Local references are a resource that must be managed (see the 1008 <externallink id="jni/functions.html#local-references"> 1009 JNI Documentation</externallink>). 1010 When threads return from native code all local references 1011 are freed. Note that some threads, including typical 1012 agent threads, will never return from native code. 1013 A thread is ensured the ability to create sixteen local 1014 references without the need for any explicit management. 1015 For threads executing a limited number of <jvmti/> calls before 1016 returning from native code 1017 (for example, threads processing events), 1018 it may be determined that no explicit management 1019 is needed. 1020 However, long running agent threads will need explicit 1021 local reference management--usually with the JNI functions 1022 <code>PushLocalFrame</code> and <code>PopLocalFrame</code>. 1023 Conversely, to preserve references beyond the 1024 return from native code, they must be converted to global references. 1025 These rules do not apply to <datalink id="jmethodID"/> and <datalink id="jfieldID"/> 1026 as they are not <datalink id="jobject"/>s. 1027 </intro> 1028 1029 <intro id="prereqState" label="Prerequisite State for Calling Functions"> 1030 Unless the function explicitly states that the agent must bring 1031 a thread or the VM to a particular state (for example, suspended), 1032 the <jvmti/> implementation is responsible for bringing the VM to a 1033 safe and consistent state for performing the function. 1034 </intro> 1035 1036 <intro id="functionsExceptions" label="Exceptions and Functions"> 1037 <jvmti/> functions never throw exceptions; error conditions are 1038 communicated via the 1039 <internallink id="functionReturn">function return value</internallink>. 1040 Any existing exception state is preserved across a call to a 1041 <jvmti/> function. 1042 See the 1043 <externallink 1044 id="jni/design.html#java-exceptions" 1045 >Java Exceptions</externallink> 1046 section of the JNI specification for information on handling exceptions. 1047 </intro> 1048 1049 <category id="memory" label="Memory Management"> 1050 <intro> 1051 These functions provide for the allocation and deallocation of 1052 memory used by <jvmti/> functionality and can be used to provide 1053 working memory for agents. 1054 Memory managed by <jvmti/> is not compatible with other memory 1055 allocation libraries and mechanisms. 1056 </intro> 1057 1058 <function id="Allocate" jkernel="yes" phase="any" callbacksafe="safe" impl="notrace" num="46"> 1059 <synopsis>Allocate</synopsis> 1060 <description> 1061 Allocate an area of memory through the <jvmti/> allocator. 1062 The allocated 1063 memory should be freed with <functionlink id="Deallocate"></functionlink>. 1064 </description> 1065 <origin>jvmdi</origin> 1066 <capabilities> 1067 </capabilities> 1068 <parameters> 1069 <param id="size"> 1070 <jlong/> 1071 <description> 1072 The number of bytes to allocate. 1073 <rationale> 1074 <code>jlong</code> is used for compatibility with JVMDI. 1075 </rationale> 1076 </description> 1077 </param> 1078 <param id="mem_ptr"> 1079 <allocbuf incount="size"><uchar/></allocbuf> 1080 <description> 1081 On return, a pointer to the beginning of the allocated memory. 1082 If <code>size</code> is zero, <code>NULL</code> is returned. 1083 </description> 1084 </param> 1085 </parameters> 1086 <errors> 1087 <error id="JVMTI_ERROR_OUT_OF_MEMORY"> 1088 Memory request cannot be honored. 1089 </error> 1090 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 1091 <paramlink id="size"></paramlink> is less than zero. 1092 </error> 1093 </errors> 1094 </function> 1095 1096 <function id="Deallocate" jkernel="yes" phase="any" callbacksafe="safe" impl="notrace" num="47"> 1097 <synopsis>Deallocate</synopsis> 1098 <description> 1099 Deallocate <code>mem</code> using the <jvmti/> allocator. 1100 This function should 1101 be used to deallocate any memory allocated and returned 1102 by a <jvmti/> function 1103 (including memory allocated with <functionlink id="Allocate"></functionlink>). 1104 All allocated memory must be deallocated 1105 or the memory cannot be reclaimed. 1106 </description> 1107 <origin>jvmdi</origin> 1108 <capabilities> 1109 </capabilities> 1110 <parameters> 1111 <param id="mem"> 1112 <outbuf> 1113 <uchar/> 1114 <nullok>the call is ignored</nullok> 1115 </outbuf> 1116 <description> 1117 A pointer to the beginning of the allocated memory. 1118 Please ignore "On return, the elements are set." 1119 <todo>keep it from generating "On return, the elements are set"</todo> 1120 </description> 1121 </param> 1122 </parameters> 1123 <errors> 1124 </errors> 1125 </function> 1126 </category> 1127 1128 <category id="threadCategory" label="Thread"> 1129 <intro> 1130 </intro> 1131 1132 <function id="GetThreadState" num="17"> 1133 <synopsis>Get Thread State</synopsis> 1134 <description> 1135 Get the state of a thread. The state of the thread is represented by the 1136 answers to the hierarchical set of questions below: 1137 <ul type="circle"> 1138 <li><i>Alive?</i> 1139 <ul> 1140 <li>Not alive. 1141 <ul type="circle"> 1142 <li><i>Why not alive?</i> 1143 <ul> 1144 <li>New.</li> 1145 <li>Terminated (<datalink 1146 id="JVMTI_THREAD_STATE_TERMINATED"><code>JVMTI_THREAD_STATE_TERMINATED</code></datalink>)</li> 1147 </ul> 1148 </li> 1149 </ul> 1150 </li> 1151 <li>Alive (<datalink 1152 id="JVMTI_THREAD_STATE_ALIVE"><code>JVMTI_THREAD_STATE_ALIVE</code></datalink>) 1153 <ul type="circle"> 1154 <li><i>Suspended?</i> 1155 <ul> 1156 <li>Suspended (<datalink 1157 id="JVMTI_THREAD_STATE_SUSPENDED"><code>JVMTI_THREAD_STATE_SUSPENDED</code></datalink>)</li> 1158 <li>Not suspended</li> 1159 </ul> 1160 </li> 1161 <li><i>Interrupted?</i> 1162 <ul> 1163 <li>Interrupted (<datalink 1164 id="JVMTI_THREAD_STATE_INTERRUPTED"><code>JVMTI_THREAD_STATE_INTERRUPTED</code></datalink>)</li> 1165 <li>Not interrupted.</li> 1166 </ul> 1167 </li> 1168 <li><i>In native?</i> 1169 <ul> 1170 <li>In native code (<datalink 1171 id="JVMTI_THREAD_STATE_IN_NATIVE"><code>JVMTI_THREAD_STATE_IN_NATIVE</code></datalink>)</li> 1172 <li>In Java programming language code</li> 1173 </ul> 1174 </li> 1175 <li><i>What alive state?</i> 1176 <ul> 1177 <li>Runnable (<datalink 1178 id="JVMTI_THREAD_STATE_RUNNABLE"><code>JVMTI_THREAD_STATE_RUNNABLE</code></datalink>)</li> 1179 <li>Blocked (<datalink 1180 id="JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER"><code>JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER</code></datalink>)</li> 1181 <li>Waiting (<datalink 1182 id="JVMTI_THREAD_STATE_WAITING"><code>JVMTI_THREAD_STATE_WAITING</code></datalink>) 1183 <ul type="circle"> 1184 <li><i>Timed wait?</i> 1185 <ul> 1186 <li>Indefinite (<datalink 1187 id="JVMTI_THREAD_STATE_WAITING_INDEFINITELY"><code>JVMTI_THREAD_STATE_WAITING_INDEFINITELY</code></datalink></li> 1188 <li>Timed (<datalink 1189 id="JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT"><code>JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT</code></datalink>)</li> 1190 </ul> 1191 </li> 1192 <li><i>Why waiting?</i> 1193 <ul> 1194 <li>Object.wait (<datalink 1195 id="JVMTI_THREAD_STATE_IN_OBJECT_WAIT"><code>JVMTI_THREAD_STATE_IN_OBJECT_WAIT</code></datalink>)</li> 1196 <li>LockSupport.park (<datalink 1197 id="JVMTI_THREAD_STATE_PARKED"><code>JVMTI_THREAD_STATE_PARKED</code></datalink>)</li> 1198 <li>Sleeping (<datalink 1199 id="JVMTI_THREAD_STATE_SLEEPING"><code>JVMTI_THREAD_STATE_SLEEPING</code></datalink>)</li> 1200 </ul> 1201 </li> 1202 </ul> 1203 </li> 1204 </ul> 1205 </li> 1206 </ul> 1207 </li> 1208 </ul> 1209 </li> 1210 </ul> 1211 <p/> 1212 The answers are represented by the following bit vector. 1213 <constants id="jvmtiThreadState" label="Thread State Flags" kind="bits"> 1214 <constant id="JVMTI_THREAD_STATE_ALIVE" num="0x0001"> 1215 Thread is alive. Zero if thread is new (not started) or terminated. 1216 </constant> 1217 <constant id="JVMTI_THREAD_STATE_TERMINATED" num="0x0002"> 1218 Thread has completed execution. 1219 </constant> 1220 <constant id="JVMTI_THREAD_STATE_RUNNABLE" num="0x0004"> 1221 Thread is runnable. 1222 </constant> 1223 <constant id="JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER" num="0x0400"> 1224 Thread is waiting to enter a synchronization block/method or, 1225 after an <code>Object.wait()</code>, waiting to re-enter a 1226 synchronization block/method. 1227 </constant> 1228 <constant id="JVMTI_THREAD_STATE_WAITING" num="0x0080"> 1229 Thread is waiting. 1230 </constant> 1231 <constant id="JVMTI_THREAD_STATE_WAITING_INDEFINITELY" num="0x0010"> 1232 Thread is waiting without a timeout. 1233 For example, <code>Object.wait()</code>. 1234 </constant> 1235 <constant id="JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT" num="0x0020"> 1236 Thread is waiting with a maximum time to wait specified. 1237 For example, <code>Object.wait(long)</code>. 1238 </constant> 1239 <constant id="JVMTI_THREAD_STATE_SLEEPING" num="0x0040"> 1240 Thread is sleeping -- <code>Thread.sleep(long)</code>. 1241 </constant> 1242 <constant id="JVMTI_THREAD_STATE_IN_OBJECT_WAIT" num="0x0100"> 1243 Thread is waiting on an object monitor -- <code>Object.wait</code>. 1244 </constant> 1245 <constant id="JVMTI_THREAD_STATE_PARKED" num="0x0200"> 1246 Thread is parked, for example: <code>LockSupport.park</code>, 1247 <code>LockSupport.parkUtil</code> and <code>LockSupport.parkNanos</code>. 1248 </constant> 1249 <constant id="JVMTI_THREAD_STATE_SUSPENDED" num="0x100000"> 1250 Thread suspended. 1251 <code>java.lang.Thread.suspend()</code> 1252 or a <jvmti/> suspend function 1253 (such as <functionlink id="SuspendThread"></functionlink>) 1254 has been called on the thread. If this bit 1255 is set, the other bits refer to the thread state before suspension. 1256 </constant> 1257 <constant id="JVMTI_THREAD_STATE_INTERRUPTED" num="0x200000"> 1258 Thread has been interrupted. 1259 </constant> 1260 <constant id="JVMTI_THREAD_STATE_IN_NATIVE" num="0x400000"> 1261 Thread is in native code--that is, a native method is running 1262 which has not called back into the VM or Java programming 1263 language code. 1264 <p/> 1265 This flag is not set when running VM compiled Java programming 1266 language code nor is it set when running VM code or 1267 VM support code. Native VM interface functions, such as JNI and 1268 <jvmti/> functions, may be implemented as VM code. 1269 </constant> 1270 <constant id="JVMTI_THREAD_STATE_VENDOR_1" num="0x10000000"> 1271 Defined by VM vendor. 1272 </constant> 1273 <constant id="JVMTI_THREAD_STATE_VENDOR_2" num="0x20000000"> 1274 Defined by VM vendor. 1275 </constant> 1276 <constant id="JVMTI_THREAD_STATE_VENDOR_3" num="0x40000000"> 1277 Defined by VM vendor. 1278 </constant> 1279 </constants> 1280 The following definitions are used to convert <jvmti/> thread state 1281 to <code>java.lang.Thread.State</code> style states. 1282 <constants id="jvmtiJavaLangThreadState" label="java.lang.Thread.State Conversion Masks" kind="bits"> 1283 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_MASK" 1284 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"> 1285 Mask the state with this before comparison 1286 </constant> 1287 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_NEW" 1288 num="0"> 1289 <code>java.lang.Thread.State.NEW</code> 1290 </constant> 1291 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_TERMINATED" 1292 num="JVMTI_THREAD_STATE_TERMINATED"> 1293 <code>java.lang.Thread.State.TERMINATED</code> 1294 </constant> 1295 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_RUNNABLE" 1296 num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_RUNNABLE"> 1297 <code>java.lang.Thread.State.RUNNABLE</code> 1298 </constant> 1299 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_BLOCKED" 1300 num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER"> 1301 <code>java.lang.Thread.State.BLOCKED</code> 1302 </constant> 1303 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_WAITING" 1304 num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_INDEFINITELY"> 1305 <code>java.lang.Thread.State.WAITING</code> 1306 </constant> 1307 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_TIMED_WAITING" 1308 num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT"> 1309 <code>java.lang.Thread.State.TIMED_WAITING</code> 1310 </constant> 1311 </constants> 1312 <b>Rules</b> 1313 <p/> 1314 There can be no more than one answer to a question, although there can be no 1315 answer (because the answer is unknown, does not apply, or none of the answers is 1316 correct). An answer is set only when the enclosing answers match. 1317 That is, no more than one of 1318 <ul type="circle"> 1319 <li><code>JVMTI_THREAD_STATE_RUNNABLE</code></li> 1320 <li><code>JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER</code></li> 1321 <li><code>JVMTI_THREAD_STATE_WAITING</code></li> 1322 </ul> 1323 can be set (a <tm>J2SE</tm> compliant implementation will always set 1324 one of these if <code>JVMTI_THREAD_STATE_ALIVE</code> is set). 1325 And if any of these are set, the enclosing answer 1326 <code>JVMTI_THREAD_STATE_ALIVE</code> is set. 1327 No more than one of 1328 <ul type="circle"> 1329 <li><code>JVMTI_THREAD_STATE_WAITING_INDEFINITELY</code></li> 1330 <li><code>JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT</code></li> 1331 </ul> 1332 can be set (a <tm>J2SE</tm> compliant implementation will always set 1333 one of these if <code>JVMTI_THREAD_STATE_WAITING</code> is set). 1334 And if either is set, the enclosing answers 1335 <code>JVMTI_THREAD_STATE_ALIVE</code> and 1336 <code>JVMTI_THREAD_STATE_WAITING</code> are set. 1337 No more than one of 1338 <ul type="circle"> 1339 <li><code>JVMTI_THREAD_STATE_IN_OBJECT_WAIT</code></li> 1340 <li><code>JVMTI_THREAD_STATE_PARKED</code></li> 1341 <li><code>JVMTI_THREAD_STATE_SLEEPING</code></li> 1342 </ul> 1343 can be set. And if any of these is set, the enclosing answers 1344 <code>JVMTI_THREAD_STATE_ALIVE</code> and 1345 <code>JVMTI_THREAD_STATE_WAITING</code> are set. 1346 Also, if <code>JVMTI_THREAD_STATE_SLEEPING</code> is set, 1347 then <code>JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT</code> is set. 1348 If a state <i>A</i> is implemented using the mechanism of 1349 state <i>B</i> then it is state <i>A</i> which 1350 is returned by this function. 1351 For example, if <code>Thread.sleep(long)</code> 1352 is implemented using <code>Object.wait(long)</code> 1353 then it is still <code>JVMTI_THREAD_STATE_SLEEPING</code> 1354 which is returned. 1355 More than one of 1356 <ul type="circle"> 1357 <li><code>JVMTI_THREAD_STATE_SUSPENDED</code></li> 1358 <li><code>JVMTI_THREAD_STATE_INTERRUPTED</code></li> 1359 <li><code>JVMTI_THREAD_STATE_IN_NATIVE</code></li> 1360 </ul> 1361 can be set, but if any is set, 1362 <code>JVMTI_THREAD_STATE_ALIVE</code> is set. 1363 <p/> 1364 And finally, 1365 <code>JVMTI_THREAD_STATE_TERMINATED</code> cannot be set unless 1366 <code>JVMTI_THREAD_STATE_ALIVE</code> is not set. 1367 <p/> 1368 The thread state representation is designed for extension in future versions 1369 of the specification; thread state values should be used accordingly, that is 1370 they should not be used as ordinals. 1371 Most queries can be made by testing a single bit, if use in a switch statement is desired, 1372 the state bits should be masked with the interesting bits. 1373 All bits not defined above are reserved for future use. 1374 A VM, compliant to the current specification, must set reserved bits to zero. 1375 An agent should ignore reserved bits -- 1376 they should not be assumed to be zero and thus should not be included in comparisons. 1377 <p/> 1378 <b>Examples</b> 1379 <p/> 1380 Note that the values below exclude reserved and vendor bits. 1381 <p/> 1382 The state of a thread blocked at a <code>synchronized</code>-statement would be: 1383 <example> 1384 JVMTI_THREAD_STATE_ALIVE + JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER 1385 </example> 1386 The state of a thread which hasn't started yet would be: 1387 <example> 1388 0 1389 </example> 1390 The state of a thread at a <code>Object.wait(3000)</code> would be: 1391 <example> 1392 JVMTI_THREAD_STATE_ALIVE + JVMTI_THREAD_STATE_WAITING + 1393 JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT + 1394 JVMTI_THREAD_STATE_MONITOR_WAITING 1395 </example> 1396 The state of a thread suspended while runnable would be: 1397 <example> 1398 JVMTI_THREAD_STATE_ALIVE + JVMTI_THREAD_STATE_RUNNABLE + JVMTI_THREAD_STATE_SUSPENDED 1399 </example> 1400 <p/> 1401 <b>Testing the State</b> 1402 <p/> 1403 In most cases, the thread state can be determined by testing the one bit corresponding 1404 to that question. For example, the code to test if a thread is sleeping: 1405 <example> 1406 jint state; 1407 jvmtiError err; 1408 1409 err = (*jvmti)->GetThreadState(jvmti, thread, &state); 1410 if (err == JVMTI_ERROR_NONE) { 1411 if (state & JVMTI_THREAD_STATE_SLEEPING) { ... 1412 </example> 1413 <p/> 1414 For waiting (that is, in <code>Object.wait</code>, parked, or sleeping) it would be: 1415 <example> 1416 if (state & JVMTI_THREAD_STATE_WAITING) { ... 1417 </example> 1418 For some states, more than one bit will need to be tested as is the case 1419 when testing if a thread has not yet been started: 1420 <example> 1421 if ((state & (JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_TERMINATED)) == 0) { ... 1422 </example> 1423 To distinguish timed from untimed <code>Object.wait</code>: 1424 <example> 1425 if (state & JVMTI_THREAD_STATE_IN_OBJECT_WAIT) { 1426 if (state & JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT) { 1427 printf("in Object.wait(long timeout)\n"); 1428 } else { 1429 printf("in Object.wait()\n"); 1430 } 1431 } 1432 </example> 1433 <p/> 1434 <b>Relationship to <code>java.lang.Thread.State</code></b> 1435 <p/> 1436 The thread state represented by <code>java.lang.Thread.State</code> 1437 returned from <code>java.lang.Thread.getState()</code> is a subset of the 1438 information returned from this function. 1439 The corresponding <code>java.lang.Thread.State</code> can be determined 1440 by using the provided conversion masks. 1441 For example, this returns the name of the <code>java.lang.Thread.State</code> thread state: 1442 <example> 1443 err = (*jvmti)->GetThreadState(jvmti, thread, &state); 1444 abortOnError(err); 1445 switch (state & JVMTI_JAVA_LANG_THREAD_STATE_MASK) { 1446 case JVMTI_JAVA_LANG_THREAD_STATE_NEW: 1447 return "NEW"; 1448 case JVMTI_JAVA_LANG_THREAD_STATE_TERMINATED: 1449 return "TERMINATED"; 1450 case JVMTI_JAVA_LANG_THREAD_STATE_RUNNABLE: 1451 return "RUNNABLE"; 1452 case JVMTI_JAVA_LANG_THREAD_STATE_BLOCKED: 1453 return "BLOCKED"; 1454 case JVMTI_JAVA_LANG_THREAD_STATE_WAITING: 1455 return "WAITING"; 1456 case JVMTI_JAVA_LANG_THREAD_STATE_TIMED_WAITING: 1457 return "TIMED_WAITING"; 1458 } 1459 </example> 1460 </description> 1461 <origin>new</origin> 1462 <capabilities> 1463 </capabilities> 1464 <parameters> 1465 <param id="thread"> 1466 <jthread null="current" started="maybe" impl="noconvert"/> 1467 <description> 1468 The thread to query. 1469 </description> 1470 </param> 1471 <param id="thread_state_ptr"> 1472 <outptr><jint/></outptr> 1473 <description> 1474 On return, points to state flags, 1475 as defined by the <internallink id="jvmtiThreadState">Thread State Flags</internallink>. 1476 </description> 1477 </param> 1478 </parameters> 1479 <errors> 1480 </errors> 1481 </function> 1482 1483 <function id="GetCurrentThread" phase="start" num="18" since="1.1"> 1484 <synopsis>Get Current Thread</synopsis> 1485 <description> 1486 Get the current thread. 1487 The current thread is the Java programming language thread which has called the function. 1488 The function may return <code>NULL</code> in the start phase if the 1489 <internallink id="jvmtiCapabilities.can_generate_early_vmstart"> 1490 <code>can_generate_early_vmstart</code></internallink> capability is enabled 1491 and the <code>java.lang.Thread</code> class has not been initialized yet. 1492 <p/> 1493 Note that most <jvmti/> functions that take a thread 1494 as an argument will accept <code>NULL</code> to mean 1495 the current thread. 1496 </description> 1497 <origin>new</origin> 1498 <capabilities> 1499 </capabilities> 1500 <parameters> 1501 <param id="thread_ptr"> 1502 <outptr><jthread/></outptr> 1503 <description> 1504 On return, points to the current thread, or <code>NULL</code>. 1505 </description> 1506 </param> 1507 </parameters> 1508 <errors> 1509 </errors> 1510 </function> 1511 1512 <function id="GetAllThreads" num="4"> 1513 <synopsis>Get All Threads</synopsis> 1514 <description> 1515 Get all live threads. 1516 The threads are Java programming language threads; 1517 that is, threads that are attached to the VM. 1518 A thread is live if <code>java.lang.Thread.isAlive()</code> 1519 would return <code>true</code>, that is, the thread has 1520 been started and has not yet died. 1521 The universe of threads is determined by the context of the <jvmti/> 1522 environment, which typically is all threads attached to the VM. 1523 Note that this includes <jvmti/> agent threads 1524 (see <functionlink id="RunAgentThread"/>). 1525 </description> 1526 <origin>jvmdi</origin> 1527 <capabilities> 1528 </capabilities> 1529 <parameters> 1530 <param id="threads_count_ptr"> 1531 <outptr><jint/></outptr> 1532 <description> 1533 On return, points to the number of running threads. 1534 </description> 1535 </param> 1536 <param id="threads_ptr"> 1537 <allocbuf outcount="threads_count_ptr"><jthread/></allocbuf> 1538 <description> 1539 On return, points to an array of references, one 1540 for each running thread. 1541 </description> 1542 </param> 1543 </parameters> 1544 <errors> 1545 </errors> 1546 </function> 1547 1548 <function id="SuspendThread" num="5"> 1549 <synopsis>Suspend Thread</synopsis> 1550 <description> 1551 Suspend the specified thread. If the calling thread is specified, 1552 this function will not return until some other thread calls 1553 <functionlink id="ResumeThread"></functionlink>. 1554 If the thread is currently suspended, this function 1555 does nothing and returns an error. 1556 </description> 1557 <origin>jvmdi</origin> 1558 <capabilities> 1559 <required id="can_suspend"></required> 1560 </capabilities> 1561 <parameters> 1562 <param id="thread"> 1563 <jthread null="current"/> 1564 <description> 1565 The thread to suspend. 1566 </description> 1567 </param> 1568 </parameters> 1569 <errors> 1570 <error id="JVMTI_ERROR_THREAD_SUSPENDED"> 1571 Thread already suspended. 1572 </error> 1573 </errors> 1574 </function> 1575 1576 <elide> 1577 <function id="SuspendAllThreads" num="101"> 1578 <synopsis>Suspend All Threads</synopsis> 1579 <description> 1580 <issue> 1581 There has been no explicit call for this function, and it will 1582 thus be removed if there is no interest. 1583 </issue> 1584 Suspend all live threads except: 1585 <ul> 1586 <li>already suspended threads</li> 1587 <li>those listed in <paramlink id="except_list"></paramlink></li> 1588 <li>certain system (non application) threads, as determined 1589 by the VM implementation</li> 1590 </ul> 1591 The threads are Java programming language threads; 1592 native threads which are not attached to the VM are not 1593 Java programming language threads. 1594 A thread is live if <code>java.lang.Thread.isAlive()</code> 1595 would return <code>true</code>, that is, the thread has 1596 been started and has not yet died. 1597 The universe of threads is determined 1598 by the context of the <jvmti/> 1599 environment, which, typically, is all threads attached to the VM, 1600 except critical VM internal threads and <jvmti/> agent threads 1601 (see <functionlink id="RunAgentThread"/>). 1602 <p/> 1603 If the calling thread is specified, 1604 all other threads are suspended first then the caller thread is suspended - 1605 this function will not return until some other thread calls 1606 <functionlink id="ResumeThread"></functionlink>. 1607 <p/> 1608 The list of actually 1609 suspended threads is returned in 1610 <paramlink id="suspended_list_ptr"></paramlink>. 1611 Suspension is as defined in <functionlink id="SuspendThread"></functionlink>. 1612 <functionlink id="ResumeThreadList"></functionlink> 1613 can be used to resume the suspended threads. 1614 </description> 1615 <origin>new</origin> 1616 <capabilities> 1617 <required id="can_suspend"></required> 1618 </capabilities> 1619 <parameters> 1620 <param id="except_count"> 1621 <jint min="0"/> 1622 <description> 1623 The number of threads in the list of threads not to be suspended. 1624 </description> 1625 </param> 1626 <param id="except_list"> 1627 <inbuf incount="except_count"> 1628 <jthread/> 1629 <nullok>not an error if <code>except_count == 0</code></nullok> 1630 </inbuf> 1631 <description> 1632 The list of threads not to be suspended. 1633 </description> 1634 </param> 1635 <param id="suspended_count_ptr"> 1636 <outptr><jint/></outptr> 1637 <description> 1638 On return, points to the number of threads suspended by this call. 1639 </description> 1640 </param> 1641 <param id="suspended_list_ptr"> 1642 <allocbuf outcount="suspended_count_ptr"><jthread/></allocbuf> 1643 <description> 1644 On return, points to an array of references, one 1645 for each thread suspended. 1646 </description> 1647 </param> 1648 </parameters> 1649 <errors> 1650 <error id="JVMTI_ERROR_INVALID_THREAD"> 1651 A thread in <paramlink id="except_list"></paramlink> was invalid. 1652 </error> 1653 <error id="JVMTI_ERROR_NULL_POINTER"> 1654 Both <paramlink id="except_list"></paramlink> was <code>NULL</code> 1655 and <paramlink id="except_count"></paramlink> was non-zero. 1656 </error> 1657 </errors> 1658 </function> 1659 </elide> 1660 1661 <function id="SuspendThreadList" num="92"> 1662 <synopsis>Suspend Thread List</synopsis> 1663 <description> 1664 Suspend the <paramlink id="request_count"></paramlink> 1665 threads specified in the 1666 <paramlink id="request_list"></paramlink> array. 1667 Threads may be resumed with 1668 <functionlink id="ResumeThreadList"></functionlink> or 1669 <functionlink id="ResumeThread"></functionlink>. 1670 If the calling thread is specified in the 1671 <paramlink id="request_list"></paramlink> array, this function will 1672 not return until some other thread resumes it. 1673 Errors encountered in the suspension of a thread 1674 are returned in the <paramlink id="results"></paramlink> 1675 array, <b>not</b> in the return value of this function. 1676 Threads that are currently suspended do not change state. 1677 </description> 1678 <origin>jvmdi</origin> 1679 <capabilities> 1680 <required id="can_suspend"></required> 1681 </capabilities> 1682 <parameters> 1683 <param id="request_count"> 1684 <jint min="0"/> 1685 <description> 1686 The number of threads to suspend. 1687 </description> 1688 </param> 1689 <param id="request_list"> 1690 <inbuf incount="request_count"><jthread/></inbuf> 1691 <description> 1692 The list of threads to suspend. 1693 </description> 1694 </param> 1695 <param id="results"> 1696 <outbuf incount="request_count"><enum>jvmtiError</enum></outbuf> 1697 <description> 1698 An agent supplied array of 1699 <paramlink id="request_count"></paramlink> elements. 1700 On return, filled with the error code for 1701 the suspend of the corresponding thread. 1702 The error code will be 1703 <errorlink id="JVMTI_ERROR_NONE"></errorlink> 1704 if the thread was suspended by this call. 1705 Possible error codes are those specified 1706 for <functionlink id="SuspendThread"></functionlink>. 1707 </description> 1708 </param> 1709 </parameters> 1710 <errors> 1711 </errors> 1712 </function> 1713 1714 <function id="ResumeThread" num="6"> 1715 <synopsis>Resume Thread</synopsis> 1716 <description> 1717 Resume a suspended thread. 1718 Any threads currently suspended through 1719 a <jvmti/> suspend function (eg. 1720 <functionlink id="SuspendThread"></functionlink>) 1721 or <code>java.lang.Thread.suspend()</code> 1722 will resume execution; 1723 all other threads are unaffected. 1724 </description> 1725 <origin>jvmdi</origin> 1726 <capabilities> 1727 <required id="can_suspend"></required> 1728 </capabilities> 1729 <parameters> 1730 <param id="thread"> 1731 <jthread/> 1732 <description> 1733 The thread to resume. 1734 </description> 1735 </param> 1736 </parameters> 1737 <errors> 1738 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 1739 Thread was not suspended. 1740 </error> 1741 <error id="JVMTI_ERROR_INVALID_TYPESTATE"> 1742 The state of the thread has been modified, and is now inconsistent. 1743 </error> 1744 </errors> 1745 </function> 1746 1747 <function id="ResumeThreadList" num="93"> 1748 <synopsis>Resume Thread List</synopsis> 1749 <description> 1750 Resume the <paramlink id="request_count"></paramlink> 1751 threads specified in the 1752 <paramlink id="request_list"></paramlink> array. 1753 Any thread suspended through 1754 a <jvmti/> suspend function (eg. 1755 <functionlink id="SuspendThreadList"></functionlink>) 1756 or <code>java.lang.Thread.suspend()</code> 1757 will resume execution. 1758 </description> 1759 <origin>jvmdi</origin> 1760 <capabilities> 1761 <required id="can_suspend"></required> 1762 </capabilities> 1763 <parameters> 1764 <param id="request_count"> 1765 <jint min="0"/> 1766 <description> 1767 The number of threads to resume. 1768 </description> 1769 </param> 1770 <param id="request_list"> 1771 <inbuf incount="request_count"><jthread/></inbuf> 1772 <description> 1773 The threads to resume. 1774 </description> 1775 </param> 1776 <param id="results"> 1777 <outbuf incount="request_count"><enum>jvmtiError</enum></outbuf> 1778 <description> 1779 An agent supplied array of 1780 <paramlink id="request_count"></paramlink> elements. 1781 On return, filled with the error code for 1782 the resume of the corresponding thread. 1783 The error code will be 1784 <errorlink id="JVMTI_ERROR_NONE"></errorlink> 1785 if the thread was suspended by this call. 1786 Possible error codes are those specified 1787 for <functionlink id="ResumeThread"></functionlink>. 1788 </description> 1789 </param> 1790 </parameters> 1791 <errors> 1792 </errors> 1793 </function> 1794 1795 <function id="StopThread" num="7"> 1796 <synopsis>Stop Thread</synopsis> 1797 <description> 1798 Send the specified asynchronous exception to the specified thread. 1799 Normally, this function is used to kill the specified thread with an 1800 instance of the exception <code>ThreadDeath</code>, similar to 1801 <code>java.lang.Thread.stop</code>. 1802 </description> 1803 <origin>jvmdi</origin> 1804 <capabilities> 1805 <required id="can_signal_thread"></required> 1806 </capabilities> 1807 <parameters> 1808 <param id="thread"> 1809 <jthread/> 1810 <description> 1811 The thread to stop. 1812 </description> 1813 </param> 1814 <param id="exception"> 1815 <jobject/> 1816 <description> 1817 The asynchronous exception object. 1818 </description> 1819 </param> 1820 </parameters> 1821 <errors> 1822 </errors> 1823 </function> 1824 1825 <function id="InterruptThread" num="8"> 1826 <synopsis>Interrupt Thread</synopsis> 1827 <description> 1828 Interrupt the specified thread 1829 (similar to <code>java.lang.Thread.interrupt</code>). 1830 </description> 1831 <origin>jvmdi</origin> 1832 <capabilities> 1833 <required id="can_signal_thread"></required> 1834 </capabilities> 1835 <parameters> 1836 <param id="thread"> 1837 <jthread impl="noconvert"/> 1838 <description> 1839 The thread to interrupt. 1840 </description> 1841 </param> 1842 </parameters> 1843 <errors> 1844 </errors> 1845 </function> 1846 1847 <function id="GetThreadInfo" num="9"> 1848 <synopsis>Get Thread Info</synopsis> 1849 <typedef id="jvmtiThreadInfo" label="Thread information structure"> 1850 <field id="name"> 1851 <allocfieldbuf><char/></allocfieldbuf> 1852 <description> 1853 The thread name, encoded as a 1854 <internallink id="mUTF">modified UTF-8</internallink> string. 1855 </description> 1856 </field> 1857 <field id="priority"> 1858 <jint/> 1859 <description> 1860 The thread priority. See the thread priority constants: 1861 <datalink id="jvmtiThreadPriority"></datalink>. 1862 </description> 1863 </field> 1864 <field id="is_daemon"> 1865 <jboolean/> 1866 <description> 1867 Is this a daemon thread? 1868 </description> 1869 </field> 1870 <field id="thread_group"> 1871 <jthreadGroup/> 1872 <description> 1873 The thread group to which this thread belongs. 1874 <code>NULL</code> if the thread has died. 1875 </description> 1876 </field> 1877 <field id="context_class_loader"> 1878 <jobject/> 1879 <description> 1880 The context class loader associated with this thread. 1881 </description> 1882 </field> 1883 </typedef> 1884 <description> 1885 Get thread information. The fields of the <datalink id="jvmtiThreadInfo"/> structure 1886 are filled in with details of the specified thread. 1887 </description> 1888 <origin>jvmdi</origin> 1889 <capabilities> 1890 </capabilities> 1891 <parameters> 1892 <param id="thread"> 1893 <jthread null="current" impl="noconvert" started="maybe"/> 1894 <description> 1895 The thread to query. 1896 </description> 1897 </param> 1898 <param id="info_ptr"> 1899 <outptr><struct>jvmtiThreadInfo</struct></outptr> 1900 <description> 1901 On return, filled with information describing the specified thread. 1902 </description> 1903 </param> 1904 </parameters> 1905 <errors> 1906 </errors> 1907 </function> 1908 1909 <function id="GetOwnedMonitorInfo" num="10"> 1910 <synopsis>Get Owned Monitor Info</synopsis> 1911 <description> 1912 Get information about the monitors owned by the 1913 specified thread. 1914 </description> 1915 <origin>jvmdiClone</origin> 1916 <capabilities> 1917 <required id="can_get_owned_monitor_info"></required> 1918 </capabilities> 1919 <parameters> 1920 <param id="thread"> 1921 <jthread null="current"/> 1922 <description> 1923 The thread to query. 1924 </description> 1925 </param> 1926 <param id="owned_monitor_count_ptr"> 1927 <outptr><jint/></outptr> 1928 <description> 1929 The number of monitors returned. 1930 </description> 1931 </param> 1932 <param id="owned_monitors_ptr"> 1933 <allocbuf outcount="owned_monitor_count_ptr"><jobject/></allocbuf> 1934 <description> 1935 The array of owned monitors. 1936 </description> 1937 </param> 1938 </parameters> 1939 <errors> 1940 </errors> 1941 </function> 1942 1943 <function id="GetOwnedMonitorStackDepthInfo" num="153" since="1.1"> 1944 <synopsis>Get Owned Monitor Stack Depth Info</synopsis> 1945 <typedef id="jvmtiMonitorStackDepthInfo" 1946 label="Monitor stack depth information structure"> 1947 <field id="monitor"> 1948 <jobject/> 1949 <description> 1950 The owned monitor. 1951 </description> 1952 </field> 1953 <field id="stack_depth"> 1954 <jint/> 1955 <description> 1956 The stack depth. Corresponds to the stack depth used in the 1957 <internallink id="stack">Stack Frame functions</internallink>. 1958 That is, zero is the current frame, one is the frame which 1959 called the current frame. And it is negative one if the 1960 implementation cannot determine the stack depth (e.g., for 1961 monitors acquired by JNI <code>MonitorEnter</code>). 1962 </description> 1963 </field> 1964 </typedef> 1965 <description> 1966 Get information about the monitors owned by the 1967 specified thread and the depth of the stack frame which locked them. 1968 </description> 1969 <origin>new</origin> 1970 <capabilities> 1971 <required id="can_get_owned_monitor_stack_depth_info"></required> 1972 </capabilities> 1973 <parameters> 1974 <param id="thread"> 1975 <jthread null="current"/> 1976 <description> 1977 The thread to query. 1978 </description> 1979 </param> 1980 <param id="monitor_info_count_ptr"> 1981 <outptr><jint/></outptr> 1982 <description> 1983 The number of monitors returned. 1984 </description> 1985 </param> 1986 <param id="monitor_info_ptr"> 1987 <allocbuf outcount="monitor_info_count_ptr"> 1988 <struct>jvmtiMonitorStackDepthInfo</struct> 1989 </allocbuf> 1990 <description> 1991 The array of owned monitor depth information. 1992 </description> 1993 </param> 1994 </parameters> 1995 <errors> 1996 </errors> 1997 </function> 1998 1999 <function id="GetCurrentContendedMonitor" num="11"> 2000 <synopsis>Get Current Contended Monitor</synopsis> 2001 <description> 2002 Get the object, if any, whose monitor the specified thread is waiting to 2003 enter or waiting to regain through <code>java.lang.Object.wait</code>. 2004 </description> 2005 <origin>jvmdi</origin> 2006 <capabilities> 2007 <required id="can_get_current_contended_monitor"></required> 2008 </capabilities> 2009 <parameters> 2010 <param id="thread"> 2011 <jthread null="current"/> 2012 <description> 2013 The thread to query. 2014 </description> 2015 </param> 2016 <param id="monitor_ptr"> 2017 <outptr><jobject/></outptr> 2018 <description> 2019 On return, filled with the current contended monitor, or 2020 NULL if there is none. 2021 </description> 2022 </param> 2023 </parameters> 2024 <errors> 2025 </errors> 2026 </function> 2027 2028 <callback id="jvmtiStartFunction"> 2029 <void/> 2030 <synopsis>Agent Start Function</synopsis> 2031 <description> 2032 Agent supplied callback function. 2033 This function is the entry point for an agent thread 2034 started with 2035 <functionlink id="RunAgentThread"></functionlink>. 2036 </description> 2037 <parameters> 2038 <param id="jvmti_env"> 2039 <outptr> 2040 <struct>jvmtiEnv</struct> 2041 </outptr> 2042 <description> 2043 The <jvmti/> environment. 2044 </description> 2045 </param> 2046 <param id="jni_env"> 2047 <outptr> 2048 <struct>JNIEnv</struct> 2049 </outptr> 2050 <description> 2051 The JNI environment. 2052 </description> 2053 </param> 2054 <param id="arg"> 2055 <outptr> 2056 <void/> 2057 </outptr> 2058 <description> 2059 The <code>arg</code> parameter passed to 2060 <functionlink id="RunAgentThread"></functionlink>. 2061 </description> 2062 </param> 2063 </parameters> 2064 </callback> 2065 2066 <function id="RunAgentThread" num="12"> 2067 <synopsis>Run Agent Thread</synopsis> 2068 <description> 2069 Starts the execution of an agent thread. with the specified native function. 2070 The parameter <paramlink id="arg"></paramlink> is forwarded on to the 2071 <functionlink id="jvmtiStartFunction">start function</functionlink> 2072 (specified with <paramlink id="proc"></paramlink>) as its single argument. 2073 This function allows the creation of agent threads 2074 for handling communication with another process or for handling events 2075 without the need to load a special subclass of <code>java.lang.Thread</code> or 2076 implementer of <code>java.lang.Runnable</code>. 2077 Instead, the created thread can run entirely in native code. 2078 However, the created thread does require a newly created instance 2079 of <code>java.lang.Thread</code> (referenced by the argument <code>thread</code>) to 2080 which it will be associated. 2081 The thread object can be created with JNI calls. 2082 <p/> 2083 The following common thread priorities are provided for your convenience: 2084 <constants id="jvmtiThreadPriority" label="Thread Priority Constants" kind="const"> 2085 <constant id="JVMTI_THREAD_MIN_PRIORITY" num="1"> 2086 Minimum possible thread priority 2087 </constant> 2088 <constant id="JVMTI_THREAD_NORM_PRIORITY" num="5"> 2089 Normal thread priority 2090 </constant> 2091 <constant id="JVMTI_THREAD_MAX_PRIORITY" num="10"> 2092 Maximum possible thread priority 2093 </constant> 2094 </constants> 2095 <p/> 2096 The new thread is started as a daemon thread with the specified 2097 <paramlink id="priority"></paramlink>. 2098 If enabled, a <eventlink id="ThreadStart"/> event will be sent. 2099 <p/> 2100 Since the thread has been started, the thread will be live when this function 2101 returns, unless the thread has died immediately. 2102 <p/> 2103 The thread group of the thread is ignored -- specifically, the thread is not 2104 added to the thread group and the thread is not seen on queries of the thread 2105 group at either the Java programming language or <jvmti/> levels. 2106 <p/> 2107 The thread is not visible to Java programming language queries but is 2108 included in <jvmti/> queries (for example, 2109 <functionlink id="GetAllThreads"/> and 2110 <functionlink id="GetAllStackTraces"/>). 2111 <p/> 2112 Upon execution of <code>proc</code>, the new thread will be attached to the 2113 VM -- see the JNI documentation on 2114 <externallink id="jni/invocation.html#attaching-to-the-vm" 2115 >Attaching to the VM</externallink>. 2116 </description> 2117 <origin>jvmdiClone</origin> 2118 <capabilities> 2119 </capabilities> 2120 <parameters> 2121 <param id="thread"> 2122 <jthread impl="noconvert" started="no"/> 2123 <description> 2124 The thread to run. 2125 </description> 2126 </param> 2127 <param id="proc"> 2128 <ptrtype> 2129 <struct>jvmtiStartFunction</struct> 2130 </ptrtype> 2131 <description> 2132 The start function. 2133 </description> 2134 </param> 2135 <param id="arg"> 2136 <inbuf> 2137 <void/> 2138 <nullok><code>NULL</code> is passed to the start function</nullok> 2139 </inbuf> 2140 <description> 2141 The argument to the start function. 2142 </description> 2143 </param> 2144 <param id="priority"> 2145 <jint/> 2146 <description> 2147 The priority of the started thread. Any thread 2148 priority allowed by <code>java.lang.Thread.setPriority</code> can be used including 2149 those in <datalink id="jvmtiThreadPriority"></datalink>. 2150 </description> 2151 </param> 2152 </parameters> 2153 <errors> 2154 <error id="JVMTI_ERROR_INVALID_PRIORITY"> 2155 <paramlink id="priority"/> is less than 2156 <datalink id="JVMTI_THREAD_MIN_PRIORITY"/> 2157 or greater than 2158 <datalink id="JVMTI_THREAD_MAX_PRIORITY"/> 2159 </error> 2160 </errors> 2161 </function> 2162 2163 <function id="SetThreadLocalStorage" jkernel="yes" impl="notrace" phase="start" num="103"> 2164 <synopsis>Set Thread Local Storage</synopsis> 2165 <description> 2166 The VM stores a pointer value associated with each environment-thread 2167 pair. This pointer value is called <i>thread-local storage</i>. 2168 This value is <code>NULL</code> unless set with this function. 2169 Agents can allocate memory in which they store thread specific 2170 information. By setting thread-local storage it can then be 2171 accessed with 2172 <functionlink id="GetThreadLocalStorage"></functionlink>. 2173 <p/> 2174 This function is called by the agent to set the value of the <jvmti/> 2175 thread-local storage. <jvmti/> supplies to the agent a pointer-size 2176 thread-local storage that can be used to record per-thread 2177 information. 2178 </description> 2179 <origin>jvmpi</origin> 2180 <capabilities> 2181 </capabilities> 2182 <parameters> 2183 <param id="thread"> 2184 <jthread null="current"/> 2185 <description> 2186 Store to this thread. 2187 </description> 2188 </param> 2189 <param id="data"> 2190 <inbuf> 2191 <void/> 2192 <nullok>value is set to <code>NULL</code></nullok> 2193 </inbuf> 2194 <description> 2195 The value to be entered into the thread-local storage. 2196 </description> 2197 </param> 2198 </parameters> 2199 <errors> 2200 </errors> 2201 </function> 2202 2203 <function id="GetThreadLocalStorage" jkernel="yes" impl="innative notrace" phase="start" num="102"> 2204 <synopsis>Get Thread Local Storage</synopsis> 2205 <description> 2206 Called by the agent to get the value of the <jvmti/> thread-local 2207 storage. 2208 </description> 2209 <origin>jvmpi</origin> 2210 <capabilities> 2211 </capabilities> 2212 <parameters> 2213 <param id="thread"> 2214 <jthread null="current" impl="noconvert"/> 2215 <description> 2216 Retrieve from this thread. 2217 </description> 2218 </param> 2219 <param id="data_ptr"> 2220 <agentbuf><void/></agentbuf> 2221 <description> 2222 Pointer through which the value of the thread local 2223 storage is returned. 2224 If thread-local storage has not been set with 2225 <functionlink id="SetThreadLocalStorage"></functionlink> the returned 2226 pointer is <code>NULL</code>. 2227 </description> 2228 </param> 2229 </parameters> 2230 <errors> 2231 </errors> 2232 </function> 2233 2234 </category> 2235 2236 <category id="thread_groups" label="Thread Group"> 2237 <intro> 2238 </intro> 2239 2240 <function id="GetTopThreadGroups" num="13"> 2241 <synopsis>Get Top Thread Groups</synopsis> 2242 <description> 2243 Return all top-level (parentless) thread groups in the VM. 2244 </description> 2245 <origin>jvmdi</origin> 2246 <capabilities> 2247 </capabilities> 2248 <parameters> 2249 <param id="group_count_ptr"> 2250 <outptr><jint/></outptr> 2251 <description> 2252 On return, points to the number of top-level thread groups. 2253 </description> 2254 </param> 2255 <param id="groups_ptr"> 2256 <allocbuf outcount="group_count_ptr"><jthreadGroup/></allocbuf> 2257 <description> 2258 On return, refers to a pointer to the top-level thread group array. 2259 </description> 2260 </param> 2261 </parameters> 2262 <errors> 2263 </errors> 2264 </function> 2265 2266 <function id="GetThreadGroupInfo" num="14"> 2267 <synopsis>Get Thread Group Info</synopsis> 2268 <typedef id="jvmtiThreadGroupInfo" label="Thread group information structure"> 2269 <field id="parent"> 2270 <jthreadGroup/> 2271 <description> 2272 The parent thread group. 2273 </description> 2274 </field> 2275 <field id="name"> 2276 <allocfieldbuf><char/></allocfieldbuf> 2277 <description> 2278 The thread group's name, encoded as a 2279 <internallink id="mUTF">modified UTF-8</internallink> string. 2280 </description> 2281 </field> 2282 <field id="max_priority"> 2283 <jint/> 2284 <description> 2285 The maximum priority for this thread group. 2286 </description> 2287 </field> 2288 <field id="is_daemon"> 2289 <jboolean/> 2290 <description> 2291 Is this a daemon thread group? 2292 </description> 2293 </field> 2294 </typedef> 2295 <description> 2296 Get information about the thread group. The fields of the 2297 <functionlink id="jvmtiThreadGroupInfo"></functionlink> structure 2298 are filled in with details of the specified thread group. 2299 </description> 2300 <origin>jvmdi</origin> 2301 <capabilities> 2302 </capabilities> 2303 <parameters> 2304 <param id="group"> 2305 <jthreadGroup/> 2306 <description> 2307 The thread group to query. 2308 </description> 2309 </param> 2310 <param id="info_ptr"> 2311 <outptr><struct>jvmtiThreadGroupInfo</struct></outptr> 2312 <description> 2313 On return, filled with information describing the specified 2314 thread group. 2315 </description> 2316 </param> 2317 </parameters> 2318 <errors> 2319 </errors> 2320 </function> 2321 2322 <function id="GetThreadGroupChildren" num="15"> 2323 <synopsis>Get Thread Group Children</synopsis> 2324 <description> 2325 Get the live threads and active subgroups in this thread group. 2326 </description> 2327 <origin>jvmdi</origin> 2328 <capabilities> 2329 </capabilities> 2330 <parameters> 2331 <param id="group"> 2332 <jthreadGroup/> 2333 <description> 2334 The group to query. 2335 </description> 2336 </param> 2337 <param id="thread_count_ptr"> 2338 <outptr><jint/></outptr> 2339 <description> 2340 On return, points to the number of live threads in this thread group. 2341 </description> 2342 </param> 2343 <param id="threads_ptr"> 2344 <allocbuf outcount="thread_count_ptr"><jthread/></allocbuf> 2345 <description> 2346 On return, points to an array of the live threads in this thread group. 2347 </description> 2348 </param> 2349 <param id="group_count_ptr"> 2350 <outptr><jint/></outptr> 2351 <description> 2352 On return, points to the number of active child thread groups 2353 </description> 2354 </param> 2355 <param id="groups_ptr"> 2356 <allocbuf outcount="group_count_ptr"><jthreadGroup/></allocbuf> 2357 <description> 2358 On return, points to an array of the active child thread groups. 2359 </description> 2360 </param> 2361 </parameters> 2362 <errors> 2363 </errors> 2364 </function> 2365 </category> 2366 2367 <category id="stack" label="Stack Frame"> 2368 <intro> 2369 These functions provide information about the stack of a thread. 2370 Stack frames are referenced by depth. 2371 The frame at depth zero is the current frame. 2372 <p/> 2373 Stack frames are as described in 2374 <vmspec chapter="3.6"/>, 2375 That is, they correspond to method 2376 invocations (including native methods) but do not correspond to platform native or 2377 VM internal frames. 2378 <p/> 2379 A <jvmti/> implementation may use method invocations to launch a thread and 2380 the corresponding frames may be included in the stack as presented by these functions -- 2381 that is, there may be frames shown 2382 deeper than <code>main()</code> and <code>run()</code>. 2383 However this presentation must be consistent across all <jvmti/> functionality which 2384 uses stack frames or stack depth. 2385 </intro> 2386 2387 <typedef id="jvmtiFrameInfo" label="Stack frame information structure"> 2388 <description> 2389 Information about a stack frame is returned in this structure. 2390 </description> 2391 <field id="method"> 2392 <jmethodID/> 2393 <description> 2394 The method executing in this frame. 2395 </description> 2396 </field> 2397 <field id="location"> 2398 <jlocation/> 2399 <description> 2400 The index of the instruction executing in this frame. 2401 <code>-1</code> if the frame is executing a native method. 2402 </description> 2403 </field> 2404 </typedef> 2405 2406 <typedef id="jvmtiStackInfo" label="Stack information structure"> 2407 <description> 2408 Information about a set of stack frames is returned in this structure. 2409 </description> 2410 <field id="thread"> 2411 <jthread/> 2412 <description> 2413 On return, the thread traced. 2414 </description> 2415 </field> 2416 <field id="state"> 2417 <jint/> 2418 <description> 2419 On return, the thread state. See <functionlink id="GetThreadState"></functionlink>. 2420 </description> 2421 </field> 2422 <field id="frame_buffer"> 2423 <outbuf incount="max_frame_count"> 2424 <struct>jvmtiFrameInfo</struct> 2425 </outbuf> 2426 <description> 2427 On return, this agent allocated buffer is filled 2428 with stack frame information. 2429 </description> 2430 </field> 2431 <field id="frame_count"> 2432 <jint/> 2433 <description> 2434 On return, the number of records filled into 2435 <code>frame_buffer</code>. 2436 This will be 2437 min(<code>max_frame_count</code>, <i>stackDepth</i>). 2438 </description> 2439 </field> 2440 </typedef> 2441 2442 <function id="GetStackTrace" num="104"> 2443 <synopsis>Get Stack Trace</synopsis> 2444 <description> 2445 Get information about the stack of a thread. 2446 If <paramlink id="max_frame_count"></paramlink> is less than the depth of the stack, 2447 the <paramlink id="max_frame_count"></paramlink> topmost frames are returned, 2448 otherwise the entire stack is returned. 2449 The topmost frames, those most recently invoked, are at the beginning of the returned buffer. 2450 <p/> 2451 The following example causes up to five of the topmost frames 2452 to be returned and (if there are any frames) the currently 2453 executing method name to be printed. 2454 <example> 2455 jvmtiFrameInfo frames[5]; 2456 jint count; 2457 jvmtiError err; 2458 2459 err = (*jvmti)->GetStackTrace(jvmti, aThread, 0, 5, 2460 frames, &count); 2461 if (err == JVMTI_ERROR_NONE && count >= 1) { 2462 char *methodName; 2463 err = (*jvmti)->GetMethodName(jvmti, frames[0].method, 2464 &methodName, NULL, NULL); 2465 if (err == JVMTI_ERROR_NONE) { 2466 printf("Executing method: %s", methodName); 2467 } 2468 } 2469 </example> 2470 <todo> 2471 check example code. 2472 </todo> 2473 <p/> 2474 The <paramlink id="thread"></paramlink> need not be suspended 2475 to call this function. 2476 <p/> 2477 The <functionlink id="GetLineNumberTable"></functionlink> 2478 function can be used to map locations to line numbers. Note that 2479 this mapping can be done lazily. 2480 </description> 2481 <origin>jvmpi</origin> 2482 <capabilities> 2483 </capabilities> 2484 <parameters> 2485 <param id="thread"> 2486 <jthread null="current"/> 2487 <description> 2488 Fetch the stack trace of this thread. 2489 </description> 2490 </param> 2491 <param id="start_depth"> 2492 <jint/> 2493 <description> 2494 Begin retrieving frames at this depth. 2495 If non-negative, count from the current frame, 2496 the first frame retrieved is at depth <code>start_depth</code>. 2497 For example, if zero, start from the current frame; if one, start from the 2498 caller of the current frame; if two, start from the caller of the 2499 caller of the current frame; and so on. 2500 If negative, count from below the oldest frame, 2501 the first frame retrieved is at depth <i>stackDepth</i><code> + start_depth</code>, 2502 where <i>stackDepth</i> is the count of frames on the stack. 2503 For example, if negative one, only the oldest frame is retrieved; 2504 if negative two, start from the frame called by the oldest frame. 2505 </description> 2506 </param> 2507 <param id="max_frame_count"> 2508 <jint min="0"/> 2509 <description> 2510 The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve. 2511 </description> 2512 </param> 2513 <param id="frame_buffer"> 2514 <outbuf incount="max_frame_count" outcount="count_ptr"> 2515 <struct>jvmtiFrameInfo</struct> 2516 </outbuf> 2517 <description> 2518 On return, this agent allocated buffer is filled 2519 with stack frame information. 2520 </description> 2521 </param> 2522 <param id="count_ptr"> 2523 <outptr><jint/></outptr> 2524 <description> 2525 On return, points to the number of records filled in. 2526 For non-negative <code>start_depth</code>, this will be 2527 min(<code>max_frame_count</code>, <i>stackDepth</i><code> - start_depth</code>). 2528 For negative <code>start_depth</code>, this will be 2529 min(<code>max_frame_count</code>, <code>-start_depth</code>). 2530 </description> 2531 </param> 2532 </parameters> 2533 <errors> 2534 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 2535 <paramlink id="start_depth"/> is positive and greater than or equal to <i>stackDepth</i>. 2536 Or <paramlink id="start_depth"/> is negative and less than <i>-stackDepth</i>. 2537 </error> 2538 </errors> 2539 </function> 2540 2541 2542 <function id="GetAllStackTraces" num="100"> 2543 <synopsis>Get All Stack Traces</synopsis> 2544 <description> 2545 Get information about the stacks of all live threads 2546 (including <internallink id="RunAgentThread">agent threads</internallink>). 2547 If <paramlink id="max_frame_count"/> is less than the depth of a stack, 2548 the <paramlink id="max_frame_count"/> topmost frames are returned for that thread, 2549 otherwise the entire stack is returned. 2550 The topmost frames, those most recently invoked, are at the beginning of the returned buffer. 2551 <p/> 2552 All stacks are collected simultaneously, that is, no changes will occur to the 2553 thread state or stacks between the sampling of one thread and the next. 2554 The threads need not be suspended. 2555 2556 <example> 2557 jvmtiStackInfo *stack_info; 2558 jint thread_count; 2559 int ti; 2560 jvmtiError err; 2561 2562 err = (*jvmti)->GetAllStackTraces(jvmti, MAX_FRAMES, &stack_info, &thread_count); 2563 if (err != JVMTI_ERROR_NONE) { 2564 ... 2565 } 2566 for (ti = 0; ti < thread_count; ++ti) { 2567 jvmtiStackInfo *infop = &stack_info[ti]; 2568 jthread thread = infop->thread; 2569 jint state = infop->state; 2570 jvmtiFrameInfo *frames = infop->frame_buffer; 2571 int fi; 2572 2573 myThreadAndStatePrinter(thread, state); 2574 for (fi = 0; fi < infop->frame_count; fi++) { 2575 myFramePrinter(frames[fi].method, frames[fi].location); 2576 } 2577 } 2578 /* this one Deallocate call frees all data allocated by GetAllStackTraces */ 2579 err = (*jvmti)->Deallocate(jvmti, stack_info); 2580 </example> 2581 <todo> 2582 check example code. 2583 </todo> 2584 2585 </description> 2586 <origin>new</origin> 2587 <capabilities> 2588 </capabilities> 2589 <parameters> 2590 <param id="max_frame_count"> 2591 <jint min="0"/> 2592 <description> 2593 The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve per thread. 2594 </description> 2595 </param> 2596 <param id="stack_info_ptr"> 2597 <allocbuf> 2598 <struct>jvmtiStackInfo</struct> 2599 </allocbuf> 2600 <description> 2601 On return, this buffer is filled 2602 with stack information for each thread. 2603 The number of <datalink id="jvmtiStackInfo"/> records is determined 2604 by <paramlink id="thread_count_ptr"/>. 2605 <p/> 2606 Note that this buffer is allocated to include the <datalink id="jvmtiFrameInfo"/> 2607 buffers pointed to by <datalink id="jvmtiStackInfo.frame_buffer"/>. 2608 These buffers must not be separately deallocated. 2609 </description> 2610 </param> 2611 <param id="thread_count_ptr"> 2612 <outptr><jint/></outptr> 2613 <description> 2614 The number of threads traced. 2615 </description> 2616 </param> 2617 </parameters> 2618 <errors> 2619 </errors> 2620 </function> 2621 2622 <function id="GetThreadListStackTraces" num="101"> 2623 <synopsis>Get Thread List Stack Traces</synopsis> 2624 <description> 2625 Get information about the stacks of the supplied threads. 2626 If <paramlink id="max_frame_count"/> is less than the depth of a stack, 2627 the <paramlink id="max_frame_count"/> topmost frames are returned for that thread, 2628 otherwise the entire stack is returned. 2629 The topmost frames, those most recently invoked, are at the beginning of the returned buffer. 2630 <p/> 2631 All stacks are collected simultaneously, that is, no changes will occur to the 2632 thread state or stacks between the sampling one thread and the next. 2633 The threads need not be suspended. 2634 <p/> 2635 If a thread has not yet started or terminates before the stack information is collected, 2636 a zero length stack (<datalink id="jvmtiStackInfo.frame_count"/> will be zero) 2637 will be returned and the thread <datalink id="jvmtiStackInfo.state"/> can be checked. 2638 <p/> 2639 See the example for the similar function 2640 <functionlink id="GetAllStackTraces"/>. 2641 </description> 2642 <origin>new</origin> 2643 <capabilities> 2644 </capabilities> 2645 <parameters> 2646 <param id="thread_count"> 2647 <jint min="0"/> 2648 <description> 2649 The number of threads to trace. 2650 </description> 2651 </param> 2652 <param id="thread_list"> 2653 <inbuf incount="thread_count"><jthread/></inbuf> 2654 <description> 2655 The list of threads to trace. 2656 </description> 2657 </param> 2658 <param id="max_frame_count"> 2659 <jint min="0"/> 2660 <description> 2661 The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve per thread. 2662 </description> 2663 </param> 2664 <param id="stack_info_ptr"> 2665 <allocbuf outcount="thread_count"> 2666 <struct>jvmtiStackInfo</struct> 2667 </allocbuf> 2668 <description> 2669 On return, this buffer is filled 2670 with stack information for each thread. 2671 The number of <datalink id="jvmtiStackInfo"/> records is determined 2672 by <paramlink id="thread_count"/>. 2673 <p/> 2674 Note that this buffer is allocated to include the <datalink id="jvmtiFrameInfo"/> 2675 buffers pointed to by <datalink id="jvmtiStackInfo.frame_buffer"/>. 2676 These buffers must not be separately deallocated. 2677 </description> 2678 </param> 2679 </parameters> 2680 <errors> 2681 <error id="JVMTI_ERROR_INVALID_THREAD"> 2682 An element in <paramlink id="thread_list"/> is not a thread object. 2683 </error> 2684 </errors> 2685 </function> 2686 2687 <elide> 2688 <function id="AsyncGetStackTrace" num="1000"> 2689 <synopsis>Get Stack Trace--Asynchronous</synopsis> 2690 <description> 2691 Get information about the entire stack of a thread (or a sub-section of it). 2692 This is the asynchronous version of <functionlink id="GetStackTrace"></functionlink> 2693 and is reentrant and safe to call 2694 from asynchronous signal handlers. 2695 The stack trace is returned only for the calling thread. 2696 <p/> 2697 The <functionlink id="GetLineNumberTable"></functionlink> 2698 function can be used to map locations to line numbers. Note that 2699 this mapping can be done lazily. 2700 </description> 2701 <origin>jvmpi</origin> 2702 <capabilities> 2703 <required id="can_get_async_stack_trace"></required> 2704 <capability id="can_show_JVM_spec_async_frames"> 2705 If <code>false</code>, 2706 <paramlink id="use_java_stack"></paramlink> 2707 must be <code>false</code>. 2708 </capability> 2709 </capabilities> 2710 <parameters> 2711 <param id="use_java_stack"> 2712 <jboolean/> 2713 <description> 2714 Return the stack showing <vmspec/> 2715 model of the stack; 2716 otherwise, show the internal representation of the stack with 2717 inlined and optimized methods missing. If the virtual machine 2718 is using the <i>Java Virtual Machine Specification</i> stack model 2719 internally, this flag is ignored. 2720 </description> 2721 </param> 2722 <param id="max_count"> 2723 <jint min="0"/> 2724 <description> 2725 The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve. 2726 Retrieve this many unless the stack depth is less than <code>max_count</code>. 2727 </description> 2728 </param> 2729 <param id="frame_buffer"> 2730 <outbuf incount="max_count" outcount="count_ptr"> 2731 <struct>jvmtiFrameInfo</struct> 2732 <nullok>this information is not returned</nullok> 2733 </outbuf> 2734 <description> 2735 The agent passes in a buffer 2736 large enough to hold <code>max_count</code> records of 2737 <datalink id="jvmtiFrameInfo"></datalink>. This buffer must be 2738 pre-allocated by the agent. 2739 </description> 2740 </param> 2741 <param id="count_ptr"> 2742 <outptr><jint/></outptr> 2743 <description> 2744 On return, points to the number of records filled in.. 2745 </description> 2746 </param> 2747 </parameters> 2748 <errors> 2749 <error id="JVMTI_ERROR_UNATTACHED_THREAD"> 2750 The thread being used to call this function is not attached 2751 to the virtual machine. Calls must be made from attached threads. 2752 </error> 2753 </errors> 2754 </function> 2755 </elide> 2756 2757 <function id="GetFrameCount" num="16"> 2758 <synopsis>Get Frame Count</synopsis> 2759 <description> 2760 Get the number of frames currently in the specified thread's call stack. 2761 <p/> 2762 If this function is called for a thread actively executing bytecodes (for example, 2763 not the current thread and not suspended), the information returned is transient. 2764 </description> 2765 <origin>jvmdi</origin> 2766 <capabilities> 2767 </capabilities> 2768 <parameters> 2769 <param id="thread"> 2770 <jthread null="current"/> 2771 <description> 2772 The thread to query. 2773 </description> 2774 </param> 2775 <param id="count_ptr"> 2776 <outptr><jint/></outptr> 2777 <description> 2778 On return, points to the number of frames in the call stack. 2779 </description> 2780 </param> 2781 </parameters> 2782 <errors> 2783 </errors> 2784 </function> 2785 2786 <function id="PopFrame" num="80"> 2787 <synopsis>Pop Frame</synopsis> 2788 <description> 2789 Pop the current frame of <code>thread</code>'s stack. 2790 Popping a frame takes you to the previous frame. 2791 When the thread is resumed, the execution 2792 state of the thread is reset to the state 2793 immediately before the called method was invoked. 2794 That is (using <vmspec/> terminology): 2795 <ul> 2796 <li>the current frame is discarded as the previous frame becomes the current one</li> 2797 <li>the operand stack is restored--the argument values are added back 2798 and if the invoke was not <code>invokestatic</code>, 2799 <code>objectref</code> is added back as well</li> 2800 <li>the Java virtual machine PC is restored to the opcode 2801 of the invoke instruction</li> 2802 </ul> 2803 Note however, that any changes to the arguments, which 2804 occurred in the called method, remain; 2805 when execution continues, the first instruction to 2806 execute will be the invoke. 2807 <p/> 2808 Between calling <code>PopFrame</code> and resuming the 2809 thread the state of the stack is undefined. 2810 To pop frames beyond the first, 2811 these three steps must be repeated: 2812 <ul> 2813 <li>suspend the thread via an event (step, breakpoint, ...)</li> 2814 <li>call <code>PopFrame</code></li> 2815 <li>resume the thread</li> 2816 </ul> 2817 <p/> 2818 A lock acquired by calling the called method 2819 (if it is a <code>synchronized</code> method) 2820 and locks acquired by entering <code>synchronized</code> 2821 blocks within the called method are released. 2822 Note: this does not apply to native locks or 2823 <code>java.util.concurrent.locks</code> locks. 2824 <p/> 2825 Finally blocks are not executed. 2826 <p/> 2827 Changes to global state are not addressed and thus remain changed. 2828 <p/> 2829 The specified thread must be suspended or must be the current thread. 2830 <p/> 2831 Both the called method and calling method must be non-native Java programming 2832 language methods. 2833 <p/> 2834 No <jvmti/> events are generated by this function. 2835 </description> 2836 <origin>jvmdi</origin> 2837 <capabilities> 2838 <required id="can_pop_frame"></required> 2839 </capabilities> 2840 <parameters> 2841 <param id="thread"> 2842 <jthread/> 2843 <description> 2844 The thread whose current frame is to be popped. 2845 </description> 2846 </param> 2847 </parameters> 2848 <errors> 2849 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 2850 Called or calling method is a native method. 2851 The implementation is unable to pop this frame. 2852 </error> 2853 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 2854 Thread was not suspended and was not the current thread. 2855 </error> 2856 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 2857 There are less than two stack frames on the call stack. 2858 </error> 2859 </errors> 2860 </function> 2861 2862 <function id="GetFrameLocation" num="19"> 2863 <synopsis>Get Frame Location</synopsis> 2864 <description> 2865 <p/> 2866 For a Java programming language frame, return the location of the instruction 2867 currently executing. 2868 </description> 2869 <origin>jvmdiClone</origin> 2870 <capabilities> 2871 </capabilities> 2872 <parameters> 2873 <param id="thread"> 2874 <jthread null="current" frame="frame"/> 2875 <description> 2876 The thread of the frame to query. 2877 </description> 2878 </param> 2879 <param id="depth"> 2880 <jframeID thread="thread"/> 2881 <description> 2882 The depth of the frame to query. 2883 </description> 2884 </param> 2885 <param id="method_ptr"> 2886 <outptr><jmethodID/></outptr> 2887 <description> 2888 On return, points to the method for the current location. 2889 </description> 2890 </param> 2891 <param id="location_ptr"> 2892 <outptr><jlocation/></outptr> 2893 <description> 2894 On return, points to the index of the currently 2895 executing instruction. 2896 Is set to <code>-1</code> if the frame is executing 2897 a native method. 2898 </description> 2899 </param> 2900 </parameters> 2901 <errors> 2902 </errors> 2903 </function> 2904 2905 <function id="NotifyFramePop" num="20"> 2906 <synopsis>Notify Frame Pop</synopsis> 2907 <description> 2908 When the frame that is currently at <paramlink id="depth"></paramlink> 2909 is popped from the stack, generate a 2910 <eventlink id="FramePop"></eventlink> event. See the 2911 <eventlink id="FramePop"></eventlink> event for details. 2912 Only frames corresponding to non-native Java programming language 2913 methods can receive notification. 2914 <p/> 2915 The specified thread must be suspended or must be the current thread. 2916 </description> 2917 <origin>jvmdi</origin> 2918 <capabilities> 2919 <required id="can_generate_frame_pop_events"></required> 2920 </capabilities> 2921 <parameters> 2922 <param id="thread"> 2923 <jthread null="current" frame="depth"/> 2924 <description> 2925 The thread of the frame for which the frame pop event will be generated. 2926 </description> 2927 </param> 2928 <param id="depth"> 2929 <jframeID thread="thread"/> 2930 <description> 2931 The depth of the frame for which the frame pop event will be generated. 2932 </description> 2933 </param> 2934 </parameters> 2935 <errors> 2936 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 2937 The frame at <code>depth</code> is executing a 2938 native method. 2939 </error> 2940 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 2941 Thread was not suspended and was not the current thread. 2942 </error> 2943 </errors> 2944 </function> 2945 2946 </category> 2947 2948 <category id="ForceEarlyReturn" label="Force Early Return"> 2949 <intro> 2950 These functions allow an agent to force a method 2951 to return at any point during its execution. 2952 The method which will return early is referred to as the <i>called method</i>. 2953 The called method is the current method 2954 (as defined by 2955 <vmspec chapter="3.6"/>) 2956 for the specified thread at 2957 the time the function is called. 2958 <p/> 2959 The specified thread must be suspended or must be the current thread. 2960 The return occurs when execution of Java programming 2961 language code is resumed on this thread. 2962 Between calling one of these functions and resumption 2963 of thread execution, the state of the stack is undefined. 2964 <p/> 2965 No further instructions are executed in the called method. 2966 Specifically, finally blocks are not executed. 2967 Note: this can cause inconsistent states in the application. 2968 <p/> 2969 A lock acquired by calling the called method 2970 (if it is a <code>synchronized</code> method) 2971 and locks acquired by entering <code>synchronized</code> 2972 blocks within the called method are released. 2973 Note: this does not apply to native locks or 2974 <code>java.util.concurrent.locks</code> locks. 2975 <p/> 2976 Events, such as <eventlink id="MethodExit"></eventlink>, 2977 are generated as they would be in a normal return. 2978 <p/> 2979 The called method must be a non-native Java programming 2980 language method. 2981 Forcing return on a thread with only one frame on the 2982 stack causes the thread to exit when resumed. 2983 </intro> 2984 2985 <function id="ForceEarlyReturnObject" num="81" since="1.1"> 2986 <synopsis>Force Early Return - Object</synopsis> 2987 <description> 2988 This function can be used to return from a method whose 2989 result type is <code>Object</code> 2990 or a subclass of <code>Object</code>. 2991 </description> 2992 <origin>new</origin> 2993 <capabilities> 2994 <required id="can_force_early_return"></required> 2995 </capabilities> 2996 <parameters> 2997 <param id="thread"> 2998 <jthread null="current"/> 2999 <description> 3000 The thread whose current frame is to return early. 3001 </description> 3002 </param> 3003 <param id="value"> 3004 <jobject/> 3005 <description> 3006 The return value for the called frame. 3007 An object or <code>NULL</code>. 3008 </description> 3009 </param> 3010 </parameters> 3011 <errors> 3012 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3013 Attempted to return early from a frame 3014 corresponding to a native method. 3015 Or the implementation is unable to provide 3016 this functionality on this frame. 3017 </error> 3018 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3019 The result type of the called method is not 3020 <code>Object</code> or a subclass of <code>Object</code>. 3021 </error> 3022 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3023 The supplied <paramlink id="value"/> is not compatible with the 3024 result type of the called method. 3025 </error> 3026 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3027 Thread was not suspended and was not the current thread. 3028 </error> 3029 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3030 There are no more frames on the call stack. 3031 </error> 3032 </errors> 3033 </function> 3034 3035 <function id="ForceEarlyReturnInt" num="82" since="1.1"> 3036 <synopsis>Force Early Return - Int</synopsis> 3037 <description> 3038 This function can be used to return from a method whose 3039 result type is <code>int</code>, <code>short</code>, 3040 <code>char</code>, <code>byte</code>, or 3041 <code>boolean</code>. 3042 </description> 3043 <origin>new</origin> 3044 <capabilities> 3045 <required id="can_force_early_return"></required> 3046 </capabilities> 3047 <parameters> 3048 <param id="thread"> 3049 <jthread null="current"/> 3050 <description> 3051 The thread whose current frame is to return early. 3052 </description> 3053 </param> 3054 <param id="value"> 3055 <jint/> 3056 <description> 3057 The return value for the called frame. 3058 </description> 3059 </param> 3060 </parameters> 3061 <errors> 3062 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3063 Attempted to return early from a frame 3064 corresponding to a native method. 3065 Or the implementation is unable to provide 3066 this functionality on this frame. 3067 </error> 3068 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3069 The result type of the called method is not 3070 <code>int</code>, <code>short</code>, 3071 <code>char</code>, <code>byte</code>, or 3072 <code>boolean</code>. 3073 </error> 3074 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3075 Thread was not suspended and was not the current thread. 3076 </error> 3077 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3078 There are no frames on the call stack. 3079 </error> 3080 </errors> 3081 </function> 3082 3083 <function id="ForceEarlyReturnLong" num="83" since="1.1"> 3084 <synopsis>Force Early Return - Long</synopsis> 3085 <description> 3086 This function can be used to return from a method whose 3087 result type is <code>long</code>. 3088 </description> 3089 <origin>new</origin> 3090 <capabilities> 3091 <required id="can_force_early_return"></required> 3092 </capabilities> 3093 <parameters> 3094 <param id="thread"> 3095 <jthread null="current"/> 3096 <description> 3097 The thread whose current frame is to return early. 3098 </description> 3099 </param> 3100 <param id="value"> 3101 <jlong/> 3102 <description> 3103 The return value for the called frame. 3104 </description> 3105 </param> 3106 </parameters> 3107 <errors> 3108 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3109 Attempted to return early from a frame 3110 corresponding to a native method. 3111 Or the implementation is unable to provide 3112 this functionality on this frame. 3113 </error> 3114 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3115 The result type of the called method is not <code>long</code>. 3116 </error> 3117 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3118 Thread was not suspended and was not the current thread. 3119 </error> 3120 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3121 There are no frames on the call stack. 3122 </error> 3123 </errors> 3124 </function> 3125 3126 <function id="ForceEarlyReturnFloat" num="84" since="1.1"> 3127 <synopsis>Force Early Return - Float</synopsis> 3128 <description> 3129 This function can be used to return from a method whose 3130 result type is <code>float</code>. 3131 </description> 3132 <origin>new</origin> 3133 <capabilities> 3134 <required id="can_force_early_return"></required> 3135 </capabilities> 3136 <parameters> 3137 <param id="thread"> 3138 <jthread null="current"/> 3139 <description> 3140 The thread whose current frame is to return early. 3141 </description> 3142 </param> 3143 <param id="value"> 3144 <jfloat/> 3145 <description> 3146 The return value for the called frame. 3147 </description> 3148 </param> 3149 </parameters> 3150 <errors> 3151 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3152 Attempted to return early from a frame 3153 corresponding to a native method. 3154 Or the implementation is unable to provide 3155 this functionality on this frame. 3156 </error> 3157 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3158 The result type of the called method is not <code>float</code>. 3159 </error> 3160 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3161 Thread was not suspended and was not the current thread. 3162 </error> 3163 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3164 There are no frames on the call stack. 3165 </error> 3166 </errors> 3167 </function> 3168 3169 <function id="ForceEarlyReturnDouble" num="85" since="1.1"> 3170 <synopsis>Force Early Return - Double</synopsis> 3171 <description> 3172 This function can be used to return from a method whose 3173 result type is <code>double</code>. 3174 </description> 3175 <origin>new</origin> 3176 <capabilities> 3177 <required id="can_force_early_return"></required> 3178 </capabilities> 3179 <parameters> 3180 <param id="thread"> 3181 <jthread null="current"/> 3182 <description> 3183 The thread whose current frame is to return early. 3184 </description> 3185 </param> 3186 <param id="value"> 3187 <jdouble/> 3188 <description> 3189 The return value for the called frame. 3190 </description> 3191 </param> 3192 </parameters> 3193 <errors> 3194 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3195 Attempted to return early from a frame corresponding to a native method. 3196 Or the implementation is unable to provide this functionality on this frame. 3197 </error> 3198 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3199 The result type of the called method is not <code>double</code>. 3200 </error> 3201 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3202 Thread was not suspended and was not the current thread. 3203 </error> 3204 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3205 There are no frames on the call stack. 3206 </error> 3207 </errors> 3208 </function> 3209 3210 <function id="ForceEarlyReturnVoid" num="86" since="1.1"> 3211 <synopsis>Force Early Return - Void</synopsis> 3212 <description> 3213 This function can be used to return from a method with no result type. 3214 That is, the called method must be declared <code>void</code>. 3215 </description> 3216 <origin>new</origin> 3217 <capabilities> 3218 <required id="can_force_early_return"></required> 3219 </capabilities> 3220 <parameters> 3221 <param id="thread"> 3222 <jthread null="current"/> 3223 <description> 3224 The thread whose current frame is to return early. 3225 </description> 3226 </param> 3227 </parameters> 3228 <errors> 3229 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 3230 Attempted to return early from a frame 3231 corresponding to a native method. 3232 Or the implementation is unable to provide 3233 this functionality on this frame. 3234 </error> 3235 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 3236 The called method has a result type. 3237 </error> 3238 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED"> 3239 Thread was not suspended and was not the current thread. 3240 </error> 3241 <error id="JVMTI_ERROR_NO_MORE_FRAMES"> 3242 There are no frames on the call stack. 3243 </error> 3244 </errors> 3245 </function> 3246 3247 </category> 3248 3249 <category id="Heap" label="Heap"> 3250 <intro> 3251 These functions are used to analyze the heap. 3252 Functionality includes the ability to view the objects in the 3253 heap and to tag these objects. 3254 </intro> 3255 3256 <intro id="objectTags" label="Object Tags"> 3257 A <i>tag</i> is a value associated with an object. 3258 Tags are explicitly set by the agent using the 3259 <functionlink id="SetTag"></functionlink> function or by 3260 callback functions such as <functionlink id="jvmtiHeapIterationCallback"/>. 3261 <p/> 3262 Tags are local to the environment; that is, the tags of one 3263 environment are not visible in another. 3264 <p/> 3265 Tags are <code>jlong</code> values which can be used 3266 simply to mark an object or to store a pointer to more detailed 3267 information. Objects which have not been tagged have a 3268 tag of zero. 3269 Setting a tag to zero makes the object untagged. 3270 </intro> 3271 3272 <intro id="heapCallbacks" label="Heap Callback Functions"> 3273 Heap functions which iterate through the heap and recursively 3274 follow object references use agent supplied callback functions 3275 to deliver the information. 3276 <p/> 3277 These heap callback functions must adhere to the following restrictions -- 3278 These callbacks must not use JNI functions. 3279 These callbacks must not use <jvmti/> functions except 3280 <i>callback safe</i> functions which 3281 specifically allow such use (see the raw monitor, memory management, 3282 and environment local storage functions). 3283 <p/> 3284 An implementation may invoke a callback on an internal thread or 3285 the thread which called the iteration function. 3286 Heap callbacks are single threaded -- no more than one callback will 3287 be invoked at a time. 3288 <p/> 3289 The Heap Filter Flags can be used to prevent reporting 3290 based on the tag status of an object or its class. 3291 If no flags are set (the <code>jint</code> is zero), objects 3292 will not be filtered out. 3293 3294 <constants id="jvmtiHeapFilter" label="Heap Filter Flags" kind="bits"> 3295 <constant id="JVMTI_HEAP_FILTER_TAGGED" num="0x4"> 3296 Filter out tagged objects. Objects which are tagged are not included. 3297 </constant> 3298 <constant id="JVMTI_HEAP_FILTER_UNTAGGED" num="0x8"> 3299 Filter out untagged objects. Objects which are not tagged are not included. 3300 </constant> 3301 <constant id="JVMTI_HEAP_FILTER_CLASS_TAGGED" num="0x10"> 3302 Filter out objects with tagged classes. Objects whose class is tagged are not included. 3303 </constant> 3304 <constant id="JVMTI_HEAP_FILTER_CLASS_UNTAGGED" num="0x20"> 3305 Filter out objects with untagged classes. Objects whose class is not tagged are not included. 3306 </constant> 3307 </constants> 3308 3309 <p/> 3310 The Heap Visit Control Flags are returned by the heap callbacks 3311 and can be used to abort the iteration. For the 3312 <functionlink id="jvmtiHeapReferenceCallback">Heap 3313 Reference Callback</functionlink>, it can also be used 3314 to prune the graph of traversed references 3315 (<code>JVMTI_VISIT_OBJECTS</code> is not set). 3316 3317 <constants id="jvmtiHeapVisitControl" 3318 label="Heap Visit Control Flags" 3319 kind="bits" 3320 since="1.1"> 3321 <constant id="JVMTI_VISIT_OBJECTS" num="0x100"> 3322 If we are visiting an object and if this callback 3323 was initiated by <functionlink id="FollowReferences"/>, 3324 traverse the references of this object. 3325 Otherwise ignored. 3326 </constant> 3327 <constant id="JVMTI_VISIT_ABORT" num="0x8000"> 3328 Abort the iteration. Ignore all other bits. 3329 </constant> 3330 </constants> 3331 3332 <p/> 3333 The Heap Reference Enumeration is provided by the 3334 <functionlink id="jvmtiHeapReferenceCallback">Heap 3335 Reference Callback</functionlink> and 3336 <functionlink id="jvmtiPrimitiveFieldCallback">Primitive Field 3337 Callback</functionlink> to 3338 describe the kind of reference 3339 being reported. 3340 3341 <constants id="jvmtiHeapReferenceKind" 3342 label="Heap Reference Enumeration" 3343 kind="enum" 3344 since="1.1"> 3345 <constant id="JVMTI_HEAP_REFERENCE_CLASS" num="1"> 3346 Reference from an object to its class. 3347 </constant> 3348 <constant id="JVMTI_HEAP_REFERENCE_FIELD" num="2"> 3349 Reference from an object to the value of one of its instance fields. 3350 </constant> 3351 <constant id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT" num="3"> 3352 Reference from an array to one of its elements. 3353 </constant> 3354 <constant id="JVMTI_HEAP_REFERENCE_CLASS_LOADER" num="4"> 3355 Reference from a class to its class loader. 3356 </constant> 3357 <constant id="JVMTI_HEAP_REFERENCE_SIGNERS" num="5"> 3358 Reference from a class to its signers array. 3359 </constant> 3360 <constant id="JVMTI_HEAP_REFERENCE_PROTECTION_DOMAIN" num="6"> 3361 Reference from a class to its protection domain. 3362 </constant> 3363 <constant id="JVMTI_HEAP_REFERENCE_INTERFACE" num="7"> 3364 Reference from a class to one of its interfaces. 3365 Note: interfaces are defined via a constant pool reference, 3366 so the referenced interfaces may also be reported with a 3367 <code>JVMTI_HEAP_REFERENCE_CONSTANT_POOL</code> reference kind. 3368 </constant> 3369 <constant id="JVMTI_HEAP_REFERENCE_STATIC_FIELD" num="8"> 3370 Reference from a class to the value of one of its static fields. 3371 </constant> 3372 <constant id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL" num="9"> 3373 Reference from a class to a resolved entry in the constant pool. 3374 </constant> 3375 <constant id="JVMTI_HEAP_REFERENCE_SUPERCLASS" num="10"> 3376 Reference from a class to its superclass. 3377 A callback is not sent if the superclass is <code>java.lang.Object</code>. 3378 Note: loaded classes define superclasses via a constant pool 3379 reference, so the referenced superclass may also be reported with 3380 a <code>JVMTI_HEAP_REFERENCE_CONSTANT_POOL</code> reference kind. 3381 </constant> 3382 <constant id="JVMTI_HEAP_REFERENCE_JNI_GLOBAL" num="21"> 3383 Heap root reference: JNI global reference. 3384 </constant> 3385 <constant id="JVMTI_HEAP_REFERENCE_SYSTEM_CLASS" num="22"> 3386 Heap root reference: System class. 3387 </constant> 3388 <constant id="JVMTI_HEAP_REFERENCE_MONITOR" num="23"> 3389 Heap root reference: monitor. 3390 </constant> 3391 <constant id="JVMTI_HEAP_REFERENCE_STACK_LOCAL" num="24"> 3392 Heap root reference: local variable on the stack. 3393 </constant> 3394 <constant id="JVMTI_HEAP_REFERENCE_JNI_LOCAL" num="25"> 3395 Heap root reference: JNI local reference. 3396 </constant> 3397 <constant id="JVMTI_HEAP_REFERENCE_THREAD" num="26"> 3398 Heap root reference: Thread. 3399 </constant> 3400 <constant id="JVMTI_HEAP_REFERENCE_OTHER" num="27"> 3401 Heap root reference: other heap root reference. 3402 </constant> 3403 </constants> 3404 3405 <p/> 3406 Definitions for the single character type descriptors of 3407 primitive types. 3408 3409 <constants id="jvmtiPrimitiveType" 3410 label="Primitive Type Enumeration" 3411 kind="enum" 3412 since="1.1"> 3413 <constant id="JVMTI_PRIMITIVE_TYPE_BOOLEAN" num="90"> 3414 'Z' - Java programming language <code>boolean</code> - JNI <code>jboolean</code> 3415 </constant> 3416 <constant id="JVMTI_PRIMITIVE_TYPE_BYTE" num="66"> 3417 'B' - Java programming language <code>byte</code> - JNI <code>jbyte</code> 3418 </constant> 3419 <constant id="JVMTI_PRIMITIVE_TYPE_CHAR" num="67"> 3420 'C' - Java programming language <code>char</code> - JNI <code>jchar</code> 3421 </constant> 3422 <constant id="JVMTI_PRIMITIVE_TYPE_SHORT" num="83"> 3423 'S' - Java programming language <code>short</code> - JNI <code>jshort</code> 3424 </constant> 3425 <constant id="JVMTI_PRIMITIVE_TYPE_INT" num="73"> 3426 'I' - Java programming language <code>int</code> - JNI <code>jint</code> 3427 </constant> 3428 <constant id="JVMTI_PRIMITIVE_TYPE_LONG" num="74"> 3429 'J' - Java programming language <code>long</code> - JNI <code>jlong</code> 3430 </constant> 3431 <constant id="JVMTI_PRIMITIVE_TYPE_FLOAT" num="70"> 3432 'F' - Java programming language <code>float</code> - JNI <code>jfloat</code> 3433 </constant> 3434 <constant id="JVMTI_PRIMITIVE_TYPE_DOUBLE" num="68"> 3435 'D' - Java programming language <code>double</code> - JNI <code>jdouble</code> 3436 </constant> 3437 </constants> 3438 </intro> 3439 3440 <typedef id="jvmtiHeapReferenceInfoField" 3441 label="Reference information structure for Field references" 3442 since="1.1"> 3443 <description> 3444 Reference information returned for 3445 <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/> and 3446 <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/> references. 3447 </description> 3448 <field id="index"> 3449 <jint/> 3450 <description> 3451 For <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/>, the 3452 referrer object is not a class or an interface. 3453 In this case, <code>index</code> is the index of the field 3454 in the class of the referrer object. 3455 This class is referred to below as <i>C</i>. 3456 <p/> 3457 For <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/>, 3458 the referrer object is a class (referred to below as <i>C</i>) 3459 or an interface (referred to below as <i>I</i>). 3460 In this case, <code>index</code> is the index of the field in 3461 that class or interface. 3462 <p/> 3463 If the referrer object is not an interface, then the field 3464 indices are determined as follows: 3465 <ul> 3466 <li>make a list of all the fields in <i>C</i> and its 3467 superclasses, starting with all the fields in 3468 <code>java.lang.Object</code> and ending with all the 3469 fields in <i>C</i>.</li> 3470 <li>Within this list, put 3471 the fields for a given class in the order returned by 3472 <functionlink id="GetClassFields"/>.</li> 3473 <li>Assign the fields in this list indices 3474 <i>n</i>, <i>n</i>+1, ..., in order, where <i>n</i> 3475 is the count of the fields in all the interfaces 3476 implemented by <i>C</i>. 3477 Note that <i>C</i> implements all interfaces 3478 directly implemented by its superclasses; as well 3479 as all superinterfaces of these interfaces.</li> 3480 </ul> 3481 If the referrer object is an interface, then the field 3482 indices are determined as follows: 3483 <ul> 3484 <li>make a list of the fields directly declared in 3485 <i>I</i>.</li> 3486 <li>Within this list, put 3487 the fields in the order returned by 3488 <functionlink id="GetClassFields"/>.</li> 3489 <li>Assign the fields in this list indices 3490 <i>n</i>, <i>n</i>+1, ..., in order, where <i>n</i> 3491 is the count of the fields in all the superinterfaces 3492 of <i>I</i>.</li> 3493 </ul> 3494 All fields are included in this computation, regardless of 3495 field modifier (static, public, private, etc). 3496 <p/> 3497 For example, given the following classes and interfaces: 3498 <example> 3499 interface I0 { 3500 int p = 0; 3501 } 3502 3503 interface I1 extends I0 { 3504 int x = 1; 3505 } 3506 3507 interface I2 extends I0 { 3508 int y = 2; 3509 } 3510 3511 class C1 implements I1 { 3512 public static int a = 3; 3513 private int b = 4; 3514 } 3515 3516 class C2 extends C1 implements I2 { 3517 static int q = 5; 3518 final int r = 6; 3519 } 3520 </example> 3521 Assume that <functionlink id="GetClassFields"/> called on 3522 <code>C1</code> returns the fields of <code>C1</code> in the 3523 order: a, b; and that the fields of <code>C2</code> are 3524 returned in the order: q, r. 3525 An instance of class <code>C1</code> will have the 3526 following field indices: 3527 <blockquote><table> 3528 <tr class="bgLight"> 3529 <th class="centered" scope="col">Field</th> 3530 <th class="centered" scope="col">Index</th> 3531 <th scope="col">Description</th> 3532 </tr> 3533 <tr> 3534 <th class="centered" scope="row"> 3535 a 3536 </th> 3537 <td class="centered"> 3538 2 3539 </td> 3540 <td> 3541 The count of the fields in the interfaces 3542 implemented by <code>C1</code> is two (<i>n</i>=2): 3543 <code>p</code> of <code>I0</code> 3544 and <code>x</code> of <code>I1</code>. 3545 </td> 3546 </tr> 3547 <tr> 3548 <th class="centered" scope="row"> 3549 b 3550 </th> 3551 <td class="centered"> 3552 3 3553 </td> 3554 <td> 3555 the subsequent index. 3556 </td> 3557 </tr> 3558 </table></blockquote> 3559 The class <code>C1</code> will have the same field indices. 3560 <p/> 3561 An instance of class <code>C2</code> will have the 3562 following field indices: 3563 <blockquote><table> 3564 <tr class="bgLight"> 3565 <th class="centered" scope="col">Field</th> 3566 <th class="centered" scope="col">Index</th> 3567 <th scope="col">Description</th> 3568 </tr> 3569 <tr> 3570 <th class="centered" scope="row"> 3571 a 3572 </th> 3573 <td class="centered"> 3574 3 3575 </td> 3576 <td> 3577 The count of the fields in the interfaces 3578 implemented by <code>C2</code> is three (<i>n</i>=3): 3579 <code>p</code> of <code>I0</code>, 3580 <code>x</code> of <code>I1</code> and <code>y</code> of <code>I2</code> 3581 (an interface of <code>C2</code>). Note that the field <code>p</code> 3582 of <code>I0</code> is only included once. 3583 </td> 3584 </tr> 3585 <tr> 3586 <th class="centered" scope="row"> 3587 b 3588 </th> 3589 <td class="centered"> 3590 4 3591 </td> 3592 <td> 3593 the subsequent index to "a". 3594 </td> 3595 </tr> 3596 <tr> 3597 <th class="centered" scope="row"> 3598 q 3599 </th> 3600 <td class="centered"> 3601 5 3602 </td> 3603 <td> 3604 the subsequent index to "b". 3605 </td> 3606 </tr> 3607 <tr> 3608 <th class="centered" scope="row"> 3609 r 3610 </th> 3611 <td class="centered"> 3612 6 3613 </td> 3614 <td> 3615 the subsequent index to "q". 3616 </td> 3617 </tr> 3618 </table></blockquote> 3619 The class <code>C2</code> will have the same field indices. 3620 Note that a field may have a different index depending on the 3621 object that is viewing it -- for example field "a" above. 3622 Note also: not all field indices may be visible from the 3623 callbacks, but all indices are shown for illustrative purposes. 3624 <p/> 3625 The interface <code>I1</code> will have the 3626 following field indices: 3627 <blockquote><table> 3628 <tr class="bgLight"> 3629 <th class="centered" scope="col">Field</th> 3630 <th class="centered" scope="col">Index</th> 3631 <th scope="col">Description</th> 3632 </tr> 3633 <tr> 3634 <th class="centered" scope="row"> 3635 x 3636 </th> 3637 <td class="centered"> 3638 1 3639 </td> 3640 <td> 3641 The count of the fields in the superinterfaces 3642 of <code>I1</code> is one (<i>n</i>=1): 3643 <code>p</code> of <code>I0</code>. 3644 </td> 3645 </tr> 3646 </table></blockquote> 3647 </description> 3648 </field> 3649 </typedef> 3650 3651 <typedef id="jvmtiHeapReferenceInfoArray" 3652 label="Reference information structure for Array references" 3653 since="1.1"> 3654 <description> 3655 Reference information returned for 3656 <datalink id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT"/> references. 3657 </description> 3658 <field id="index"> 3659 <jint/> 3660 <description> 3661 The array index. 3662 </description> 3663 </field> 3664 </typedef> 3665 3666 <typedef id="jvmtiHeapReferenceInfoConstantPool" 3667 label="Reference information structure for Constant Pool references" 3668 since="1.1"> 3669 <description> 3670 Reference information returned for 3671 <datalink id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL"/> references. 3672 </description> 3673 <field id="index"> 3674 <jint/> 3675 <description> 3676 The index into the constant pool of the class. See the description in 3677 <vmspec chapter="4.4"/>. 3678 </description> 3679 </field> 3680 </typedef> 3681 3682 <typedef id="jvmtiHeapReferenceInfoStackLocal" 3683 label="Reference information structure for Local Variable references" 3684 since="1.1"> 3685 <description> 3686 Reference information returned for 3687 <datalink id="JVMTI_HEAP_REFERENCE_STACK_LOCAL"/> references. 3688 </description> 3689 <field id="thread_tag"> 3690 <jlong/> 3691 <description> 3692 The tag of the thread corresponding to this stack, zero if not tagged. 3693 </description> 3694 </field> 3695 <field id="thread_id"> 3696 <jlong/> 3697 <description> 3698 The unique thread ID of the thread corresponding to this stack. 3699 </description> 3700 </field> 3701 <field id="depth"> 3702 <jint/> 3703 <description> 3704 The depth of the frame. 3705 </description> 3706 </field> 3707 <field id="method"> 3708 <jmethodID/> 3709 <description> 3710 The method executing in this frame. 3711 </description> 3712 </field> 3713 <field id="location"> 3714 <jlocation/> 3715 <description> 3716 The currently executing location in this frame. 3717 </description> 3718 </field> 3719 <field id="slot"> 3720 <jint/> 3721 <description> 3722 The slot number of the local variable. 3723 </description> 3724 </field> 3725 </typedef> 3726 3727 <typedef id="jvmtiHeapReferenceInfoJniLocal" 3728 label="Reference information structure for JNI local references" 3729 since="1.1"> 3730 <description> 3731 Reference information returned for 3732 <datalink id="JVMTI_HEAP_REFERENCE_JNI_LOCAL"/> references. 3733 </description> 3734 <field id="thread_tag"> 3735 <jlong/> 3736 <description> 3737 The tag of the thread corresponding to this stack, zero if not tagged. 3738 </description> 3739 </field> 3740 <field id="thread_id"> 3741 <jlong/> 3742 <description> 3743 The unique thread ID of the thread corresponding to this stack. 3744 </description> 3745 </field> 3746 <field id="depth"> 3747 <jint/> 3748 <description> 3749 The depth of the frame. 3750 </description> 3751 </field> 3752 <field id="method"> 3753 <jmethodID/> 3754 <description> 3755 The method executing in this frame. 3756 </description> 3757 </field> 3758 </typedef> 3759 3760 <typedef id="jvmtiHeapReferenceInfoReserved" 3761 label="Reference information structure for Other references" 3762 since="1.1"> 3763 <description> 3764 Reference information returned for other references. 3765 </description> 3766 <field id="reserved1"> 3767 <jlong/> 3768 <description> 3769 reserved for future use. 3770 </description> 3771 </field> 3772 <field id="reserved2"> 3773 <jlong/> 3774 <description> 3775 reserved for future use. 3776 </description> 3777 </field> 3778 <field id="reserved3"> 3779 <jlong/> 3780 <description> 3781 reserved for future use. 3782 </description> 3783 </field> 3784 <field id="reserved4"> 3785 <jlong/> 3786 <description> 3787 reserved for future use. 3788 </description> 3789 </field> 3790 <field id="reserved5"> 3791 <jlong/> 3792 <description> 3793 reserved for future use. 3794 </description> 3795 </field> 3796 <field id="reserved6"> 3797 <jlong/> 3798 <description> 3799 reserved for future use. 3800 </description> 3801 </field> 3802 <field id="reserved7"> 3803 <jlong/> 3804 <description> 3805 reserved for future use. 3806 </description> 3807 </field> 3808 <field id="reserved8"> 3809 <jlong/> 3810 <description> 3811 reserved for future use. 3812 </description> 3813 </field> 3814 </typedef> 3815 3816 <uniontypedef id="jvmtiHeapReferenceInfo" 3817 label="Reference information structure" 3818 since="1.1"> 3819 <description> 3820 The information returned about referrers. 3821 Represented as a union of the various kinds of reference information. 3822 </description> 3823 <field id="field"> 3824 <struct>jvmtiHeapReferenceInfoField</struct> 3825 <description> 3826 The referrer information for 3827 <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/> 3828 and <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/> references. 3829 </description> 3830 </field> 3831 <field id="array"> 3832 <struct>jvmtiHeapReferenceInfoArray</struct> 3833 <description> 3834 The referrer information for 3835 For <datalink id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT"/> references. 3836 </description> 3837 </field> 3838 <field id="constant_pool"> 3839 <struct>jvmtiHeapReferenceInfoConstantPool</struct> 3840 <description> 3841 The referrer information for 3842 For <datalink id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL"/> references. 3843 </description> 3844 </field> 3845 <field id="stack_local"> 3846 <struct>jvmtiHeapReferenceInfoStackLocal</struct> 3847 <description> 3848 The referrer information for 3849 For <datalink id="JVMTI_HEAP_REFERENCE_STACK_LOCAL"/> references. 3850 </description> 3851 </field> 3852 <field id="jni_local"> 3853 <struct>jvmtiHeapReferenceInfoJniLocal</struct> 3854 <description> 3855 The referrer information for 3856 For <datalink id="JVMTI_HEAP_REFERENCE_JNI_LOCAL"/> references. 3857 </description> 3858 </field> 3859 <field id="other"> 3860 <struct>jvmtiHeapReferenceInfoReserved</struct> 3861 <description> 3862 reserved for future use. 3863 </description> 3864 </field> 3865 </uniontypedef> 3866 3867 <typedef id="jvmtiHeapCallbacks" 3868 label="Heap callback function structure" 3869 since="1.1"> 3870 <field id="heap_iteration_callback"> 3871 <ptrtype> 3872 <struct>jvmtiHeapIterationCallback</struct> 3873 </ptrtype> 3874 <description> 3875 The callback to be called to describe an 3876 object in the heap. Used by the 3877 <functionlink id="IterateThroughHeap"/> function, ignored by the 3878 <functionlink id="FollowReferences"/> function. 3879 </description> 3880 </field> 3881 <field id="heap_reference_callback"> 3882 <ptrtype> 3883 <struct>jvmtiHeapReferenceCallback</struct> 3884 </ptrtype> 3885 <description> 3886 The callback to be called to describe an 3887 object reference. Used by the 3888 <functionlink id="FollowReferences"/> function, ignored by the 3889 <functionlink id="IterateThroughHeap"/> function. 3890 </description> 3891 </field> 3892 <field id="primitive_field_callback"> 3893 <ptrtype> 3894 <struct>jvmtiPrimitiveFieldCallback</struct> 3895 </ptrtype> 3896 <description> 3897 The callback to be called to describe a 3898 primitive field. 3899 </description> 3900 </field> 3901 <field id="array_primitive_value_callback"> 3902 <ptrtype> 3903 <struct>jvmtiArrayPrimitiveValueCallback</struct> 3904 </ptrtype> 3905 <description> 3906 The callback to be called to describe an 3907 array of primitive values. 3908 </description> 3909 </field> 3910 <field id="string_primitive_value_callback"> 3911 <ptrtype> 3912 <struct>jvmtiStringPrimitiveValueCallback</struct> 3913 </ptrtype> 3914 <description> 3915 The callback to be called to describe a String value. 3916 </description> 3917 </field> 3918 <field id="reserved5"> 3919 <ptrtype> 3920 <struct>jvmtiReservedCallback</struct> 3921 </ptrtype> 3922 <description> 3923 Reserved for future use.. 3924 </description> 3925 </field> 3926 <field id="reserved6"> 3927 <ptrtype> 3928 <struct>jvmtiReservedCallback</struct> 3929 </ptrtype> 3930 <description> 3931 Reserved for future use.. 3932 </description> 3933 </field> 3934 <field id="reserved7"> 3935 <ptrtype> 3936 <struct>jvmtiReservedCallback</struct> 3937 </ptrtype> 3938 <description> 3939 Reserved for future use.. 3940 </description> 3941 </field> 3942 <field id="reserved8"> 3943 <ptrtype> 3944 <struct>jvmtiReservedCallback</struct> 3945 </ptrtype> 3946 <description> 3947 Reserved for future use.. 3948 </description> 3949 </field> 3950 <field id="reserved9"> 3951 <ptrtype> 3952 <struct>jvmtiReservedCallback</struct> 3953 </ptrtype> 3954 <description> 3955 Reserved for future use.. 3956 </description> 3957 </field> 3958 <field id="reserved10"> 3959 <ptrtype> 3960 <struct>jvmtiReservedCallback</struct> 3961 </ptrtype> 3962 <description> 3963 Reserved for future use.. 3964 </description> 3965 </field> 3966 <field id="reserved11"> 3967 <ptrtype> 3968 <struct>jvmtiReservedCallback</struct> 3969 </ptrtype> 3970 <description> 3971 Reserved for future use.. 3972 </description> 3973 </field> 3974 <field id="reserved12"> 3975 <ptrtype> 3976 <struct>jvmtiReservedCallback</struct> 3977 </ptrtype> 3978 <description> 3979 Reserved for future use.. 3980 </description> 3981 </field> 3982 <field id="reserved13"> 3983 <ptrtype> 3984 <struct>jvmtiReservedCallback</struct> 3985 </ptrtype> 3986 <description> 3987 Reserved for future use.. 3988 </description> 3989 </field> 3990 <field id="reserved14"> 3991 <ptrtype> 3992 <struct>jvmtiReservedCallback</struct> 3993 </ptrtype> 3994 <description> 3995 Reserved for future use.. 3996 </description> 3997 </field> 3998 <field id="reserved15"> 3999 <ptrtype> 4000 <struct>jvmtiReservedCallback</struct> 4001 </ptrtype> 4002 <description> 4003 Reserved for future use.. 4004 </description> 4005 </field> 4006 </typedef> 4007 4008 4009 <intro> 4010 <rationale> 4011 The heap dumping functionality (below) uses a callback 4012 for each object. While it would seem that a buffered approach 4013 would provide better throughput, tests do 4014 not show this to be the case--possibly due to locality of 4015 memory reference or array access overhead. 4016 </rationale> 4017 4018 <issue> 4019 Still under investigation as to if java.lang.ref references 4020 are reported as a different type of reference. 4021 </issue> 4022 4023 <issue> 4024 Should or can an indication of the cost or relative cost of 4025 these operations be included? 4026 </issue> 4027 4028 </intro> 4029 4030 <callback id="jvmtiHeapIterationCallback" since="1.1"> 4031 <jint/> 4032 <synopsis>Heap Iteration Callback</synopsis> 4033 <description> 4034 Agent supplied callback function. 4035 Describes (but does not pass in) an object in the heap. 4036 <p/> 4037 This function should return a bit vector of the desired 4038 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>. 4039 This will determine if the entire iteration should be aborted 4040 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored). 4041 <p/> 4042 See the <internallink id="heapCallbacks">heap callback 4043 function restrictions</internallink>. 4044 </description> 4045 <parameters> 4046 <param id="class_tag"> 4047 <jlong/> 4048 <description> 4049 The tag of the class of object (zero if the class is not tagged). 4050 If the object represents a runtime class, 4051 the <code>class_tag</code> is the tag 4052 associated with <code>java.lang.Class</code> 4053 (zero if <code>java.lang.Class</code> is not tagged). 4054 </description> 4055 </param> 4056 <param id="size"> 4057 <jlong/> 4058 <description> 4059 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 4060 </description> 4061 </param> 4062 <param id="tag_ptr"> 4063 <outptr><jlong/></outptr> 4064 <description> 4065 The object tag value, or zero if the object is not tagged. 4066 To set the tag value to be associated with the object 4067 the agent sets the <code>jlong</code> pointed to by the parameter. 4068 </description> 4069 </param> 4070 <param id="length"> 4071 <jint/> 4072 <description> 4073 If this object is an array, the length of the array. Otherwise negative one (-1). 4074 </description> 4075 </param> 4076 <param id="user_data"> 4077 <outptr><void/></outptr> 4078 <description> 4079 The user supplied data that was passed into the iteration function. 4080 </description> 4081 </param> 4082 </parameters> 4083 </callback> 4084 4085 <callback id="jvmtiHeapReferenceCallback" since="1.1"> 4086 <jint/> 4087 <synopsis>Heap Reference Callback</synopsis> 4088 <description> 4089 Agent supplied callback function. 4090 Describes a reference from an object or the VM (the referrer) to another object 4091 (the referree) or a heap root to a referree. 4092 <p/> 4093 This function should return a bit vector of the desired 4094 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>. 4095 This will determine if the objects referenced by the referree 4096 should be visited or if the entire iteration should be aborted. 4097 <p/> 4098 See the <internallink id="heapCallbacks">heap callback 4099 function restrictions</internallink>. 4100 </description> 4101 <parameters> 4102 <param id="reference_kind"> 4103 <enum>jvmtiHeapReferenceKind</enum> 4104 <description> 4105 The kind of reference. 4106 </description> 4107 </param> 4108 <param id="reference_info"> 4109 <inptr> 4110 <struct>jvmtiHeapReferenceInfo</struct> 4111 </inptr> 4112 <description> 4113 Details about the reference. 4114 Set when the <datalink id="jvmtiHeapReferenceCallback.reference_kind">reference_kind</datalink> is 4115 <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/>, 4116 <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/>, 4117 <datalink id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT"/>, 4118 <datalink id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL"/>, 4119 <datalink id="JVMTI_HEAP_REFERENCE_STACK_LOCAL"/>, 4120 or <datalink id="JVMTI_HEAP_REFERENCE_JNI_LOCAL"/>. 4121 Otherwise <code>NULL</code>. 4122 </description> 4123 </param> 4124 <param id="class_tag"> 4125 <jlong/> 4126 <description> 4127 The tag of the class of referree object (zero if the class is not tagged). 4128 If the referree object represents a runtime class, 4129 the <code>class_tag</code> is the tag 4130 associated with <code>java.lang.Class</code> 4131 (zero if <code>java.lang.Class</code> is not tagged). 4132 </description> 4133 </param> 4134 <param id="referrer_class_tag"> 4135 <jlong/> 4136 <description> 4137 The tag of the class of the referrer object (zero if the class is not tagged 4138 or the referree is a heap root). If the referrer object represents a runtime 4139 class, the <code>referrer_class_tag</code> is the tag associated with 4140 the <code>java.lang.Class</code> 4141 (zero if <code>java.lang.Class</code> is not tagged). 4142 </description> 4143 </param> 4144 <param id="size"> 4145 <jlong/> 4146 <description> 4147 Size of the referree object (in bytes). 4148 See <functionlink id="GetObjectSize"/>. 4149 </description> 4150 </param> 4151 <param id="tag_ptr"> 4152 <outptr><jlong/></outptr> 4153 <description> 4154 Points to the referree object tag value, or zero if the object is not 4155 tagged. 4156 To set the tag value to be associated with the object 4157 the agent sets the <code>jlong</code> pointed to by the parameter. 4158 </description> 4159 </param> 4160 <param id="referrer_tag_ptr"> 4161 <outptr><jlong/></outptr> 4162 <description> 4163 Points to the tag of the referrer object, or 4164 points to the zero if the referrer 4165 object is not tagged. 4166 <code>NULL</code> if the referrer in not an object (that is, 4167 this callback is reporting a heap root). 4168 To set the tag value to be associated with the referrer object 4169 the agent sets the <code>jlong</code> pointed to by the parameter. 4170 If this callback is reporting a reference from an object to itself, 4171 <code>referrer_tag_ptr == tag_ptr</code>. 4172 </description> 4173 </param> 4174 <param id="length"> 4175 <jint/> 4176 <description> 4177 If this object is an array, the length of the array. Otherwise negative one (-1). 4178 </description> 4179 </param> 4180 <param id="user_data"> 4181 <outptr><void/></outptr> 4182 <description> 4183 The user supplied data that was passed into the iteration function. 4184 </description> 4185 </param> 4186 </parameters> 4187 </callback> 4188 4189 <callback id="jvmtiPrimitiveFieldCallback" since="1.1"> 4190 <jint/> 4191 <synopsis>Primitive Field Callback</synopsis> 4192 <description> 4193 Agent supplied callback function which 4194 describes a primitive field of an object (<i>the object</i>). 4195 A primitive field is a field whose type is a primitive type. 4196 This callback will describe a static field if the object is a class, 4197 and otherwise will describe an instance field. 4198 <p/> 4199 This function should return a bit vector of the desired 4200 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>. 4201 This will determine if the entire iteration should be aborted 4202 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored). 4203 <p/> 4204 See the <internallink id="heapCallbacks">heap callback 4205 function restrictions</internallink>. 4206 </description> 4207 <parameters> 4208 <param id="kind"> 4209 <enum>jvmtiHeapReferenceKind</enum> 4210 <description> 4211 The kind of field -- instance or static (<datalink id="JVMTI_HEAP_REFERENCE_FIELD"/> or 4212 <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/>). 4213 </description> 4214 </param> 4215 <param id="info"> 4216 <inptr> 4217 <struct>jvmtiHeapReferenceInfo</struct> 4218 </inptr> 4219 <description> 4220 Which field (the field index). 4221 </description> 4222 </param> 4223 <param id="object_class_tag"> 4224 <jlong/> 4225 <description> 4226 The tag of the class of the object (zero if the class is not tagged). 4227 If the object represents a runtime class, the 4228 <code>object_class_tag</code> is the tag 4229 associated with <code>java.lang.Class</code> 4230 (zero if <code>java.lang.Class</code> is not tagged). 4231 </description> 4232 </param> 4233 <param id="object_tag_ptr"> 4234 <outptr><jlong/></outptr> 4235 <description> 4236 Points to the tag of the object, or zero if the object is not 4237 tagged. 4238 To set the tag value to be associated with the object 4239 the agent sets the <code>jlong</code> pointed to by the parameter. 4240 </description> 4241 </param> 4242 <param id="value"> 4243 <jvalue/> 4244 <description> 4245 The value of the field. 4246 </description> 4247 </param> 4248 <param id="value_type"> 4249 <enum>jvmtiPrimitiveType</enum> 4250 <description> 4251 The type of the field. 4252 </description> 4253 </param> 4254 <param id="user_data"> 4255 <outptr><void/></outptr> 4256 <description> 4257 The user supplied data that was passed into the iteration function. 4258 </description> 4259 </param> 4260 </parameters> 4261 </callback> 4262 4263 <callback id="jvmtiArrayPrimitiveValueCallback" since="1.1"> 4264 <jint/> 4265 <synopsis>Array Primitive Value Callback</synopsis> 4266 <description> 4267 Agent supplied callback function. 4268 Describes the values in an array of a primitive type. 4269 <p/> 4270 This function should return a bit vector of the desired 4271 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>. 4272 This will determine if the entire iteration should be aborted 4273 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored). 4274 <p/> 4275 See the <internallink id="heapCallbacks">heap callback 4276 function restrictions</internallink>. 4277 </description> 4278 <parameters> 4279 <param id="class_tag"> 4280 <jlong/> 4281 <description> 4282 The tag of the class of the array object (zero if the class is not tagged). 4283 </description> 4284 </param> 4285 <param id="size"> 4286 <jlong/> 4287 <description> 4288 Size of the array (in bytes). 4289 See <functionlink id="GetObjectSize"/>. 4290 </description> 4291 </param> 4292 <param id="tag_ptr"> 4293 <outptr><jlong/></outptr> 4294 <description> 4295 Points to the tag of the array object, or zero if the object is not 4296 tagged. 4297 To set the tag value to be associated with the object 4298 the agent sets the <code>jlong</code> pointed to by the parameter. 4299 </description> 4300 </param> 4301 <param id="element_count"> 4302 <jint/> 4303 <description> 4304 The length of the primitive array. 4305 </description> 4306 </param> 4307 <param id="element_type"> 4308 <enum>jvmtiPrimitiveType</enum> 4309 <description> 4310 The type of the elements of the array. 4311 </description> 4312 </param> 4313 <param id="elements"> 4314 <vmbuf><void/></vmbuf> 4315 <description> 4316 The elements of the array in a packed array of <code>element_count</code> 4317 items of <code>element_type</code> size each. 4318 </description> 4319 </param> 4320 <param id="user_data"> 4321 <outptr><void/></outptr> 4322 <description> 4323 The user supplied data that was passed into the iteration function. 4324 </description> 4325 </param> 4326 </parameters> 4327 </callback> 4328 4329 <callback id="jvmtiStringPrimitiveValueCallback" since="1.1"> 4330 <jint/> 4331 <synopsis>String Primitive Value Callback</synopsis> 4332 <description> 4333 Agent supplied callback function. 4334 Describes the value of a java.lang.String. 4335 <p/> 4336 This function should return a bit vector of the desired 4337 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>. 4338 This will determine if the entire iteration should be aborted 4339 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored). 4340 <p/> 4341 See the <internallink id="heapCallbacks">heap callback 4342 function restrictions</internallink>. 4343 </description> 4344 <parameters> 4345 <param id="class_tag"> 4346 <jlong/> 4347 <description> 4348 The tag of the class of the String class (zero if the class is not tagged). 4349 <issue>Is this needed?</issue> 4350 </description> 4351 </param> 4352 <param id="size"> 4353 <jlong/> 4354 <description> 4355 Size of the string (in bytes). 4356 See <functionlink id="GetObjectSize"/>. 4357 </description> 4358 </param> 4359 <param id="tag_ptr"> 4360 <outptr><jlong/></outptr> 4361 <description> 4362 Points to the tag of the String object, or zero if the object is not 4363 tagged. 4364 To set the tag value to be associated with the object 4365 the agent sets the <code>jlong</code> pointed to by the parameter. 4366 </description> 4367 </param> 4368 <param id="value"> 4369 <vmbuf><jchar/></vmbuf> 4370 <description> 4371 The value of the String, encoded as a Unicode string. 4372 </description> 4373 </param> 4374 <param id="value_length"> 4375 <jint/> 4376 <description> 4377 The length of the string. 4378 The length is equal to the number of 16-bit Unicode 4379 characters in the string. 4380 </description> 4381 </param> 4382 <param id="user_data"> 4383 <outptr><void/></outptr> 4384 <description> 4385 The user supplied data that was passed into the iteration function. 4386 </description> 4387 </param> 4388 </parameters> 4389 </callback> 4390 4391 4392 <callback id="jvmtiReservedCallback" since="1.1"> 4393 <jint/> 4394 <synopsis>reserved for future use Callback</synopsis> 4395 <description> 4396 Placeholder -- reserved for future use. 4397 </description> 4398 <parameters> 4399 </parameters> 4400 </callback> 4401 4402 <function id="FollowReferences" num="115" since="1.1"> 4403 <synopsis>Follow References</synopsis> 4404 <description> 4405 This function initiates a traversal over the objects that are 4406 directly and indirectly reachable from the specified object or, 4407 if <code>initial_object</code> is not specified, all objects 4408 reachable from the heap roots. 4409 The heap root are the set of system classes, 4410 JNI globals, references from thread stacks, and other objects used as roots 4411 for the purposes of garbage collection. 4412 <p/> 4413 This function operates by traversing the reference graph. 4414 Let <i>A</i>, <i>B</i>, ... represent objects. 4415 When a reference from <i>A</i> to <i>B</i> is traversed, 4416 when a reference from a heap root to <i>B</i> is traversed, 4417 or when <i>B</i> is specified as the <paramlink id="initial_object"/>, 4418 then <i>B</i> is said to be <i>visited</i>. 4419 A reference from <i>A</i> to <i>B</i> is not traversed until <i>A</i> 4420 is visited. 4421 References are reported in the same order that the references are traversed. 4422 Object references are reported by invoking the agent supplied 4423 callback function <functionlink id="jvmtiHeapReferenceCallback"/>. 4424 In a reference from <i>A</i> to <i>B</i>, <i>A</i> is known 4425 as the <i>referrer</i> and <i>B</i> as the <i>referree</i>. 4426 The callback is invoked exactly once for each reference from a referrer; 4427 this is true even if there are reference cycles or multiple paths to 4428 the referrer. 4429 There may be more than one reference between a referrer and a referree, 4430 each reference is reported. 4431 These references may be distinguished by examining the 4432 <datalink 4433 id="jvmtiHeapReferenceCallback.reference_kind"><code>reference_kind</code></datalink> 4434 and 4435 <datalink 4436 id="jvmtiHeapReferenceCallback.reference_info"><code>reference_info</code></datalink> 4437 parameters of the <functionlink id="jvmtiHeapReferenceCallback"/> callback. 4438 <p/> 4439 This function reports a Java programming language view of object references, 4440 not a virtual machine implementation view. The following object references 4441 are reported when they are non-null: 4442 <ul> 4443 <li>Instance objects report references to each non-primitive instance fields 4444 (including inherited fields).</li> 4445 <li>Instance objects report a reference to the object type (class).</li> 4446 <li>Classes report a reference to the superclass and directly 4447 implemented/extended interfaces.</li> 4448 <li>Classes report a reference to the class loader, protection domain, 4449 signers, and resolved entries in the constant pool.</li> 4450 <li>Classes report a reference to each directly declared non-primitive 4451 static field.</li> 4452 <li>Arrays report a reference to the array type (class) and each 4453 array element.</li> 4454 <li>Primitive arrays report a reference to the array type.</li> 4455 </ul> 4456 <p/> 4457 This function can also be used to examine primitive (non-object) values. 4458 The primitive value of an array or String 4459 is reported after the object has been visited; 4460 it is reported by invoking the agent supplied callback function 4461 <functionlink id="jvmtiArrayPrimitiveValueCallback"/> or 4462 <functionlink id="jvmtiStringPrimitiveValueCallback"/>. 4463 A primitive field 4464 is reported after the object with that field is visited; 4465 it is reported by invoking the agent supplied callback function 4466 <functionlink id="jvmtiPrimitiveFieldCallback"/>. 4467 <p/> 4468 Whether a callback is provided or is <code>NULL</code> only determines 4469 whether the callback will be invoked, it does not influence 4470 which objects are visited nor does it influence whether other callbacks 4471 will be invoked. 4472 However, the 4473 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink> 4474 returned by <functionlink id="jvmtiHeapReferenceCallback"/> 4475 do determine if the objects referenced by the 4476 current object as visited. 4477 The <datalink id="jvmtiHeapFilter">heap filter flags</datalink> 4478 and <paramlink id="klass"/> provided as parameters to this function 4479 do not control which objects are visited but they do control which 4480 objects and primitive values are reported by the callbacks. 4481 For example, if the only callback that was set is 4482 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> and <code>klass</code> 4483 is set to the array of bytes class, then only arrays of byte will be 4484 reported. 4485 The table below summarizes this: 4486 <p/> 4487 <table> 4488 <tr class="bgLight"> 4489 <th/> 4490 <th class="centered" scope="col">Controls objects visited</th> 4491 <th class="centered" scope="col">Controls objects reported</th> 4492 <th class="centered" scope="col">Controls primitives reported</th> 4493 </tr> 4494 <tr> 4495 <th scope="row"> 4496 the 4497 <datalink id="jvmtiHeapVisitControl">Heap Visit Control Flags</datalink> 4498 returned by <functionlink id="jvmtiHeapReferenceCallback"/> 4499 </th> 4500 <td class="centered"> 4501 <b>Yes</b> 4502 </td> 4503 <td class="centered"> 4504 <b>Yes</b>, since visits are controlled 4505 </td> 4506 <td class="centered"> 4507 <b>Yes</b>, since visits are controlled 4508 </td> 4509 </tr> 4510 <tr> 4511 <th scope="row"> 4512 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> 4513 in <paramlink id="callbacks"/> set 4514 </th> 4515 <td class="centered"> 4516 No 4517 </td> 4518 <td class="centered"> 4519 <b>Yes</b> 4520 </td> 4521 <td class="centered"> 4522 No 4523 </td> 4524 </tr> 4525 <tr> 4526 <th scope="row"> 4527 <paramlink id="heap_filter"/> 4528 </th> 4529 <td class="centered"> 4530 No 4531 </td> 4532 <td class="centered"> 4533 <b>Yes</b> 4534 </td> 4535 <td class="centered"> 4536 <b>Yes</b> 4537 </td> 4538 </tr> 4539 <tr> 4540 <th scope="row"> 4541 <paramlink id="klass"/> 4542 </th> 4543 <td class="centered"> 4544 No 4545 </td> 4546 <td class="centered"> 4547 <b>Yes</b> 4548 </td> 4549 <td class="centered"> 4550 <b>Yes</b> 4551 </td> 4552 </tr> 4553 </table> 4554 <p/> 4555 During the execution of this function the state of the heap 4556 does not change: no objects are allocated, no objects are 4557 garbage collected, and the state of objects (including 4558 held values) does not change. 4559 As a result, threads executing Java 4560 programming language code, threads attempting to resume the 4561 execution of Java programming language code, and threads 4562 attempting to execute JNI functions are typically stalled. 4563 </description> 4564 <origin>new</origin> 4565 <capabilities> 4566 <required id="can_tag_objects"></required> 4567 </capabilities> 4568 <parameters> 4569 <param id="heap_filter"> 4570 <jint/> 4571 <description> 4572 This bit vector of 4573 <datalink id="jvmtiHeapFilter">heap filter flags</datalink>. 4574 restricts the objects for which the callback function is called. 4575 This applies to both the object and primitive callbacks. 4576 </description> 4577 </param> 4578 <param id="klass"> 4579 <ptrtype> 4580 <jclass/> 4581 <nullok>callbacks are not limited to instances of a particular 4582 class</nullok> 4583 </ptrtype> 4584 <description> 4585 Callbacks are only reported when the object is an instance of 4586 this class. 4587 Objects which are instances of a subclass of <code>klass</code> 4588 are not reported. 4589 If <code>klass</code> is an interface, no objects are reported. 4590 This applies to both the object and primitive callbacks. 4591 </description> 4592 </param> 4593 <param id="initial_object"> 4594 <ptrtype> 4595 <jobject/> 4596 <nullok>references are followed from the heap roots</nullok> 4597 </ptrtype> 4598 <description> 4599 The object to follow 4600 </description> 4601 </param> 4602 <param id="callbacks"> 4603 <inptr> 4604 <struct>jvmtiHeapCallbacks</struct> 4605 </inptr> 4606 <description> 4607 Structure defining the set of callback functions. 4608 </description> 4609 </param> 4610 <param id="user_data"> 4611 <inbuf> 4612 <void/> 4613 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 4614 </inbuf> 4615 <description> 4616 User supplied data to be passed to the callback. 4617 </description> 4618 </param> 4619 </parameters> 4620 <errors> 4621 <error id="JVMTI_ERROR_INVALID_CLASS"> 4622 <paramlink id="klass"/> is not a valid class. 4623 </error> 4624 <error id="JVMTI_ERROR_INVALID_OBJECT"> 4625 <paramlink id="initial_object"/> is not a valid object. 4626 </error> 4627 </errors> 4628 </function> 4629 4630 4631 <function id="IterateThroughHeap" num="116" since="1.1"> 4632 <synopsis>Iterate Through Heap</synopsis> 4633 <description> 4634 Initiate an iteration over all objects in the heap. 4635 This includes both reachable and 4636 unreachable objects. Objects are visited in no particular order. 4637 <p/> 4638 Heap objects are reported by invoking the agent supplied 4639 callback function <functionlink id="jvmtiHeapIterationCallback"/>. 4640 References between objects are not reported. 4641 If only reachable objects are desired, or if object reference information 4642 is needed, use <functionlink id="FollowReferences"/>. 4643 <p/> 4644 This function can also be used to examine primitive (non-object) values. 4645 The primitive value of an array or String 4646 is reported after the object has been visited; 4647 it is reported by invoking the agent supplied callback function 4648 <functionlink id="jvmtiArrayPrimitiveValueCallback"/> or 4649 <functionlink id="jvmtiStringPrimitiveValueCallback"/>. 4650 A primitive field 4651 is reported after the object with that field is visited; 4652 it is reported by invoking the agent supplied 4653 callback function 4654 <functionlink id="jvmtiPrimitiveFieldCallback"/>. 4655 <p/> 4656 Unless the iteration is aborted by the 4657 <datalink id="jvmtiHeapVisitControl">Heap Visit Control Flags</datalink> 4658 returned by a callback, all objects in the heap are visited. 4659 Whether a callback is provided or is <code>NULL</code> only determines 4660 whether the callback will be invoked, it does not influence 4661 which objects are visited nor does it influence whether other callbacks 4662 will be invoked. 4663 The <datalink id="jvmtiHeapFilter">heap filter flags</datalink> 4664 and <paramlink id="klass"/> provided as parameters to this function 4665 do not control which objects are visited but they do control which 4666 objects and primitive values are reported by the callbacks. 4667 For example, if the only callback that was set is 4668 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> and <code>klass</code> 4669 is set to the array of bytes class, then only arrays of byte will be 4670 reported. The table below summarizes this (contrast this with 4671 <functionlink id="FollowReferences"/>): 4672 <p/> 4673 <table> 4674 <tr class="bgLight"> 4675 <th/> 4676 <th class="centered" scope="col">Controls objects visited</th> 4677 <th class="centered" scope="col">Controls objects reported</th> 4678 <th class="centered" scope="col">Controls primitives reported</th> 4679 </tr> 4680 <tr> 4681 <th scope="row"> 4682 the 4683 <datalink id="jvmtiHeapVisitControl">Heap Visit Control Flags</datalink> 4684 returned by <functionlink id="jvmtiHeapIterationCallback"/> 4685 </th> 4686 <td class="centered"> 4687 No<br/>(unless they abort the iteration) 4688 </td> 4689 <td class="centered"> 4690 No<br/>(unless they abort the iteration) 4691 </td> 4692 <td class="centered"> 4693 No<br/>(unless they abort the iteration) 4694 </td> 4695 </tr> 4696 <tr> 4697 <th scope="row"> 4698 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> 4699 in <paramlink id="callbacks"/> set 4700 </th> 4701 <td class="centered"> 4702 No 4703 </td> 4704 <td class="centered"> 4705 <b>Yes</b> 4706 </td> 4707 <td class="centered"> 4708 No 4709 </td> 4710 </tr> 4711 <tr> 4712 <th scope="row"> 4713 <paramlink id="heap_filter"/> 4714 </th> 4715 <td class="centered"> 4716 No 4717 </td> 4718 <td class="centered"> 4719 <b>Yes</b> 4720 </td> 4721 <td class="centered"> 4722 <b>Yes</b> 4723 </td> 4724 </tr> 4725 <tr> 4726 <th scope="row"> 4727 <paramlink id="klass"/> 4728 </th> 4729 <td class="centered"> 4730 No 4731 </td> 4732 <td class="centered"> 4733 <b>Yes</b> 4734 </td> 4735 <td class="centered"> 4736 <b>Yes</b> 4737 </td> 4738 </tr> 4739 </table> 4740 <p/> 4741 During the execution of this function the state of the heap 4742 does not change: no objects are allocated, no objects are 4743 garbage collected, and the state of objects (including 4744 held values) does not change. 4745 As a result, threads executing Java 4746 programming language code, threads attempting to resume the 4747 execution of Java programming language code, and threads 4748 attempting to execute JNI functions are typically stalled. 4749 </description> 4750 <origin>new</origin> 4751 <capabilities> 4752 <required id="can_tag_objects"></required> 4753 </capabilities> 4754 <parameters> 4755 <param id="heap_filter"> 4756 <jint/> 4757 <description> 4758 This bit vector of 4759 <datalink id="jvmtiHeapFilter">heap filter flags</datalink>. 4760 restricts the objects for which the callback function is called. 4761 This applies to both the object and primitive callbacks. 4762 </description> 4763 </param> 4764 <param id="klass"> 4765 <ptrtype> 4766 <jclass/> 4767 <nullok>callbacks are not limited to instances of a particular class</nullok> 4768 </ptrtype> 4769 <description> 4770 Callbacks are only reported when the object is an instance of 4771 this class. 4772 Objects which are instances of a subclass of <code>klass</code> 4773 are not reported. 4774 If <code>klass</code> is an interface, no objects are reported. 4775 This applies to both the object and primitive callbacks. 4776 </description> 4777 </param> 4778 <param id="callbacks"> 4779 <inptr> 4780 <struct>jvmtiHeapCallbacks</struct> 4781 </inptr> 4782 <description> 4783 Structure defining the set callback functions. 4784 </description> 4785 </param> 4786 <param id="user_data"> 4787 <inbuf> 4788 <void/> 4789 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 4790 </inbuf> 4791 <description> 4792 User supplied data to be passed to the callback. 4793 </description> 4794 </param> 4795 </parameters> 4796 <errors> 4797 <error id="JVMTI_ERROR_INVALID_CLASS"> 4798 <paramlink id="klass"/> is not a valid class. 4799 </error> 4800 </errors> 4801 </function> 4802 4803 <function id="GetTag" phase="start" num="106"> 4804 <synopsis>Get Tag</synopsis> 4805 <description> 4806 Retrieve the tag associated with an object. 4807 The tag is a long value typically used to store a 4808 unique identifier or pointer to object information. 4809 The tag is set with 4810 <functionlink id="SetTag"></functionlink>. 4811 Objects for which no tags have been set return a 4812 tag value of zero. 4813 </description> 4814 <origin>new</origin> 4815 <capabilities> 4816 <required id="can_tag_objects"></required> 4817 </capabilities> 4818 <parameters> 4819 <param id="object"> 4820 <jobject/> 4821 <description> 4822 The object whose tag is to be retrieved. 4823 </description> 4824 </param> 4825 <param id="tag_ptr"> 4826 <outptr><jlong/></outptr> 4827 <description> 4828 On return, the referenced long is set to the value 4829 of the tag. 4830 </description> 4831 </param> 4832 </parameters> 4833 <errors> 4834 </errors> 4835 </function> 4836 4837 <function id="SetTag" phase="start" num="107"> 4838 <synopsis>Set Tag</synopsis> 4839 <description> 4840 Set the tag associated with an object. 4841 The tag is a long value typically used to store a 4842 unique identifier or pointer to object information. 4843 The tag is visible with 4844 <functionlink id="GetTag"></functionlink>. 4845 </description> 4846 <origin>new</origin> 4847 <capabilities> 4848 <required id="can_tag_objects"></required> 4849 </capabilities> 4850 <parameters> 4851 <param id="object"> 4852 <jobject/> 4853 <description> 4854 The object whose tag is to be set. 4855 </description> 4856 </param> 4857 <param id="tag"> 4858 <jlong/> 4859 <description> 4860 The new value of the tag. 4861 </description> 4862 </param> 4863 </parameters> 4864 <errors> 4865 </errors> 4866 </function> 4867 4868 <function id="GetObjectsWithTags" num="114"> 4869 <synopsis>Get Objects With Tags</synopsis> 4870 <description> 4871 Return objects in the heap with the specified tags. 4872 The format is parallel arrays of objects and tags. 4873 </description> 4874 <origin>new</origin> 4875 <capabilities> 4876 <required id="can_tag_objects"></required> 4877 </capabilities> 4878 <parameters> 4879 <param id="tag_count"> 4880 <jint min="0"/> 4881 <description> 4882 Number of tags to scan for. 4883 </description> 4884 </param> 4885 <param id="tags"> 4886 <inbuf incount="tag_count"> 4887 <jlong/> 4888 </inbuf> 4889 <description> 4890 Scan for objects with these tags. 4891 Zero is not permitted in this array. 4892 </description> 4893 </param> 4894 <param id="count_ptr"> 4895 <outptr> 4896 <jint/> 4897 </outptr> 4898 <description> 4899 Return the number of objects with any of the tags 4900 in <paramlink id="tags"/>. 4901 </description> 4902 </param> 4903 <param id="object_result_ptr"> 4904 <allocbuf outcount="count_ptr"> 4905 <jobject/> 4906 <nullok>this information is not returned</nullok> 4907 </allocbuf> 4908 <description> 4909 Returns the array of objects with any of the tags 4910 in <paramlink id="tags"/>. 4911 </description> 4912 </param> 4913 <param id="tag_result_ptr"> 4914 <allocbuf outcount="count_ptr"> 4915 <jlong/> 4916 <nullok>this information is not returned</nullok> 4917 </allocbuf> 4918 <description> 4919 For each object in <paramlink id="object_result_ptr"/>, 4920 return the tag at the corresponding index. 4921 </description> 4922 </param> 4923 </parameters> 4924 <errors> 4925 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 4926 Zero is present in <paramlink id="tags"></paramlink>. 4927 </error> 4928 </errors> 4929 </function> 4930 4931 <function id="ForceGarbageCollection" num="108"> 4932 <synopsis>Force Garbage Collection</synopsis> 4933 <description> 4934 Force the VM to perform a garbage collection. 4935 The garbage collection is as complete as possible. 4936 This function does not cause finalizers to be run. 4937 This function does not return until the garbage collection 4938 is finished. 4939 <p/> 4940 Although garbage collection is as complete 4941 as possible there is no guarantee that all 4942 <eventlink id="ObjectFree"/> 4943 events will have been 4944 sent by the time that this function 4945 returns. In particular, an object may be 4946 prevented from being freed because it 4947 is awaiting finalization. 4948 </description> 4949 <origin>new</origin> 4950 <capabilities> 4951 </capabilities> 4952 <parameters> 4953 </parameters> 4954 <errors> 4955 </errors> 4956 </function> 4957 4958 4959 </category> 4960 4961 <category id="Heap_1_0" label="Heap (1.0)"> 4962 <intro> 4963 <b> 4964 These functions and data types were introduced in the original 4965 <jvmti/> version 1.0 and have been superseded by more 4966 </b> 4967 <internallink id="Heap"><b>powerful and flexible versions</b></internallink> 4968 <b> 4969 which: 4970 </b> 4971 <ul> 4972 <li> 4973 <b> 4974 Allow access to primitive values (the value of Strings, arrays, 4975 and primitive fields) 4976 </b> 4977 </li> 4978 <li> 4979 <b> 4980 Allow the tag of the referrer to be set, thus enabling more 4981 efficient localized reference graph building 4982 </b> 4983 </li> 4984 <li> 4985 <b> 4986 Provide more extensive filtering abilities 4987 </b> 4988 </li> 4989 <li> 4990 <b> 4991 Are extensible, allowing their abilities to grow in future versions of <jvmti/> 4992 </b> 4993 </li> 4994 </ul> 4995 <p/> 4996 <b>Please use the </b> 4997 <internallink id="Heap"><b>current Heap functions</b></internallink>. 4998 <p/> 4999 <constants id="jvmtiHeapObjectFilter" label="Heap Object Filter Enumeration" kind="enum"> 5000 <constant id="JVMTI_HEAP_OBJECT_TAGGED" num="1"> 5001 Tagged objects only. 5002 </constant> 5003 <constant id="JVMTI_HEAP_OBJECT_UNTAGGED" num="2"> 5004 Untagged objects only. 5005 </constant> 5006 <constant id="JVMTI_HEAP_OBJECT_EITHER" num="3"> 5007 Either tagged or untagged objects. 5008 </constant> 5009 </constants> 5010 5011 <constants id="jvmtiHeapRootKind" label="Heap Root Kind Enumeration" kind="enum"> 5012 <constant id="JVMTI_HEAP_ROOT_JNI_GLOBAL" num="1"> 5013 JNI global reference. 5014 </constant> 5015 <constant id="JVMTI_HEAP_ROOT_SYSTEM_CLASS" num="2"> 5016 System class. 5017 </constant> 5018 <constant id="JVMTI_HEAP_ROOT_MONITOR" num="3"> 5019 Monitor. 5020 </constant> 5021 <constant id="JVMTI_HEAP_ROOT_STACK_LOCAL" num="4"> 5022 Stack local. 5023 </constant> 5024 <constant id="JVMTI_HEAP_ROOT_JNI_LOCAL" num="5"> 5025 JNI local reference. 5026 </constant> 5027 <constant id="JVMTI_HEAP_ROOT_THREAD" num="6"> 5028 Thread. 5029 </constant> 5030 <constant id="JVMTI_HEAP_ROOT_OTHER" num="7"> 5031 Other. 5032 </constant> 5033 </constants> 5034 5035 <constants id="jvmtiObjectReferenceKind" label="Object Reference Enumeration" kind="enum"> 5036 <constant id="JVMTI_REFERENCE_CLASS" num="1"> 5037 Reference from an object to its class. 5038 </constant> 5039 <constant id="JVMTI_REFERENCE_FIELD" num="2"> 5040 Reference from an object to the value of one of its instance fields. 5041 For references of this kind the <code>referrer_index</code> 5042 parameter to the <internallink id="jvmtiObjectReferenceCallback"> 5043 jvmtiObjectReferenceCallback</internallink> is the index of the 5044 the instance field. The index is based on the order of all the 5045 object's fields. This includes all fields of the directly declared 5046 static and instance fields in the class, and includes all fields (both 5047 public and private) fields declared in superclasses and superinterfaces. 5048 The index is thus calculated by summing the index of the field in the directly 5049 declared class (see <functionlink id="GetClassFields"/>), with the total 5050 number of fields (both public and private) declared in all superclasses 5051 and superinterfaces. The index starts at zero. 5052 </constant> 5053 <constant id="JVMTI_REFERENCE_ARRAY_ELEMENT" num="3"> 5054 Reference from an array to one of its elements. 5055 For references of this kind the <code>referrer_index</code> 5056 parameter to the <internallink id="jvmtiObjectReferenceCallback"> 5057 jvmtiObjectReferenceCallback</internallink> is the array index. 5058 </constant> 5059 <constant id="JVMTI_REFERENCE_CLASS_LOADER" num="4"> 5060 Reference from a class to its class loader. 5061 </constant> 5062 <constant id="JVMTI_REFERENCE_SIGNERS" num="5"> 5063 Reference from a class to its signers array. 5064 </constant> 5065 <constant id="JVMTI_REFERENCE_PROTECTION_DOMAIN" num="6"> 5066 Reference from a class to its protection domain. 5067 </constant> 5068 <constant id="JVMTI_REFERENCE_INTERFACE" num="7"> 5069 Reference from a class to one of its interfaces. 5070 </constant> 5071 <constant id="JVMTI_REFERENCE_STATIC_FIELD" num="8"> 5072 Reference from a class to the value of one of its static fields. 5073 For references of this kind the <code>referrer_index</code> 5074 parameter to the <internallink id="jvmtiObjectReferenceCallback"> 5075 jvmtiObjectReferenceCallback</internallink> is the index of the 5076 the static field. The index is based on the order of all the 5077 object's fields. This includes all fields of the directly declared 5078 static and instance fields in the class, and includes all fields (both 5079 public and private) fields declared in superclasses and superinterfaces. 5080 The index is thus calculated by summing the index of the field in the directly 5081 declared class (see <functionlink id="GetClassFields"/>), with the total 5082 number of fields (both public and private) declared in all superclasses 5083 and superinterfaces. The index starts at zero. 5084 Note: this definition differs from that in the <jvmti/> 1.0 Specification. 5085 <rationale>No known implementations used the 1.0 definition.</rationale> 5086 </constant> 5087 <constant id="JVMTI_REFERENCE_CONSTANT_POOL" num="9"> 5088 Reference from a class to a resolved entry in the constant pool. 5089 For references of this kind the <code>referrer_index</code> 5090 parameter to the <internallink id="jvmtiObjectReferenceCallback"> 5091 jvmtiObjectReferenceCallback</internallink> is the index into 5092 constant pool table of the class, starting at 1. See 5093 <vmspec chapter="4.4"/>. 5094 </constant> 5095 </constants> 5096 5097 <constants id="jvmtiIterationControl" label="Iteration Control Enumeration" kind="enum"> 5098 <constant id="JVMTI_ITERATION_CONTINUE" num="1"> 5099 Continue the iteration. 5100 If this is a reference iteration, follow the references of this object. 5101 </constant> 5102 <constant id="JVMTI_ITERATION_IGNORE" num="2"> 5103 Continue the iteration. 5104 If this is a reference iteration, ignore the references of this object. 5105 </constant> 5106 <constant id="JVMTI_ITERATION_ABORT" num="0"> 5107 Abort the iteration. 5108 </constant> 5109 </constants> 5110 </intro> 5111 5112 <callback id="jvmtiHeapObjectCallback"> 5113 <enum>jvmtiIterationControl</enum> 5114 <synopsis>Heap Object Callback</synopsis> 5115 <description> 5116 Agent supplied callback function. 5117 Describes (but does not pass in) an object in the heap. 5118 <p/> 5119 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration, 5120 or <code>JVMTI_ITERATION_ABORT</code> to stop iteration. 5121 <p/> 5122 See the <internallink id="heapCallbacks">heap callback 5123 function restrictions</internallink>. 5124 </description> 5125 <parameters> 5126 <param id="class_tag"> 5127 <jlong/> 5128 <description> 5129 The tag of the class of object (zero if the class is not tagged). 5130 If the object represents a runtime class, 5131 the <code>class_tag</code> is the tag 5132 associated with <code>java.lang.Class</code> 5133 (zero if <code>java.lang.Class</code> is not tagged). 5134 </description> 5135 </param> 5136 <param id="size"> 5137 <jlong/> 5138 <description> 5139 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 5140 </description> 5141 </param> 5142 <param id="tag_ptr"> 5143 <outptr><jlong/></outptr> 5144 <description> 5145 The object tag value, or zero if the object is not tagged. 5146 To set the tag value to be associated with the object 5147 the agent sets the <code>jlong</code> pointed to by the parameter. 5148 </description> 5149 </param> 5150 <param id="user_data"> 5151 <outptr><void/></outptr> 5152 <description> 5153 The user supplied data that was passed into the iteration function. 5154 </description> 5155 </param> 5156 </parameters> 5157 </callback> 5158 5159 <callback id="jvmtiHeapRootCallback"> 5160 <enum>jvmtiIterationControl</enum> 5161 <synopsis>Heap Root Object Callback</synopsis> 5162 <description> 5163 Agent supplied callback function. 5164 Describes (but does not pass in) an object that is a root for the purposes 5165 of garbage collection. 5166 <p/> 5167 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration, 5168 <code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing 5169 references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration. 5170 <p/> 5171 See the <internallink id="heapCallbacks">heap callback 5172 function restrictions</internallink>. 5173 </description> 5174 <parameters> 5175 <param id="root_kind"> 5176 <enum>jvmtiHeapRootKind</enum> 5177 <description> 5178 The kind of heap root. 5179 </description> 5180 </param> 5181 <param id="class_tag"> 5182 <jlong/> 5183 <description> 5184 The tag of the class of object (zero if the class is not tagged). 5185 If the object represents a runtime class, the <code>class_tag</code> is the tag 5186 associated with <code>java.lang.Class</code> 5187 (zero if <code>java.lang.Class</code> is not tagged). 5188 </description> 5189 </param> 5190 <param id="size"> 5191 <jlong/> 5192 <description> 5193 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 5194 </description> 5195 </param> 5196 <param id="tag_ptr"> 5197 <outptr><jlong/></outptr> 5198 <description> 5199 The object tag value, or zero if the object is not tagged. 5200 To set the tag value to be associated with the object 5201 the agent sets the <code>jlong</code> pointed to by the parameter. 5202 </description> 5203 </param> 5204 <param id="user_data"> 5205 <outptr><void/></outptr> 5206 <description> 5207 The user supplied data that was passed into the iteration function. 5208 </description> 5209 </param> 5210 </parameters> 5211 </callback> 5212 5213 <callback id="jvmtiStackReferenceCallback"> 5214 <enum>jvmtiIterationControl</enum> 5215 <synopsis>Stack Reference Object Callback</synopsis> 5216 <description> 5217 Agent supplied callback function. 5218 Describes (but does not pass in) an object on the stack that is a root for 5219 the purposes of garbage collection. 5220 <p/> 5221 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration, 5222 <code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing 5223 references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration. 5224 <p/> 5225 See the <internallink id="heapCallbacks">heap callback 5226 function restrictions</internallink>. 5227 </description> 5228 <parameters> 5229 <param id="root_kind"> 5230 <enum>jvmtiHeapRootKind</enum> 5231 <description> 5232 The kind of root (either <code>JVMTI_HEAP_ROOT_STACK_LOCAL</code> or 5233 <code>JVMTI_HEAP_ROOT_JNI_LOCAL</code>). 5234 </description> 5235 </param> 5236 <param id="class_tag"> 5237 <jlong/> 5238 <description> 5239 The tag of the class of object (zero if the class is not tagged). 5240 If the object represents a runtime class, the <code>class_tag</code> is the tag 5241 associated with <code>java.lang.Class</code> 5242 (zero if <code>java.lang.Class</code> is not tagged). 5243 </description> 5244 </param> 5245 <param id="size"> 5246 <jlong/> 5247 <description> 5248 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 5249 </description> 5250 </param> 5251 <param id="tag_ptr"> 5252 <outptr><jlong/></outptr> 5253 <description> 5254 The object tag value, or zero if the object is not tagged. 5255 To set the tag value to be associated with the object 5256 the agent sets the <code>jlong</code> pointed to by the parameter. 5257 </description> 5258 </param> 5259 <param id="thread_tag"> 5260 <jlong/> 5261 <description> 5262 The tag of the thread corresponding to this stack, zero if not tagged. 5263 </description> 5264 </param> 5265 <param id="depth"> 5266 <jint/> 5267 <description> 5268 The depth of the frame. 5269 </description> 5270 </param> 5271 <param id="method"> 5272 <jmethodID/> 5273 <description> 5274 The method executing in this frame. 5275 </description> 5276 </param> 5277 <param id="slot"> 5278 <jint/> 5279 <description> 5280 The slot number. 5281 </description> 5282 </param> 5283 <param id="user_data"> 5284 <outptr><void/></outptr> 5285 <description> 5286 The user supplied data that was passed into the iteration function. 5287 </description> 5288 </param> 5289 </parameters> 5290 </callback> 5291 5292 <callback id="jvmtiObjectReferenceCallback"> 5293 <enum>jvmtiIterationControl</enum> 5294 <synopsis>Object Reference Callback</synopsis> 5295 <description> 5296 Agent supplied callback function. 5297 Describes a reference from an object (the referrer) to another object 5298 (the referree). 5299 <p/> 5300 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration, 5301 <code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing 5302 references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration. 5303 <p/> 5304 See the <internallink id="heapCallbacks">heap callback 5305 function restrictions</internallink>. 5306 </description> 5307 <parameters> 5308 <param id="reference_kind"> 5309 <enum>jvmtiObjectReferenceKind</enum> 5310 <description> 5311 The type of reference. 5312 </description> 5313 </param> 5314 <param id="class_tag"> 5315 <jlong/> 5316 <description> 5317 The tag of the class of referree object (zero if the class is not tagged). 5318 If the referree object represents a runtime class, 5319 the <code>class_tag</code> is the tag 5320 associated with <code>java.lang.Class</code> 5321 (zero if <code>java.lang.Class</code> is not tagged). 5322 </description> 5323 </param> 5324 <param id="size"> 5325 <jlong/> 5326 <description> 5327 Size of the referree object (in bytes). 5328 See <functionlink id="GetObjectSize"/>. 5329 </description> 5330 </param> 5331 <param id="tag_ptr"> 5332 <outptr><jlong/></outptr> 5333 <description> 5334 The referree object tag value, or zero if the object is not 5335 tagged. 5336 To set the tag value to be associated with the object 5337 the agent sets the <code>jlong</code> pointed to by the parameter. 5338 </description> 5339 </param> 5340 <param id="referrer_tag"> 5341 <jlong/> 5342 <description> 5343 The tag of the referrer object, or zero if the referrer 5344 object is not tagged. 5345 </description> 5346 </param> 5347 <param id="referrer_index"> 5348 <jint/> 5349 <description> 5350 For references of type <code>JVMTI_REFERENCE_FIELD</code> or 5351 <code>JVMTI_REFERENCE_STATIC_FIELD</code> the index 5352 of the field in the referrer object. The index is based on the 5353 order of all the object's fields - see <internallink 5354 id="JVMTI_REFERENCE_FIELD">JVMTI_REFERENCE_FIELD</internallink> 5355 or <internallink 5356 id="JVMTI_REFERENCE_STATIC_FIELD">JVMTI_REFERENCE_STATIC_FIELD 5357 </internallink> for further description. 5358 <p/> 5359 For references of type <code>JVMTI_REFERENCE_ARRAY_ELEMENT</code> 5360 the array index - see <internallink id="JVMTI_REFERENCE_ARRAY_ELEMENT"> 5361 JVMTI_REFERENCE_ARRAY_ELEMENT</internallink> for further description. 5362 <p/> 5363 For references of type <code>JVMTI_REFERENCE_CONSTANT_POOL</code> 5364 the index into the constant pool of the class - see 5365 <internallink id="JVMTI_REFERENCE_CONSTANT_POOL"> 5366 JVMTI_REFERENCE_CONSTANT_POOL</internallink> for further 5367 description. 5368 <p/> 5369 For references of other kinds the <code>referrer_index</code> is 5370 <code>-1</code>. 5371 </description> 5372 </param> 5373 <param id="user_data"> 5374 <outptr><void/></outptr> 5375 <description> 5376 The user supplied data that was passed into the iteration function. 5377 </description> 5378 </param> 5379 </parameters> 5380 </callback> 5381 5382 <function id="IterateOverObjectsReachableFromObject" num="109"> 5383 <synopsis>Iterate Over Objects Reachable From Object</synopsis> 5384 <description> 5385 This function iterates over all objects that are directly 5386 and indirectly reachable from the specified object. 5387 For each object <i>A</i> (known 5388 as the referrer) with a reference to object <i>B</i> the specified 5389 callback function is called to describe the object reference. 5390 The callback is called exactly once for each reference from a referrer; 5391 this is true even if there are reference cycles or multiple paths to 5392 the referrer. 5393 There may be more than one reference between a referrer and a referree, 5394 These may be distinguished by the 5395 <datalink id="jvmtiObjectReferenceCallback.reference_kind"></datalink> and 5396 <datalink id="jvmtiObjectReferenceCallback.referrer_index"></datalink>. 5397 The callback for an object will always occur after the callback for 5398 its referrer. 5399 <p/> 5400 See <functionlink id="FollowReferences"/> for the object 5401 references which are reported. 5402 <p/> 5403 During the execution of this function the state of the heap 5404 does not change: no objects are allocated, no objects are 5405 garbage collected, and the state of objects (including 5406 held values) does not change. 5407 As a result, threads executing Java 5408 programming language code, threads attempting to resume the 5409 execution of Java programming language code, and threads 5410 attempting to execute JNI functions are typically stalled. 5411 </description> 5412 <origin>new</origin> 5413 <capabilities> 5414 <required id="can_tag_objects"></required> 5415 </capabilities> 5416 <parameters> 5417 <param id="object"> 5418 <jobject/> 5419 <description> 5420 The object 5421 </description> 5422 </param> 5423 <param id="object_reference_callback"> 5424 <ptrtype> 5425 <struct>jvmtiObjectReferenceCallback</struct> 5426 </ptrtype> 5427 <description> 5428 The callback to be called to describe each 5429 object reference. 5430 </description> 5431 </param> 5432 <param id="user_data"> 5433 <inbuf> 5434 <void/> 5435 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 5436 </inbuf> 5437 <description> 5438 User supplied data to be passed to the callback. 5439 </description> 5440 </param> 5441 </parameters> 5442 <errors> 5443 </errors> 5444 </function> 5445 5446 <function id="IterateOverReachableObjects" num="110"> 5447 <synopsis>Iterate Over Reachable Objects</synopsis> 5448 <description> 5449 This function iterates over the root objects and all objects that 5450 are directly and indirectly reachable from the root objects. 5451 The root objects comprise the set of system classes, 5452 JNI globals, references from thread stacks, and other objects used as roots 5453 for the purposes of garbage collection. 5454 <p/> 5455 For each root the <paramlink id="heap_root_callback"></paramlink> 5456 or <paramlink id="stack_ref_callback"></paramlink> callback is called. 5457 An object can be a root object for more than one reason and in that case 5458 the appropriate callback is called for each reason. 5459 <p/> 5460 For each object reference the <paramlink id="object_ref_callback"></paramlink> 5461 callback function is called to describe the object reference. 5462 The callback is called exactly once for each reference from a referrer; 5463 this is true even if there are reference cycles or multiple paths to 5464 the referrer. 5465 There may be more than one reference between a referrer and a referree, 5466 These may be distinguished by the 5467 <datalink id="jvmtiObjectReferenceCallback.reference_kind"></datalink> and 5468 <datalink id="jvmtiObjectReferenceCallback.referrer_index"></datalink>. 5469 The callback for an object will always occur after the callback for 5470 its referrer. 5471 <p/> 5472 See <functionlink id="FollowReferences"/> for the object 5473 references which are reported. 5474 <p/> 5475 Roots are always reported to the profiler before any object references 5476 are reported. In other words, the <paramlink id="object_ref_callback"></paramlink> 5477 callback will not be called until the appropriate callback has been called 5478 for all roots. If the <paramlink id="object_ref_callback"></paramlink> callback is 5479 specified as <code>NULL</code> then this function returns after 5480 reporting the root objects to the profiler. 5481 <p/> 5482 During the execution of this function the state of the heap 5483 does not change: no objects are allocated, no objects are 5484 garbage collected, and the state of objects (including 5485 held values) does not change. 5486 As a result, threads executing Java 5487 programming language code, threads attempting to resume the 5488 execution of Java programming language code, and threads 5489 attempting to execute JNI functions are typically stalled. 5490 </description> 5491 <origin>new</origin> 5492 <capabilities> 5493 <required id="can_tag_objects"></required> 5494 </capabilities> 5495 <parameters> 5496 <param id="heap_root_callback"> 5497 <ptrtype> 5498 <struct>jvmtiHeapRootCallback</struct> 5499 <nullok>do not report heap roots</nullok> 5500 </ptrtype> 5501 <description> 5502 The callback function to be called for each heap root of type 5503 <code>JVMTI_HEAP_ROOT_JNI_GLOBAL</code>, 5504 <code>JVMTI_HEAP_ROOT_SYSTEM_CLASS</code>, 5505 <code>JVMTI_HEAP_ROOT_MONITOR</code>, 5506 <code>JVMTI_HEAP_ROOT_THREAD</code>, or 5507 <code>JVMTI_HEAP_ROOT_OTHER</code>. 5508 </description> 5509 </param> 5510 <param id="stack_ref_callback"> 5511 <ptrtype> 5512 <struct>jvmtiStackReferenceCallback</struct> 5513 <nullok>do not report stack references</nullok> 5514 </ptrtype> 5515 <description> 5516 The callback function to be called for each heap root of 5517 <code>JVMTI_HEAP_ROOT_STACK_LOCAL</code> or 5518 <code>JVMTI_HEAP_ROOT_JNI_LOCAL</code>. 5519 </description> 5520 </param> 5521 <param id="object_ref_callback"> 5522 <ptrtype> 5523 <struct>jvmtiObjectReferenceCallback</struct> 5524 <nullok>do not follow references from the root objects</nullok> 5525 </ptrtype> 5526 <description> 5527 The callback function to be called for each object reference. 5528 </description> 5529 </param> 5530 <param id="user_data"> 5531 <inbuf> 5532 <void/> 5533 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 5534 </inbuf> 5535 <description> 5536 User supplied data to be passed to the callback. 5537 </description> 5538 </param> 5539 </parameters> 5540 <errors> 5541 </errors> 5542 </function> 5543 5544 <function id="IterateOverHeap" num="111"> 5545 <synopsis>Iterate Over Heap</synopsis> 5546 <description> 5547 Iterate over all objects in the heap. This includes both reachable and 5548 unreachable objects. 5549 <p/> 5550 The <paramlink id="object_filter"></paramlink> parameter indicates the 5551 objects for which the callback function is called. If this parameter 5552 is <code>JVMTI_HEAP_OBJECT_TAGGED</code> then the callback will only be 5553 called for every object that is tagged. If the parameter is 5554 <code>JVMTI_HEAP_OBJECT_UNTAGGED</code> then the callback will only be 5555 for objects that are not tagged. If the parameter 5556 is <code>JVMTI_HEAP_OBJECT_EITHER</code> then the callback will be 5557 called for every object in the heap, irrespective of whether it is 5558 tagged or not. 5559 <p/> 5560 During the execution of this function the state of the heap 5561 does not change: no objects are allocated, no objects are 5562 garbage collected, and the state of objects (including 5563 held values) does not change. 5564 As a result, threads executing Java 5565 programming language code, threads attempting to resume the 5566 execution of Java programming language code, and threads 5567 attempting to execute JNI functions are typically stalled. 5568 </description> 5569 <origin>new</origin> 5570 <capabilities> 5571 <required id="can_tag_objects"></required> 5572 </capabilities> 5573 <parameters> 5574 <param id="object_filter"> 5575 <enum>jvmtiHeapObjectFilter</enum> 5576 <description> 5577 Indicates the objects for which the callback function is called. 5578 </description> 5579 </param> 5580 <param id="heap_object_callback"> 5581 <ptrtype> 5582 <struct>jvmtiHeapObjectCallback</struct> 5583 </ptrtype> 5584 <description> 5585 The iterator function to be called for each 5586 object matching the <paramlink id="object_filter"/>. 5587 </description> 5588 </param> 5589 <param id="user_data"> 5590 <inbuf> 5591 <void/> 5592 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 5593 </inbuf> 5594 <description> 5595 User supplied data to be passed to the callback. 5596 </description> 5597 </param> 5598 </parameters> 5599 <errors> 5600 </errors> 5601 </function> 5602 5603 <function id="IterateOverInstancesOfClass" num="112"> 5604 <synopsis>Iterate Over Instances Of Class</synopsis> 5605 <description> 5606 Iterate over all objects in the heap that are instances of the specified class. 5607 This includes direct instances of the specified class and 5608 instances of all subclasses of the specified class. 5609 This includes both reachable and unreachable objects. 5610 <p/> 5611 The <paramlink id="object_filter"></paramlink> parameter indicates the 5612 objects for which the callback function is called. If this parameter 5613 is <code>JVMTI_HEAP_OBJECT_TAGGED</code> then the callback will only be 5614 called for every object that is tagged. If the parameter is 5615 <code>JVMTI_HEAP_OBJECT_UNTAGGED</code> then the callback will only be 5616 called for objects that are not tagged. If the parameter 5617 is <code>JVMTI_HEAP_OBJECT_EITHER</code> then the callback will be 5618 called for every object in the heap, irrespective of whether it is 5619 tagged or not. 5620 <p/> 5621 During the execution of this function the state of the heap 5622 does not change: no objects are allocated, no objects are 5623 garbage collected, and the state of objects (including 5624 held values) does not change. 5625 As a result, threads executing Java 5626 programming language code, threads attempting to resume the 5627 execution of Java programming language code, and threads 5628 attempting to execute JNI functions are typically stalled. 5629 </description> 5630 <origin>new</origin> 5631 <capabilities> 5632 <required id="can_tag_objects"></required> 5633 </capabilities> 5634 <parameters> 5635 <param id="klass"> 5636 <jclass/> 5637 <description> 5638 Iterate over objects of this class only. 5639 </description> 5640 </param> 5641 <param id="object_filter"> 5642 <enum>jvmtiHeapObjectFilter</enum> 5643 <description> 5644 Indicates the objects for which the callback function is called. 5645 </description> 5646 </param> 5647 <param id="heap_object_callback"> 5648 <ptrtype> 5649 <struct>jvmtiHeapObjectCallback</struct> 5650 </ptrtype> 5651 <description> 5652 The iterator function to be called for each 5653 <paramlink id="klass"/> instance matching 5654 the <paramlink id="object_filter"/>. 5655 </description> 5656 </param> 5657 <param id="user_data"> 5658 <inbuf> 5659 <void/> 5660 <nullok><code>NULL</code> is passed as the user supplied data</nullok> 5661 </inbuf> 5662 <description> 5663 User supplied data to be passed to the callback. 5664 </description> 5665 </param> 5666 </parameters> 5667 <errors> 5668 </errors> 5669 </function> 5670 5671 </category> 5672 5673 <category id="local" label="Local Variable"> 5674 5675 <intro> 5676 These functions are used to retrieve or set the value of a local variable. 5677 The variable is identified by the depth of the frame containing its 5678 value and the variable's slot number within that frame. 5679 The mapping of variables to 5680 slot numbers can be obtained with the function 5681 <functionlink id="GetLocalVariableTable"></functionlink>. 5682 </intro> 5683 5684 <function id="GetLocalObject" num="21"> 5685 <synopsis>Get Local Variable - Object</synopsis> 5686 <description> 5687 This function can be used to retrieve the value of a local 5688 variable whose type is <code>Object</code> or a subclass of <code>Object</code>. 5689 </description> 5690 <origin>jvmdi</origin> 5691 <capabilities> 5692 <required id="can_access_local_variables"></required> 5693 </capabilities> 5694 <parameters> 5695 <param id="thread"> 5696 <jthread null="current" frame="frame"/> 5697 <description> 5698 The thread of the frame containing the variable's value. 5699 </description> 5700 </param> 5701 <param id="depth"> 5702 <jframeID thread="thread"/> 5703 <description> 5704 The depth of the frame containing the variable's value. 5705 </description> 5706 </param> 5707 <param id="slot"> 5708 <jint/> 5709 <description> 5710 The variable's slot number. 5711 </description> 5712 </param> 5713 <param id="value_ptr"> 5714 <outptr><jobject/></outptr> 5715 <description> 5716 On return, points to the variable's value. 5717 </description> 5718 </param> 5719 </parameters> 5720 <errors> 5721 <error id="JVMTI_ERROR_INVALID_SLOT"> 5722 Invalid <code>slot</code>. 5723 </error> 5724 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 5725 The variable type is not 5726 <code>Object</code> or a subclass of <code>Object</code>. 5727 </error> 5728 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 5729 Not a visible frame 5730 </error> 5731 </errors> 5732 </function> 5733 5734 <function id="GetLocalInstance" num="155" since="1.2"> 5735 <synopsis>Get Local Instance</synopsis> 5736 <description> 5737 This function can be used to retrieve the value of the local object 5738 variable at slot 0 (the "<code>this</code>" object) from non-static 5739 frames. This function can retrieve the "<code>this</code>" object from 5740 native method frames, whereas <code>GetLocalObject()</code> would 5741 return <code>JVMTI_ERROR_OPAQUE_FRAME</code> in those cases. 5742 </description> 5743 <origin>new</origin> 5744 <capabilities> 5745 <required id="can_access_local_variables"></required> 5746 </capabilities> 5747 <parameters> 5748 <param id="thread"> 5749 <jthread null="current" frame="frame"/> 5750 <description> 5751 The thread of the frame containing the variable's value. 5752 </description> 5753 </param> 5754 <param id="depth"> 5755 <jframeID thread="thread"/> 5756 <description> 5757 The depth of the frame containing the variable's value. 5758 </description> 5759 </param> 5760 <param id="value_ptr"> 5761 <outptr><jobject/></outptr> 5762 <description> 5763 On return, points to the variable's value. 5764 </description> 5765 </param> 5766 </parameters> 5767 <errors> 5768 <error id="JVMTI_ERROR_INVALID_SLOT"> 5769 If the specified frame is a static method frame. 5770 </error> 5771 </errors> 5772 </function> 5773 <function id="GetLocalInt" num="22"> 5774 <synopsis>Get Local Variable - Int</synopsis> 5775 <description> 5776 This function can be used to retrieve the value of a local 5777 variable whose type is <code>int</code>, 5778 <code>short</code>, <code>char</code>, <code>byte</code>, or 5779 <code>boolean</code>. 5780 </description> 5781 <origin>jvmdi</origin> 5782 <capabilities> 5783 <required id="can_access_local_variables"></required> 5784 </capabilities> 5785 <parameters> 5786 <param id="thread"> 5787 <jthread null="current" frame="frame"/> 5788 <description> 5789 The thread of the frame containing the variable's value. 5790 </description> 5791 </param> 5792 <param id="depth"> 5793 <jframeID thread="thread"/> 5794 <description> 5795 The depth of the frame containing the variable's value. 5796 </description> 5797 </param> 5798 <param id="slot"> 5799 <jint/> 5800 <description> 5801 The variable's slot number. 5802 </description> 5803 </param> 5804 <param id="value_ptr"> 5805 <outptr><jint/></outptr> 5806 <description> 5807 On return, points to the variable's value. 5808 </description> 5809 </param> 5810 </parameters> 5811 <errors> 5812 <error id="JVMTI_ERROR_INVALID_SLOT"> 5813 Invalid <code>slot</code>. 5814 </error> 5815 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 5816 The variable type is not 5817 <code>int</code>, <code>short</code>, 5818 <code>char</code>, <code>byte</code>, or 5819 <code>boolean</code>. 5820 </error> 5821 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 5822 Not a visible frame 5823 </error> 5824 </errors> 5825 </function> 5826 5827 <function id="GetLocalLong" num="23"> 5828 <synopsis>Get Local Variable - Long</synopsis> 5829 <description> 5830 This function can be used to retrieve the value of a local 5831 variable whose type is <code>long</code>. 5832 </description> 5833 <origin>jvmdi</origin> 5834 <capabilities> 5835 <required id="can_access_local_variables"></required> 5836 </capabilities> 5837 <parameters> 5838 <param id="thread"> 5839 <jthread null="current" frame="frame"/> 5840 <description> 5841 The thread of the frame containing the variable's value. 5842 </description> 5843 </param> 5844 <param id="depth"> 5845 <jframeID thread="thread"/> 5846 <description> 5847 The depth of the frame containing the variable's value. 5848 </description> 5849 </param> 5850 <param id="slot"> 5851 <jint/> 5852 <description> 5853 The variable's slot number. 5854 </description> 5855 </param> 5856 <param id="value_ptr"> 5857 <outptr><jlong/></outptr> 5858 <description> 5859 On return, points to the variable's value. 5860 </description> 5861 </param> 5862 </parameters> 5863 <errors> 5864 <error id="JVMTI_ERROR_INVALID_SLOT"> 5865 Invalid <code>slot</code>. 5866 </error> 5867 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 5868 The variable type is not <code>long</code>. 5869 </error> 5870 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 5871 Not a visible frame 5872 </error> 5873 </errors> 5874 </function> 5875 5876 <function id="GetLocalFloat" num="24"> 5877 <synopsis>Get Local Variable - Float</synopsis> 5878 <description> 5879 This function can be used to retrieve the value of a local 5880 variable whose type is <code>float</code>. 5881 </description> 5882 <origin>jvmdi</origin> 5883 <capabilities> 5884 <required id="can_access_local_variables"></required> 5885 </capabilities> 5886 <parameters> 5887 <param id="thread"> 5888 <jthread null="current" frame="frame"/> 5889 <description> 5890 The thread of the frame containing the variable's value. 5891 </description> 5892 </param> 5893 <param id="depth"> 5894 <jframeID thread="thread"/> 5895 <description> 5896 The depth of the frame containing the variable's value. 5897 </description> 5898 </param> 5899 <param id="slot"> 5900 <jint/> 5901 <description> 5902 The variable's slot number. 5903 </description> 5904 </param> 5905 <param id="value_ptr"> 5906 <outptr><jfloat/></outptr> 5907 <description> 5908 On return, points to the variable's value. 5909 </description> 5910 </param> 5911 </parameters> 5912 <errors> 5913 <error id="JVMTI_ERROR_INVALID_SLOT"> 5914 Invalid <code>slot</code>. 5915 </error> 5916 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 5917 The variable type is not <code>float</code>. 5918 </error> 5919 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 5920 Not a visible frame 5921 </error> 5922 </errors> 5923 </function> 5924 5925 <function id="GetLocalDouble" num="25"> 5926 <synopsis>Get Local Variable - Double</synopsis> 5927 <description> 5928 This function can be used to retrieve the value of a local 5929 variable whose type is <code>long</code>. 5930 </description> 5931 <origin>jvmdi</origin> 5932 <capabilities> 5933 <required id="can_access_local_variables"></required> 5934 </capabilities> 5935 <parameters> 5936 <param id="thread"> 5937 <jthread null="current" frame="frame"/> 5938 <description> 5939 The thread of the frame containing the variable's value. 5940 </description> 5941 </param> 5942 <param id="depth"> 5943 <jframeID thread="thread"/> 5944 <description> 5945 The depth of the frame containing the variable's value. 5946 </description> 5947 </param> 5948 <param id="slot"> 5949 <jint/> 5950 <description> 5951 The variable's slot number. 5952 </description> 5953 </param> 5954 <param id="value_ptr"> 5955 <outptr><jdouble/></outptr> 5956 <description> 5957 On return, points to the variable's value. 5958 </description> 5959 </param> 5960 </parameters> 5961 <errors> 5962 <error id="JVMTI_ERROR_INVALID_SLOT"> 5963 Invalid <code>slot</code>. 5964 </error> 5965 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 5966 The variable type is not <code>double</code>. 5967 </error> 5968 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 5969 Not a visible frame 5970 </error> 5971 </errors> 5972 </function> 5973 5974 <function id="SetLocalObject" num="26"> 5975 <synopsis>Set Local Variable - Object</synopsis> 5976 <description> 5977 This function can be used to set the value of a local 5978 variable whose type is <code>Object</code> or a subclass of <code>Object</code>. 5979 </description> 5980 <origin>jvmdi</origin> 5981 <capabilities> 5982 <required id="can_access_local_variables"></required> 5983 </capabilities> 5984 <parameters> 5985 <param id="thread"> 5986 <jthread null="current" frame="frame"/> 5987 <description> 5988 The thread of the frame containing the variable's value. 5989 </description> 5990 </param> 5991 <param id="depth"> 5992 <jframeID thread="thread"/> 5993 <description> 5994 The depth of the frame containing the variable's value. 5995 </description> 5996 </param> 5997 <param id="slot"> 5998 <jint/> 5999 <description> 6000 The variable's slot number. 6001 </description> 6002 </param> 6003 <param id="value"> 6004 <jobject/> 6005 <description> 6006 The new value for the variable. 6007 </description> 6008 </param> 6009 </parameters> 6010 <errors> 6011 <error id="JVMTI_ERROR_INVALID_SLOT"> 6012 Invalid <code>slot</code>. 6013 </error> 6014 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6015 The variable type is not 6016 <code>Object</code> or a subclass of <code>Object</code>. 6017 </error> 6018 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6019 The supplied <paramlink id="value"/> is not compatible 6020 with the variable type. 6021 </error> 6022 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6023 Not a visible frame 6024 </error> 6025 </errors> 6026 </function> 6027 6028 <function id="SetLocalInt" num="27"> 6029 <synopsis>Set Local Variable - Int</synopsis> 6030 <description> 6031 This function can be used to set the value of a local 6032 variable whose type is <code>int</code>, 6033 <code>short</code>, <code>char</code>, <code>byte</code>, or 6034 <code>boolean</code>. 6035 </description> 6036 <origin>jvmdi</origin> 6037 <capabilities> 6038 <required id="can_access_local_variables"></required> 6039 </capabilities> 6040 <parameters> 6041 <param id="thread"> 6042 <jthread null="current" frame="frame"/> 6043 <description> 6044 The thread of the frame containing the variable's value. 6045 </description> 6046 </param> 6047 <param id="depth"> 6048 <jframeID thread="thread"/> 6049 <description> 6050 The depth of the frame containing the variable's value. 6051 </description> 6052 </param> 6053 <param id="slot"> 6054 <jint/> 6055 <description> 6056 The variable's slot number. 6057 </description> 6058 </param> 6059 <param id="value"> 6060 <jint/> 6061 <description> 6062 The new value for the variable. 6063 </description> 6064 </param> 6065 </parameters> 6066 <errors> 6067 <error id="JVMTI_ERROR_INVALID_SLOT"> 6068 Invalid <code>slot</code>. 6069 </error> 6070 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6071 The variable type is not 6072 <code>int</code>, <code>short</code>, 6073 <code>char</code>, <code>byte</code>, or 6074 <code>boolean</code>. 6075 </error> 6076 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6077 Not a visible frame 6078 </error> 6079 </errors> 6080 </function> 6081 6082 <function id="SetLocalLong" num="28"> 6083 <synopsis>Set Local Variable - Long</synopsis> 6084 <description> 6085 This function can be used to set the value of a local 6086 variable whose type is <code>long</code>. 6087 </description> 6088 <origin>jvmdi</origin> 6089 <capabilities> 6090 <required id="can_access_local_variables"></required> 6091 </capabilities> 6092 <parameters> 6093 <param id="thread"> 6094 <jthread null="current" frame="frame"/> 6095 <description> 6096 The thread of the frame containing the variable's value. 6097 </description> 6098 </param> 6099 <param id="depth"> 6100 <jframeID thread="thread"/> 6101 <description> 6102 The depth of the frame containing the variable's value. 6103 </description> 6104 </param> 6105 <param id="slot"> 6106 <jint/> 6107 <description> 6108 The variable's slot number. 6109 </description> 6110 </param> 6111 <param id="value"> 6112 <jlong/> 6113 <description> 6114 The new value for the variable. 6115 </description> 6116 </param> 6117 </parameters> 6118 <errors> 6119 <error id="JVMTI_ERROR_INVALID_SLOT"> 6120 Invalid <code>slot</code>. 6121 </error> 6122 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6123 The variable type is not <code>long</code>. 6124 </error> 6125 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6126 Not a visible frame 6127 </error> 6128 </errors> 6129 </function> 6130 6131 <function id="SetLocalFloat" num="29"> 6132 <synopsis>Set Local Variable - Float</synopsis> 6133 <description> 6134 This function can be used to set the value of a local 6135 variable whose type is <code>float</code>. 6136 </description> 6137 <origin>jvmdi</origin> 6138 <capabilities> 6139 <required id="can_access_local_variables"></required> 6140 </capabilities> 6141 <parameters> 6142 <param id="thread"> 6143 <jthread null="current" frame="frame"/> 6144 <description> 6145 The thread of the frame containing the variable's value. 6146 </description> 6147 </param> 6148 <param id="depth"> 6149 <jframeID thread="thread"/> 6150 <description> 6151 The depth of the frame containing the variable's value. 6152 </description> 6153 </param> 6154 <param id="slot"> 6155 <jint/> 6156 <description> 6157 The variable's slot number. 6158 </description> 6159 </param> 6160 <param id="value"> 6161 <jfloat/> 6162 <description> 6163 The new value for the variable. 6164 </description> 6165 </param> 6166 </parameters> 6167 <errors> 6168 <error id="JVMTI_ERROR_INVALID_SLOT"> 6169 Invalid <code>slot</code>. 6170 </error> 6171 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6172 The variable type is not <code>float</code>. 6173 </error> 6174 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6175 Not a visible frame 6176 </error> 6177 </errors> 6178 </function> 6179 6180 <function id="SetLocalDouble" num="30"> 6181 <synopsis>Set Local Variable - Double</synopsis> 6182 <description> 6183 This function can be used to set the value of a local 6184 variable whose type is <code>double</code>. 6185 </description> 6186 <origin>jvmdi</origin> 6187 <capabilities> 6188 <required id="can_access_local_variables"></required> 6189 </capabilities> 6190 <parameters> 6191 <param id="thread"> 6192 <jthread null="current" frame="frame"/> 6193 <description> 6194 The thread of the frame containing the variable's value. 6195 </description> 6196 </param> 6197 <param id="depth"> 6198 <jframeID thread="thread"/> 6199 <description> 6200 The depth of the frame containing the variable's value. 6201 </description> 6202 </param> 6203 <param id="slot"> 6204 <jint/> 6205 <description> 6206 The variable's slot number. 6207 </description> 6208 </param> 6209 <param id="value"> 6210 <jdouble/> 6211 <description> 6212 The new value for the variable. 6213 </description> 6214 </param> 6215 </parameters> 6216 <errors> 6217 <error id="JVMTI_ERROR_INVALID_SLOT"> 6218 Invalid <code>slot</code>. 6219 </error> 6220 <error id="JVMTI_ERROR_TYPE_MISMATCH"> 6221 The variable type is not <code>double</code>. 6222 </error> 6223 <error id="JVMTI_ERROR_OPAQUE_FRAME"> 6224 Not a visible frame 6225 </error> 6226 </errors> 6227 </function> 6228 </category> 6229 6230 <category id="breakpointCategory" label="Breakpoint"> 6231 6232 <intro> 6233 </intro> 6234 6235 <function id="SetBreakpoint" num="38"> 6236 <synopsis>Set Breakpoint</synopsis> 6237 <description> 6238 Set a breakpoint at the instruction indicated by 6239 <code>method</code> and <code>location</code>. 6240 An instruction can only have one breakpoint. 6241 <p/> 6242 Whenever the designated instruction is about to be executed, a 6243 <eventlink id="Breakpoint"></eventlink> event is generated. 6244 </description> 6245 <origin>jvmdi</origin> 6246 <capabilities> 6247 <required id="can_generate_breakpoint_events"></required> 6248 </capabilities> 6249 <parameters> 6250 <param id="klass"> 6251 <jclass method="method"/> 6252 <description> 6253 The class in which to set the breakpoint 6254 </description> 6255 </param> 6256 <param id="method"> 6257 <jmethodID class="klass"/> 6258 <description> 6259 The method in which to set the breakpoint 6260 </description> 6261 </param> 6262 <param id="location"> 6263 <jlocation/> 6264 <description> 6265 the index of the instruction at which to set the breakpoint 6266 6267 </description> 6268 </param> 6269 </parameters> 6270 <errors> 6271 <error id="JVMTI_ERROR_DUPLICATE"> 6272 The designated bytecode already has a breakpoint. 6273 </error> 6274 </errors> 6275 </function> 6276 6277 <function id="ClearBreakpoint" num="39"> 6278 <synopsis>Clear Breakpoint</synopsis> 6279 <description> 6280 Clear the breakpoint at the bytecode indicated by 6281 <code>method</code> and <code>location</code>. 6282 </description> 6283 <origin>jvmdi</origin> 6284 <capabilities> 6285 <required id="can_generate_breakpoint_events"></required> 6286 </capabilities> 6287 <parameters> 6288 <param id="klass"> 6289 <jclass method="method"/> 6290 <description> 6291 The class in which to clear the breakpoint 6292 </description> 6293 </param> 6294 <param id="method"> 6295 <jmethodID class="klass"/> 6296 <description> 6297 The method in which to clear the breakpoint 6298 </description> 6299 </param> 6300 <param id="location"> 6301 <jlocation/> 6302 <description> 6303 the index of the instruction at which to clear the breakpoint 6304 </description> 6305 </param> 6306 </parameters> 6307 <errors> 6308 <error id="JVMTI_ERROR_NOT_FOUND"> 6309 There's no breakpoint at the designated bytecode. 6310 </error> 6311 </errors> 6312 </function> 6313 6314 </category> 6315 6316 <category id="fieldWatch" label="Watched Field"> 6317 6318 <intro> 6319 </intro> 6320 6321 <function id="SetFieldAccessWatch" num="41"> 6322 <synopsis>Set Field Access Watch</synopsis> 6323 <description> 6324 Generate a <eventlink id="FieldAccess"></eventlink> event 6325 when the field specified 6326 by <code>klass</code> and 6327 <code>field</code> is about to be accessed. 6328 An event will be generated for each access of the field 6329 until it is canceled with 6330 <functionlink id="ClearFieldAccessWatch"></functionlink>. 6331 Field accesses from Java programming language code or from JNI code are watched, 6332 fields modified by other means are not watched. 6333 Note that <jvmti/> users should be aware that their own field accesses 6334 will trigger the watch. 6335 A field can only have one field access watch set. 6336 Modification of a field is not considered an access--use 6337 <functionlink id="SetFieldModificationWatch"></functionlink> 6338 to monitor modifications. 6339 </description> 6340 <origin>jvmdi</origin> 6341 <capabilities> 6342 <required id="can_generate_field_access_events"></required> 6343 </capabilities> 6344 <parameters> 6345 <param id="klass"> 6346 <jclass field="field"/> 6347 <description> 6348 The class containing the field to watch 6349 </description> 6350 </param> 6351 <param id="field"> 6352 <jfieldID class="klass"/> 6353 <description> 6354 The field to watch 6355 6356 </description> 6357 </param> 6358 </parameters> 6359 <errors> 6360 <error id="JVMTI_ERROR_DUPLICATE"> 6361 The designated field is already being watched for accesses. 6362 </error> 6363 </errors> 6364 </function> 6365 6366 <function id="ClearFieldAccessWatch" num="42"> 6367 <synopsis>Clear Field Access Watch</synopsis> 6368 <description> 6369 Cancel a field access watch previously set by 6370 <functionlink id="SetFieldAccessWatch"></functionlink>, on the 6371 field specified 6372 by <code>klass</code> and 6373 <code>field</code>. 6374 </description> 6375 <origin>jvmdi</origin> 6376 <capabilities> 6377 <required id="can_generate_field_access_events"></required> 6378 </capabilities> 6379 <parameters> 6380 <param id="klass"> 6381 <jclass field="field"/> 6382 <description> 6383 The class containing the field to watch 6384 </description> 6385 </param> 6386 <param id="field"> 6387 <jfieldID class="klass"/> 6388 <description> 6389 The field to watch 6390 6391 </description> 6392 </param> 6393 </parameters> 6394 <errors> 6395 <error id="JVMTI_ERROR_NOT_FOUND"> 6396 The designated field is not being watched for accesses. 6397 </error> 6398 </errors> 6399 </function> 6400 6401 <function id="SetFieldModificationWatch" num="43"> 6402 <synopsis>Set Field Modification Watch</synopsis> 6403 <description> 6404 Generate a <eventlink id="FieldModification"></eventlink> event 6405 when the field specified 6406 by <code>klass</code> and 6407 <code>field</code> is about to be modified. 6408 An event will be generated for each modification of the field 6409 until it is canceled with 6410 <functionlink id="ClearFieldModificationWatch"></functionlink>. 6411 Field modifications from Java programming language code or from JNI code are watched, 6412 fields modified by other means are not watched. 6413 Note that <jvmti/> users should be aware that their own field modifications 6414 will trigger the watch. 6415 A field can only have one field modification watch set. 6416 </description> 6417 <origin>jvmdi</origin> 6418 <capabilities> 6419 <required id="can_generate_field_modification_events"></required> 6420 </capabilities> 6421 <parameters> 6422 <param id="klass"> 6423 <jclass field="field"/> 6424 <description> 6425 The class containing the field to watch 6426 </description> 6427 </param> 6428 <param id="field"> 6429 <jfieldID class="klass"/> 6430 <description> 6431 The field to watch 6432 6433 </description> 6434 </param> 6435 </parameters> 6436 <errors> 6437 <error id="JVMTI_ERROR_DUPLICATE"> 6438 The designated field is already being watched for modifications. 6439 </error> 6440 </errors> 6441 </function> 6442 6443 <function id="ClearFieldModificationWatch" num="44"> 6444 <synopsis>Clear Field Modification Watch</synopsis> 6445 <description> 6446 6447 Cancel a field modification watch previously set by 6448 <functionlink id="SetFieldModificationWatch"></functionlink>, on the 6449 field specified 6450 by <code>klass</code> and 6451 <code>field</code>. 6452 </description> 6453 <origin>jvmdi</origin> 6454 <capabilities> 6455 <required id="can_generate_field_modification_events"></required> 6456 </capabilities> 6457 <parameters> 6458 <param id="klass"> 6459 <jclass field="field"/> 6460 <description> 6461 The class containing the field to watch 6462 </description> 6463 </param> 6464 <param id="field"> 6465 <jfieldID class="klass"/> 6466 <description> 6467 The field to watch 6468 6469 </description> 6470 </param> 6471 </parameters> 6472 <errors> 6473 <error id="JVMTI_ERROR_NOT_FOUND"> 6474 The designated field is not being watched for modifications. 6475 </error> 6476 </errors> 6477 </function> 6478 </category> 6479 6480 <category id="module" label="Module"> 6481 6482 <intro> 6483 </intro> 6484 6485 <function id="GetAllModules" num="3" since="9"> 6486 <synopsis>Get All Modules</synopsis> 6487 <description> 6488 Return an array of all modules loaded in the virtual machine. 6489 The array includes the unnamed module for each class loader. 6490 The number of modules in the array is returned via 6491 <code>module_count_ptr</code>, and the array itself via 6492 <code>modules_ptr</code>. 6493 <p/> 6494 </description> 6495 <origin>new</origin> 6496 <capabilities> 6497 </capabilities> 6498 <parameters> 6499 <param id="module_count_ptr"> 6500 <outptr><jint/></outptr> 6501 <description> 6502 On return, points to the number of returned modules. 6503 </description> 6504 </param> 6505 <param id="modules_ptr"> 6506 <allocbuf outcount="module_count_ptr"><jobject/></allocbuf> 6507 <description> 6508 On return, points to an array of references, one 6509 for each module. 6510 </description> 6511 </param> 6512 </parameters> 6513 <errors> 6514 </errors> 6515 </function> 6516 6517 <function id="GetNamedModule" num="40" since="9"> 6518 <synopsis>Get Named Module</synopsis> 6519 <description> 6520 Return the <code>java.lang.Module</code> object for a named 6521 module defined to a class loader that contains a given package. 6522 The module is returned via <code>module_ptr</code>. 6523 <p/> 6524 If a named module is defined to the class loader and it 6525 contains the package then that named module is returned, 6526 otherwise <code>NULL</code> is returned. 6527 <p/> 6528 </description> 6529 <origin>new</origin> 6530 <capabilities> 6531 </capabilities> 6532 <parameters> 6533 <param id="class_loader"> 6534 <ptrtype> 6535 <jobject/> 6536 <nullok>the bootstrap loader is assumed</nullok> 6537 </ptrtype> 6538 <description> 6539 A class loader. 6540 If the <code>class_loader</code> is not <code>NULL</code> 6541 or a subclass of <code>java.lang.ClassLoader</code> 6542 this function returns 6543 <errorlink id="JVMTI_ERROR_ILLEGAL_ARGUMENT"></errorlink>. 6544 </description> 6545 </param> 6546 <param id="package_name"> 6547 <inbuf><char/></inbuf> 6548 <description> 6549 The name of the package, encoded as a 6550 <internallink id="mUTF">modified UTF-8</internallink> string. 6551 The package name is in internal form (JVMS 4.2.1); 6552 identifiers are separated by forward slashes rather than periods. 6553 </description> 6554 </param> 6555 <param id="module_ptr"> 6556 <outptr><jobject/></outptr> 6557 <description> 6558 On return, points to a <code>java.lang.Module</code> object 6559 or points to <code>NULL</code>. 6560 </description> 6561 </param> 6562 </parameters> 6563 <errors> 6564 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 6565 If class loader is not <code>NULL</code> and is not a class loader object. 6566 </error> 6567 </errors> 6568 </function> 6569 6570 <function id="AddModuleReads" num="94" since="9"> 6571 <synopsis>Add Module Reads</synopsis> 6572 <description> 6573 Update a module to read another module. This function is a no-op 6574 when <paramlink id="module"></paramlink> is an unnamed module. 6575 This function facilitates the instrumentation of code 6576 in named modules where that instrumentation requires 6577 expanding the set of modules that a module reads. 6578 </description> 6579 <origin>new</origin> 6580 <capabilities> 6581 </capabilities> 6582 <parameters> 6583 <param id="module"> 6584 <ptrtype><jobject/></ptrtype> 6585 <description> 6586 The module to update. 6587 </description> 6588 </param> 6589 <param id="to_module"> 6590 <ptrtype><jobject/></ptrtype> 6591 <description> 6592 The additional module to read. 6593 </description> 6594 </param> 6595 </parameters> 6596 <errors> 6597 <error id="JVMTI_ERROR_INVALID_MODULE"> 6598 If <paramlink id="module"></paramlink> is not a module object. 6599 </error> 6600 <error id="JVMTI_ERROR_INVALID_MODULE"> 6601 If <paramlink id="to_module"></paramlink> is not a module object. 6602 </error> 6603 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE"> 6604 if the module cannot be modified. 6605 See <functionlink id="IsModifiableModule"/>. 6606 </error> 6607 </errors> 6608 </function> 6609 6610 <function id="AddModuleExports" num="95" since="9"> 6611 <synopsis>Add Module Exports</synopsis> 6612 <description> 6613 Update a module to export a package to another module. 6614 This function is a no-op when <paramlink id="module"></paramlink> 6615 is an unnamed module or an open module. 6616 This function facilitates the instrumentation of code 6617 in named modules where that instrumentation requires 6618 expanding the set of packages that a module exports. 6619 </description> 6620 <origin>new</origin> 6621 <capabilities> 6622 </capabilities> 6623 <parameters> 6624 <param id="module"> 6625 <ptrtype><jobject/></ptrtype> 6626 <description> 6627 The module to update. 6628 </description> 6629 </param> 6630 <param id="pkg_name"> 6631 <inbuf><char/></inbuf> 6632 <description> 6633 The exported package name. 6634 </description> 6635 </param> 6636 <param id="to_module"> 6637 <ptrtype><jobject/></ptrtype> 6638 <description> 6639 The module the package is exported to. 6640 If the <code>to_module</code> is not a subclass of 6641 <code>java.lang.Module</code> this function returns 6642 <errorlink id="JVMTI_ERROR_INVALID_MODULE"></errorlink>. 6643 </description> 6644 </param> 6645 </parameters> 6646 <errors> 6647 <error id="JVMTI_ERROR_INVALID_MODULE"> 6648 If <paramlink id="module"></paramlink> is not a module object. 6649 </error> 6650 <error id="JVMTI_ERROR_INVALID_MODULE"> 6651 If <paramlink id="to_module"></paramlink> is not a module object. 6652 </error> 6653 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 6654 If the package <paramlink id="pkg_name"></paramlink> 6655 does not belong to the module. 6656 </error> 6657 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE"> 6658 if the module cannot be modified. 6659 See <functionlink id="IsModifiableModule"/>. 6660 </error> 6661 </errors> 6662 </function> 6663 6664 <function id="AddModuleOpens" num="96" since="9"> 6665 <synopsis>Add Module Opens</synopsis> 6666 <description> 6667 Update a module to open a package to another module. 6668 This function is a no-op when <paramlink id="module"></paramlink> 6669 is an unnamed module or an open module. 6670 This function facilitates the instrumentation of code 6671 in modules where that instrumentation requires 6672 expanding the set of packages that a module opens to 6673 other modules. 6674 </description> 6675 <origin>new</origin> 6676 <capabilities> 6677 </capabilities> 6678 <parameters> 6679 <param id="module"> 6680 <ptrtype><jobject/></ptrtype> 6681 <description> 6682 The module to update. 6683 </description> 6684 </param> 6685 <param id="pkg_name"> 6686 <inbuf><char/></inbuf> 6687 <description> 6688 The package name of the package to open. 6689 </description> 6690 </param> 6691 <param id="to_module"> 6692 <ptrtype><jobject/></ptrtype> 6693 <description> 6694 The module with the package to open. 6695 If the <code>to_module</code> is not a subclass of 6696 <code>java.lang.Module</code> this function returns 6697 <errorlink id="JVMTI_ERROR_INVALID_MODULE"></errorlink>. 6698 </description> 6699 </param> 6700 </parameters> 6701 <errors> 6702 <error id="JVMTI_ERROR_INVALID_MODULE"> 6703 If <paramlink id="module"></paramlink> is not a module object. 6704 </error> 6705 <error id="JVMTI_ERROR_INVALID_MODULE"> 6706 If <paramlink id="to_module"></paramlink> is not a module object. 6707 </error> 6708 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 6709 If the package <paramlink id="pkg_name"></paramlink> 6710 does not belong to the module. 6711 </error> 6712 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE"> 6713 if the module cannot be modified. 6714 See <functionlink id="IsModifiableModule"/>. 6715 </error> 6716 </errors> 6717 </function> 6718 6719 <function id="AddModuleUses" num="97" since="9"> 6720 <synopsis>Add Module Uses</synopsis> 6721 <description> 6722 Updates a module to add a service to the set of services that 6723 a module uses. This function is a no-op when the module 6724 is an unnamed module. 6725 This function facilitates the instrumentation of code 6726 in named modules where that instrumentation requires 6727 expanding the set of services that a module is using. 6728 </description> 6729 <origin>new</origin> 6730 <capabilities> 6731 </capabilities> 6732 <parameters> 6733 <param id="module"> 6734 <ptrtype><jobject/></ptrtype> 6735 <description> 6736 The module to update. 6737 </description> 6738 </param> 6739 <param id="service"> 6740 <ptrtype><jclass/></ptrtype> 6741 <description> 6742 The service to use. 6743 </description> 6744 </param> 6745 </parameters> 6746 <errors> 6747 <error id="JVMTI_ERROR_INVALID_MODULE"> 6748 If <paramlink id="module"></paramlink> is not a module object. 6749 </error> 6750 <error id="JVMTI_ERROR_INVALID_CLASS"> 6751 If <paramlink id="service"></paramlink> is not a class object. 6752 </error> 6753 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE"> 6754 if the module cannot be modified. 6755 See <functionlink id="IsModifiableModule"/>. 6756 </error> 6757 </errors> 6758 </function> 6759 6760 <function id="AddModuleProvides" num="98" since="9"> 6761 <synopsis>Add Module Provides</synopsis> 6762 <description> 6763 Updates a module to add a service to the set of services that 6764 a module provides. This function is a no-op when the module 6765 is an unnamed module. 6766 This function facilitates the instrumentation of code 6767 in named modules where that instrumentation requires 6768 changes to the services that are provided. 6769 </description> 6770 <origin>new</origin> 6771 <capabilities> 6772 </capabilities> 6773 <parameters> 6774 <param id="module"> 6775 <ptrtype><jobject/></ptrtype> 6776 <description> 6777 The module to update. 6778 </description> 6779 </param> 6780 <param id="service"> 6781 <ptrtype><jclass/></ptrtype> 6782 <description> 6783 The service to provide. 6784 </description> 6785 </param> 6786 <param id="impl_class"> 6787 <ptrtype><jclass/></ptrtype> 6788 <description> 6789 The implementation class for the provided service. 6790 </description> 6791 </param> 6792 </parameters> 6793 <errors> 6794 <error id="JVMTI_ERROR_INVALID_MODULE"> 6795 If <paramlink id="module"></paramlink> is not a module object. 6796 </error> 6797 <error id="JVMTI_ERROR_INVALID_CLASS"> 6798 If <paramlink id="service"></paramlink> is not a class object. 6799 </error> 6800 <error id="JVMTI_ERROR_INVALID_CLASS"> 6801 If <paramlink id="impl_class"></paramlink> is not a class object. 6802 </error> 6803 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE"> 6804 if the module cannot be modified. 6805 See <functionlink id="IsModifiableModule"/>. 6806 </error> 6807 </errors> 6808 </function> 6809 6810 <function id="IsModifiableModule" num="99" since="9"> 6811 <synopsis>Is Modifiable Module</synopsis> 6812 <description> 6813 Determines whether a module is modifiable. 6814 If a module is modifiable then this module can be updated with 6815 <functionlink id="AddModuleReads"/>, <functionlink id="AddModuleExports"/>, 6816 <functionlink id="AddModuleOpens"/>, <functionlink id="AddModuleUses"/>, 6817 and <functionlink id="AddModuleProvides"/>. If a module is not modifiable 6818 then the module can not be updated with these functions. The result of 6819 this function is always <code>JNI_TRUE</code> when called to determine 6820 if an unnamed module is modifiable. 6821 </description> 6822 <origin>new</origin> 6823 <capabilities> 6824 </capabilities> 6825 <parameters> 6826 <param id="module"> 6827 <ptrtype><jobject/></ptrtype> 6828 <description> 6829 The module to query. 6830 </description> 6831 </param> 6832 <param id="is_modifiable_module_ptr"> 6833 <outptr><jboolean/></outptr> 6834 <description> 6835 On return, points to the boolean result of this function. 6836 </description> 6837 </param> 6838 </parameters> 6839 <errors> 6840 <error id="JVMTI_ERROR_INVALID_MODULE"> 6841 If <paramlink id="module"></paramlink> is not a module object. 6842 </error> 6843 </errors> 6844 </function> 6845 6846 </category> 6847 6848 <category id="class" label="Class"> 6849 <function id="GetLoadedClasses" jkernel="yes" num="78"> 6850 <synopsis>Get Loaded Classes</synopsis> 6851 <description> 6852 Return an array of all classes loaded in the virtual machine. 6853 The number of classes in the array is returned via 6854 <code>class_count_ptr</code>, and the array itself via 6855 <code>classes_ptr</code>. 6856 <p/> 6857 A class or interface creation can be triggered by one of the following: 6858 <ul> 6859 <li>By loading and deriving a class from a <code>class</code> file representation 6860 using a class loader (see <vmspec chapter="5.3"/>).</li> 6861 <li>By invoking <externallink id="../api/java.base/java/lang/invoke/MethodHandles.Lookup.html#defineHiddenClass(byte[],boolean,java.lang.invoke.MethodHandles.Lookup.ClassOption...)">Lookup::defineHiddenClass</externallink> 6862 that creates a hidden class or interface from a <code>class</code> file representation.</li> 6863 <li>By invoking methods in certain Java SE Platform APIs such as reflection.</li> 6864 </ul> 6865 <p/> 6866 An array class is created directly by the Java virtual machine. The creation 6867 can be triggered by using class loaders or by invoking methods in certain 6868 Java SE Platform APIs such as reflection. 6869 <p/> 6870 The returned list includes all classes and interfaces, including 6871 <externallink id="../api/java.base/java/lang/Class.html#isHidden()"> 6872 hidden classes or interfaces</externallink>, 6873 and also array classes of all types 6874 (including arrays of primitive types). 6875 Primitive classes (for example, <code>java.lang.Integer.TYPE</code>) are 6876 <i>not</i> included in the returned list. 6877 </description> 6878 <origin>jvmdi</origin> 6879 <capabilities> 6880 </capabilities> 6881 <parameters> 6882 <param id="class_count_ptr"> 6883 <outptr><jint/></outptr> 6884 <description> 6885 On return, points to the number of classes. 6886 </description> 6887 </param> 6888 <param id="classes_ptr"> 6889 <allocbuf outcount="class_count_ptr"><jclass/></allocbuf> 6890 <description> 6891 On return, points to an array of references, one 6892 for each class. 6893 </description> 6894 </param> 6895 </parameters> 6896 <errors> 6897 </errors> 6898 </function> 6899 6900 <function id="GetClassLoaderClasses" jkernel="yes" num="79"> 6901 <synopsis>Get Classloader Classes</synopsis> 6902 <description> 6903 Returns an array of all classes which this class loader 6904 can find by name via 6905 <externallink id="../api/java.base/java/lang/ClassLoader.html#loadClass(java.lang.String,boolean)">ClassLoader::loadClass</externallink>, 6906 <externallink id="../api/java.base/java/lang/Class.html#forName(java.lang.String,boolean,java.lang.ClassLoader)">Class::forName</externallink> and bytecode linkage. 6907 That is, all classes for which <code>initiating_loader</code> 6908 has been recorded as an initiating loader. 6909 Each class in the returned array was created by this class loader, 6910 either by defining it directly or by delegation to another class loader. 6911 See <vmspec chapter="5.3"/>. 6912 <p/> 6913 The returned list does not include 6914 <externallink id="../api/java.base/java/lang/Class.html#isHidden()">hidden 6915 classes or interfaces</externallink> or array classes whose 6916 element type is a hidden class or interface as they cannot be discovered 6917 by any class loader. 6918 <p/> 6919 The number of classes in the array is returned via 6920 <code>class_count_ptr</code>, and the array itself via 6921 <code>classes_ptr</code>. 6922 <p/> 6923 See <externallink id="../api/java.base/java/lang/invoke/MethodHandles.Lookup.html#defineHiddenClass(byte[],boolean,java.lang.invoke.MethodHandles.Lookup.ClassOption...)">Lookup::defineHiddenClass</externallink>. 6924 </description> 6925 <origin>jvmdi</origin> 6926 <capabilities> 6927 </capabilities> 6928 <parameters> 6929 <param id="initiating_loader"> 6930 <ptrtype> 6931 <jobject/> 6932 <nullok>the classes initiated by the bootstrap loader will be returned</nullok> 6933 </ptrtype> 6934 <description> 6935 An initiating class loader. 6936 </description> 6937 </param> 6938 <param id="class_count_ptr"> 6939 <outptr><jint/></outptr> 6940 <description> 6941 On return, points to the number of classes. 6942 </description> 6943 </param> 6944 <param id="classes_ptr"> 6945 <allocbuf outcount="class_count_ptr"><jclass/></allocbuf> 6946 <description> 6947 On return, points to an array of references, one 6948 for each class. 6949 </description> 6950 </param> 6951 </parameters> 6952 <errors> 6953 </errors> 6954 </function> 6955 6956 <function id="GetClassSignature" phase="start" num="48"> 6957 <synopsis>Get Class Signature</synopsis> 6958 <description> 6959 Return the name and the generic signature of the class indicated by <code>klass</code>. 6960 <p/> 6961 If the class is a class or interface, then: 6962 <ul> 6963 <li>If the class or interface is not <externallink id="../api/java.base/java/lang/Class.html#isHidden()">hidden</externallink>, 6964 then the returned name is the <externallink id="jni/types.html#type-signatures"> 6965 JNI type signature</externallink>. 6966 For example, java.util.List is "Ljava/util/List;" 6967 </li> 6968 <li>If the class or interface is <externallink id="../api/java.base/java/lang/Class.html#isHidden()">hidden</externallink>, 6969 then the returned name is a string of the form: 6970 <code>"L" + N + "." + S + ";"</code> 6971 where <code>N</code> is the binary name encoded in internal form (JVMS 4.2.1) 6972 indicated by the <code>class</code> file passed to 6973 <externallink id="../api/java.base/java/lang/invoke/MethodHandles.Lookup.html#defineHiddenClass(byte[],boolean,java.lang.invoke.MethodHandles.Lookup.ClassOption...)">Lookup::defineHiddenClass</externallink>, 6974 and <code>S</code> is an unqualified name. 6975 The returned name is not a type descriptor and does not conform to JVMS 4.3.2. 6976 For example, com.foo.Foo/AnySuffix is "Lcom/foo/Foo.AnySuffix;" 6977 </li> 6978 </ul> 6979 <p/> 6980 If the class indicated by <code>klass</code> represents an array class, then 6981 the returned name is a string consisting of one or more "<code>[</code>" characters 6982 representing the depth of the array nesting, followed by the class signature 6983 of the element type. For example the class signature of java.lang.String[] is 6984 "[Ljava/lang/String;" and that of int[] is "[I". 6985 <p/> 6986 If the class indicated by <code>klass</code> represents primitive type or <code>void</code>, 6987 then the returned name is the <externallink id="jni/types.html#type-signatures"> 6988 type signature character of the corresponding primitive type</externallink>. 6989 For example, java.lang.Integer.TYPE is "I". 6990 </description> 6991 <origin>jvmdiClone</origin> 6992 <capabilities> 6993 </capabilities> 6994 <parameters> 6995 <param id="klass"> 6996 <jclass/> 6997 <description> 6998 The class to query. 6999 </description> 7000 </param> 7001 <param id="signature_ptr"> 7002 <allocbuf> 7003 <char/> 7004 <nullok>the signature is not returned</nullok> 7005 </allocbuf> 7006 <description> 7007 On return, points to the JNI type signature of the class, encoded as a 7008 <internallink id="mUTF">modified UTF-8</internallink> string. 7009 </description> 7010 </param> 7011 <param id="generic_ptr"> 7012 <allocbuf> 7013 <char/> 7014 <nullok>the generic signature is not returned</nullok> 7015 </allocbuf> 7016 <description> 7017 On return, points to the generic signature of the class, encoded as a 7018 <internallink id="mUTF">modified UTF-8</internallink> string. 7019 If there is no generic signature attribute for the class, then, 7020 on return, points to <code>NULL</code>. 7021 </description> 7022 </param> 7023 </parameters> 7024 <errors> 7025 </errors> 7026 </function> 7027 7028 <function id="GetClassStatus" phase="start" num="49"> 7029 <synopsis>Get Class Status</synopsis> 7030 <description> 7031 Get the status of the class. Zero or more of the following bits can be 7032 set. 7033 <constants id="jvmtiClassStatus" label="Class Status Flags" kind="bits"> 7034 <constant id="JVMTI_CLASS_STATUS_VERIFIED" num="1"> 7035 Class bytecodes have been verified 7036 </constant> 7037 <constant id="JVMTI_CLASS_STATUS_PREPARED" num="2"> 7038 Class preparation is complete 7039 </constant> 7040 <constant id="JVMTI_CLASS_STATUS_INITIALIZED" num="4"> 7041 Class initialization is complete. Static initializer has been run. 7042 </constant> 7043 <constant id="JVMTI_CLASS_STATUS_ERROR" num="8"> 7044 Error during initialization makes class unusable 7045 </constant> 7046 <constant id="JVMTI_CLASS_STATUS_ARRAY" num="16"> 7047 Class is an array. If set, all other bits are zero. 7048 </constant> 7049 <constant id="JVMTI_CLASS_STATUS_PRIMITIVE" num="32"> 7050 Class is a primitive class (for example, <code>java.lang.Integer.TYPE</code>). 7051 If set, all other bits are zero. 7052 </constant> 7053 </constants> 7054 </description> 7055 <origin>jvmdi</origin> 7056 <capabilities> 7057 </capabilities> 7058 <parameters> 7059 <param id="klass"> 7060 <jclass/> 7061 <description> 7062 The class to query. 7063 </description> 7064 </param> 7065 <param id="status_ptr"> 7066 <outptr><jint/></outptr> 7067 <description> 7068 On return, points to the current state of this class as one or 7069 more of the <internallink id="jvmtiClassStatus">class status flags</internallink>. 7070 </description> 7071 </param> 7072 </parameters> 7073 <errors> 7074 </errors> 7075 </function> 7076 7077 <function id="GetSourceFileName" phase="start" num="50"> 7078 <synopsis>Get Source File Name</synopsis> 7079 <description> 7080 For the class indicated by <code>klass</code>, return the source file 7081 name via <code>source_name_ptr</code>. The returned string 7082 is a file name only and never contains a directory name. 7083 <p/> 7084 For primitive classes (for example, <code>java.lang.Integer.TYPE</code>) 7085 and for arrays this function returns 7086 <errorlink id="JVMTI_ERROR_ABSENT_INFORMATION"></errorlink>. 7087 </description> 7088 <origin>jvmdi</origin> 7089 <capabilities> 7090 <required id="can_get_source_file_name"></required> 7091 </capabilities> 7092 <parameters> 7093 <param id="klass"> 7094 <jclass/> 7095 <description> 7096 The class to query. 7097 </description> 7098 </param> 7099 <param id="source_name_ptr"> 7100 <allocbuf><char/></allocbuf> 7101 <description> 7102 On return, points to the class's source file name, encoded as a 7103 <internallink id="mUTF">modified UTF-8</internallink> string. 7104 </description> 7105 </param> 7106 </parameters> 7107 <errors> 7108 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 7109 Class information does not include a source file name. This includes 7110 cases where the class is an array class or primitive class. 7111 </error> 7112 </errors> 7113 </function> 7114 7115 <function id="GetClassModifiers" phase="start" num="51"> 7116 <synopsis>Get Class Modifiers</synopsis> 7117 <description> 7118 For the class indicated by <code>klass</code>, return the access 7119 flags 7120 via <code>modifiers_ptr</code>. 7121 Access flags are defined in <vmspec chapter="4"/>. 7122 <p/> 7123 If the class is an array class, then its public, private, and protected 7124 modifiers are the same as those of its component type. For arrays of 7125 primitives, this component type is represented by one of the primitive 7126 classes (for example, <code>java.lang.Integer.TYPE</code>). 7127 <p/> 7128 If the class is a primitive class, its public modifier is always true, 7129 and its protected and private modifiers are always false. 7130 <p/> 7131 If the class is an array class or a primitive class then its final 7132 modifier is always true and its interface modifier is always false. 7133 The values of its other modifiers are not determined by this specification. 7134 7135 </description> 7136 <origin>jvmdi</origin> 7137 <capabilities> 7138 </capabilities> 7139 <parameters> 7140 <param id="klass"> 7141 <jclass/> 7142 <description> 7143 The class to query. 7144 </description> 7145 </param> 7146 <param id="modifiers_ptr"> 7147 <outptr><jint/></outptr> 7148 <description> 7149 On return, points to the current access flags of this class. 7150 7151 </description> 7152 </param> 7153 </parameters> 7154 <errors> 7155 </errors> 7156 </function> 7157 7158 <function id="GetClassMethods" phase="start" num="52"> 7159 <synopsis>Get Class Methods</synopsis> 7160 <description> 7161 For the class indicated by <code>klass</code>, return a count of 7162 methods via <code>method_count_ptr</code> and a list of 7163 method IDs via <code>methods_ptr</code>. The method list contains 7164 constructors and static initializers as well as true methods. 7165 Only directly declared methods are returned (not inherited methods). 7166 An empty method list is returned for array classes and primitive classes 7167 (for example, <code>java.lang.Integer.TYPE</code>). 7168 </description> 7169 <origin>jvmdi</origin> 7170 <capabilities> 7171 <capability id="can_maintain_original_method_order"/> 7172 </capabilities> 7173 <parameters> 7174 <param id="klass"> 7175 <jclass/> 7176 <description> 7177 The class to query. 7178 </description> 7179 </param> 7180 <param id="method_count_ptr"> 7181 <outptr><jint/></outptr> 7182 <description> 7183 On return, points to the number of methods declared in this class. 7184 </description> 7185 </param> 7186 <param id="methods_ptr"> 7187 <allocbuf outcount="method_count_ptr"><jmethodID class="klass"/></allocbuf> 7188 <description> 7189 On return, points to the method ID array. 7190 </description> 7191 </param> 7192 </parameters> 7193 <errors> 7194 <error id="JVMTI_ERROR_CLASS_NOT_PREPARED"> 7195 <paramlink id="klass"></paramlink> is not prepared. 7196 </error> 7197 </errors> 7198 </function> 7199 7200 <function id="GetClassFields" phase="start" num="53"> 7201 <synopsis>Get Class Fields</synopsis> 7202 <description> 7203 For the class indicated by <code>klass</code>, return a count of fields 7204 via <code>field_count_ptr</code> and a list of field IDs via 7205 <code>fields_ptr</code>. 7206 Only directly declared fields are returned (not inherited fields). 7207 Fields are returned in the order they occur in the class file. 7208 An empty field list is returned for array classes and primitive classes 7209 (for example, <code>java.lang.Integer.TYPE</code>). 7210 Use JNI to determine the length of an array. 7211 </description> 7212 <origin>jvmdi</origin> 7213 <capabilities> 7214 </capabilities> 7215 <parameters> 7216 <param id="klass"> 7217 <jclass/> 7218 <description> 7219 The class to query. 7220 </description> 7221 </param> 7222 <param id="field_count_ptr"> 7223 <outptr><jint/></outptr> 7224 <description> 7225 On return, points to the number of fields declared in this class. 7226 </description> 7227 </param> 7228 <param id="fields_ptr"> 7229 <allocbuf outcount="field_count_ptr"><jfieldID/></allocbuf> 7230 <description> 7231 On return, points to the field ID array. 7232 </description> 7233 </param> 7234 </parameters> 7235 <errors> 7236 <error id="JVMTI_ERROR_CLASS_NOT_PREPARED"> 7237 <paramlink id="klass"></paramlink> is not prepared. 7238 </error> 7239 </errors> 7240 </function> 7241 7242 <function id="GetImplementedInterfaces" phase="start" num="54"> 7243 <synopsis>Get Implemented Interfaces</synopsis> 7244 <description> 7245 Return the direct super-interfaces of this class. For a class, this 7246 function returns the interfaces declared in its <code>implements</code> 7247 clause. For an interface, this function returns the interfaces declared in 7248 its <code>extends</code> clause. 7249 An empty interface list is returned for array classes and primitive classes 7250 (for example, <code>java.lang.Integer.TYPE</code>). 7251 </description> 7252 <origin>jvmdi</origin> 7253 <capabilities> 7254 </capabilities> 7255 <parameters> 7256 <param id="klass"> 7257 <jclass/> 7258 <description> 7259 The class to query. 7260 </description> 7261 </param> 7262 <param id="interface_count_ptr"> 7263 <outptr><jint/></outptr> 7264 <description> 7265 On return, points to the number of interfaces. 7266 </description> 7267 </param> 7268 <param id="interfaces_ptr"> 7269 <allocbuf outcount="interface_count_ptr"><jclass/></allocbuf> 7270 <description> 7271 On return, points to the interface array. 7272 </description> 7273 </param> 7274 </parameters> 7275 <errors> 7276 <error id="JVMTI_ERROR_CLASS_NOT_PREPARED"> 7277 <paramlink id="klass"></paramlink> is not prepared. 7278 </error> 7279 </errors> 7280 </function> 7281 7282 <function id="GetClassVersionNumbers" phase="start" num="145" since="1.1"> 7283 <synopsis>Get Class Version Numbers</synopsis> 7284 <description> 7285 For the class indicated by <code>klass</code>, 7286 return the minor and major version numbers, 7287 as defined in 7288 <vmspec chapter="4"/>. 7289 </description> 7290 <origin>new</origin> 7291 <capabilities> 7292 </capabilities> 7293 <parameters> 7294 <param id="klass"> 7295 <jclass/> 7296 <description> 7297 The class to query. 7298 </description> 7299 </param> 7300 <param id="minor_version_ptr"> 7301 <outptr><jint/></outptr> 7302 <description> 7303 On return, points to the value of the 7304 <code>minor_version</code> item of the 7305 Class File Format. 7306 Note: to be consistent with the Class File Format, 7307 the minor version number is the first parameter. 7308 </description> 7309 </param> 7310 <param id="major_version_ptr"> 7311 <outptr><jint/></outptr> 7312 <description> 7313 On return, points to the value of the 7314 <code>major_version</code> item of the 7315 Class File Format. 7316 </description> 7317 </param> 7318 </parameters> 7319 <errors> 7320 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 7321 The class is a primitive or array class. 7322 </error> 7323 </errors> 7324 </function> 7325 7326 <function id="GetConstantPool" phase="start" num="146" since="1.1"> 7327 <synopsis>Get Constant Pool</synopsis> 7328 <description> 7329 For the class indicated by <code>klass</code>, 7330 return the raw bytes of the constant pool in the format of the 7331 <code>constant_pool</code> item of 7332 <vmspec chapter="4"/>. 7333 The format of the constant pool may differ between versions 7334 of the Class File Format, so, the 7335 <functionlink id="GetClassVersionNumbers">minor and major 7336 class version numbers</functionlink> should be checked for 7337 compatibility. 7338 <p/> 7339 The returned constant pool might not have the same layout or 7340 contents as the constant pool in the defining class file. 7341 The constant pool returned by GetConstantPool() may have 7342 more or fewer entries than the defining constant pool. 7343 Entries may be in a different order. 7344 The constant pool returned by GetConstantPool() will match the 7345 constant pool used by 7346 <functionlink id="GetBytecodes">GetBytecodes()</functionlink>. 7347 That is, the bytecodes returned by GetBytecodes() will have 7348 constant pool indices which refer to constant pool entries returned 7349 by GetConstantPool(). 7350 Note that since <functionlink id="RetransformClasses"/> 7351 and <functionlink id="RedefineClasses"/> can change 7352 the constant pool, the constant pool returned by this function 7353 can change accordingly. Thus, the correspondence between 7354 GetConstantPool() and GetBytecodes() does not hold if there 7355 is an intervening class retransformation or redefinition. 7356 The value of a constant pool entry used by a given bytecode will 7357 match that of the defining class file (even if the indices don't match). 7358 Constant pool entries which are not used directly or indirectly by 7359 bytecodes (for example, UTF-8 strings associated with annotations) are 7360 not required to exist in the returned constant pool. 7361 </description> 7362 <origin>new</origin> 7363 <capabilities> 7364 <required id="can_get_constant_pool"></required> 7365 </capabilities> 7366 <parameters> 7367 <param id="klass"> 7368 <jclass/> 7369 <description> 7370 The class to query. 7371 </description> 7372 </param> 7373 <param id="constant_pool_count_ptr"> 7374 <outptr><jint/></outptr> 7375 <description> 7376 On return, points to the number of entries 7377 in the constant pool table plus one. 7378 This corresponds to the <code>constant_pool_count</code> 7379 item of the Class File Format. 7380 </description> 7381 </param> 7382 <param id="constant_pool_byte_count_ptr"> 7383 <outptr><jint/></outptr> 7384 <description> 7385 On return, points to the number of bytes 7386 in the returned raw constant pool. 7387 </description> 7388 </param> 7389 <param id="constant_pool_bytes_ptr"> 7390 <allocbuf outcount="constant_pool_byte_count_ptr"><uchar/></allocbuf> 7391 <description> 7392 On return, points to the raw constant pool, that is the bytes 7393 defined by the <code>constant_pool</code> item of the 7394 Class File Format 7395 </description> 7396 </param> 7397 </parameters> 7398 <errors> 7399 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 7400 The class is a primitive or array class. 7401 </error> 7402 </errors> 7403 </function> 7404 7405 <function id="IsInterface" phase="start" num="55"> 7406 <synopsis>Is Interface</synopsis> 7407 <description> 7408 Determines whether a class object reference represents an interface. 7409 The <code>jboolean</code> result is 7410 <code>JNI_TRUE</code> if the "class" is actually an interface, 7411 <code>JNI_FALSE</code> otherwise. 7412 </description> 7413 <origin>jvmdi</origin> 7414 <capabilities> 7415 </capabilities> 7416 <parameters> 7417 <param id="klass"> 7418 <jclass/> 7419 <description> 7420 The class to query. 7421 </description> 7422 </param> 7423 <param id="is_interface_ptr"> 7424 <outptr><jboolean/></outptr> 7425 <description> 7426 On return, points to the boolean result of this function. 7427 7428 </description> 7429 </param> 7430 </parameters> 7431 <errors> 7432 </errors> 7433 </function> 7434 7435 <function id="IsArrayClass" phase="start" num="56"> 7436 <synopsis>Is Array Class</synopsis> 7437 <description> 7438 Determines whether a class object reference represents an array. 7439 The <code>jboolean</code> result is 7440 <code>JNI_TRUE</code> if the class is an array, 7441 <code>JNI_FALSE</code> otherwise. 7442 </description> 7443 <origin>jvmdi</origin> 7444 <capabilities> 7445 </capabilities> 7446 <parameters> 7447 <param id="klass"> 7448 <jclass/> 7449 <description> 7450 The class to query. 7451 </description> 7452 </param> 7453 <param id="is_array_class_ptr"> 7454 <outptr><jboolean/></outptr> 7455 <description> 7456 On return, points to the boolean result of this function. 7457 7458 </description> 7459 </param> 7460 </parameters> 7461 <errors> 7462 </errors> 7463 </function> 7464 7465 <function id="IsModifiableClass" jkernel="yes" phase="start" num="45" since="1.1"> 7466 <synopsis>Is Modifiable Class</synopsis> 7467 <description> 7468 Determines whether a class is modifiable. 7469 If a class is modifiable (<paramlink id="is_modifiable_class_ptr"/> 7470 returns <code>JNI_TRUE</code>) the class can be 7471 redefined with <functionlink id="RedefineClasses"/> (assuming 7472 the agent possesses the 7473 <fieldlink id="can_redefine_classes" struct="jvmtiCapabilities"/> 7474 capability) or 7475 retransformed with <functionlink id="RetransformClasses"/> (assuming 7476 the agent possesses the 7477 <fieldlink id="can_retransform_classes" struct="jvmtiCapabilities"/> 7478 capability). 7479 If a class is not modifiable (<paramlink id="is_modifiable_class_ptr"/> 7480 returns <code>JNI_FALSE</code>) the class can be neither 7481 redefined nor retransformed. 7482 <p/> 7483 Primitive classes (for example, <code>java.lang.Integer.TYPE</code>), 7484 array classes, and some implementation defined classes are never modifiable. 7485 <p/> 7486 </description> 7487 <origin>new</origin> 7488 <capabilities> 7489 <capability id="can_redefine_any_class"> 7490 If possessed then all classes (except primitive, array, and some implementation defined 7491 classes) are modifiable with <functionlink id="RedefineClasses"/>. 7492 </capability> 7493 <capability id="can_retransform_any_class"> 7494 If possessed then all classes (except primitive, array, and some implementation defined 7495 classes) are modifiable with <functionlink id="RetransformClasses"/>. 7496 </capability> 7497 <capability id="can_redefine_classes"> 7498 No effect on the result of the function. 7499 But must additionally be possessed to modify the class with 7500 <functionlink id="RedefineClasses"/>. 7501 </capability> 7502 <capability id="can_retransform_classes"> 7503 No effect on the result of the function. 7504 But must additionally be possessed to modify the class with 7505 <functionlink id="RetransformClasses"/>. 7506 </capability> 7507 </capabilities> 7508 <parameters> 7509 <param id="klass"> 7510 <jclass/> 7511 <description> 7512 The class to query. 7513 </description> 7514 </param> 7515 <param id="is_modifiable_class_ptr"> 7516 <outptr><jboolean/></outptr> 7517 <description> 7518 On return, points to the boolean result of this function. 7519 </description> 7520 </param> 7521 </parameters> 7522 <errors> 7523 </errors> 7524 </function> 7525 7526 <function id="GetClassLoader" phase="start" num="57"> 7527 <synopsis>Get Class Loader</synopsis> 7528 <description> 7529 For the class indicated by <code>klass</code>, return via 7530 <code>classloader_ptr</code> a reference to the class loader for the 7531 class. 7532 </description> 7533 <origin>jvmdi</origin> 7534 <capabilities> 7535 </capabilities> 7536 <parameters> 7537 <param id="klass"> 7538 <jclass/> 7539 <description> 7540 The class to query. 7541 </description> 7542 </param> 7543 <param id="classloader_ptr"> 7544 <outptr><jobject/></outptr> 7545 <description> 7546 On return, points to the class loader that loaded 7547 this class. 7548 If the class was not created by a class loader 7549 or if the class loader is the bootstrap class loader, 7550 points to <code>NULL</code>. 7551 </description> 7552 </param> 7553 </parameters> 7554 <errors> 7555 </errors> 7556 7557 </function> 7558 7559 <function id="GetSourceDebugExtension" phase="start" num="90"> 7560 <synopsis>Get Source Debug Extension</synopsis> 7561 <description> 7562 For the class indicated by <code>klass</code>, return the debug 7563 extension via <code>source_debug_extension_ptr</code>. 7564 The returned string 7565 contains exactly the debug extension information present in the 7566 class file of <code>klass</code>. 7567 </description> 7568 <origin>jvmdi</origin> 7569 <capabilities> 7570 <required id="can_get_source_debug_extension"></required> 7571 </capabilities> 7572 <parameters> 7573 <param id="klass"> 7574 <jclass/> 7575 <description> 7576 The class to query. 7577 </description> 7578 </param> 7579 <param id="source_debug_extension_ptr"> 7580 <allocbuf><char/></allocbuf> 7581 <description> 7582 On return, points to the class's debug extension, encoded as a 7583 <internallink id="mUTF">modified UTF-8</internallink> string. 7584 </description> 7585 </param> 7586 </parameters> 7587 <errors> 7588 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 7589 Class information does not include a debug extension. 7590 </error> 7591 </errors> 7592 </function> 7593 7594 <function id="RetransformClasses" jkernel="yes" num="152" since="1.1"> 7595 <synopsis>Retransform Classes</synopsis> 7596 <description> 7597 This function facilitates the 7598 <internallink id="bci">bytecode instrumentation</internallink> 7599 of already loaded classes. 7600 To replace the class definition without reference to the existing 7601 bytecodes, as one might do when recompiling from source for 7602 fix-and-continue debugging, <functionlink id="RedefineClasses"/> 7603 function should be used instead. 7604 <p/> 7605 When classes are initially loaded or when they are 7606 <functionlink id="RedefineClasses">redefined</functionlink>, 7607 the initial class file bytes can be transformed with the 7608 <eventlink id="ClassFileLoadHook"/> event. 7609 This function reruns the transformation process 7610 (whether or not a transformation has previously occurred). 7611 This retransformation follows these steps: 7612 <ul> 7613 <li>starting from the initial class file bytes 7614 </li> 7615 <li>for each <fieldlink id="can_retransform_classes" 7616 struct="jvmtiCapabilities">retransformation 7617 incapable</fieldlink> 7618 agent which received a 7619 <code>ClassFileLoadHook</code> event during the previous 7620 load or redefine, the bytes it returned 7621 (via the <code>new_class_data</code> parameter) 7622 are reused as the output of the transformation; 7623 note that this is equivalent to reapplying 7624 the previous transformation, unaltered. except that 7625 the <code>ClassFileLoadHook</code> event 7626 is <b>not</b> sent to these agents 7627 </li> 7628 <li>for each <fieldlink id="can_retransform_classes" 7629 struct="jvmtiCapabilities">retransformation 7630 capable</fieldlink> 7631 agent, the <code>ClassFileLoadHook</code> event is sent, 7632 allowing a new transformation to be applied 7633 </li> 7634 <li>the transformed class file bytes are installed as the new 7635 definition of the class 7636 </li> 7637 </ul> 7638 See the <eventlink id="ClassFileLoadHook"/> event for more details. 7639 <p/> 7640 The initial class file bytes represent the bytes passed to 7641 <code>ClassLoader.defineClass</code> 7642 or <code>RedefineClasses</code> (before any transformations 7643 were applied), however they may not exactly match them. 7644 The constant pool may differ in ways described in 7645 <functionlink id="GetConstantPool"/>. 7646 Constant pool indices in the bytecodes of methods will correspond. 7647 Some attributes may not be present. 7648 Where order is not meaningful, for example the order of methods, 7649 order may not be preserved. 7650 <p/> 7651 Retransformation can cause new versions of methods to be installed. 7652 Old method versions may become 7653 <internallink id="obsoleteMethods">obsolete</internallink> 7654 The new method version will be used on new invokes. 7655 If a method has active stack frames, those active frames continue to 7656 run the bytecodes of the original method version. 7657 <p/> 7658 This function does not cause any initialization except that which 7659 would occur under the customary JVM semantics. 7660 In other words, retransforming a class does not cause its initializers to be 7661 run. The values of static fields will remain as they were 7662 prior to the call. 7663 <p/> 7664 Threads need not be suspended. 7665 <p/> 7666 All breakpoints in the class are cleared. 7667 <p/> 7668 All attributes are updated. 7669 <p/> 7670 Instances of the retransformed class are not affected -- fields retain their 7671 previous values. 7672 <functionlink id="GetTag">Tags</functionlink> on the instances are 7673 also unaffected. 7674 <p/> 7675 In response to this call, no events other than the 7676 <eventlink id="ClassFileLoadHook"/> event 7677 will be sent. 7678 <p/> 7679 The retransformation may change method bodies, the constant pool and attributes 7680 (unless explicitly prohibited). 7681 The retransformation must not add, remove or rename fields or methods, change the 7682 signatures of methods, change modifiers, or change inheritance. 7683 The retransformation must not change the <code>NestHost</code>, 7684 <code>NestMembers</code>, or <code>Record</code> attributes. 7685 These restrictions may be lifted in future versions. 7686 See the error return description below for information on error codes 7687 returned if an unsupported retransformation is attempted. 7688 The class file bytes are not verified or installed until they have passed 7689 through the chain of <eventlink id="ClassFileLoadHook"/> events, thus the 7690 returned error code reflects the result of the transformations. 7691 If any error code is returned other than <code>JVMTI_ERROR_NONE</code>, 7692 none of the classes to be retransformed will have a new definition installed. 7693 When this function returns (with the error code of <code>JVMTI_ERROR_NONE</code>) 7694 all of the classes to be retransformed will have their new definitions installed. 7695 </description> 7696 <origin>new</origin> 7697 <capabilities> 7698 <required id="can_retransform_classes"></required> 7699 <capability id="can_retransform_any_class"></capability> 7700 </capabilities> 7701 <parameters> 7702 <param id="class_count"> 7703 <jint min="0"/> 7704 <description> 7705 The number of classes to be retransformed. 7706 </description> 7707 </param> 7708 <param id="classes"> 7709 <inbuf incount="class_count"><jclass/></inbuf> 7710 <description> 7711 The array of classes to be retransformed. 7712 </description> 7713 </param> 7714 </parameters> 7715 <errors> 7716 <error id="JVMTI_ERROR_UNMODIFIABLE_CLASS"> 7717 One of the <paramlink id="classes"/> cannot be modified. 7718 See <functionlink id="IsModifiableClass"/>. 7719 </error> 7720 <error id="JVMTI_ERROR_INVALID_CLASS"> 7721 One of the <paramlink id="classes"/> is not a valid class. 7722 </error> 7723 <error id="JVMTI_ERROR_UNSUPPORTED_VERSION"> 7724 A retransformed class file has a version number not supported by this VM. 7725 </error> 7726 <error id="JVMTI_ERROR_INVALID_CLASS_FORMAT"> 7727 A retransformed class file is malformed (The VM would return a <code>ClassFormatError</code>). 7728 </error> 7729 <error id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION"> 7730 The retransformed class file definitions would lead to a circular definition 7731 (the VM would return a <code>ClassCircularityError</code>). 7732 </error> 7733 <error id="JVMTI_ERROR_FAILS_VERIFICATION"> 7734 The retransformed class file bytes fail verification. 7735 </error> 7736 <error id="JVMTI_ERROR_NAMES_DONT_MATCH"> 7737 The class name defined in a retransformed class file is 7738 different from the name in the old class object. 7739 </error> 7740 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED"> 7741 A retransformed class file would require adding a method. 7742 </error> 7743 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED"> 7744 A retransformed class file changes a field. 7745 </error> 7746 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED"> 7747 A direct superclass is different for a retransformed class file, 7748 or the set of directly implemented 7749 interfaces is different. 7750 </error> 7751 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED"> 7752 A retransformed class file does not declare a method 7753 declared in the old class version. 7754 </error> 7755 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED"> 7756 A retransformed class file has unsupported differences in class attributes. 7757 </error> 7758 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED"> 7759 A retransformed class file has different class modifiers. 7760 </error> 7761 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED"> 7762 A method in the retransformed class file has different modifiers 7763 than its counterpart in the old class version. 7764 </error> 7765 </errors> 7766 </function> 7767 7768 <function id="RedefineClasses" jkernel="yes" num="87"> 7769 <synopsis>Redefine Classes</synopsis> 7770 <typedef id="jvmtiClassDefinition" label="Class redefinition description"> 7771 <field id="klass"> 7772 <jclass/> 7773 <description> 7774 Class object for this class 7775 </description> 7776 </field> 7777 <field id="class_byte_count"> 7778 <jint/> 7779 <description> 7780 Number of bytes defining class (below) 7781 </description> 7782 </field> 7783 <field id="class_bytes"> 7784 <inbuf incount="class_byte_count"><uchar/></inbuf> 7785 <description> 7786 Bytes defining class (in <vmspec chapter="4"/>) 7787 </description> 7788 </field> 7789 </typedef> 7790 <description> 7791 All classes given are redefined according to the definitions 7792 supplied. 7793 This function is used to replace the definition of a class 7794 with a new definition, as might be needed in fix-and-continue 7795 debugging. 7796 Where the existing class file bytes are to be transformed, for 7797 example in 7798 <internallink id="bci">bytecode instrumentation</internallink>, 7799 <functionlink id="RetransformClasses"/> should be used. 7800 <p/> 7801 Redefinition can cause new versions of methods to be installed. 7802 Old method versions may become 7803 <internallink id="obsoleteMethods">obsolete</internallink> 7804 The new method version will be used on new invokes. 7805 If a method has active stack frames, those active frames continue to 7806 run the bytecodes of the original method version. 7807 If resetting of stack frames is desired, use 7808 <functionlink id="PopFrame"></functionlink> 7809 to pop frames with obsolete method versions. 7810 <p/> 7811 This function does not cause any initialization except that which 7812 would occur under the customary JVM semantics. 7813 In other words, redefining a class does not cause its initializers to be 7814 run. The values of static fields will remain as they were 7815 prior to the call. 7816 <p/> 7817 Threads need not be suspended. 7818 <p/> 7819 All breakpoints in the class are cleared. 7820 <p/> 7821 All attributes are updated. 7822 <p/> 7823 Instances of the redefined class are not affected -- fields retain their 7824 previous values. 7825 <functionlink id="GetTag">Tags</functionlink> on the instances are 7826 also unaffected. 7827 <p/> 7828 In response to this call, the <jvmti/> event 7829 <eventlink id="ClassFileLoadHook">Class File Load Hook</eventlink> 7830 will be sent (if enabled), but no other <jvmti/> events will be sent. 7831 <p/> 7832 The redefinition may change method bodies, the constant pool and attributes 7833 (unless explicitly prohibited). 7834 The redefinition must not add, remove or rename fields or methods, change the 7835 signatures of methods, change modifiers, or change inheritance. 7836 The redefinition must not change the <code>NestHost</code>, 7837 <code>NestMembers</code>, or <code>Record</code> attributes. 7838 These restrictions may be lifted in future versions. 7839 See the error return description below for information on error codes 7840 returned if an unsupported redefinition is attempted. 7841 The class file bytes are not verified or installed until they have passed 7842 through the chain of <eventlink id="ClassFileLoadHook"/> events, thus the 7843 returned error code reflects the result of the transformations applied 7844 to the bytes passed into <paramlink id="class_definitions"/>. 7845 If any error code is returned other than <code>JVMTI_ERROR_NONE</code>, 7846 none of the classes to be redefined will have a new definition installed. 7847 When this function returns (with the error code of <code>JVMTI_ERROR_NONE</code>) 7848 all of the classes to be redefined will have their new definitions installed. 7849 </description> 7850 <origin>jvmdi</origin> 7851 <capabilities> 7852 <required id="can_redefine_classes"></required> 7853 <capability id="can_redefine_any_class"></capability> 7854 </capabilities> 7855 <parameters> 7856 <param id="class_count"> 7857 <jint min="0"/> 7858 <description> 7859 The number of classes specified in <code>class_definitions</code> 7860 </description> 7861 </param> 7862 <param id="class_definitions"> 7863 <inbuf incount="class_count"><struct>jvmtiClassDefinition</struct></inbuf> 7864 <description> 7865 The array of new class definitions 7866 </description> 7867 </param> 7868 </parameters> 7869 <errors> 7870 <error id="JVMTI_ERROR_NULL_POINTER"> 7871 One of <code>class_bytes</code> is <code>NULL</code>. 7872 </error> 7873 <error id="JVMTI_ERROR_UNMODIFIABLE_CLASS"> 7874 An element of <code>class_definitions</code> cannot be modified. 7875 See <functionlink id="IsModifiableClass"/>. 7876 </error> 7877 <error id="JVMTI_ERROR_INVALID_CLASS"> 7878 An element of <code>class_definitions</code> is not a valid class. 7879 </error> 7880 <error id="JVMTI_ERROR_UNSUPPORTED_VERSION"> 7881 A new class file has a version number not supported by this VM. 7882 </error> 7883 <error id="JVMTI_ERROR_INVALID_CLASS_FORMAT"> 7884 A new class file is malformed (The VM would return a <code>ClassFormatError</code>). 7885 </error> 7886 <error id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION"> 7887 The new class file definitions would lead to a circular definition 7888 (the VM would return a <code>ClassCircularityError</code>). 7889 </error> 7890 <error id="JVMTI_ERROR_FAILS_VERIFICATION"> 7891 The class bytes fail verification. 7892 </error> 7893 <error id="JVMTI_ERROR_NAMES_DONT_MATCH"> 7894 The class name defined in a new class file is 7895 different from the name in the old class object. 7896 </error> 7897 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED"> 7898 A new class file would require adding a method. 7899 </error> 7900 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED"> 7901 A new class version changes a field. 7902 </error> 7903 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED"> 7904 A direct superclass is different for a new class 7905 version, or the set of directly implemented 7906 interfaces is different. 7907 </error> 7908 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED"> 7909 A new class version does not declare a method 7910 declared in the old class version. 7911 </error> 7912 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED"> 7913 A new class version has unsupported differences in class attributes. 7914 </error> 7915 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED"> 7916 A new class version has different modifiers. 7917 </error> 7918 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED"> 7919 A method in the new class version has different modifiers 7920 than its counterpart in the old class version. 7921 </error> 7922 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE"> 7923 A module cannot be modified. 7924 See <functionlink id="IsModifiableModule"/>. 7925 </error> 7926 </errors> 7927 </function> 7928 7929 </category> 7930 7931 <category id="object" label="Object"> 7932 7933 <function id="GetObjectSize" jkernel="yes" phase="start" num="154"> 7934 <synopsis>Get Object Size</synopsis> 7935 <description> 7936 For the object indicated by <code>object</code>, 7937 return via <code>size_ptr</code> the size of the object. 7938 This size is an implementation-specific approximation of 7939 the amount of storage consumed by this object. 7940 It may include some or all of the object's overhead, and thus 7941 is useful for comparison within an implementation but not 7942 between implementations. 7943 The estimate may change during a single invocation of the JVM. 7944 </description> 7945 <origin>new</origin> 7946 <capabilities> 7947 </capabilities> 7948 <parameters> 7949 <param id="object"> 7950 <jobject/> 7951 <description> 7952 The object to query. 7953 </description> 7954 </param> 7955 <param id="size_ptr"> 7956 <outptr><jlong/></outptr> 7957 <description> 7958 On return, points to the object's size in bytes. 7959 </description> 7960 </param> 7961 </parameters> 7962 <errors> 7963 </errors> 7964 </function> 7965 7966 <function id="GetObjectHashCode" phase="start" num="58"> 7967 <synopsis>Get Object Hash Code</synopsis> 7968 <description> 7969 For the object indicated by <code>object</code>, 7970 return via <code>hash_code_ptr</code> a hash code. 7971 This hash code could be used to maintain a hash table of object references, 7972 however, on some implementations this can cause significant performance 7973 impacts--in most cases 7974 <internallink id="Heap">tags</internallink> 7975 will be a more efficient means of associating information with objects. 7976 This function guarantees 7977 the same hash code value for a particular object throughout its life 7978 </description> 7979 <origin>jvmdi</origin> 7980 <capabilities> 7981 </capabilities> 7982 <parameters> 7983 <param id="object"> 7984 <jobject/> 7985 <description> 7986 The object to query. 7987 </description> 7988 </param> 7989 <param id="hash_code_ptr"> 7990 <outptr><jint/></outptr> 7991 <description> 7992 On return, points to the object's hash code. 7993 </description> 7994 </param> 7995 </parameters> 7996 <errors> 7997 </errors> 7998 </function> 7999 8000 <function id="GetObjectMonitorUsage" num="59"> 8001 <synopsis>Get Object Monitor Usage</synopsis> 8002 <typedef id="jvmtiMonitorUsage" label="Object monitor usage information"> 8003 <field id="owner"> 8004 <jthread/> 8005 <description> 8006 The thread owning this monitor, or <code>NULL</code> if unused 8007 </description> 8008 </field> 8009 <field id="entry_count"> 8010 <jint/> 8011 <description> 8012 The number of times the owning thread has entered the monitor 8013 </description> 8014 </field> 8015 <field id="waiter_count"> 8016 <jint/> 8017 <description> 8018 The number of threads waiting to own this monitor 8019 </description> 8020 </field> 8021 <field id="waiters"> 8022 <allocfieldbuf><jthread/></allocfieldbuf> 8023 <description> 8024 The <code>waiter_count</code> waiting threads 8025 </description> 8026 </field> 8027 <field id="notify_waiter_count"> 8028 <jint/> 8029 <description> 8030 The number of threads waiting to be notified by this monitor 8031 </description> 8032 </field> 8033 <field id="notify_waiters"> 8034 <allocfieldbuf><jthread/></allocfieldbuf> 8035 <description> 8036 The <code>notify_waiter_count</code> threads waiting to be notified 8037 </description> 8038 </field> 8039 </typedef> 8040 <description> 8041 Get information about the object's monitor. 8042 The fields of the <functionlink id="jvmtiMonitorUsage"></functionlink> structure 8043 are filled in with information about usage of the monitor. 8044 <todo> 8045 Decide and then clarify suspend requirements. 8046 </todo> 8047 </description> 8048 <origin>jvmdi</origin> 8049 <capabilities> 8050 <required id="can_get_monitor_info"></required> 8051 </capabilities> 8052 <parameters> 8053 <param id="object"> 8054 <jobject/> 8055 <description> 8056 The object to query. 8057 </description> 8058 </param> 8059 <param id="info_ptr"> 8060 <outptr><struct>jvmtiMonitorUsage</struct></outptr> 8061 <description> 8062 On return, filled with monitor information for the 8063 specified object. 8064 </description> 8065 </param> 8066 </parameters> 8067 <errors> 8068 </errors> 8069 </function> 8070 8071 <elide> 8072 <function id="GetObjectMonitors" num="116"> 8073 <synopsis>Get Object Monitors</synopsis> 8074 <description> 8075 Return the list of object monitors. 8076 <p/> 8077 Note: details about each monitor can be examined with 8078 <functionlink id="GetObjectMonitorUsage"></functionlink>. 8079 </description> 8080 <origin>new</origin> 8081 <capabilities> 8082 <required id="can_get_monitor_info"></required> 8083 </capabilities> 8084 <parameters> 8085 <param id="monitorCnt"> 8086 <outptr><jint/></outptr> 8087 <description> 8088 On return, pointer to the number 8089 of monitors returned in <code>monitors_ptr</code>. 8090 </description> 8091 </param> 8092 <param id="monitors_ptr"> 8093 <allocbuf outcount="monitorCnt"><jobject/></allocbuf> 8094 <description> 8095 On return, pointer to the monitor list. 8096 </description> 8097 </param> 8098 </parameters> 8099 <errors> 8100 </errors> 8101 </function> 8102 </elide> 8103 8104 </category> 8105 8106 <category id="fieldCategory" label="Field"> 8107 8108 <intro> 8109 </intro> 8110 8111 <function id="GetFieldName" phase="start" num="60"> 8112 <synopsis>Get Field Name (and Signature)</synopsis> 8113 <description> 8114 For the field indicated by <paramlink id="klass"/> and <paramlink id="field"/>, 8115 return the field name via <paramlink id="name_ptr"/> and field signature via 8116 <paramlink id="signature_ptr"/>. 8117 <p/> 8118 Field signatures are defined in the 8119 <externallink id="jni/index.html">JNI Specification</externallink> 8120 and are referred to as <code>field descriptors</code> in 8121 <vmspec chapter="4.3.2"/>. 8122 </description> 8123 <origin>jvmdiClone</origin> 8124 <capabilities> 8125 </capabilities> 8126 <parameters> 8127 <param id="klass"> 8128 <jclass field="field"/> 8129 <description> 8130 The class of the field to query. 8131 </description> 8132 </param> 8133 <param id="field"> 8134 <jfieldID class="klass"/> 8135 <description> 8136 The field to query. 8137 </description> 8138 </param> 8139 <param id="name_ptr"> 8140 <allocbuf> 8141 <char/> 8142 <nullok>the name is not returned</nullok> 8143 </allocbuf> 8144 <description> 8145 On return, points to the field name, encoded as a 8146 <internallink id="mUTF">modified UTF-8</internallink> string. 8147 </description> 8148 </param> 8149 <param id="signature_ptr"> 8150 <allocbuf> 8151 <char/> 8152 <nullok>the signature is not returned</nullok> 8153 </allocbuf> 8154 <description> 8155 On return, points to the field signature, encoded as a 8156 <internallink id="mUTF">modified UTF-8</internallink> string. 8157 </description> 8158 </param> 8159 <param id="generic_ptr"> 8160 <allocbuf> 8161 <char/> 8162 <nullok>the generic signature is not returned</nullok> 8163 </allocbuf> 8164 <description> 8165 On return, points to the generic signature of the field, encoded as a 8166 <internallink id="mUTF">modified UTF-8</internallink> string. 8167 If there is no generic signature attribute for the field, then, 8168 on return, points to <code>NULL</code>. 8169 </description> 8170 </param> 8171 </parameters> 8172 <errors> 8173 </errors> 8174 </function> 8175 8176 <function id="GetFieldDeclaringClass" phase="start" num="61"> 8177 <synopsis>Get Field Declaring Class</synopsis> 8178 <description> 8179 For the field indicated by <code>klass</code> and <code>field</code> 8180 return the class that defined it via <code>declaring_class_ptr</code>. 8181 The declaring class will either be <code>klass</code>, a superclass, or 8182 an implemented interface. 8183 </description> 8184 <origin>jvmdi</origin> 8185 <capabilities> 8186 </capabilities> 8187 <parameters> 8188 <param id="klass"> 8189 <jclass field="field"/> 8190 <description> 8191 The class to query. 8192 </description> 8193 </param> 8194 <param id="field"> 8195 <jfieldID class="klass"/> 8196 <description> 8197 The field to query. 8198 </description> 8199 </param> 8200 <param id="declaring_class_ptr"> 8201 <outptr><jclass/></outptr> 8202 <description> 8203 On return, points to the declaring class 8204 </description> 8205 </param> 8206 </parameters> 8207 <errors> 8208 </errors> 8209 </function> 8210 8211 <function id="GetFieldModifiers" phase="start" num="62"> 8212 <synopsis>Get Field Modifiers</synopsis> 8213 <description> 8214 For the field indicated by <code>klass</code> and <code>field</code> 8215 return the access flags via <code>modifiers_ptr</code>. 8216 Access flags are defined in <vmspec chapter="4"/>. 8217 </description> 8218 <origin>jvmdi</origin> 8219 <capabilities> 8220 </capabilities> 8221 <parameters> 8222 <param id="klass"> 8223 <jclass field="field"/> 8224 <description> 8225 The class to query. 8226 </description> 8227 </param> 8228 <param id="field"> 8229 <jfieldID class="klass"/> 8230 <description> 8231 The field to query. 8232 </description> 8233 </param> 8234 <param id="modifiers_ptr"> 8235 <outptr><jint/></outptr> 8236 <description> 8237 On return, points to the access flags. 8238 </description> 8239 </param> 8240 </parameters> 8241 <errors> 8242 </errors> 8243 </function> 8244 8245 <function id="IsFieldSynthetic" phase="start" num="63"> 8246 <synopsis>Is Field Synthetic</synopsis> 8247 <description> 8248 For the field indicated by <code>klass</code> and <code>field</code>, return a 8249 value indicating whether the field is synthetic via <code>is_synthetic_ptr</code>. 8250 Synthetic fields are generated by the compiler but not present in the 8251 original source code. 8252 </description> 8253 <origin>jvmdi</origin> 8254 <capabilities> 8255 <required id="can_get_synthetic_attribute"></required> 8256 </capabilities> 8257 <parameters> 8258 <param id="klass"> 8259 <jclass field="field"/> 8260 <description> 8261 The class of the field to query. 8262 </description> 8263 </param> 8264 <param id="field"> 8265 <jfieldID class="klass"/> 8266 <description> 8267 The field to query. 8268 </description> 8269 </param> 8270 <param id="is_synthetic_ptr"> 8271 <outptr><jboolean/></outptr> 8272 <description> 8273 On return, points to the boolean result of this function. 8274 </description> 8275 </param> 8276 </parameters> 8277 <errors> 8278 </errors> 8279 </function> 8280 8281 </category> 8282 8283 <category id="method" label="Method"> 8284 8285 <intro> 8286 These functions provide information about a method (represented as a 8287 <typelink id="jmethodID"/>) and set how methods are processed. 8288 </intro> 8289 8290 <intro id="obsoleteMethods" label="Obsolete Methods"> 8291 The functions <functionlink id="RetransformClasses"/> and 8292 <functionlink id="RedefineClasses"/> can cause new versions 8293 of methods to be installed. 8294 An original version of a method is considered equivalent 8295 to the new version if: 8296 <ul> 8297 <li>their bytecodes are the same except for indices into the 8298 constant pool and </li> 8299 <li>the referenced constants are equal.</li> 8300 </ul> 8301 An original method version which is not equivalent to the 8302 new method version is called obsolete and is assigned a new method ID; 8303 the original method ID now refers to the new method version. 8304 A method ID can be tested for obsolescence with 8305 <functionlink id="IsMethodObsolete"/>. 8306 </intro> 8307 8308 <function id="GetMethodName" phase="start" num="64"> 8309 <synopsis>Get Method Name (and Signature)</synopsis> 8310 <description> 8311 For the method indicated by <code>method</code>, 8312 return the method name via <code>name_ptr</code> and method signature via 8313 <code>signature_ptr</code>. 8314 <p/> 8315 Method signatures are defined in the 8316 <externallink id="jni/index.html">JNI Specification</externallink> 8317 and are referred to as <code>method descriptors</code> in 8318 <vmspec chapter="4.3.3"/>. 8319 Note this is different 8320 than method signatures as defined in the <i>Java Language Specification</i>. 8321 </description> 8322 <origin>jvmdiClone</origin> 8323 <capabilities> 8324 </capabilities> 8325 <parameters> 8326 <param id="method"> 8327 <jmethodID/> 8328 <description> 8329 The method to query. 8330 </description> 8331 </param> 8332 <param id="name_ptr"> 8333 <allocbuf> 8334 <char/> 8335 <nullok>the name is not returned</nullok> 8336 </allocbuf> 8337 <description> 8338 On return, points to the method name, encoded as a 8339 <internallink id="mUTF">modified UTF-8</internallink> string. 8340 </description> 8341 </param> 8342 <param id="signature_ptr"> 8343 <allocbuf> 8344 <char/> 8345 <nullok>the signature is not returned</nullok> 8346 </allocbuf> 8347 <description> 8348 On return, points to the method signature, encoded as a 8349 <internallink id="mUTF">modified UTF-8</internallink> string. 8350 </description> 8351 </param> 8352 <param id="generic_ptr"> 8353 <allocbuf> 8354 <char/> 8355 <nullok>the generic signature is not returned</nullok> 8356 </allocbuf> 8357 <description> 8358 On return, points to the generic signature of the method, encoded as a 8359 <internallink id="mUTF">modified UTF-8</internallink> string. 8360 If there is no generic signature attribute for the method, then, 8361 on return, points to <code>NULL</code>. 8362 </description> 8363 </param> 8364 </parameters> 8365 <errors> 8366 </errors> 8367 </function> 8368 8369 <function id="GetMethodDeclaringClass" phase="start" num="65"> 8370 <synopsis>Get Method Declaring Class</synopsis> 8371 <description> 8372 For the method indicated by <code>method</code>, 8373 return the class that defined it via <code>declaring_class_ptr</code>. 8374 </description> 8375 <origin>jvmdi</origin> 8376 <capabilities> 8377 </capabilities> 8378 <parameters> 8379 <param id="klass"> 8380 <jclass method="method"/> 8381 <description> 8382 The class to query. 8383 </description> 8384 </param> 8385 <param id="method"> 8386 <jmethodID class="klass"/> 8387 <description> 8388 The method to query. 8389 </description> 8390 </param> 8391 <param id="declaring_class_ptr"> 8392 <outptr><jclass/></outptr> 8393 <description> 8394 On return, points to the declaring class 8395 </description> 8396 </param> 8397 </parameters> 8398 <errors> 8399 </errors> 8400 </function> 8401 8402 <function id="GetMethodModifiers" phase="start" num="66"> 8403 <synopsis>Get Method Modifiers</synopsis> 8404 <description> 8405 For the method indicated by <code>method</code>, 8406 return the access flags via <code>modifiers_ptr</code>. 8407 Access flags are defined in <vmspec chapter="4"/>. 8408 </description> 8409 <origin>jvmdi</origin> 8410 <capabilities> 8411 </capabilities> 8412 <parameters> 8413 <param id="klass"> 8414 <jclass method="method"/> 8415 <description> 8416 The class to query. 8417 </description> 8418 </param> 8419 <param id="method"> 8420 <jmethodID class="klass"/> 8421 <description> 8422 The method to query. 8423 </description> 8424 </param> 8425 <param id="modifiers_ptr"> 8426 <outptr><jint/></outptr> 8427 <description> 8428 On return, points to the access flags. 8429 </description> 8430 </param> 8431 </parameters> 8432 <errors> 8433 </errors> 8434 </function> 8435 8436 <function id="GetMaxLocals" phase="start" num="68"> 8437 <synopsis>Get Max Locals</synopsis> 8438 <description> 8439 For the method indicated by <code>method</code>, 8440 return the number of local variable slots used by the method, 8441 including the local variables used to pass parameters to the 8442 method on its invocation. 8443 <p/> 8444 See <code>max_locals</code> in <vmspec chapter="4.7.3"/>. 8445 </description> 8446 <origin>jvmdi</origin> 8447 <capabilities> 8448 </capabilities> 8449 <parameters> 8450 <param id="klass"> 8451 <jclass method="method"/> 8452 <description> 8453 The class to query. 8454 </description> 8455 </param> 8456 <param id="method"> 8457 <jmethodID class="klass" native="error"/> 8458 <description> 8459 The method to query. 8460 </description> 8461 </param> 8462 <param id="max_ptr"> 8463 <outptr><jint/></outptr> 8464 <description> 8465 On return, points to the maximum number of local slots 8466 </description> 8467 </param> 8468 </parameters> 8469 <errors> 8470 </errors> 8471 </function> 8472 8473 <function id="GetArgumentsSize" phase="start" num="69"> 8474 <synopsis>Get Arguments Size</synopsis> 8475 <description> 8476 For the method indicated by <code>method</code>, 8477 return via <code>max_ptr</code> the number of local variable slots used 8478 by the method's arguments. 8479 Note that two-word arguments use two slots. 8480 </description> 8481 <origin>jvmdi</origin> 8482 <capabilities> 8483 </capabilities> 8484 <parameters> 8485 <param id="klass"> 8486 <jclass method="method"/> 8487 <description> 8488 The class to query. 8489 </description> 8490 </param> 8491 <param id="method"> 8492 <jmethodID class="klass" native="error"/> 8493 <description> 8494 The method to query. 8495 </description> 8496 </param> 8497 <param id="size_ptr"> 8498 <outptr><jint/></outptr> 8499 <description> 8500 On return, points to the number of argument slots 8501 </description> 8502 </param> 8503 </parameters> 8504 <errors> 8505 </errors> 8506 </function> 8507 8508 <function id="GetLineNumberTable" phase="start" num="70"> 8509 <synopsis>Get Line Number Table</synopsis> 8510 <typedef id="jvmtiLineNumberEntry" label="Line number table entry"> 8511 <field id="start_location"> 8512 <jlocation/> 8513 <description> 8514 the <datalink id="jlocation"></datalink> where the line begins 8515 </description> 8516 </field> 8517 <field id="line_number"> 8518 <jint/> 8519 <description> 8520 the line number 8521 </description> 8522 </field> 8523 </typedef> 8524 <description> 8525 For the method indicated by <code>method</code>, 8526 return a table of source line number entries. The size of the table is 8527 returned via <code>entry_count_ptr</code> and the table itself is 8528 returned via <code>table_ptr</code>. 8529 </description> 8530 <origin>jvmdi</origin> 8531 <capabilities> 8532 <required id="can_get_line_numbers"></required> 8533 </capabilities> 8534 <parameters> 8535 <param id="klass"> 8536 <jclass method="method"/> 8537 <description> 8538 The class to query. 8539 </description> 8540 </param> 8541 <param id="method"> 8542 <jmethodID class="klass" native="error"/> 8543 <description> 8544 The method to query. 8545 </description> 8546 </param> 8547 <param id="entry_count_ptr"> 8548 <outptr><jint/></outptr> 8549 <description> 8550 On return, points to the number of entries in the table 8551 </description> 8552 </param> 8553 <param id="table_ptr"> 8554 <allocbuf outcount="entry_count_ptr"><struct>jvmtiLineNumberEntry</struct></allocbuf> 8555 <description> 8556 On return, points to the line number table pointer. 8557 </description> 8558 </param> 8559 </parameters> 8560 <errors> 8561 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 8562 Class information does not include line numbers. 8563 </error> 8564 </errors> 8565 </function> 8566 8567 <function id="GetMethodLocation" phase="start" num="71"> 8568 <synopsis>Get Method Location</synopsis> 8569 <description> 8570 For the method indicated by <code>method</code>, 8571 return the beginning and ending addresses through 8572 <code>start_location_ptr</code> and <code>end_location_ptr</code>. In a 8573 conventional bytecode indexing scheme, 8574 <code>start_location_ptr</code> will always point to zero 8575 and <code>end_location_ptr</code> 8576 will always point to the bytecode count minus one. 8577 </description> 8578 <origin>jvmdi</origin> 8579 <capabilities> 8580 </capabilities> 8581 <parameters> 8582 <param id="klass"> 8583 <jclass method="method"/> 8584 <description> 8585 The class to query. 8586 </description> 8587 </param> 8588 <param id="method"> 8589 <jmethodID class="klass" native="error"/> 8590 <description> 8591 The method to query. 8592 </description> 8593 </param> 8594 <param id="start_location_ptr"> 8595 <outptr><jlocation/></outptr> 8596 <description> 8597 On return, points to the first location, or 8598 <code>-1</code> if location information is not available. 8599 If the information is available and 8600 <functionlink id="GetJLocationFormat"></functionlink> 8601 returns <datalink id="JVMTI_JLOCATION_JVMBCI"></datalink> 8602 then this will always be zero. 8603 </description> 8604 </param> 8605 <param id="end_location_ptr"> 8606 <outptr><jlocation/></outptr> 8607 <description> 8608 On return, points to the last location, 8609 or <code>-1</code> if location information is not available. 8610 </description> 8611 </param> 8612 </parameters> 8613 <errors> 8614 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 8615 Class information does not include method sizes. 8616 </error> 8617 </errors> 8618 </function> 8619 8620 <function id="GetLocalVariableTable" num="72"> 8621 <synopsis>Get Local Variable Table</synopsis> 8622 <typedef id="jvmtiLocalVariableEntry" label="Local variable table entry"> 8623 <field id="start_location"> 8624 <jlocation/> 8625 <description> 8626 The code array index where the local variable is first valid 8627 (that is, where it must have a value). 8628 </description> 8629 </field> 8630 <field id="length"> 8631 <jint/> 8632 <description> 8633 The length of the valid section for this local variable. 8634 The last code array index where the local variable is valid 8635 is <code>start_location + length</code>. 8636 </description> 8637 </field> 8638 <field id="name"> 8639 <allocfieldbuf><char/></allocfieldbuf> 8640 <description> 8641 The local variable name, encoded as a 8642 <internallink id="mUTF">modified UTF-8</internallink> string. 8643 </description> 8644 </field> 8645 <field id="signature"> 8646 <allocfieldbuf><char/></allocfieldbuf> 8647 <description> 8648 The local variable's type signature, encoded as a 8649 <internallink id="mUTF">modified UTF-8</internallink> string. 8650 The signature format is the same as that defined in 8651 <vmspec chapter="4.3.2"/>. 8652 </description> 8653 </field> 8654 <field id="generic_signature"> 8655 <allocfieldbuf><char/></allocfieldbuf> 8656 <description> 8657 The local variable's generic signature, encoded as a 8658 <internallink id="mUTF">modified UTF-8</internallink> string. 8659 The value of this field will be <code>NULL</code> for any local 8660 variable which does not have a generic type. 8661 </description> 8662 </field> 8663 <field id="slot"> 8664 <jint/> 8665 <description> 8666 The local variable's slot. See <internallink id="local">Local Variables</internallink>. 8667 </description> 8668 </field> 8669 </typedef> 8670 <description> 8671 Return local variable information. 8672 </description> 8673 <origin>jvmdiClone</origin> 8674 <capabilities> 8675 <required id="can_access_local_variables"></required> 8676 </capabilities> 8677 <parameters> 8678 <param id="method"> 8679 <jmethodID native="error"/> 8680 <description> 8681 The method to query. 8682 </description> 8683 </param> 8684 <param id="entry_count_ptr"> 8685 <outptr><jint/></outptr> 8686 <description> 8687 On return, points to the number of entries in the table 8688 </description> 8689 </param> 8690 <param id="table_ptr"> 8691 <allocbuf outcount="entry_count_ptr"><struct>jvmtiLocalVariableEntry</struct></allocbuf> 8692 <description> 8693 On return, points to an array of local variable table entries. 8694 </description> 8695 </param> 8696 </parameters> 8697 <errors> 8698 <error id="JVMTI_ERROR_ABSENT_INFORMATION"> 8699 Class information does not include local variable 8700 information. 8701 </error> 8702 </errors> 8703 </function> 8704 8705 <function id="GetBytecodes" phase="start" num="75"> 8706 <synopsis>Get Bytecodes</synopsis> 8707 <description> 8708 For the method indicated by <code>method</code>, 8709 return the bytecodes that implement the method. The number of 8710 bytecodes is returned via <code>bytecode_count_ptr</code>. The bytecodes 8711 themselves are returned via <code>bytecodes_ptr</code>. 8712 </description> 8713 <origin>jvmdi</origin> 8714 <capabilities> 8715 <required id="can_get_bytecodes"></required> 8716 </capabilities> 8717 <parameters> 8718 <param id="klass"> 8719 <jclass method="method"/> 8720 <description> 8721 The class to query. 8722 </description> 8723 </param> 8724 <param id="method"> 8725 <jmethodID class="klass" native="error"/> 8726 <description> 8727 The method to query. 8728 </description> 8729 </param> 8730 <param id="bytecode_count_ptr"> 8731 <outptr><jint/></outptr> 8732 <description> 8733 On return, points to the length of the bytecode array 8734 </description> 8735 </param> 8736 <param id="bytecodes_ptr"> 8737 <allocbuf outcount="bytecode_count_ptr"><uchar/></allocbuf> 8738 <description> 8739 On return, points to the pointer to the bytecode array 8740 </description> 8741 </param> 8742 </parameters> 8743 <errors> 8744 </errors> 8745 </function> 8746 8747 <function id="IsMethodNative" phase="start" num="76"> 8748 <synopsis>Is Method Native</synopsis> 8749 <description> 8750 For the method indicated by <code>method</code>, return a 8751 value indicating whether the method is native via <code>is_native_ptr</code> 8752 </description> 8753 <origin>jvmdi</origin> 8754 <capabilities> 8755 </capabilities> 8756 <parameters> 8757 <param id="klass"> 8758 <jclass method="method"/> 8759 <description> 8760 The class to query. 8761 </description> 8762 </param> 8763 <param id="method"> 8764 <jmethodID class="klass"/> 8765 <description> 8766 The method to query. 8767 </description> 8768 </param> 8769 <param id="is_native_ptr"> 8770 <outptr><jboolean/></outptr> 8771 <description> 8772 On return, points to the boolean result of this function. 8773 </description> 8774 </param> 8775 </parameters> 8776 <errors> 8777 </errors> 8778 </function> 8779 8780 <function id="IsMethodSynthetic" phase="start" num="77"> 8781 <synopsis>Is Method Synthetic</synopsis> 8782 <description> 8783 For the method indicated by <code>method</code>, return a 8784 value indicating whether the method is synthetic via <code>is_synthetic_ptr</code>. 8785 Synthetic methods are generated by the compiler but not present in the 8786 original source code. 8787 </description> 8788 <origin>jvmdi</origin> 8789 <capabilities> 8790 <required id="can_get_synthetic_attribute"></required> 8791 </capabilities> 8792 <parameters> 8793 <param id="klass"> 8794 <jclass method="method"/> 8795 <description> 8796 The class to query. 8797 </description> 8798 </param> 8799 <param id="method"> 8800 <jmethodID class="klass"/> 8801 <description> 8802 The method to query. 8803 </description> 8804 </param> 8805 <param id="is_synthetic_ptr"> 8806 <outptr><jboolean/></outptr> 8807 <description> 8808 On return, points to the boolean result of this function. 8809 </description> 8810 </param> 8811 </parameters> 8812 <errors> 8813 </errors> 8814 </function> 8815 8816 <function id="IsMethodObsolete" phase="start" num="91"> 8817 <synopsis>Is Method Obsolete</synopsis> 8818 <description> 8819 Determine if a method ID refers to an 8820 <internallink id="obsoleteMethods">obsolete</internallink> 8821 method version. 8822 </description> 8823 <origin>jvmdi</origin> 8824 <capabilities> 8825 </capabilities> 8826 <parameters> 8827 <param id="klass"> 8828 <jclass method="method"/> 8829 <description> 8830 The class to query. 8831 </description> 8832 </param> 8833 <param id="method"> 8834 <jmethodID class="klass"/> 8835 <description> 8836 The method ID to query. 8837 </description> 8838 </param> 8839 <param id="is_obsolete_ptr"> 8840 <outptr><jboolean/></outptr> 8841 <description> 8842 On return, points to the boolean result of this function. 8843 </description> 8844 </param> 8845 </parameters> 8846 <errors> 8847 </errors> 8848 </function> 8849 8850 <function id="SetNativeMethodPrefix" jkernel="yes" phase="any" num="73" since="1.1"> 8851 <synopsis>Set Native Method Prefix</synopsis> 8852 <description> 8853 This function modifies the failure handling of 8854 native method resolution by allowing retry 8855 with a prefix applied to the name. 8856 When used with the 8857 <eventlink id="ClassFileLoadHook">ClassFileLoadHook 8858 event</eventlink>, it enables native methods to be 8859 <internallink id="bci">instrumented</internallink>. 8860 <p/> 8861 Since native methods cannot be directly instrumented 8862 (they have no bytecodes), they must be wrapped with 8863 a non-native method which can be instrumented. 8864 For example, if we had: 8865 <example> 8866 native boolean foo(int x);</example> 8867 <p/> 8868 We could transform the class file (with the 8869 ClassFileLoadHook event) so that this becomes: 8870 <example> 8871 boolean foo(int x) { 8872 <i>... record entry to foo ...</i> 8873 return wrapped_foo(x); 8874 } 8875 8876 native boolean wrapped_foo(int x);</example> 8877 <p/> 8878 Where foo becomes a wrapper for the actual native method 8879 with the appended prefix "wrapped_". Note that 8880 "wrapped_" would be a poor choice of prefix since it 8881 might conceivably form the name of an existing method 8882 thus something like "$$$MyAgentWrapped$$$_" would be 8883 better but would make these examples less readable. 8884 <p/> 8885 The wrapper will allow data to be collected on the native 8886 method call, but now the problem becomes linking up the 8887 wrapped method with the native implementation. 8888 That is, the method <code>wrapped_foo</code> needs to be 8889 resolved to the native implementation of <code>foo</code>, 8890 which might be: 8891 <example> 8892 Java_somePackage_someClass_foo(JNIEnv* env, jint x)</example> 8893 <p/> 8894 This function allows the prefix to be specified and the 8895 proper resolution to occur. 8896 Specifically, when the standard resolution fails, the 8897 resolution is retried taking the prefix into consideration. 8898 There are two ways that resolution occurs, explicit 8899 resolution with the JNI function <code>RegisterNatives</code> 8900 and the normal automatic resolution. For 8901 <code>RegisterNatives</code>, the VM will attempt this 8902 association: 8903 <example> 8904 method(foo) -> nativeImplementation(foo)</example> 8905 <p/> 8906 When this fails, the resolution will be retried with 8907 the specified prefix prepended to the method name, 8908 yielding the correct resolution: 8909 <example> 8910 method(wrapped_foo) -> nativeImplementation(foo)</example> 8911 <p/> 8912 For automatic resolution, the VM will attempt: 8913 <example> 8914 method(wrapped_foo) -> nativeImplementation(wrapped_foo)</example> 8915 <p/> 8916 When this fails, the resolution will be retried with 8917 the specified prefix deleted from the implementation name, 8918 yielding the correct resolution: 8919 <example> 8920 method(wrapped_foo) -> nativeImplementation(foo)</example> 8921 <p/> 8922 Note that since the prefix is only used when standard 8923 resolution fails, native methods can be wrapped selectively. 8924 <p/> 8925 Since each <jvmti/> environment is independent and 8926 can do its own transformation of the bytecodes, more 8927 than one layer of wrappers may be applied. Thus each 8928 environment needs its own prefix. Since transformations 8929 are applied in order, the prefixes, if applied, will 8930 be applied in the same order. 8931 The order of transformation application is described in 8932 the <eventlink id="ClassFileLoadHook"/> event. 8933 Thus if three environments applied 8934 wrappers, <code>foo</code> might become 8935 <code>$env3_$env2_$env1_foo</code>. But if, say, 8936 the second environment did not apply a wrapper to 8937 <code>foo</code> it would be just 8938 <code>$env3_$env1_foo</code>. To be able to 8939 efficiently determine the sequence of prefixes, 8940 an intermediate prefix is only applied if its non-native 8941 wrapper exists. Thus, in the last example, even though 8942 <code>$env1_foo</code> is not a native method, the 8943 <code>$env1_</code> prefix is applied since 8944 <code>$env1_foo</code> exists. 8945 <p/> 8946 Since the prefixes are used at resolution time 8947 and since resolution may be arbitrarily delayed, a 8948 native method prefix must remain set as long as there 8949 are corresponding prefixed native methods. 8950 </description> 8951 <origin>new</origin> 8952 <capabilities> 8953 <required id="can_set_native_method_prefix"></required> 8954 </capabilities> 8955 <parameters> 8956 <param id="prefix"> 8957 <inbuf> 8958 <char/> 8959 <nullok> 8960 any existing prefix in this environment is cancelled 8961 </nullok> 8962 </inbuf> 8963 <description> 8964 The prefix to apply, encoded as a 8965 <internallink id="mUTF">modified UTF-8</internallink> string. 8966 </description> 8967 </param> 8968 </parameters> 8969 <errors> 8970 </errors> 8971 </function> 8972 8973 <function id="SetNativeMethodPrefixes" jkernel="yes" phase="any" num="74" since="1.1"> 8974 <synopsis>Set Native Method Prefixes</synopsis> 8975 <description> 8976 For a normal agent, <functionlink id="SetNativeMethodPrefix"/> 8977 will provide all needed native method prefixing. 8978 For a meta-agent that performs multiple independent class 8979 file transformations (for example as a proxy for another 8980 layer of agents) this function allows each transformation 8981 to have its own prefix. 8982 The prefixes are applied in the order supplied and are 8983 processed in the same manner as described for the 8984 application of prefixes from multiple <jvmti/> environments 8985 in <functionlink id="SetNativeMethodPrefix"/>. 8986 <p/> 8987 Any previous prefixes are replaced. Thus, calling this 8988 function with a <paramlink id="prefix_count"/> of <code>0</code> 8989 disables prefixing in this environment. 8990 <p/> 8991 <functionlink id="SetNativeMethodPrefix"/> and this function 8992 are the two ways to set the prefixes. 8993 Calling <code>SetNativeMethodPrefix</code> with 8994 a prefix is the same as calling this function with 8995 <paramlink id="prefix_count"/> of <code>1</code>. 8996 Calling <code>SetNativeMethodPrefix</code> with 8997 <code>NULL</code> is the same as calling this function with 8998 <paramlink id="prefix_count"/> of <code>0</code>. 8999 </description> 9000 <origin>new</origin> 9001 <capabilities> 9002 <required id="can_set_native_method_prefix"></required> 9003 </capabilities> 9004 <parameters> 9005 <param id="prefix_count"> 9006 <jint min="0"/> 9007 <description> 9008 The number of prefixes to apply. 9009 </description> 9010 </param> 9011 <param id="prefixes"> 9012 <agentbuf> 9013 <char/> 9014 </agentbuf> 9015 <description> 9016 The prefixes to apply for this environment, each encoded as a 9017 <internallink id="mUTF">modified UTF-8</internallink> string. 9018 </description> 9019 </param> 9020 </parameters> 9021 <errors> 9022 </errors> 9023 </function> 9024 9025 </category> 9026 9027 <category id="RawMonitors" label="Raw Monitor"> 9028 9029 <function id="CreateRawMonitor" phase="onload" callbacksafe="safe" num="31"> 9030 <synopsis>Create Raw Monitor</synopsis> 9031 <description> 9032 Create a raw monitor. 9033 </description> 9034 <origin>jvmdi</origin> 9035 <capabilities> 9036 </capabilities> 9037 <parameters> 9038 <param id="name"> 9039 <inbuf><char/></inbuf> 9040 <description> 9041 A name to identify the monitor, encoded as a 9042 <internallink id="mUTF">modified UTF-8</internallink> string. 9043 </description> 9044 </param> 9045 <param id="monitor_ptr"> 9046 <outptr><jrawMonitorID/></outptr> 9047 <description> 9048 On return, points to the created monitor. 9049 </description> 9050 </param> 9051 </parameters> 9052 <errors> 9053 </errors> 9054 </function> 9055 9056 <function id="DestroyRawMonitor" phase="onload" callbacksafe="safe" num="32"> 9057 <synopsis>Destroy Raw Monitor</synopsis> 9058 <description> 9059 Destroy the raw monitor. 9060 If the monitor being destroyed has been entered by this thread, it will be 9061 exited before it is destroyed. 9062 If the monitor being destroyed has been entered by another thread, 9063 an error will be returned and the monitor will not be destroyed. 9064 </description> 9065 <origin>jvmdi</origin> 9066 <capabilities> 9067 </capabilities> 9068 <parameters> 9069 <param id="monitor"> 9070 <jrawMonitorID/> 9071 <description> 9072 The monitor 9073 </description> 9074 </param> 9075 </parameters> 9076 <errors> 9077 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 9078 Not monitor owner 9079 </error> 9080 </errors> 9081 </function> 9082 9083 <function id="RawMonitorEnter" phase="any" callbacksafe="safe" impl="innative notrace" num="33"> 9084 <synopsis>Raw Monitor Enter</synopsis> 9085 <description> 9086 Gain exclusive ownership of a raw monitor. 9087 The same thread may enter a monitor more then once. 9088 The thread must 9089 <functionlink id="RawMonitorExit">exit</functionlink> 9090 the monitor the same number of times as it is entered. 9091 If a monitor is entered during <code>OnLoad</code> (before attached threads exist) 9092 and has not exited when attached threads come into existence, the enter 9093 is considered to have occurred on the main thread. 9094 </description> 9095 <origin>jvmdi</origin> 9096 <capabilities> 9097 </capabilities> 9098 <parameters> 9099 <param id="monitor"> 9100 <jrawMonitorID/> 9101 <description> 9102 The monitor 9103 </description> 9104 </param> 9105 </parameters> 9106 <errors> 9107 </errors> 9108 </function> 9109 9110 <function id="RawMonitorExit" phase="any" callbacksafe="safe" impl="innative notrace" num="34"> 9111 <synopsis>Raw Monitor Exit</synopsis> 9112 <description> 9113 Release exclusive ownership of a raw monitor. 9114 </description> 9115 <origin>jvmdi</origin> 9116 <capabilities> 9117 </capabilities> 9118 <parameters> 9119 <param id="monitor"> 9120 <jrawMonitorID/> 9121 <description> 9122 The monitor 9123 </description> 9124 </param> 9125 </parameters> 9126 <errors> 9127 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 9128 Not monitor owner 9129 </error> 9130 </errors> 9131 </function> 9132 9133 <function id="RawMonitorWait" phase="any" callbacksafe="safe" impl="innative notrace" num="35"> 9134 <synopsis>Raw Monitor Wait</synopsis> 9135 <description> 9136 Wait for notification of the raw monitor. 9137 <p/> 9138 Causes the current thread to wait until either another thread calls 9139 <functionlink id="RawMonitorNotify"/> or 9140 <functionlink id="RawMonitorNotifyAll"/> 9141 for the specified raw monitor, or the specified 9142 <paramlink id="millis">timeout</paramlink> 9143 has elapsed. 9144 </description> 9145 <origin>jvmdi</origin> 9146 <capabilities> 9147 </capabilities> 9148 <parameters> 9149 <param id="monitor"> 9150 <jrawMonitorID/> 9151 <description> 9152 The monitor 9153 </description> 9154 </param> 9155 <param id="millis"> 9156 <jlong/> 9157 <description> 9158 The timeout, in milliseconds. If the timeout is 9159 zero, then real time is not taken into consideration 9160 and the thread simply waits until notified. 9161 </description> 9162 </param> 9163 </parameters> 9164 <errors> 9165 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 9166 Not monitor owner 9167 </error> 9168 <error id="JVMTI_ERROR_INTERRUPT"> 9169 Wait was interrupted, try again 9170 </error> 9171 </errors> 9172 </function> 9173 9174 <function id="RawMonitorNotify" phase="any" callbacksafe="safe" impl="notrace" num="36"> 9175 <synopsis>Raw Monitor Notify</synopsis> 9176 <description> 9177 Notify a single thread waiting on the raw monitor. 9178 </description> 9179 <origin>jvmdi</origin> 9180 <capabilities> 9181 </capabilities> 9182 <parameters> 9183 <param id="monitor"> 9184 <jrawMonitorID/> 9185 <description> 9186 The monitor 9187 </description> 9188 </param> 9189 </parameters> 9190 <errors> 9191 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 9192 Not monitor owner 9193 </error> 9194 </errors> 9195 </function> 9196 9197 <function id="RawMonitorNotifyAll" phase="any" callbacksafe="safe" impl="notrace" num="37"> 9198 <synopsis>Raw Monitor Notify All</synopsis> 9199 <description> 9200 Notify all threads waiting on the raw monitor. 9201 </description> 9202 <origin>jvmdi</origin> 9203 <capabilities> 9204 </capabilities> 9205 <parameters> 9206 <param id="monitor"> 9207 <jrawMonitorID/> 9208 <description> 9209 The monitor 9210 </description> 9211 </param> 9212 </parameters> 9213 <errors> 9214 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER"> 9215 Not monitor owner 9216 </error> 9217 </errors> 9218 </function> 9219 9220 <elide> 9221 <function id="GetRawMonitorUse" num="118"> 9222 <synopsis>Get Raw Monitor Use</synopsis> 9223 <description> 9224 The fields of the <functionlink id="jvmtiMonitorUsage"></functionlink> structure 9225 are filled in with information about usage of the raw monitor. 9226 </description> 9227 <origin>new</origin> 9228 <capabilities> 9229 <required id="can_get_raw_monitor_usage"></required> 9230 </capabilities> 9231 <parameters> 9232 <param id="monitor"> 9233 <jrawMonitorID/> 9234 <description> 9235 the raw monitor to query. 9236 </description> 9237 </param> 9238 <param id="info_ptr"> 9239 <outptr><struct>jvmtiMonitorUsage</struct></outptr> 9240 <description> 9241 On return, filled with monitor information for the 9242 specified raw monitor. 9243 </description> 9244 </param> 9245 </parameters> 9246 <errors> 9247 </errors> 9248 </function> 9249 9250 <function id="GetRawMonitors" num="119"> 9251 <synopsis>Get Raw Monitors</synopsis> 9252 <description> 9253 Return the list of raw monitors. 9254 <p/> 9255 Note: details about each monitor can be examined with 9256 <functionlink id="GetRawMonitorUse"></functionlink>. 9257 </description> 9258 <origin>new</origin> 9259 <capabilities> 9260 <required id="can_get_raw_monitor_usage"></required> 9261 </capabilities> 9262 <parameters> 9263 <param id="monitorCnt"> 9264 <outptr><jint/></outptr> 9265 <description> 9266 On return, pointer to the number 9267 of monitors returned in <code>monitors_ptr</code>. 9268 </description> 9269 </param> 9270 <param id="monitors_ptr"> 9271 <allocbuf outcount="monitorCnt"><jrawMonitorID/></allocbuf> 9272 <description> 9273 On return, pointer to the monitor list. 9274 </description> 9275 </param> 9276 </parameters> 9277 <errors> 9278 </errors> 9279 </function> 9280 </elide> 9281 </category> 9282 9283 <category id="jniIntercept" label="JNI Function Interception"> 9284 9285 <intro> 9286 Provides the ability to intercept and resend 9287 Java Native Interface (JNI) function calls 9288 by manipulating the JNI function table. 9289 See <externallink id="jni/functions.html">JNI 9290 Functions</externallink> in the <i>Java Native Interface Specification</i>. 9291 <p/> 9292 The following example illustrates intercepting the 9293 <code>NewGlobalRef</code> JNI call in order to count reference 9294 creation. 9295 <example> 9296 JNIEnv original_jni_Functions; 9297 JNIEnv redirected_jni_Functions; 9298 int my_global_ref_count = 0; 9299 9300 jobject 9301 MyNewGlobalRef(JNIEnv *jni_env, jobject lobj) { 9302 ++my_global_ref_count; 9303 return originalJNIFunctions->NewGlobalRef(env, lobj); 9304 } 9305 9306 void 9307 myInit() { 9308 jvmtiError err; 9309 9310 err = (*jvmti_env)->GetJNIFunctionTable(jvmti_env, &original_jni_Functions); 9311 if (err != JVMTI_ERROR_NONE) { 9312 die(); 9313 } 9314 err = (*jvmti_env)->GetJNIFunctionTable(jvmti_env, &redirected_jni_Functions); 9315 if (err != JVMTI_ERROR_NONE) { 9316 die(); 9317 } 9318 redirectedJNIFunctions->NewGlobalRef = MyNewGlobalRef; 9319 err = (*jvmti_env)->SetJNIFunctionTable(jvmti_env, redirected_jni_Functions); 9320 if (err != JVMTI_ERROR_NONE) { 9321 die(); 9322 } 9323 } 9324 </example> 9325 Sometime after <code>myInit</code> is called the user's JNI 9326 code is executed which makes the call to create a new global 9327 reference. Instead of going to the normal JNI implementation 9328 the call goes to <code>myNewGlobalRef</code>. Note that a 9329 copy of the original function table is kept so that the normal 9330 JNI function can be called after the data is collected. 9331 Note also that any JNI functions which are not overwritten 9332 will behave normally. 9333 <todo> 9334 check that the example compiles and executes. 9335 </todo> 9336 </intro> 9337 9338 <function id="SetJNIFunctionTable" phase="start" num="120"> 9339 <synopsis>Set JNI Function Table</synopsis> 9340 <description> 9341 Set the JNI function table 9342 in all current and future JNI environments. 9343 As a result, all future JNI calls are directed to the specified functions. 9344 Use <functionlink id="GetJNIFunctionTable"></functionlink> to get the 9345 function table to pass to this function. 9346 For this function to take effect the the updated table entries must be 9347 used by the JNI clients. 9348 Since the table is defined <code>const</code> some compilers may optimize 9349 away the access to the table, thus preventing this function from taking 9350 effect. 9351 The table is copied--changes to the local copy of the 9352 table have no effect. 9353 This function affects only the function table, all other aspects of the environment are 9354 unaffected. 9355 See the examples <internallink id="jniIntercept">above</internallink>. 9356 </description> 9357 <origin>new</origin> 9358 <capabilities> 9359 </capabilities> 9360 <parameters> 9361 <param id="function_table"> 9362 <inptr> 9363 <struct>jniNativeInterface</struct> 9364 </inptr> 9365 <description> 9366 Points to the new JNI function table. 9367 </description> 9368 </param> 9369 </parameters> 9370 <errors> 9371 </errors> 9372 </function> 9373 9374 <function id="GetJNIFunctionTable" phase="start" num="121"> 9375 <synopsis>Get JNI Function Table</synopsis> 9376 <description> 9377 Get the JNI function table. 9378 The JNI function table is copied into allocated memory. 9379 If <functionlink id="SetJNIFunctionTable"></functionlink> 9380 has been called, the modified (not the original) function 9381 table is returned. 9382 Only the function table is copied, no other aspects of the environment 9383 are copied. 9384 See the examples <internallink id="jniIntercept">above</internallink>. 9385 </description> 9386 <origin>new</origin> 9387 <capabilities> 9388 </capabilities> 9389 <parameters> 9390 <param id="function_table"> 9391 <allocbuf> 9392 <struct>jniNativeInterface</struct> 9393 </allocbuf> 9394 <description> 9395 On return, <code>*function_table</code> 9396 points a newly allocated copy of the JNI function table. 9397 </description> 9398 </param> 9399 </parameters> 9400 <errors> 9401 </errors> 9402 </function> 9403 9404 </category> 9405 9406 <category id="eventManagement" label="Event Management"> 9407 9408 <function id="SetEventCallbacks" jkernel="yes" phase="onload" num="122"> 9409 <synopsis>Set Event Callbacks</synopsis> 9410 <description> 9411 Set the functions to be called for each event. 9412 The callbacks are specified by supplying a replacement function table. 9413 The function table is copied--changes to the local copy of the 9414 table have no effect. 9415 This is an atomic action, all callbacks are set at once. 9416 No events are sent before this function is called. 9417 When an entry is <code>NULL</code> or when the event is beyond 9418 <paramlink id="size_of_callbacks"></paramlink> no event is sent. 9419 Details on events are 9420 described <internallink id="EventSection">later</internallink> in this document. 9421 An event must be enabled and have a callback in order to be 9422 sent--the order in which this function and 9423 <functionlink id="SetEventNotificationMode"></functionlink> 9424 are called does not affect the result. 9425 </description> 9426 <origin>new</origin> 9427 <capabilities> 9428 </capabilities> 9429 <parameters> 9430 <param id="callbacks"> 9431 <inptr> 9432 <struct>jvmtiEventCallbacks</struct> 9433 <nullok>remove the existing callbacks</nullok> 9434 </inptr> 9435 <description> 9436 The new event callbacks. 9437 </description> 9438 </param> 9439 <param id="size_of_callbacks"> 9440 <jint min="0"/> 9441 <description> 9442 <code>sizeof(jvmtiEventCallbacks)</code>--for version 9443 compatibility. 9444 </description> 9445 </param> 9446 </parameters> 9447 <errors> 9448 </errors> 9449 </function> 9450 9451 <function id="SetEventNotificationMode" jkernel="yes" phase="onload" num="2"> 9452 <synopsis>Set Event Notification Mode</synopsis> 9453 <description> 9454 Control the generation of events. 9455 <constants id="jvmtiEventMode" label="Event Enable/Disable" kind="enum"> 9456 <constant id="JVMTI_ENABLE" num="1"> 9457 If <paramlink id="mode"></paramlink> is <code>JVMTI_ENABLE</code>, 9458 the event <paramlink id="event_type"></paramlink> will be enabled 9459 </constant> 9460 <constant id="JVMTI_DISABLE" num="0"> 9461 If <paramlink id="mode"></paramlink> is <code>JVMTI_DISABLE</code>, 9462 the event <paramlink id="event_type"></paramlink> will be disabled 9463 </constant> 9464 </constants> 9465 If <code>event_thread</code> is <code>NULL</code>, 9466 the event is enabled or disabled globally; otherwise, it is 9467 enabled or disabled for a particular thread. 9468 An event is generated for 9469 a particular thread if it is enabled either at the thread or global 9470 levels. 9471 <p/> 9472 See <internallink id="EventIndex">below</internallink> for information on specific events. 9473 <p/> 9474 The following events cannot be controlled at the thread 9475 level through this function. 9476 <ul> 9477 <li><eventlink id="VMInit"></eventlink></li> 9478 <li><eventlink id="VMStart"></eventlink></li> 9479 <li><eventlink id="VMDeath"></eventlink></li> 9480 <li><eventlink id="ThreadStart"></eventlink></li> 9481 <li><eventlink id="CompiledMethodLoad"></eventlink></li> 9482 <li><eventlink id="CompiledMethodUnload"></eventlink></li> 9483 <li><eventlink id="DynamicCodeGenerated"></eventlink></li> 9484 <li><eventlink id="DataDumpRequest"></eventlink></li> 9485 </ul> 9486 <p/> 9487 Initially, no events are enabled at either the thread level 9488 or the global level. 9489 <p/> 9490 Any needed capabilities (see Event Enabling Capabilities below) must be possessed 9491 before calling this function. 9492 <p/> 9493 Details on events are 9494 described <internallink id="EventSection">below</internallink>. 9495 </description> 9496 <origin>jvmdiClone</origin> 9497 <eventcapabilities></eventcapabilities> 9498 <parameters> 9499 <param id="mode"> 9500 <enum>jvmtiEventMode</enum> 9501 <description> 9502 <code>JVMTI_ENABLE</code> or <code>JVMTI_DISABLE</code> 9503 </description> 9504 </param> 9505 <param id="event_type"> 9506 <enum>jvmtiEvent</enum> 9507 <description> 9508 the event to control 9509 </description> 9510 </param> 9511 <param id="event_thread"> 9512 <ptrtype> 9513 <jthread impl="noconvert"/> 9514 <nullok>event is controlled at the global level</nullok> 9515 </ptrtype> 9516 <description> 9517 The thread to control 9518 </description> 9519 </param> 9520 <param id="..."> 9521 <varargs/> 9522 <description> 9523 for future expansion 9524 </description> 9525 </param> 9526 </parameters> 9527 <errors> 9528 <error id="JVMTI_ERROR_INVALID_THREAD"> 9529 <paramlink id="event_thread"/> is non-<code>NULL</code> and is not a valid thread. 9530 </error> 9531 <error id="JVMTI_ERROR_THREAD_NOT_ALIVE"> 9532 <paramlink id="event_thread"/> is non-<code>NULL</code> and is not live (has not been started or is now dead). 9533 </error> 9534 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 9535 thread level control was attempted on events which do not 9536 permit thread level control. 9537 </error> 9538 <error id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY"> 9539 The Required Event Enabling Capability is not possessed. 9540 </error> 9541 </errors> 9542 </function> 9543 9544 <function id="GenerateEvents" num="123"> 9545 <synopsis>Generate Events</synopsis> 9546 <description> 9547 Generate events to represent the current state of the VM. 9548 For example, if <paramlink id="event_type"/> is 9549 <code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code>, 9550 a <eventlink id="CompiledMethodLoad"></eventlink> event will be 9551 sent for each currently compiled method. 9552 Methods that were loaded and now have been unloaded are not sent. 9553 The history of what events have previously been sent does not 9554 effect what events are sent by this function--for example, 9555 all currently compiled methods 9556 will be sent each time this function is called. 9557 <p/> 9558 This function is useful when 9559 events may have been missed due to the agent attaching after program 9560 execution begins; this function generates the missed events. 9561 <p/> 9562 Attempts to execute Java programming language code or 9563 JNI functions may be paused until this function returns - 9564 so neither should be called from the thread sending the event. 9565 This function returns only after the missed events have been 9566 sent, processed and have returned. 9567 The event may be sent on a different thread than the thread 9568 on which the event occurred. 9569 The callback for the event must be set with 9570 <functionlink id="SetEventCallbacks"></functionlink> 9571 and the event must be enabled with 9572 <functionlink id="SetEventNotificationMode"></functionlink> 9573 or the events will not occur. 9574 If the VM no longer has the information to generate some or 9575 all of the requested events, the events are simply not sent - 9576 no error is returned. 9577 <p/> 9578 Only the following events are supported: 9579 <ul> 9580 <li><eventlink id="CompiledMethodLoad"></eventlink></li> 9581 <li><eventlink id="DynamicCodeGenerated"></eventlink></li> 9582 </ul> 9583 </description> 9584 <origin>new</origin> 9585 <capabilities> 9586 <capability id="can_generate_compiled_method_load_events"></capability> 9587 </capabilities> 9588 <parameters> 9589 <param id="event_type"> 9590 <enum>jvmtiEvent</enum> 9591 <description> 9592 The type of event to generate. Must be one of these: 9593 <ul> 9594 <li><eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink></li> 9595 <li><eventlink id="DynamicCodeGenerated"><code>JVMTI_EVENT_DYNAMIC_CODE_GENERATED</code></eventlink></li> 9596 </ul> 9597 </description> 9598 </param> 9599 </parameters> 9600 <errors> 9601 <error id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY"> 9602 <paramlink id="event_type"/> is 9603 <eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink> 9604 and <fieldlink id="can_generate_compiled_method_load_events" struct="jvmtiCapabilities"></fieldlink> 9605 is <code>false</code>. 9606 </error> 9607 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 9608 <paramlink id="event_type"/> is other than 9609 <eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink> 9610 or <eventlink id="DynamicCodeGenerated"><code>JVMTI_EVENT_DYNAMIC_CODE_GENERATED</code></eventlink>. 9611 </error> 9612 </errors> 9613 </function> 9614 9615 </category> 9616 9617 <category id="extension" label="Extension Mechanism"> 9618 9619 <intro> 9620 These functions 9621 allow a <jvmti/> implementation to provide functions and events 9622 beyond those defined in this specification. 9623 <p/> 9624 Both extension functions and extension events have parameters 9625 each of which has a 'type' and 'kind' chosen from the following tables: 9626 9627 <constants id="jvmtiParamTypes" label="Extension Function/Event Parameter Types" kind="enum"> 9628 <constant id="JVMTI_TYPE_JBYTE" num="101"> 9629 Java programming language primitive type - <code>byte</code>. 9630 JNI type <code>jbyte</code>. 9631 </constant> 9632 <constant id="JVMTI_TYPE_JCHAR" num="102"> 9633 Java programming language primitive type - <code>char</code>. 9634 JNI type <code>jchar</code>. 9635 </constant> 9636 <constant id="JVMTI_TYPE_JSHORT" num="103"> 9637 Java programming language primitive type - <code>short</code>. 9638 JNI type <code>jshort</code>. 9639 </constant> 9640 <constant id="JVMTI_TYPE_JINT" num="104"> 9641 Java programming language primitive type - <code>int</code>. 9642 JNI type <datalink id="jint"></datalink>. 9643 </constant> 9644 <constant id="JVMTI_TYPE_JLONG" num="105"> 9645 Java programming language primitive type - <code>long</code>. 9646 JNI type <datalink id="jlong"></datalink>. 9647 </constant> 9648 <constant id="JVMTI_TYPE_JFLOAT" num="106"> 9649 Java programming language primitive type - <code>float</code>. 9650 JNI type <datalink id="jfloat"></datalink>. 9651 </constant> 9652 <constant id="JVMTI_TYPE_JDOUBLE" num="107"> 9653 Java programming language primitive type - <code>double</code>. 9654 JNI type <datalink id="jdouble"></datalink>. 9655 </constant> 9656 <constant id="JVMTI_TYPE_JBOOLEAN" num="108"> 9657 Java programming language primitive type - <code>boolean</code>. 9658 JNI type <datalink id="jboolean"></datalink>. 9659 </constant> 9660 <constant id="JVMTI_TYPE_JOBJECT" num="109"> 9661 Java programming language object type - <code>java.lang.Object</code>. 9662 JNI type <datalink id="jobject"></datalink>. 9663 Returned values are JNI local references and must be managed. 9664 </constant> 9665 <constant id="JVMTI_TYPE_JTHREAD" num="110"> 9666 Java programming language object type - <code>java.lang.Thread</code>. 9667 <jvmti/> type <datalink id="jthread"></datalink>. 9668 Returned values are JNI local references and must be managed. 9669 </constant> 9670 <constant id="JVMTI_TYPE_JCLASS" num="111"> 9671 Java programming language object type - <code>java.lang.Class</code>. 9672 JNI type <datalink id="jclass"></datalink>. 9673 Returned values are JNI local references and must be managed. 9674 </constant> 9675 <constant id="JVMTI_TYPE_JVALUE" num="112"> 9676 Union of all Java programming language primitive and object types - 9677 JNI type <datalink id="jvalue"></datalink>. 9678 Returned values which represent object types are JNI local references and must be managed. 9679 </constant> 9680 <constant id="JVMTI_TYPE_JFIELDID" num="113"> 9681 Java programming language field identifier - 9682 JNI type <datalink id="jfieldID"></datalink>. 9683 </constant> 9684 <constant id="JVMTI_TYPE_JMETHODID" num="114"> 9685 Java programming language method identifier - 9686 JNI type <datalink id="jmethodID"></datalink>. 9687 </constant> 9688 <constant id="JVMTI_TYPE_CCHAR" num="115"> 9689 C programming language type - <code>char</code>. 9690 </constant> 9691 <constant id="JVMTI_TYPE_CVOID" num="116"> 9692 C programming language type - <code>void</code>. 9693 </constant> 9694 <constant id="JVMTI_TYPE_JNIENV" num="117"> 9695 JNI environment - <code>JNIEnv</code>. 9696 Should be used with the correct <datalink id="jvmtiParamKind"/> to make it a pointer type. 9697 </constant> 9698 </constants> 9699 9700 <constants id="jvmtiParamKind" label="Extension Function/Event Parameter Kinds" kind="enum"> 9701 <constant id="JVMTI_KIND_IN" num="91"> 9702 Ingoing argument - <code>foo</code>. 9703 </constant> 9704 <constant id="JVMTI_KIND_IN_PTR" num="92"> 9705 Ingoing pointer argument - <code>const foo*</code>. 9706 </constant> 9707 <constant id="JVMTI_KIND_IN_BUF" num="93"> 9708 Ingoing array argument - <code>const foo*</code>. 9709 </constant> 9710 <constant id="JVMTI_KIND_ALLOC_BUF" num="94"> 9711 Outgoing allocated array argument - <code>foo**</code>. 9712 Free with <code>Deallocate</code>. 9713 </constant> 9714 <constant id="JVMTI_KIND_ALLOC_ALLOC_BUF" num="95"> 9715 Outgoing allocated array of allocated arrays argument - <code>foo***</code>. 9716 Free with <code>Deallocate</code>. 9717 </constant> 9718 <constant id="JVMTI_KIND_OUT" num="96"> 9719 Outgoing argument - <code>foo*</code>. 9720 </constant> 9721 <constant id="JVMTI_KIND_OUT_BUF" num="97"> 9722 Outgoing array argument (pre-allocated by agent) - <code>foo*</code>. 9723 Do not <code>Deallocate</code>. 9724 </constant> 9725 </constants> 9726 9727 </intro> 9728 9729 <typedef id="jvmtiParamInfo" label="Extension Function/Event Parameter Info"> 9730 <field id="name"> 9731 <allocfieldbuf><char/></allocfieldbuf> 9732 <description> 9733 The parameter name, encoded as a 9734 <internallink id="mUTF">modified UTF-8</internallink> string 9735 </description> 9736 </field> 9737 <field id="kind"> 9738 <enum>jvmtiParamKind</enum> 9739 <description> 9740 The kind of the parameter - type modifiers 9741 </description> 9742 </field> 9743 <field id="base_type"> 9744 <enum>jvmtiParamTypes</enum> 9745 <description> 9746 The base type of the parameter - modified by <code>kind</code> 9747 </description> 9748 </field> 9749 <field id="null_ok"> 9750 <jboolean/> 9751 <description> 9752 Is a <code>NULL</code> argument permitted? Applies only to pointer and object types. 9753 </description> 9754 </field> 9755 </typedef> 9756 9757 <callback id="jvmtiExtensionFunction"> 9758 <enum>jvmtiError</enum> 9759 <synopsis>Extension Function</synopsis> 9760 <description> 9761 This is the implementation-specific extension function. 9762 </description> 9763 <parameters> 9764 <param id="jvmti_env"> 9765 <outptr> 9766 <struct>jvmtiEnv</struct> 9767 </outptr> 9768 <description> 9769 The <jvmti/> environment is the only fixed parameter for extension functions. 9770 </description> 9771 </param> 9772 <param id="..."> 9773 <varargs/> 9774 <description> 9775 The extension function-specific parameters 9776 </description> 9777 </param> 9778 </parameters> 9779 </callback> 9780 9781 <function id="GetExtensionFunctions" phase="onload" num="124"> 9782 <synopsis>Get Extension Functions</synopsis> 9783 9784 <typedef id="jvmtiExtensionFunctionInfo" label="Extension Function Info"> 9785 <field id="func"> 9786 <ptrtype> 9787 <struct>jvmtiExtensionFunction</struct> 9788 </ptrtype> 9789 <description> 9790 The actual function to call 9791 </description> 9792 </field> 9793 <field id="id"> 9794 <allocfieldbuf><char/></allocfieldbuf> 9795 <description> 9796 The identifier for the extension function, encoded as a 9797 <internallink id="mUTF">modified UTF-8</internallink> string. 9798 Uses package name conventions. 9799 For example, <code>com.sun.hotspot.bar</code> 9800 </description> 9801 </field> 9802 <field id="short_description"> 9803 <allocfieldbuf><char/></allocfieldbuf> 9804 <description> 9805 A one sentence description of the function, encoded as a 9806 <internallink id="mUTF">modified UTF-8</internallink> string. 9807 </description> 9808 </field> 9809 <field id="param_count"> 9810 <jint/> 9811 <description> 9812 The number of parameters excluding <code>jvmtiEnv *jvmti_env</code> 9813 </description> 9814 </field> 9815 <field id="params"> 9816 <allocfieldbuf outcount="param_count"> 9817 <struct>jvmtiParamInfo</struct> 9818 </allocfieldbuf> 9819 <description> 9820 Array of 9821 <fieldlink id="param_count" struct="jvmtiExtensionFunctionInfo"></fieldlink> 9822 parameters (<code>jvmtiEnv *jvmti_env</code> excluded) 9823 </description> 9824 </field> 9825 <field id="error_count"> 9826 <jint/> 9827 <description> 9828 The number of possible error returns (excluding universal errors) 9829 </description> 9830 </field> 9831 <field id="errors"> 9832 <allocfieldbuf outcount="error_count"> 9833 <enum>jvmtiError</enum> 9834 </allocfieldbuf> 9835 <description> 9836 Array of <fieldlink id="error_count" struct="jvmtiExtensionFunctionInfo"></fieldlink> 9837 possible errors 9838 </description> 9839 </field> 9840 </typedef> 9841 9842 <description> 9843 Returns the set of extension functions. 9844 </description> 9845 <origin>new</origin> 9846 <capabilities> 9847 </capabilities> 9848 <parameters> 9849 <param id="extension_count_ptr"> 9850 <outptr><jint/></outptr> 9851 <description> 9852 On return, points to the number of extension functions 9853 </description> 9854 </param> 9855 <param id="extensions"> 9856 <allocbuf outcount="extension_count_ptr"><struct>jvmtiExtensionFunctionInfo</struct></allocbuf> 9857 <description> 9858 Returns an array of extension function info, one per function 9859 </description> 9860 </param> 9861 </parameters> 9862 <errors> 9863 </errors> 9864 </function> 9865 9866 <function id="GetExtensionEvents" phase="onload" num="125"> 9867 <synopsis>Get Extension Events</synopsis> 9868 9869 <typedef id="jvmtiExtensionEventInfo" label="Extension Event Info"> 9870 <field id="extension_event_index"> 9871 <jint/> 9872 <description> 9873 The identifying index of the event 9874 </description> 9875 </field> 9876 <field id="id"> 9877 <allocfieldbuf><char/></allocfieldbuf> 9878 <description> 9879 The identifier for the extension event, encoded as a 9880 <internallink id="mUTF">modified UTF-8</internallink> string. 9881 Uses package name conventions. 9882 For example, <code>com.sun.hotspot.bar</code> 9883 </description> 9884 </field> 9885 <field id="short_description"> 9886 <allocfieldbuf><char/></allocfieldbuf> 9887 <description> 9888 A one sentence description of the event, encoded as a 9889 <internallink id="mUTF">modified UTF-8</internallink> string. 9890 </description> 9891 </field> 9892 <field id="param_count"> 9893 <jint/> 9894 <description> 9895 The number of parameters excluding <code>jvmtiEnv *jvmti_env</code> 9896 </description> 9897 </field> 9898 <field id="params"> 9899 <allocfieldbuf outcount="param_count"> 9900 <struct>jvmtiParamInfo</struct> 9901 </allocfieldbuf> 9902 <description> 9903 Array of 9904 <fieldlink id="param_count" struct="jvmtiExtensionEventInfo"></fieldlink> 9905 parameters (<code>jvmtiEnv *jvmti_env</code> excluded) 9906 </description> 9907 </field> 9908 </typedef> 9909 9910 <description> 9911 Returns the set of extension events. 9912 </description> 9913 <origin>new</origin> 9914 <capabilities> 9915 </capabilities> 9916 <parameters> 9917 <param id="extension_count_ptr"> 9918 <outptr><jint/></outptr> 9919 <description> 9920 On return, points to the number of extension events 9921 </description> 9922 </param> 9923 <param id="extensions"> 9924 <allocbuf outcount="extension_count_ptr"><struct>jvmtiExtensionEventInfo</struct></allocbuf> 9925 <description> 9926 Returns an array of extension event info, one per event 9927 </description> 9928 </param> 9929 </parameters> 9930 <errors> 9931 </errors> 9932 </function> 9933 9934 <callback id="jvmtiExtensionEvent"> 9935 <void/> 9936 <synopsis>Extension Event</synopsis> 9937 <description> 9938 This is the implementation-specific event. 9939 The event handler is set with 9940 <functionlink id="SetExtensionEventCallback"/>. 9941 <p/> 9942 Event handlers for extension events must be declared varargs to match this definition. 9943 Failure to do so could result in calling convention mismatch and undefined behavior 9944 on some platforms. 9945 <p/> 9946 For example, if the <code>jvmtiParamInfo</code> 9947 returned by <functionlink id="GetExtensionEvents"/> indicates that 9948 there is a <code>jint</code> parameter, the event handler should be 9949 declared: 9950 <example> 9951 void JNICALL myHandler(jvmtiEnv* jvmti_env, jint myInt, ...) 9952 </example> 9953 Note the terminal "<code>...</code>" which indicates varargs. 9954 </description> 9955 <parameters> 9956 <param id="jvmti_env"> 9957 <outptr> 9958 <struct>jvmtiEnv</struct> 9959 </outptr> 9960 <description> 9961 The <jvmti/> environment is the only fixed parameter for extension events. 9962 </description> 9963 </param> 9964 <param id="..."> 9965 <varargs/> 9966 <description> 9967 The extension event-specific parameters 9968 </description> 9969 </param> 9970 </parameters> 9971 </callback> 9972 9973 <function id="SetExtensionEventCallback" phase="onload" num="126"> 9974 <synopsis>Set Extension Event Callback</synopsis> 9975 9976 <description> 9977 Sets the callback function for an extension event and 9978 enables the event. Or, if the callback is <code>NULL</code>, disables 9979 the event. Note that unlike standard events, setting 9980 the callback and enabling the event are a single operation. 9981 </description> 9982 <origin>new</origin> 9983 <capabilities> 9984 </capabilities> 9985 <parameters> 9986 <param id="extension_event_index"> 9987 <jint/> 9988 <description> 9989 Identifies which callback to set. 9990 This index is the 9991 <fieldlink id="extension_event_index" struct="jvmtiExtensionEventInfo"></fieldlink> 9992 field of 9993 <datalink id="jvmtiExtensionEventInfo"/>. 9994 </description> 9995 </param> 9996 <param id="callback"> 9997 <ptrtype> 9998 <struct>jvmtiExtensionEvent</struct> 9999 <nullok>disable the event</nullok> 10000 </ptrtype> 10001 <description> 10002 If <code>callback</code> is non-<code>NULL</code>, 10003 set <code>callback</code> to be the event callback function 10004 and enable the event. 10005 </description> 10006 </param> 10007 </parameters> 10008 <errors> 10009 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 10010 <paramlink id="extension_event_index"/> is not an 10011 <fieldlink id="extension_event_index" 10012 struct="jvmtiExtensionEventInfo"/> 10013 returned by 10014 <functionlink id="GetExtensionEvents"/> 10015 </error> 10016 </errors> 10017 </function> 10018 10019 </category> 10020 10021 <category id="capability" label="Capability"> 10022 10023 <intro> 10024 The capabilities functions allow you to change the 10025 functionality available to <jvmti/>--that is, 10026 which <jvmti/> 10027 functions can be called, what events can be generated, 10028 and what functionality these events and functions can 10029 provide. 10030 <p/> 10031 The "Capabilities" section of each function and event describe which 10032 capabilities, if any, they are associated with. "Required Functionality" 10033 means it is available for use and no capabilities must be added to use it. 10034 "Optional Functionality" means the agent must possess the capability 10035 before it can be used. 10036 To possess a capability, the agent must 10037 <functionlink id="AddCapabilities">add the capability</functionlink>. 10038 "Optional Features" describe capabilities which, 10039 if added, extend the feature set. 10040 <p/> 10041 The potentially available capabilities of each <jvmti/> implementation are different. 10042 Depending on the implementation, a capability: 10043 <ul> 10044 <li>may never be added</li> 10045 <li>may be added in either the <code>OnLoad</code> or live phase in any environment</li> 10046 <li>may be added only during the <code>OnLoad</code> phase</li> 10047 <li>may be possessed by only one environment at a time</li> 10048 <li>may be possessed by only one environment at a time, 10049 and only during the <code>OnLoad</code> phase</li> 10050 <li>and so on ...</li> 10051 </ul> 10052 Frequently, the addition of a capability may incur a cost in execution speed, start up 10053 time, and/or memory footprint. Note that the overhead of using a capability 10054 is completely different than the overhead of possessing a capability. 10055 Take single stepping as an example. When single stepping is on (that 10056 is, when the event is enabled and thus actively sending events) 10057 the overhead of sending and processing an event 10058 on each instruction is huge in any implementation. 10059 However, the overhead of possessing the capability may be small or large, 10060 depending on the implementation. Also, when and if a capability is potentially 10061 available depends on the implementation. Some examples: 10062 <ul> 10063 <li>One VM might perform all execution by compiling bytecodes into 10064 native code and be unable to generate single step instructions. 10065 In this implementation the capability can not be added.</li> 10066 <li>Another VM may be able to switch execution to a single stepping 10067 interpreter at any time. In this implementation, having the capability has no 10068 overhead and could be added at any time.</li> 10069 <li>Yet another VM might be able to choose a bytecode compiling or single stepping capable interpreted 10070 execution engine at start up, but be unable to switch between them. 10071 In this implementation the capability would need to be added 10072 during the <code>OnLoad</code> phase (before bytecode 10073 execution begins) and would have a large impact on execution speed 10074 even if single stepping was never used.</li> 10075 <li>Still another VM might be able to add an "is single stepping on" check 10076 into compiled bytecodes or a generated interpreter. Again in this implementation 10077 the capability would need to be added during the <code>OnLoad</code> phase but the overhead (a test 10078 and branch on each instruction) would be considerably less.</li> 10079 </ul> 10080 <p/> 10081 Each <jvmti/> <internallink id="environments">environment</internallink> 10082 has its own set of capabilities. 10083 Initially, that set is empty. 10084 Any desired capability must be added. 10085 If possible, capabilities should be added during the <code>OnLoad</code> phase. For most 10086 virtual machines certain capabilities require special set up for 10087 the virtual machine and this set up must happen 10088 during the <code>OnLoad</code> phase, before the virtual machine begins execution. 10089 Once a capability is added, it can 10090 only be removed if explicitly relinquished by the environment. 10091 <p/> 10092 The agent can, 10093 <functionlink id="GetPotentialCapabilities">determine what 10094 capabilities this VM can potentially provide</functionlink>, 10095 <functionlink id="AddCapabilities">add the capabilities 10096 to be used</functionlink>, 10097 <functionlink id="RelinquishCapabilities">release capabilities 10098 which are no longer needed</functionlink>, and 10099 <functionlink id="GetCapabilities">examine the currently available 10100 capabilities</functionlink>. 10101 </intro> 10102 10103 <intro id="capabilityExamples" label="Capability Examples"> 10104 For example, a freshly started agent (in the <code>OnLoad</code> function) 10105 wants to enable all possible capabilities. 10106 Note that, in general, this is not advisable as the agent may suffer 10107 a performance penalty for functionality it is not using. 10108 The code might look like this in C: 10109 <example> 10110 jvmtiCapabilities capa; 10111 jvmtiError err; 10112 10113 err = (*jvmti)->GetPotentialCapabilities(jvmti, &capa); 10114 if (err == JVMTI_ERROR_NONE) { 10115 err = (*jvmti)->AddCapabilities(jvmti, &capa); 10116 </example> 10117 For example, if an agent wants to check if it can get 10118 the bytecodes of a method (that is, it wants to check 10119 if it previously added this capability and has not 10120 relinquished it), the code might 10121 look like this in C: 10122 <example> 10123 jvmtiCapabilities capa; 10124 jvmtiError err; 10125 10126 err = (*jvmti)->GetCapabilities(jvmti, &capa); 10127 if (err == JVMTI_ERROR_NONE) { 10128 if (capa.can_get_bytecodes) { ... } } 10129 </example> 10130 </intro> 10131 10132 <capabilitiestypedef id="jvmtiCapabilities" label="The Capabilities Structure"> 10133 <description> 10134 The functions in this category use this capabilities structure 10135 which contains boolean flags corresponding to each capability: 10136 </description> 10137 <capabilityfield id="can_tag_objects"> 10138 <description> 10139 Can set and get tags, as described in the 10140 <internallink id="Heap">Heap category</internallink>. 10141 </description> 10142 </capabilityfield> 10143 <capabilityfield id="can_generate_field_modification_events"> 10144 <description> 10145 Can set watchpoints on field modification - 10146 <functionlink id="SetFieldModificationWatch"></functionlink> 10147 </description> 10148 </capabilityfield> 10149 <capabilityfield id="can_generate_field_access_events"> 10150 <description> 10151 Can set watchpoints on field access - 10152 <functionlink id="SetFieldAccessWatch"></functionlink> 10153 </description> 10154 </capabilityfield> 10155 <capabilityfield id="can_get_bytecodes"> 10156 <description> 10157 Can get bytecodes of a method <functionlink id="GetBytecodes"></functionlink> 10158 </description> 10159 </capabilityfield> 10160 <capabilityfield id="can_get_synthetic_attribute"> 10161 <description> 10162 Can test if a field or method is synthetic - 10163 <functionlink id="IsFieldSynthetic"></functionlink> and 10164 <functionlink id="IsMethodSynthetic"></functionlink> 10165 </description> 10166 </capabilityfield> 10167 <capabilityfield id="can_get_owned_monitor_info"> 10168 <description> 10169 Can get information about ownership of monitors - 10170 <functionlink id="GetOwnedMonitorInfo"></functionlink> 10171 </description> 10172 </capabilityfield> 10173 <capabilityfield id="can_get_current_contended_monitor"> 10174 <description> 10175 Can <functionlink id="GetCurrentContendedMonitor"></functionlink> 10176 </description> 10177 </capabilityfield> 10178 <capabilityfield id="can_get_monitor_info"> 10179 <description> 10180 Can <functionlink id="GetObjectMonitorUsage"></functionlink> 10181 </description> 10182 </capabilityfield> 10183 <capabilityfield id="can_pop_frame"> 10184 <description> 10185 Can pop frames off the stack - <functionlink id="PopFrame"></functionlink> 10186 </description> 10187 </capabilityfield> 10188 <capabilityfield id="can_redefine_classes"> 10189 <description> 10190 Can redefine classes with <functionlink id="RedefineClasses"/>. 10191 </description> 10192 </capabilityfield> 10193 <capabilityfield id="can_signal_thread"> 10194 <description> 10195 Can send stop or interrupt to threads 10196 </description> 10197 </capabilityfield> 10198 <capabilityfield id="can_get_source_file_name"> 10199 <description> 10200 Can get the source file name of a class 10201 </description> 10202 </capabilityfield> 10203 <capabilityfield id="can_get_line_numbers"> 10204 <description> 10205 Can get the line number table of a method 10206 </description> 10207 </capabilityfield> 10208 <capabilityfield id="can_get_source_debug_extension"> 10209 <description> 10210 Can get the source debug extension of a class 10211 </description> 10212 </capabilityfield> 10213 <capabilityfield id="can_access_local_variables"> 10214 <description> 10215 Can set and get local variables 10216 </description> 10217 </capabilityfield> 10218 <capabilityfield id="can_maintain_original_method_order"> 10219 <description> 10220 Can return methods in the order they occur in the class file 10221 </description> 10222 </capabilityfield> 10223 <capabilityfield id="can_generate_single_step_events"> 10224 <description> 10225 Can get <eventlink id="SingleStep">single step</eventlink> events 10226 </description> 10227 </capabilityfield> 10228 <capabilityfield id="can_generate_exception_events"> 10229 <description> 10230 Can get <eventlink id="Exception">exception thrown</eventlink> and 10231 <eventlink id="ExceptionCatch">exception catch</eventlink> events 10232 </description> 10233 </capabilityfield> 10234 <capabilityfield id="can_generate_frame_pop_events"> 10235 <description> 10236 Can <functionlink id="NotifyFramePop">set</functionlink> and thus get 10237 <eventlink id="FramePop"></eventlink> events 10238 </description> 10239 </capabilityfield> 10240 <capabilityfield id="can_generate_breakpoint_events"> 10241 <description> 10242 Can <functionlink id="SetBreakpoint">set</functionlink> and thus get 10243 <eventlink id="Breakpoint"></eventlink> events 10244 </description> 10245 </capabilityfield> 10246 <capabilityfield id="can_suspend"> 10247 <description> 10248 Can suspend and resume threads 10249 </description> 10250 </capabilityfield> 10251 <capabilityfield id="can_redefine_any_class"> 10252 <description> 10253 <functionlink id="RedefineClasses"/> can be called on any modifiable class. 10254 See <functionlink id="IsModifiableClass"/>. 10255 (<fieldlink id="can_redefine_classes" struct="jvmtiCapabilities"/> 10256 must also be set) 10257 </description> 10258 </capabilityfield> 10259 <capabilityfield id="can_get_current_thread_cpu_time"> 10260 <description> 10261 Can <functionlink id="GetCurrentThreadCpuTime">get</functionlink> 10262 current thread CPU time 10263 </description> 10264 </capabilityfield> 10265 <capabilityfield id="can_get_thread_cpu_time"> 10266 <description> 10267 Can <functionlink id="GetThreadCpuTime">get</functionlink> 10268 thread CPU time 10269 </description> 10270 </capabilityfield> 10271 <capabilityfield id="can_generate_method_entry_events" 10272 disp1="can_generate" disp2="_method_entry_events" 10273 > 10274 <description> 10275 Can generate method entry events on entering a method 10276 </description> 10277 </capabilityfield> 10278 <capabilityfield id="can_generate_method_exit_events" 10279 disp1="can_generate" disp2="_method_exit_events" 10280 > 10281 <description> 10282 Can generate method exit events on leaving a method 10283 </description> 10284 </capabilityfield> 10285 <capabilityfield id="can_generate_all_class_hook_events" 10286 disp1="can_generate" disp2="_all_class_hook_events" 10287 > 10288 <description> 10289 Can generate ClassFileLoadHook events for every loaded class. 10290 </description> 10291 </capabilityfield> 10292 <capabilityfield id="can_generate_compiled_method_load_events" 10293 disp1="can_generate" disp2="_compiled_method_load_events" 10294 > 10295 <description> 10296 Can generate events when a method is compiled or unloaded 10297 </description> 10298 </capabilityfield> 10299 <capabilityfield id="can_generate_monitor_events" 10300 disp1="can_generate" disp2="_monitor_events" 10301 > 10302 <description> 10303 Can generate events on monitor activity 10304 </description> 10305 </capabilityfield> 10306 <capabilityfield id="can_generate_vm_object_alloc_events" 10307 disp1="can_generate" disp2="_vm_object_alloc_events" 10308 > 10309 <description> 10310 Can generate events on VM allocation of an object 10311 </description> 10312 </capabilityfield> 10313 <capabilityfield id="can_generate_native_method_bind_events" 10314 disp1="can_generate" disp2="_native_method_bind_events" 10315 > 10316 <description> 10317 Can generate events when a native method is bound to its 10318 implementation 10319 </description> 10320 </capabilityfield> 10321 <capabilityfield id="can_generate_garbage_collection_events" 10322 disp1="can_generate" disp2="_garbage_collection_events" 10323 > 10324 <description> 10325 Can generate events when garbage collection begins or ends 10326 </description> 10327 </capabilityfield> 10328 <capabilityfield id="can_generate_object_free_events" 10329 disp1="can_generate" disp2="_object_free_events" 10330 > 10331 <description> 10332 Can generate events when the garbage collector frees an object 10333 </description> 10334 </capabilityfield> 10335 <capabilityfield id="can_force_early_return" since="1.1"> 10336 <description> 10337 Can return early from a method, as described in the 10338 <internallink id="ForceEarlyReturn">Force Early Return category</internallink>. 10339 </description> 10340 </capabilityfield> 10341 <capabilityfield id="can_get_owned_monitor_stack_depth_info" since="1.1"> 10342 <description> 10343 Can get information about owned monitors with stack depth - 10344 <functionlink id="GetOwnedMonitorStackDepthInfo"></functionlink> 10345 </description> 10346 </capabilityfield> 10347 <capabilityfield id="can_get_constant_pool" since="1.1"> 10348 <description> 10349 Can get the constant pool of a class - 10350 <functionlink id="GetConstantPool"></functionlink> 10351 </description> 10352 </capabilityfield> 10353 <capabilityfield id="can_set_native_method_prefix" since="1.1"> 10354 <description> 10355 Can set prefix to be applied when native method cannot be resolved - 10356 <functionlink id="SetNativeMethodPrefix"/> and 10357 <functionlink id="SetNativeMethodPrefixes"/> 10358 </description> 10359 </capabilityfield> 10360 <capabilityfield id="can_retransform_classes" since="1.1"> 10361 <description> 10362 Can retransform classes with <functionlink id="RetransformClasses"/>. 10363 In addition to the restrictions imposed by the specific 10364 implementation on this capability (see the 10365 <internallink id="capability">Capability</internallink> section), 10366 this capability must be set before the 10367 <eventlink id="ClassFileLoadHook"/> event is enabled for the 10368 first time in this environment. 10369 An environment that possesses this capability at the time that 10370 <code>ClassFileLoadHook</code> is enabled for the first time is 10371 said to be <i>retransformation capable</i>. 10372 An environment that does not possess this capability at the time that 10373 <code>ClassFileLoadHook</code> is enabled for the first time is 10374 said to be <i>retransformation incapable</i>. 10375 </description> 10376 </capabilityfield> 10377 <capabilityfield id="can_retransform_any_class" since="1.1"> 10378 <description> 10379 <functionlink id="RetransformClasses"/> can be called on any modifiable class. 10380 See <functionlink id="IsModifiableClass"/>. 10381 (<fieldlink id="can_retransform_classes" struct="jvmtiCapabilities"/> 10382 must also be set) 10383 </description> 10384 </capabilityfield> 10385 <capabilityfield id="can_generate_resource_exhaustion_heap_events" since="1.1"> 10386 <description> 10387 Can generate events when the VM is unable to allocate memory from 10388 the <tm>Java</tm> platform heap. 10389 See <eventlink id="ResourceExhausted"/>. 10390 </description> 10391 </capabilityfield> 10392 <capabilityfield id="can_generate_resource_exhaustion_threads_events" since="1.1"> 10393 <description> 10394 Can generate events when the VM is unable to create a thread. 10395 See <eventlink id="ResourceExhausted"/>. 10396 </description> 10397 </capabilityfield> 10398 <capabilityfield id="can_generate_early_vmstart" since="9"> 10399 <description> 10400 Can generate the <code>VMStart</code> event early. 10401 See <eventlink id="VMStart"/>. 10402 </description> 10403 </capabilityfield> 10404 <capabilityfield id="can_generate_early_class_hook_events" since="9"> 10405 <description> 10406 Can generate the <eventlink id="ClassFileLoadHook"/> events 10407 in the primordial phase. If this capability and 10408 <internallink id="jvmtiCapabilities.can_generate_all_class_hook_events"> 10409 <code>can_generate_all_class_hook_events</code></internallink> 10410 are enabled then the <eventlink id="ClassFileLoadHook"/> events 10411 can be posted for classes loaded in the primordial phase. 10412 See <eventlink id="ClassFileLoadHook"/>. 10413 </description> 10414 </capabilityfield> 10415 <capabilityfield id="can_generate_sampled_object_alloc_events" since="11"> 10416 <description> 10417 Can generate sampled allocation events. 10418 If this capability is enabled then the heap sampling method 10419 <functionlink id="SetHeapSamplingInterval"></functionlink> can be 10420 called and <eventlink id="SampledObjectAlloc"></eventlink> events can be generated. 10421 </description> 10422 </capabilityfield> 10423 </capabilitiestypedef> 10424 10425 <function id="GetPotentialCapabilities" jkernel="yes" phase="onload" num="140"> 10426 <synopsis>Get Potential Capabilities</synopsis> 10427 <description> 10428 Returns via <paramlink id="capabilities_ptr"></paramlink> the <jvmti/> 10429 features that can potentially be possessed by this environment 10430 at this time. 10431 The returned capabilities differ from the complete set of capabilities 10432 implemented by the VM in two cases: another environment possesses 10433 capabilities that can only be possessed by one environment, or the 10434 current <functionlink id="GetPhase">phase</functionlink> is live, 10435 and certain capabilities can only be added during the <code>OnLoad</code> phase. 10436 The <functionlink id="AddCapabilities"></functionlink> function 10437 may be used to set any or all or these capabilities. 10438 Currently possessed capabilities are included. 10439 <p/> 10440 Typically this function is used in the <code>OnLoad</code> function. 10441 Some virtual machines may allow a limited set of capabilities to be 10442 added in the live phase. 10443 In this case, the set of potentially available capabilities 10444 will likely differ from the <code>OnLoad</code> phase set. 10445 <p/> 10446 See the 10447 <internallink id="capabilityExamples">Capability Examples</internallink>. 10448 </description> 10449 <origin>new</origin> 10450 <capabilities> 10451 </capabilities> 10452 <parameters> 10453 <param id="capabilities_ptr"> 10454 <outptr><struct>jvmtiCapabilities</struct></outptr> 10455 <description> 10456 On return, points to the <jvmti/> capabilities that may be added. 10457 </description> 10458 </param> 10459 </parameters> 10460 <errors> 10461 </errors> 10462 </function> 10463 10464 <elide> 10465 <function id="EstimateCostOfCapabilities" phase="onload" num="141"> 10466 <synopsis>Estimate Cost Of Capabilities</synopsis> 10467 <description> 10468 <issue>There is strong opposition to this function. The concern is 10469 that it would be difficult or impossible to provide meaningful 10470 numbers, as the amount of impact is conditional on many factors 10471 that a single number could not represent. There is doubt that 10472 conditional implementations would be used or are even a good idea. 10473 The thought is that release documentation for the implementation 10474 would be the best means of exposing this information. 10475 Unless new arguments are presented, I intend to remove this 10476 function in the next revision. 10477 </issue> 10478 <p/> 10479 Return via the <paramlink id="time_impact_ptr"></paramlink> and 10480 <paramlink id="space_impact_ptr"></paramlink> an estimate of the impact 10481 of adding the capabilities pointed to by 10482 <paramlink id="capabilities_ptr"></paramlink>. 10483 The returned estimates are in percentage of additional overhead, thus 10484 a time impact of 100 mean the application might run 10485 at half the speed. 10486 The estimates are very rough approximations and are not guaranteed. 10487 Note also, that the estimates are of the impact of having the 10488 capability available--when and if it is used the impact may be 10489 much greater. 10490 Estimates can be for a single capability or for a set of 10491 capabilities. Note that the costs are not necessarily additive, 10492 adding support for one capability might make another available 10493 for free or conversely having two capabilities at once may 10494 have multiplicative impact. 10495 Estimates are relative to the current set of capabilities - 10496 that is, how much more impact given the currently possessed capabilities. 10497 <p/> 10498 Typically this function is used in the OnLoad function, 10499 some virtual machines may allow a limited set of capabilities to be 10500 added in the live phase. 10501 In this case, the set of potentially available capabilities 10502 will likely differ from the OnLoad phase set. 10503 <p/> 10504 See the 10505 <internallink id="capabilityExamples">Capability Examples</internallink>. 10506 </description> 10507 <origin>new</origin> 10508 <capabilities> 10509 </capabilities> 10510 <parameters> 10511 <param id="capabilities_ptr"> 10512 <inptr><struct>jvmtiCapabilities</struct></inptr> 10513 <description> 10514 points to the <jvmti/> capabilities to evaluate. 10515 </description> 10516 </param> 10517 <param id="time_impact_ptr"> 10518 <outptr><jint/></outptr> 10519 <description> 10520 On return, points to the estimated percentage increase in 10521 run time if this capability was added. 10522 </description> 10523 </param> 10524 <param id="space_impact_ptr"> 10525 <outptr><jint/></outptr> 10526 <description> 10527 On return, points to the estimated percentage increase in 10528 memory space used if this capability was added. 10529 </description> 10530 </param> 10531 </parameters> 10532 <errors> 10533 <error id="JVMTI_ERROR_NOT_AVAILABLE"> 10534 The desired capabilities are not even potentially available. 10535 </error> 10536 </errors> 10537 </function> 10538 </elide> 10539 10540 <function id="AddCapabilities" jkernel="yes" phase="onload" num="142"> 10541 <synopsis>Add Capabilities</synopsis> 10542 <description> 10543 Set new capabilities by adding the capabilities 10544 whose values are set to one (<code>1</code>) in 10545 <code>*</code><paramlink id="capabilities_ptr"></paramlink>. 10546 All previous capabilities are retained. 10547 Typically this function is used in the <code>OnLoad</code> function. 10548 Some virtual machines may allow a limited set of capabilities to be 10549 added in the live phase. 10550 <p/> 10551 See the 10552 <internallink id="capabilityExamples">Capability Examples</internallink>. 10553 </description> 10554 <origin>new</origin> 10555 <capabilities> 10556 </capabilities> 10557 <parameters> 10558 <param id="capabilities_ptr"> 10559 <inptr><struct>jvmtiCapabilities</struct></inptr> 10560 <description> 10561 Points to the <jvmti/> capabilities to add. 10562 </description> 10563 </param> 10564 </parameters> 10565 <errors> 10566 <error id="JVMTI_ERROR_NOT_AVAILABLE"> 10567 The desired capabilities are not even potentially available. 10568 </error> 10569 </errors> 10570 </function> 10571 10572 10573 <function id="RelinquishCapabilities" phase="onload" num="143"> 10574 <synopsis>Relinquish Capabilities</synopsis> 10575 <description> 10576 Relinquish the capabilities 10577 whose values are set to one (<code>1</code>) in 10578 <code>*</code><paramlink id="capabilities_ptr"></paramlink>. 10579 Some implementations may allow only one environment to have a capability 10580 (see the <internallink id="capability">capability introduction</internallink>). 10581 This function releases capabilities 10582 so that they may be used by other agents. 10583 All other capabilities are retained. 10584 The capability will no longer be present in <functionlink id="GetCapabilities"></functionlink>. 10585 Attempting to relinquish a capability that the agent does not possess is not an error. 10586 <issue> 10587 It is possible for the agent to be actively using capabilities 10588 which are being relinquished. For example, a thread is currently 10589 suspended and can_suspend is being relinquished or an event is currently 10590 enabled and can_generate_whatever is being relinquished. 10591 There are three possible ways we could spec this: 10592 <ul> 10593 <li>relinquish automatically releases them</li> 10594 <li>relinquish checks and returns some error code if held</li> 10595 <li>it is the agent's responsibility and it is not checked</li> 10596 </ul> 10597 One of these should be chosen. 10598 </issue> 10599 </description> 10600 <origin>new</origin> 10601 <capabilities> 10602 </capabilities> 10603 <parameters> 10604 <param id="capabilities_ptr"> 10605 <inptr><struct>jvmtiCapabilities</struct></inptr> 10606 <description> 10607 Points to the <jvmti/> capabilities to relinquish. 10608 </description> 10609 </param> 10610 </parameters> 10611 <errors> 10612 </errors> 10613 </function> 10614 10615 10616 10617 <function id="GetCapabilities" jkernel="yes" phase="any" num="89"> 10618 <synopsis>Get Capabilities</synopsis> 10619 <description> 10620 Returns via <paramlink id="capabilities_ptr"></paramlink> the optional <jvmti/> 10621 features which this environment currently possesses. 10622 Each possessed capability is indicated by a one (<code>1</code>) in the 10623 corresponding field of the <internallink id="jvmtiCapabilities">capabilities 10624 structure</internallink>. 10625 An environment does not possess a capability unless it has been successfully added with 10626 <functionlink id="AddCapabilities"/>. 10627 An environment only loses possession of a capability if it has been relinquished with 10628 <functionlink id="RelinquishCapabilities"/>. Thus, this function returns the net result 10629 of the <code>AddCapabilities</code> and <code>RelinquishCapabilities</code> calls which 10630 have been made. 10631 <p/> 10632 See the 10633 <internallink id="capabilityExamples">Capability Examples</internallink>. 10634 </description> 10635 <origin>jvmdiClone</origin> 10636 <capabilities> 10637 </capabilities> 10638 <parameters> 10639 <param id="capabilities_ptr"> 10640 <outptr><struct>jvmtiCapabilities</struct></outptr> 10641 <description> 10642 On return, points to the <jvmti/> capabilities. 10643 </description> 10644 </param> 10645 </parameters> 10646 <errors> 10647 </errors> 10648 </function> 10649 10650 </category> 10651 10652 10653 <category id="timers" label="Timers"> 10654 10655 <intro> 10656 These functions provide timing information. 10657 The resolution at which the time is updated is not specified. 10658 They provides nanosecond precision, but not necessarily nanosecond accuracy. 10659 Details about the timers, such as their maximum values, can be accessed with 10660 the timer information functions. 10661 </intro> 10662 10663 <typedef id="jvmtiTimerInfo" label="Timer Info"> 10664 <description> 10665 The information function for each timer returns this data structure. 10666 </description> 10667 <field id="max_value"> 10668 <jlong/> 10669 <description> 10670 The maximum value the timer can reach. 10671 After this value is reached the timer wraps back to zero. 10672 This is an unsigned value. If tested or printed as a jlong (signed value) 10673 it may appear to be a negative number. 10674 </description> 10675 </field> 10676 <field id="may_skip_forward"> 10677 <jboolean/> 10678 <description> 10679 If true, the timer can be externally adjusted and as a result skip forward. 10680 If false, the timer value will never increase faster than real time. 10681 </description> 10682 </field> 10683 <field id="may_skip_backward"> 10684 <jboolean/> 10685 <description> 10686 If true, the timer can be externally adjusted and as a result skip backward. 10687 If false, the timer value will be monotonically increasing. 10688 </description> 10689 </field> 10690 <field id="kind"> 10691 <enum>jvmtiTimerKind</enum> 10692 <description> 10693 The kind of timer. 10694 On a platform that does not distinguish between user and system time, <datalink 10695 id="JVMTI_TIMER_TOTAL_CPU"><code>JVMTI_TIMER_TOTAL_CPU</code></datalink> 10696 is returned. 10697 </description> 10698 </field> 10699 <field id="reserved1"> 10700 <jlong/> 10701 <description> 10702 Reserved for future use. 10703 </description> 10704 </field> 10705 <field id="reserved2"> 10706 <jlong/> 10707 <description> 10708 Reserved for future use. 10709 </description> 10710 </field> 10711 </typedef> 10712 10713 <intro> 10714 Where the timer kind is -- 10715 10716 <constants id="jvmtiTimerKind" label="Timer Kinds" kind="enum"> 10717 <constant id="JVMTI_TIMER_USER_CPU" num="30"> 10718 CPU time that a thread is in user mode. 10719 </constant> 10720 <constant id="JVMTI_TIMER_TOTAL_CPU" num="31"> 10721 CPU time that a thread is in user or system mode. 10722 </constant> 10723 <constant id="JVMTI_TIMER_ELAPSED" num="32"> 10724 Elapsed time. 10725 </constant> 10726 </constants> 10727 </intro> 10728 10729 <function id="GetCurrentThreadCpuTimerInfo" callbacksafe="safe" impl="innative notrace" phase="start" num="134"> 10730 <synopsis>Get Current Thread CPU Timer Information</synopsis> 10731 <description> 10732 Get information about the 10733 <functionlink id="GetCurrentThreadCpuTime"/> timer. 10734 The fields of the <datalink id="jvmtiTimerInfo"/> structure 10735 are filled in with details about the timer. 10736 This information is specific to the platform and the implementation of 10737 <functionlink id="GetCurrentThreadCpuTime"/> and thus 10738 does not vary by thread nor does it vary 10739 during a particular invocation of the VM. 10740 <p/> 10741 Note that the implementations of <functionlink id="GetCurrentThreadCpuTime"/> 10742 and <functionlink id="GetThreadCpuTime"/> may differ, and thus the values 10743 returned by <code>GetCurrentThreadCpuTimerInfo</code> 10744 and <functionlink id="GetThreadCpuTimerInfo"/> 10745 may differ -- see <functionlink id="GetCurrentThreadCpuTime"/> for more information. 10746 </description> 10747 <origin>new</origin> 10748 <capabilities> 10749 <required id="can_get_current_thread_cpu_time"> 10750 Can get current thread CPU time. 10751 </required> 10752 </capabilities> 10753 <parameters> 10754 <param id="info_ptr"> 10755 <outptr><struct>jvmtiTimerInfo</struct></outptr> 10756 <description> 10757 On return, filled with information describing the time 10758 returned by <functionlink id="GetCurrentThreadCpuTime"/>. 10759 </description> 10760 </param> 10761 </parameters> 10762 <errors> 10763 </errors> 10764 </function> 10765 10766 <function id="GetCurrentThreadCpuTime" callbacksafe="safe" impl="innative notrace" phase="start" num="135"> 10767 <synopsis>Get Current Thread CPU Time</synopsis> 10768 <description> 10769 Return the CPU time utilized by the current thread. 10770 <p/> 10771 Note that the <functionlink id="GetThreadCpuTime"/> 10772 function provides CPU time for any thread, including 10773 the current thread. <code>GetCurrentThreadCpuTime</code> 10774 exists to support platforms which cannot 10775 supply CPU time for threads other than the current 10776 thread or which have more accurate information for 10777 the current thread (see 10778 <functionlink id="GetCurrentThreadCpuTimerInfo"/> vs 10779 <functionlink id="GetThreadCpuTimerInfo"/>). 10780 On many platforms this call will be equivalent to: 10781 <example> 10782 GetThreadCpuTime(env, NULL, nanos_ptr) 10783 </example> 10784 </description> 10785 <origin>new</origin> 10786 <capabilities> 10787 <required id="can_get_current_thread_cpu_time"> 10788 Can get current thread CPU time. 10789 <p/> 10790 If this capability is enabled after threads have started, 10791 the implementation may choose any time up 10792 to and including the time that the capability is enabled 10793 as the point where CPU time collection starts. 10794 <p/> 10795 This capability must be potentially available on any 10796 platform where 10797 <internallink id="jvmtiCapabilities.can_get_thread_cpu_time"><code>can_get_thread_cpu_time</code></internallink> 10798 is potentially available. 10799 </required> 10800 </capabilities> 10801 <parameters> 10802 <param id="nanos_ptr"> 10803 <outptr><jlong/></outptr> 10804 <description> 10805 On return, points to the CPU time used by this thread 10806 in nanoseconds. 10807 This is an unsigned value. If tested or printed as a jlong (signed value) 10808 it may appear to be a negative number. 10809 </description> 10810 </param> 10811 </parameters> 10812 <errors> 10813 </errors> 10814 </function> 10815 10816 <function id="GetThreadCpuTimerInfo" num="136"> 10817 <synopsis>Get Thread CPU Timer Information</synopsis> 10818 <description> 10819 Get information about the 10820 <functionlink id="GetThreadCpuTime"/> timer. 10821 The fields of the <datalink id="jvmtiTimerInfo"/> structure 10822 are filled in with details about the timer. 10823 This information is specific to the platform and the implementation of 10824 <functionlink id="GetThreadCpuTime"/> and thus 10825 does not vary by thread nor does it vary 10826 during a particular invocation of the VM. 10827 <p/> 10828 Note that the implementations of <functionlink id="GetCurrentThreadCpuTime"/> 10829 and <functionlink id="GetThreadCpuTime"/> may differ, and thus the values 10830 returned by <functionlink id="GetCurrentThreadCpuTimerInfo"/> 10831 and <code>GetThreadCpuTimerInfo</code> 10832 may differ -- see <functionlink id="GetCurrentThreadCpuTime"/> for more information. 10833 </description> 10834 <origin>new</origin> 10835 <capabilities> 10836 <required id="can_get_thread_cpu_time"> 10837 Can get thread CPU time. 10838 </required> 10839 </capabilities> 10840 <parameters> 10841 <param id="info_ptr"> 10842 <outptr><struct>jvmtiTimerInfo</struct></outptr> 10843 <description> 10844 On return, filled with information describing the time 10845 returned by <functionlink id="GetThreadCpuTime"/>. 10846 </description> 10847 </param> 10848 </parameters> 10849 <errors> 10850 </errors> 10851 </function> 10852 10853 <function id="GetThreadCpuTime" num="137"> 10854 <synopsis>Get Thread CPU Time</synopsis> 10855 <description> 10856 Return the CPU time utilized by the specified thread. 10857 <p/> 10858 Get information about this timer with 10859 <functionlink id="GetThreadCpuTimerInfo"/>. 10860 </description> 10861 <origin>new</origin> 10862 <capabilities> 10863 <required id="can_get_thread_cpu_time"> 10864 Can get thread CPU time. 10865 <p/> 10866 If this capability is enabled after threads have started, 10867 the implementation may choose any time up 10868 to and including the time that the capability is enabled 10869 as the point where CPU time collection starts. 10870 </required> 10871 </capabilities> 10872 <parameters> 10873 <param id="thread"> 10874 <jthread null="current"/> 10875 <description> 10876 The thread to query. 10877 </description> 10878 </param> 10879 <param id="nanos_ptr"> 10880 <outptr><jlong/></outptr> 10881 <description> 10882 On return, points to the CPU time used by the specified thread 10883 in nanoseconds. 10884 This is an unsigned value. If tested or printed as a jlong (signed value) 10885 it may appear to be a negative number. 10886 </description> 10887 </param> 10888 </parameters> 10889 <errors> 10890 </errors> 10891 </function> 10892 10893 <function id="GetTimerInfo" phase="any" callbacksafe="safe" num="138"> 10894 <synopsis>Get Timer Information</synopsis> 10895 <description> 10896 Get information about the 10897 <functionlink id="GetTime"/> timer. 10898 The fields of the <datalink id="jvmtiTimerInfo"/> structure 10899 are filled in with details about the timer. 10900 This information will not change during a particular invocation of the VM. 10901 </description> 10902 <origin>new</origin> 10903 <capabilities> 10904 </capabilities> 10905 <parameters> 10906 <param id="info_ptr"> 10907 <outptr><struct>jvmtiTimerInfo</struct></outptr> 10908 <description> 10909 On return, filled with information describing the time 10910 returned by <functionlink id="GetTime"/>. 10911 </description> 10912 </param> 10913 </parameters> 10914 <errors> 10915 </errors> 10916 </function> 10917 10918 <function id="GetTime" phase="any" callbacksafe="safe" num="139"> 10919 <synopsis>Get Time</synopsis> 10920 <description> 10921 Return the current value of the system timer, in nanoseconds. 10922 <p/> 10923 The value returned represents nanoseconds since some fixed but 10924 arbitrary time (perhaps in the future, so values may be 10925 negative). This function provides nanosecond precision, but not 10926 necessarily nanosecond accuracy. No guarantees are made about 10927 how frequently values change. 10928 <p/> 10929 Get information about this timer with 10930 <functionlink id="GetTimerInfo"/>. 10931 </description> 10932 <origin>new</origin> 10933 <capabilities> 10934 </capabilities> 10935 <parameters> 10936 <param id="nanos_ptr"> 10937 <outptr><jlong/></outptr> 10938 <description> 10939 On return, points to the time in nanoseconds. 10940 This is an unsigned value. If tested or printed as a jlong (signed value) 10941 it may appear to be a negative number. 10942 </description> 10943 </param> 10944 </parameters> 10945 <errors> 10946 </errors> 10947 </function> 10948 10949 <function id="GetAvailableProcessors" phase="any" num="144"> 10950 <synopsis>Get Available Processors</synopsis> 10951 <description> 10952 Returns the number of processors available to the Java virtual machine. 10953 <p/> 10954 This value may change during a particular invocation of the virtual machine. 10955 Applications that are sensitive to the number of available processors should 10956 therefore occasionally poll this property. 10957 </description> 10958 <origin>new</origin> 10959 <capabilities> 10960 </capabilities> 10961 <parameters> 10962 <param id="processor_count_ptr"> 10963 <outptr><jint/></outptr> 10964 <description> 10965 On return, points to the maximum number of processors available to the 10966 virtual machine; never smaller than one. 10967 </description> 10968 </param> 10969 </parameters> 10970 <errors> 10971 </errors> 10972 </function> 10973 10974 </category> 10975 10976 10977 <category id="classLoaderSearch" label="Class Loader Search"> 10978 10979 <intro> 10980 These functions allow the agent to add to the locations that a class loader searches for a class. 10981 This is useful for installing instrumentation under the correct class loader. 10982 </intro> 10983 10984 <function id="AddToBootstrapClassLoaderSearch" jkernel="yes" phase="onload" num="149"> 10985 <synopsis>Add To Bootstrap Class Loader Search</synopsis> 10986 <description> 10987 This function can be used to cause instrumentation classes to be defined by the 10988 bootstrap class loader. See <vmspec chapter="5.3.1"/>. 10989 After the bootstrap 10990 class loader unsuccessfully searches for a class, the specified platform-dependent 10991 search path <paramlink id="segment"/> will be searched as well. Only one segment may be specified in 10992 the <paramlink id="segment"/>. This function may be called multiple times to add multiple segments, 10993 the segments will be searched in the order that this function was called. 10994 <p/> 10995 In the <code>OnLoad</code> phase the function may be used to specify any platform-dependent 10996 search path segment to be searched after the bootstrap class loader unsuccessfully searches 10997 for a class. The segment is typically a directory or JAR file. 10998 <p/> 10999 In the live phase the <paramlink id="segment"/> may be used to specify any platform-dependent 11000 path to a <externallink id="jar/jar.html"> 11001 JAR file</externallink>. The agent should take care that the JAR file does not 11002 contain any classes or resources other than those to be defined by the bootstrap 11003 class loader for the purposes of instrumentation. 11004 <p/> 11005 <vmspec/> specifies that a subsequent attempt to resolve a symbolic 11006 reference that the Java virtual machine has previously unsuccessfully attempted 11007 to resolve always fails with the same error that was thrown as a result of the 11008 initial resolution attempt. Consequently, if the JAR file contains an entry 11009 that corresponds to a class for which the Java virtual machine has 11010 unsuccessfully attempted to resolve a reference, then subsequent attempts to 11011 resolve that reference will fail with the same error as the initial attempt. 11012 </description> 11013 <origin>new</origin> 11014 <capabilities> 11015 </capabilities> 11016 <parameters> 11017 <param id="segment"> 11018 <inbuf><char/></inbuf> 11019 <description> 11020 The platform-dependent search path segment, encoded as a 11021 <internallink id="mUTF">modified UTF-8</internallink> string. 11022 </description> 11023 </param> 11024 </parameters> 11025 <errors> 11026 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 11027 <paramlink id="segment"/> is an invalid path. In the live phase, anything other than an 11028 existing JAR file is an invalid path. 11029 </error> 11030 </errors> 11031 </function> 11032 11033 <function id="AddToSystemClassLoaderSearch" jkernel="yes" phase="onload" num="151" since="1.1"> 11034 <synopsis>Add To System Class Loader Search</synopsis> 11035 <description> 11036 This function can be used to cause instrumentation classes to be 11037 defined by the system class loader. See <vmspec chapter="5.3.2"/>. 11038 After the class loader unsuccessfully searches for a class, the specified platform-dependent search 11039 path <paramlink id="segment"/> will be searched as well. Only one segment may be specified in the 11040 <paramlink id="segment"/>. This function may be called multiple times to add multiple segments, the 11041 segments will be searched in the order that this function was called. 11042 <p/> 11043 In the <code>OnLoad</code> phase the function may be used to specify any platform-dependent 11044 search path segment to be searched after the system class loader unsuccessfully searches 11045 for a class. The segment is typically a directory or JAR file. 11046 <p/> 11047 In the live phase the <paramlink id="segment"/> is a platform-dependent path to a 11048 <externallink id="jar/jar.html">JAR file</externallink> to be 11049 searched after the system class loader unsuccessfully searches for a class. The agent should 11050 take care that the JAR file does not contain any classes or resources other than those to be 11051 defined by the system class loader for the purposes of instrumentation. 11052 <p/> 11053 In the live phase the system class loader supports adding a JAR file to be searched if 11054 the system class loader implements a method name <code>appendToClassPathForInstrumentation</code> 11055 which takes a single parameter of type <code>java.lang.String</code>. The method is not required 11056 to have <code>public</code> access. 11057 <p/> 11058 <vmspec/> specifies that a subsequent attempt to resolve a symbolic 11059 reference that the Java virtual machine has previously unsuccessfully attempted 11060 to resolve always fails with the same error that was thrown as a result of the 11061 initial resolution attempt. Consequently, if the JAR file contains an entry 11062 that corresponds to a class for which the Java virtual machine has 11063 unsuccessfully attempted to resolve a reference, then subsequent attempts to 11064 resolve that reference will fail with the same error as the initial attempt. 11065 </description> 11066 <origin>new</origin> 11067 <capabilities> 11068 </capabilities> 11069 <parameters> 11070 <param id="segment"> 11071 <inbuf><char/></inbuf> 11072 <description> 11073 The platform-dependent search path segment, encoded as a 11074 <internallink id="mUTF">modified UTF-8</internallink> string. 11075 </description> 11076 </param> 11077 </parameters> 11078 <errors> 11079 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 11080 <paramlink id="segment"/> is an invalid path. In the live phase, anything other than an 11081 existing JAR file is an invalid path. 11082 </error> 11083 <error id="JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED"> 11084 Operation not supported by the system class loader. 11085 </error> 11086 </errors> 11087 </function> 11088 11089 </category> 11090 11091 11092 <category id="props" label="System Properties"> 11093 11094 <intro> 11095 These functions get and set system properties. 11096 </intro> 11097 11098 <function id="GetSystemProperties" phase="onload" num="130"> 11099 <synopsis>Get System Properties</synopsis> 11100 <description> 11101 The list of VM system property keys which may be used with 11102 <functionlink id="GetSystemProperty"/> is returned. 11103 It is strongly recommended that virtual machines provide the 11104 following property keys: 11105 <ul> 11106 <li><code>java.vm.vendor</code></li> 11107 <li><code>java.vm.version</code></li> 11108 <li><code>java.vm.name</code></li> 11109 <li><code>java.vm.info</code></li> 11110 <li><code>java.library.path</code></li> 11111 <li><code>java.class.path</code></li> 11112 </ul> 11113 Provides access to system properties defined by and used 11114 by the VM. 11115 Properties set on the command-line are included. 11116 This allows getting and setting of these properties 11117 before the VM even begins executing bytecodes. 11118 Since this is a VM view of system properties, the set of available 11119 properties will usually be different than that 11120 in <code>java.lang.System.getProperties</code>. 11121 JNI method invocation may be used to access 11122 <code>java.lang.System.getProperties</code>. 11123 <p/> 11124 The set of properties may grow during execution. 11125 </description> 11126 <origin>new</origin> 11127 <capabilities> 11128 </capabilities> 11129 <parameters> 11130 <param id="count_ptr"> 11131 <outptr><jint/></outptr> 11132 <description> 11133 On return, points to the number of property keys returned. 11134 </description> 11135 </param> 11136 <param id="property_ptr"> 11137 <allocallocbuf outcount="count_ptr"><char/></allocallocbuf> 11138 <description> 11139 On return, points to an array of property keys, encoded as 11140 <internallink id="mUTF">modified UTF-8</internallink> strings. 11141 </description> 11142 </param> 11143 </parameters> 11144 <errors> 11145 </errors> 11146 </function> 11147 11148 <function id="GetSystemProperty" phase="onload" num="131"> 11149 <synopsis>Get System Property</synopsis> 11150 <description> 11151 Return a VM system property value given the property key. 11152 <p/> 11153 The function <functionlink id="GetSystemProperties"/> 11154 returns the set of property keys which may be used. 11155 The properties which can be retrieved may grow during 11156 execution. 11157 <p/> 11158 Since this is a VM view of system properties, the values 11159 of properties may differ from that returned by 11160 <code>java.lang.System.getProperty(String)</code>. 11161 A typical VM might copy the values of the VM system 11162 properties into the <code>Properties</code> held by 11163 <code>java.lang.System</code> during the initialization 11164 of that class. Thereafter any changes to the VM system 11165 properties (with <functionlink id="SetSystemProperty"/>) 11166 or the <code>java.lang.System</code> system properties 11167 (with <code>java.lang.System.setProperty(String,String)</code>) 11168 would cause the values to diverge. 11169 JNI method invocation may be used to access 11170 <code>java.lang.System.getProperty(String)</code>. 11171 </description> 11172 <origin>new</origin> 11173 <capabilities> 11174 </capabilities> 11175 <parameters> 11176 <param id="property"> 11177 <inbuf><char/></inbuf> 11178 <description> 11179 The key of the property to retrieve, encoded as a 11180 <internallink id="mUTF">modified UTF-8</internallink> string. 11181 </description> 11182 </param> 11183 <param id="value_ptr"> 11184 <allocbuf><char/></allocbuf> 11185 <description> 11186 On return, points to the property value, encoded as a 11187 <internallink id="mUTF">modified UTF-8</internallink> string. 11188 </description> 11189 </param> 11190 </parameters> 11191 <errors> 11192 <error id="JVMTI_ERROR_NOT_AVAILABLE"> 11193 This property is not available. 11194 Use <functionlink id="GetSystemProperties"/> to find available properties. 11195 </error> 11196 </errors> 11197 </function> 11198 11199 <function id="SetSystemProperty" phase="onloadOnly" num="132"> 11200 <synopsis>Set System Property</synopsis> 11201 <description> 11202 Set a VM system property value. 11203 <p/> 11204 The function <functionlink id="GetSystemProperties"/> 11205 returns the set of property keys, some of these may be settable. 11206 See <functionlink id="GetSystemProperty"/>. 11207 </description> 11208 <origin>new</origin> 11209 <capabilities> 11210 </capabilities> 11211 <parameters> 11212 <param id="property"> 11213 <inbuf><char/></inbuf> 11214 <description> 11215 The key of the property, encoded as a 11216 <internallink id="mUTF">modified UTF-8</internallink> string. 11217 </description> 11218 </param> 11219 <param id="value_ptr"> 11220 <inbuf> 11221 <char/> 11222 <nullok> 11223 do not set the value, but return <errorlink id="JVMTI_ERROR_NOT_AVAILABLE"/> 11224 if the property is not writeable 11225 </nullok> 11226 </inbuf> 11227 <description> 11228 The property value to set, encoded as a 11229 <internallink id="mUTF">modified UTF-8</internallink> string. 11230 </description> 11231 </param> 11232 </parameters> 11233 <errors> 11234 <error id="JVMTI_ERROR_NOT_AVAILABLE"> 11235 This property is not available or is not writeable. 11236 </error> 11237 </errors> 11238 </function> 11239 11240 </category> 11241 11242 <category id="general" label="General"> 11243 11244 <intro> 11245 </intro> 11246 11247 <function id="GetPhase" jkernel="yes" phase="any" num="133"> 11248 <synopsis>Get Phase</synopsis> 11249 <description> 11250 Return the current phase of VM execution. 11251 The phases proceed in sequence: 11252 <constants id="jvmtiPhase" label="Phases of execution" kind="enum"> 11253 <constant id="JVMTI_PHASE_ONLOAD" num="1"> 11254 <code>OnLoad</code> phase: while in the 11255 <internallink id="onload"><code>Agent_OnLoad</code></internallink> 11256 or, for statically linked agents, the <internallink id="onload"> 11257 <code>Agent_OnLoad_<agent-lib-name> 11258 </code></internallink> function. 11259 </constant> 11260 <constant id="JVMTI_PHASE_PRIMORDIAL" num="2"> 11261 Primordial phase: between return from <code>Agent_OnLoad</code> 11262 or <code>Agent_OnLoad_<agent-lib-name></code> and the 11263 <code>VMStart</code> event. 11264 </constant> 11265 <constant id="JVMTI_PHASE_START" num="6"> 11266 Start phase: when the <eventlink id="VMStart"><code>VMStart</code></eventlink> event 11267 is sent and until the <code>VMInit</code> event is sent. 11268 </constant> 11269 <constant id="JVMTI_PHASE_LIVE" num="4"> 11270 Live phase: when the <eventlink id="VMInit"><code>VMInit</code></eventlink> event is sent 11271 and until the <eventlink id="VMDeath"></eventlink> event returns. 11272 </constant> 11273 <constant id="JVMTI_PHASE_DEAD" num="8"> 11274 Dead phase: after the <eventlink id="VMDeath"></eventlink> event returns or after 11275 start-up failure. 11276 </constant> 11277 </constants> 11278 In the case of start-up failure the VM will proceed directly to the dead 11279 phase skipping intermediate phases and neither a <code>VMInit</code> nor 11280 <code>VMDeath</code> event will be sent. 11281 <p/> 11282 Most <jvmti/> functions operate only in the live phase. 11283 The following functions operate in either the <code>OnLoad</code> or live phases: 11284 <functionphaselist phase="onload"/> 11285 The following functions operate in only the <code>OnLoad</code> phase: 11286 <functionphaselist phase="onloadOnly"/> 11287 The following functions operate in the start or live phases: 11288 <functionphaselist phase="start"/> 11289 The following functions operate in any phase: 11290 <functionphaselist phase="any"/> 11291 JNI functions (except the Invocation API) must only be used in the start or live phases. 11292 <p/> 11293 Most <jvmti/> events are sent only in the live phase. 11294 The following events operate in others phases: 11295 <eventphaselist phase="start"/> 11296 <eventphaselist phase="any"/> 11297 </description> 11298 <origin>new</origin> 11299 <capabilities> 11300 </capabilities> 11301 <parameters> 11302 <param id="phase_ptr"> 11303 <outptr><enum>jvmtiPhase</enum></outptr> 11304 <description> 11305 On return, points to the phase. 11306 </description> 11307 </param> 11308 </parameters> 11309 <errors> 11310 </errors> 11311 </function> 11312 11313 <function id="DisposeEnvironment" jkernel="yes" phase="any" num="127"> 11314 <synopsis>Dispose Environment</synopsis> 11315 <description> 11316 Shutdown a <jvmti/> connection created with JNI <code>GetEnv</code> 11317 (see <internallink id="environments"><jvmti/> Environments</internallink>). 11318 Dispose of any resources held by the environment. 11319 <issue> 11320 What resources are reclaimed? What is undone? 11321 Breakpoints,watchpoints removed? 11322 </issue> 11323 Threads suspended by this environment are not resumed by this call, 11324 this must be done explicitly by the agent. 11325 Memory allocated by this environment via calls to <jvmti/> functions 11326 is not released, this can be done explicitly by the agent 11327 by calling <functionlink id="Deallocate"/>. 11328 Raw monitors created by this environment are not destroyed, 11329 this can be done explicitly by the agent 11330 by calling <functionlink id="DestroyRawMonitor"/>. 11331 The state of threads waiting on raw monitors created by this environment 11332 are not affected. 11333 <p/> 11334 Any <functionlink id="SetNativeMethodPrefix">native method 11335 prefixes</functionlink> for this environment will be unset; 11336 the agent must remove any prefixed native methods before 11337 dispose is called. 11338 <p/> 11339 Any <internallink id="capability">capabilities</internallink> 11340 held by this environment are relinquished. 11341 <p/> 11342 Events enabled by this environment will no longer be sent, however 11343 event handlers currently running will continue to run. Caution must 11344 be exercised in the design of event handlers whose environment may 11345 be disposed and thus become invalid during their execution. 11346 <p/> 11347 This environment may not be used after this call. 11348 This call returns to the caller. 11349 </description> 11350 <origin>new</origin> 11351 <capabilities> 11352 </capabilities> 11353 <parameters> 11354 </parameters> 11355 <errors> 11356 </errors> 11357 </function> 11358 11359 <function id="SetEnvironmentLocalStorage" jkernel="yes" phase="any" callbacksafe="safe" impl="innative notrace" num="148"> 11360 <synopsis>Set Environment Local Storage</synopsis> 11361 <description> 11362 The VM stores a pointer value associated with each environment. 11363 This pointer value is called <i>environment-local storage</i>. 11364 This value is <code>NULL</code> unless set with this function. 11365 Agents can allocate memory in which they store environment specific 11366 information. By setting environment-local storage it can then be 11367 accessed with 11368 <functionlink id="GetEnvironmentLocalStorage"></functionlink>. 11369 <p/> 11370 Called by the agent to set the value of the <jvmti/> 11371 environment-local storage. <jvmti/> supplies to the agent a pointer-size 11372 environment-local storage that can be used to record per-environment 11373 information. 11374 </description> 11375 <origin>new</origin> 11376 <capabilities> 11377 </capabilities> 11378 <parameters> 11379 <param id="data"> 11380 <inbuf> 11381 <void/> 11382 <nullok>value is set to <code>NULL</code></nullok> 11383 </inbuf> 11384 <description> 11385 The value to be entered into the environment-local storage. 11386 </description> 11387 </param> 11388 </parameters> 11389 <errors> 11390 </errors> 11391 </function> 11392 11393 <function id="GetEnvironmentLocalStorage" jkernel="yes" phase="any" callbacksafe="safe" impl="innative notrace" num="147"> 11394 <synopsis>Get Environment Local Storage</synopsis> 11395 <description> 11396 Called by the agent to get the value of the <jvmti/> environment-local 11397 storage. 11398 </description> 11399 <origin>new</origin> 11400 <capabilities> 11401 </capabilities> 11402 <parameters> 11403 <param id="data_ptr"> 11404 <agentbuf><void/></agentbuf> 11405 <description> 11406 Pointer through which the value of the environment local 11407 storage is returned. 11408 If environment-local storage has not been set with 11409 <functionlink id="SetEnvironmentLocalStorage"></functionlink> returned 11410 pointer is <code>NULL</code>. 11411 </description> 11412 </param> 11413 </parameters> 11414 <errors> 11415 </errors> 11416 </function> 11417 11418 <function id="GetVersionNumber" jkernel="yes" phase="any" num="88"> 11419 <synopsis>Get Version Number</synopsis> 11420 <description> 11421 Return the <jvmti/> version via <code>version_ptr</code>. 11422 The return value is the version identifier. 11423 The version identifier includes major, minor and micro 11424 version as well as the interface type. 11425 <constants id="jvmtiVersionInterfaceTypes" label="Version Interface Types" kind="bits"> 11426 <constant id="JVMTI_VERSION_INTERFACE_JNI" num="0x00000000"> 11427 Value of <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> for JNI. 11428 </constant> 11429 <constant id="JVMTI_VERSION_INTERFACE_JVMTI" num="0x30000000"> 11430 Value of <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> for <jvmti/>. 11431 </constant> 11432 </constants> 11433 <constants id="jvmtiVersionMasks" label="Version Masks" kind="bits"> 11434 <constant id="JVMTI_VERSION_MASK_INTERFACE_TYPE" num="0x70000000"> 11435 Mask to extract interface type. 11436 The value of the version returned by this function masked with 11437 <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> is always 11438 <code>JVMTI_VERSION_INTERFACE_JVMTI</code> 11439 since this is a <jvmti/> function. 11440 </constant> 11441 <constant id="JVMTI_VERSION_MASK_MAJOR" num="0x0FFF0000"> 11442 Mask to extract major version number. 11443 </constant> 11444 <constant id="JVMTI_VERSION_MASK_MINOR" num="0x0000FF00"> 11445 Mask to extract minor version number. 11446 </constant> 11447 <constant id="JVMTI_VERSION_MASK_MICRO" num="0x000000FF"> 11448 Mask to extract micro version number. 11449 </constant> 11450 </constants> 11451 <constants id="jvmtiVersionShifts" label="Version Shifts" kind="bits"> 11452 <constant id="JVMTI_VERSION_SHIFT_MAJOR" num="16"> 11453 Shift to extract major version number. 11454 </constant> 11455 <constant id="JVMTI_VERSION_SHIFT_MINOR" num="8"> 11456 Shift to extract minor version number. 11457 </constant> 11458 <constant id="JVMTI_VERSION_SHIFT_MICRO" num="0"> 11459 Shift to extract micro version number. 11460 </constant> 11461 </constants> 11462 </description> 11463 <origin>jvmdi</origin> 11464 <capabilities> 11465 </capabilities> 11466 <parameters> 11467 <param id="version_ptr"> 11468 <outptr><jint/></outptr> 11469 <description> 11470 On return, points to the <jvmti/> version. 11471 </description> 11472 </param> 11473 </parameters> 11474 <errors> 11475 </errors> 11476 </function> 11477 11478 11479 <function id="GetErrorName" phase="any" num="128"> 11480 <synopsis>Get Error Name</synopsis> 11481 <description> 11482 Return the symbolic name for an 11483 <internallink id="ErrorSection">error code</internallink>. 11484 <p/> 11485 For example 11486 <code>GetErrorName(env, JVMTI_ERROR_NONE, &err_name)</code> 11487 would return in <code>err_name</code> the string 11488 <code>"JVMTI_ERROR_NONE"</code>. 11489 </description> 11490 <origin>new</origin> 11491 <capabilities> 11492 </capabilities> 11493 <parameters> 11494 <param id="error"> 11495 <enum>jvmtiError</enum> 11496 <description> 11497 The error code. 11498 </description> 11499 </param> 11500 <param id="name_ptr"> 11501 <allocbuf><char/></allocbuf> 11502 <description> 11503 On return, points to the error name. 11504 The name is encoded as a 11505 <internallink id="mUTF">modified UTF-8</internallink> string, 11506 but is restricted to the ASCII subset. 11507 </description> 11508 </param> 11509 </parameters> 11510 <errors> 11511 </errors> 11512 </function> 11513 11514 <function id="SetVerboseFlag" phase="any" num="150"> 11515 <synopsis>Set Verbose Flag</synopsis> 11516 <description> 11517 <constants id="jvmtiVerboseFlag" label="Verbose Flag Enumeration" kind="enum"> 11518 <constant id="JVMTI_VERBOSE_OTHER" num="0"> 11519 Verbose output other than the below. 11520 </constant> 11521 <constant id="JVMTI_VERBOSE_GC" num="1"> 11522 Verbose garbage collector output, like that specified with <code>-verbose:gc</code>. 11523 </constant> 11524 <constant id="JVMTI_VERBOSE_CLASS" num="2"> 11525 Verbose class loading output, like that specified with <code>-verbose:class</code>. 11526 </constant> 11527 <constant id="JVMTI_VERBOSE_JNI" num="4"> 11528 Verbose JNI output, like that specified with <code>-verbose:jni</code>. 11529 </constant> 11530 </constants> 11531 Control verbose output. 11532 This is the output which typically is sent to <code>stderr</code>. 11533 </description> 11534 <origin>new</origin> 11535 <capabilities> 11536 </capabilities> 11537 <parameters> 11538 <param id="flag"> 11539 <enum>jvmtiVerboseFlag</enum> 11540 <description> 11541 Which verbose flag to set. 11542 </description> 11543 </param> 11544 <param id="value"> 11545 <jboolean/> 11546 <description> 11547 New value of the flag. 11548 </description> 11549 </param> 11550 </parameters> 11551 <errors> 11552 </errors> 11553 </function> 11554 11555 11556 <function id="GetJLocationFormat" phase="any" num="129"> 11557 <synopsis>Get JLocation Format</synopsis> 11558 <description> 11559 Although the greatest functionality is achieved with location information 11560 referencing the virtual machine bytecode index, the definition of 11561 <code>jlocation</code> has intentionally been left unconstrained to allow VM 11562 implementations that do not have this information. 11563 <p/> 11564 This function describes the representation of <code>jlocation</code> used in this VM. 11565 If the returned format is <datalink id="JVMTI_JLOCATION_JVMBCI"></datalink>, 11566 <code>jlocation</code>s can 11567 be used as in indices into the array returned by 11568 <functionlink id="GetBytecodes"></functionlink>. 11569 <constants id="jvmtiJlocationFormat" label="JLocation Format Enumeration" kind="enum"> 11570 <constant id="JVMTI_JLOCATION_JVMBCI" num="1"> 11571 <code>jlocation</code> values represent virtual machine 11572 bytecode indices--that is, offsets into the 11573 virtual machine code for a method. 11574 </constant> 11575 <constant id="JVMTI_JLOCATION_MACHINEPC" num="2"> 11576 <code>jlocation</code> values represent native machine 11577 program counter values. 11578 </constant> 11579 <constant id="JVMTI_JLOCATION_OTHER" num="0"> 11580 <code>jlocation</code> values have some other representation. 11581 </constant> 11582 </constants> 11583 </description> 11584 <origin>new</origin> 11585 <capabilities> 11586 </capabilities> 11587 <parameters> 11588 <param id="format_ptr"> 11589 <outptr><enum>jvmtiJlocationFormat</enum></outptr> 11590 <description> 11591 On return, points to the format identifier for <code>jlocation</code> values. 11592 </description> 11593 </param> 11594 </parameters> 11595 <errors> 11596 </errors> 11597 </function> 11598 11599 </category> 11600 11601 <category id="heap_monitoring" label="Heap Monitoring"> 11602 <function id="SetHeapSamplingInterval" phase="onload" num="156" since="11"> 11603 <synopsis>Set Heap Sampling Interval</synopsis> 11604 <description> 11605 Generate a <eventlink id="SampledObjectAlloc"/> event when objects are allocated. 11606 Each thread keeps a counter of bytes allocated. The event will only be generated 11607 when that counter exceeds an average of <paramlink id="sampling_interval"></paramlink> 11608 since the last sample. 11609 <p/> 11610 Setting <paramlink id="sampling_interval"></paramlink> to 0 will cause an event to be 11611 generated by each allocation supported by the system once the new interval is taken into account. 11612 <p/> 11613 Note that updating the new sampling interval might take various number of allocations 11614 to provoke internal data structure updates. Therefore it is important to 11615 consider the sampling interval as an average. This includes the interval 0, where events 11616 might not be generated straight away for each allocation. 11617 </description> 11618 <origin>new</origin> 11619 <capabilities> 11620 <required id="can_generate_sampled_object_alloc_events"></required> 11621 </capabilities> 11622 <parameters> 11623 <param id="sampling_interval"> 11624 <jint/> 11625 <description> 11626 The sampling interval in bytes. The sampler uses a statistical approach to 11627 generate an event, on average, once for every <paramlink id="sampling_interval"/> bytes of 11628 memory allocated by a given thread. 11629 <p/> 11630 Once the new sampling interval is taken into account, 0 as a sampling interval will generate 11631 a sample for every allocation. 11632 <p/> 11633 Note: The overhead of this feature is directly correlated with the sampling interval. 11634 A high sampling interval, such as 1024 bytes, will incur a high overhead. 11635 A lower interval, such as 1024KB, will have a much lower overhead. Sampling should only 11636 be used with an understanding that it may impact performance. 11637 </description> 11638 </param> 11639 </parameters> 11640 <errors> 11641 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> 11642 <paramlink id="sampling_interval"></paramlink> is less than zero. 11643 </error> 11644 </errors> 11645 </function> 11646 </category> 11647 11648 </functionsection> 11649 11650 <errorsection label="Error Reference"> 11651 <intro> 11652 Every <jvmti/> function returns a <b><code>jvmtiError</code></b> error code. 11653 <p/> 11654 It is the responsibility of the agent to call <jvmti/> functions with 11655 valid parameters and in the proper context (calling thread is attached, 11656 phase is correct, etc.). 11657 Detecting some error conditions may be difficult, inefficient, or 11658 impossible for an implementation. 11659 The errors listed in 11660 <internallink id="reqerrors">Function Specific Required Errors</internallink> 11661 must be detected by the implementation. 11662 All other errors represent the recommended response to the error 11663 condition. 11664 </intro> 11665 11666 <errorcategory id="universal-error" label="Universal Errors"> 11667 <intro> 11668 The following errors may be returned by any function 11669 </intro> 11670 11671 <errorid id="JVMTI_ERROR_NONE" num="0"> 11672 No error has occurred. This is the error code that is returned 11673 on successful completion of the function. 11674 </errorid> 11675 <errorid id="JVMTI_ERROR_NULL_POINTER" num="100"> 11676 Pointer is unexpectedly <code>NULL</code>. 11677 </errorid> 11678 <errorid id="JVMTI_ERROR_OUT_OF_MEMORY" num="110"> 11679 The function attempted to allocate memory and no more memory was 11680 available for allocation. 11681 </errorid> 11682 <errorid id="JVMTI_ERROR_ACCESS_DENIED" num="111"> 11683 The desired functionality has not been enabled in this virtual machine. 11684 </errorid> 11685 <errorid id="JVMTI_ERROR_UNATTACHED_THREAD" num="115"> 11686 The thread being used to call this function is not attached 11687 to the virtual machine. Calls must be made from attached threads. 11688 See <code>AttachCurrentThread</code> in the JNI invocation API. 11689 </errorid> 11690 <errorid id="JVMTI_ERROR_INVALID_ENVIRONMENT" num="116"> 11691 The <jvmti/> environment provided is no longer connected or is 11692 not an environment. 11693 </errorid> 11694 <errorid id="JVMTI_ERROR_WRONG_PHASE" num="112"> 11695 The desired functionality is not available in the current 11696 <functionlink id="GetPhase">phase</functionlink>. 11697 Always returned if the virtual machine has completed running. 11698 </errorid> 11699 <errorid id="JVMTI_ERROR_INTERNAL" num="113"> 11700 An unexpected internal error has occurred. 11701 </errorid> 11702 </errorcategory> 11703 11704 <errorcategory id="reqerrors" label="Function Specific Required Errors"> 11705 <intro> 11706 The following errors are returned by some <jvmti/> functions and must 11707 be returned by the implementation when the condition occurs. 11708 </intro> 11709 11710 <errorid id="JVMTI_ERROR_INVALID_PRIORITY" num="12"> 11711 Invalid priority. 11712 </errorid> 11713 <errorid id="JVMTI_ERROR_THREAD_NOT_SUSPENDED" num="13"> 11714 Thread was not suspended. 11715 </errorid> 11716 <errorid id="JVMTI_ERROR_THREAD_SUSPENDED" num="14"> 11717 Thread already suspended. 11718 </errorid> 11719 <errorid id="JVMTI_ERROR_THREAD_NOT_ALIVE" num="15"> 11720 This operation requires the thread to be alive--that is, 11721 it must be started and not yet have died. 11722 </errorid> 11723 <errorid id="JVMTI_ERROR_CLASS_NOT_PREPARED" num="22"> 11724 The class has been loaded but not yet prepared. 11725 </errorid> 11726 <errorid id="JVMTI_ERROR_NO_MORE_FRAMES" num="31"> 11727 There are no Java programming language or JNI stack frames at the specified depth. 11728 </errorid> 11729 <errorid id="JVMTI_ERROR_OPAQUE_FRAME" num="32"> 11730 Information about the frame is not available (e.g. for native frames). 11731 </errorid> 11732 <errorid id="JVMTI_ERROR_DUPLICATE" num="40"> 11733 Item already set. 11734 </errorid> 11735 <errorid id="JVMTI_ERROR_NOT_FOUND" num="41"> 11736 Desired element (e.g. field or breakpoint) not found 11737 </errorid> 11738 <errorid id="JVMTI_ERROR_NOT_MONITOR_OWNER" num="51"> 11739 This thread doesn't own the raw monitor. 11740 </errorid> 11741 <errorid id="JVMTI_ERROR_INTERRUPT" num="52"> 11742 The call has been interrupted before completion. 11743 </errorid> 11744 <errorid id="JVMTI_ERROR_UNMODIFIABLE_CLASS" num="79"> 11745 The class cannot be modified. 11746 </errorid> 11747 <errorid id="JVMTI_ERROR_UNMODIFIABLE_MODULE" num="80"> 11748 The module cannot be modified. 11749 </errorid> 11750 <errorid id="JVMTI_ERROR_NOT_AVAILABLE" num="98"> 11751 The functionality is not available in this virtual machine. 11752 </errorid> 11753 <errorid id="JVMTI_ERROR_ABSENT_INFORMATION" num="101"> 11754 The requested information is not available. 11755 </errorid> 11756 <errorid id="JVMTI_ERROR_INVALID_EVENT_TYPE" num="102"> 11757 The specified event type ID is not recognized. 11758 </errorid> 11759 <errorid id="JVMTI_ERROR_NATIVE_METHOD" num="104"> 11760 The requested information is not available for native method. 11761 </errorid> 11762 <errorid id="JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED" num="106"> 11763 The class loader does not support this operation. 11764 </errorid> 11765 </errorcategory> 11766 11767 <errorcategory id="function-specific-errors" label="Function Specific Agent Errors"> 11768 <intro> 11769 The following errors are returned by some <jvmti/> functions. 11770 They are returned in the event of invalid parameters passed by the 11771 agent or usage in an invalid context. 11772 An implementation is not required to detect these errors. 11773 </intro> 11774 11775 <errorid id="JVMTI_ERROR_INVALID_THREAD" num="10"> 11776 The passed thread is not a valid thread. 11777 </errorid> 11778 <errorid id="JVMTI_ERROR_INVALID_FIELDID" num="25"> 11779 Invalid field. 11780 </errorid> 11781 <errorid id="JVMTI_ERROR_INVALID_MODULE" num="26"> 11782 Invalid module. 11783 </errorid> 11784 <errorid id="JVMTI_ERROR_INVALID_METHODID" num="23"> 11785 Invalid method. 11786 </errorid> 11787 <errorid id="JVMTI_ERROR_INVALID_LOCATION" num="24"> 11788 Invalid location. 11789 </errorid> 11790 <errorid id="JVMTI_ERROR_INVALID_OBJECT" num="20"> 11791 Invalid object. 11792 </errorid> 11793 <errorid id="JVMTI_ERROR_INVALID_CLASS" num="21"> 11794 Invalid class. 11795 </errorid> 11796 <errorid id="JVMTI_ERROR_TYPE_MISMATCH" num="34"> 11797 The variable is not an appropriate type for the function used. 11798 </errorid> 11799 <errorid id="JVMTI_ERROR_INVALID_SLOT" num="35"> 11800 Invalid slot. 11801 </errorid> 11802 <errorid id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY" num="99"> 11803 The capability being used is false in this environment. 11804 </errorid> 11805 <errorid id="JVMTI_ERROR_INVALID_THREAD_GROUP" num="11"> 11806 Thread group invalid. 11807 </errorid> 11808 <errorid id="JVMTI_ERROR_INVALID_MONITOR" num="50"> 11809 Invalid raw monitor. 11810 </errorid> 11811 <errorid id="JVMTI_ERROR_ILLEGAL_ARGUMENT" num="103"> 11812 Illegal argument. 11813 </errorid> 11814 <errorid id="JVMTI_ERROR_INVALID_TYPESTATE" num="65"> 11815 The state of the thread has been modified, and is now inconsistent. 11816 </errorid> 11817 <errorid id="JVMTI_ERROR_UNSUPPORTED_VERSION" num="68"> 11818 A new class file has a version number not supported by this VM. 11819 </errorid> 11820 <errorid id="JVMTI_ERROR_INVALID_CLASS_FORMAT" num="60"> 11821 A new class file is malformed (the VM would return a <code>ClassFormatError</code>). 11822 </errorid> 11823 <errorid id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION" num="61"> 11824 The new class file definitions would lead to a circular 11825 definition (the VM would return a <code>ClassCircularityError</code>). 11826 </errorid> 11827 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED" num="63"> 11828 A new class file would require adding a method. 11829 </errorid> 11830 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED" num="64"> 11831 A new class version changes a field. 11832 </errorid> 11833 <errorid id="JVMTI_ERROR_FAILS_VERIFICATION" num="62"> 11834 The class bytes fail verification. 11835 </errorid> 11836 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED" num="66"> 11837 A direct superclass is different for the new class 11838 version, or the set of directly implemented 11839 interfaces is different. 11840 </errorid> 11841 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED" num="67"> 11842 A new class version does not declare a method 11843 declared in the old class version. 11844 </errorid> 11845 <errorid id="JVMTI_ERROR_NAMES_DONT_MATCH" num="69"> 11846 The class name defined in the new class file is 11847 different from the name in the old class object. 11848 </errorid> 11849 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED" num="70"> 11850 A new class version has different modifiers. 11851 </errorid> 11852 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED" num="71"> 11853 A method in the new class version has different modifiers 11854 than its counterpart in the old class version. 11855 </errorid> 11856 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED" num="72"> 11857 A new class version has unsupported differences in class attributes. 11858 </errorid> 11859 </errorcategory> 11860 </errorsection> 11861 11862 <eventsection label="Events"> 11863 <intro label="Handling Events" id="eventIntro"> 11864 Agents can be informed of many events that occur in application 11865 programs. 11866 <p/> 11867 To handle events, designate a set of callback functions with 11868 <functionlink id="SetEventCallbacks"></functionlink>. 11869 For each event the corresponding callback function will be 11870 called. 11871 Arguments to the callback function provide additional 11872 information about the event. 11873 <p/> 11874 The callback function is usually called from within an application 11875 thread. The <jvmti/> implementation does not 11876 queue events in any way. This means 11877 that event callback functions must be written 11878 carefully. Here are some general guidelines. See 11879 the individual event descriptions for further 11880 suggestions. 11881 <p/> 11882 <ul> 11883 <li>Any exception thrown during the execution of an event callback can 11884 overwrite any current pending exception in the current application thread. 11885 Care must be taken to preserve a pending exception 11886 when an event callback makes a JNI call that might generate an exception. 11887 </li> 11888 <li>Event callback functions must be re-entrant. The <jvmti/> implementation does 11889 not queue events. If an agent needs to process events one at a time, it 11890 can use a raw monitor inside the 11891 event callback functions to serialize event processing. 11892 </li> 11893 <li>Event callback functions that execute JNI's FindClass function to load 11894 classes need to note that FindClass locates the class loader associated 11895 with the current native method. For the purposes of class loading, an 11896 event callback that includes a JNI environment as a parameter to the 11897 callback will treated as if it is a native call, where the native method 11898 is in the class of the event thread's current frame. 11899 </li> 11900 </ul> 11901 <p/> 11902 Some <jvmti/> events identify objects with JNI references. 11903 All references 11904 in <jvmti/> events are JNI local references and will become invalid 11905 after the event callback returns. 11906 Unless stated otherwise, memory referenced by pointers sent in event 11907 callbacks may not be referenced after the event callback returns. 11908 <p/> 11909 Except where stated otherwise, events are delivered on the thread 11910 that caused the event. 11911 Events are sent at the time they occur. 11912 The specification for each event includes the set of 11913 <functionlink id="GetPhase">phases</functionlink> in which it can be sent; 11914 if an event triggering activity occurs during another phase, no event 11915 is sent. 11916 <p/> 11917 A thread that generates an event does not change its execution status 11918 (for example, the event does not cause the thread to be suspended). 11919 If an agent wishes the event to result in suspension, then the agent 11920 is responsible for explicitly suspending the thread with 11921 <functionlink id="SuspendThread"></functionlink>. 11922 <p/> 11923 If an event is enabled in multiple environments, the event will be sent 11924 to each agent in the order that the environments were created. 11925 </intro> 11926 11927 <intro label="Enabling Events" id="enablingevents"> 11928 All events are initially disabled. In order to receive any 11929 event: 11930 <ul> 11931 <li> 11932 If the event requires a capability, that capability must 11933 be added with 11934 <functionlink id="AddCapabilities"></functionlink>. 11935 </li> 11936 <li> 11937 A callback for the event must be set with 11938 <functionlink id="SetEventCallbacks"></functionlink>. 11939 </li> 11940 <li> 11941 The event must be enabled with 11942 <functionlink id="SetEventNotificationMode"></functionlink>. 11943 </li> 11944 </ul> 11945 </intro> 11946 11947 <intro label="Multiple Co-located Events" id="eventorder"> 11948 In many situations it is possible for multiple events to occur 11949 at the same location in one thread. When this happens, all the events 11950 are reported through the event callbacks in the order specified in this section. 11951 <p/> 11952 If the current location is at the entry point of a method, the 11953 <eventlink id="MethodEntry"></eventlink> event is reported before 11954 any other event at the current location in the same thread. 11955 <p/> 11956 If an exception catch has been detected at the current location, 11957 either because it is the beginning of a catch clause or a native method 11958 that cleared a pending exception has returned, the 11959 <code>exceptionCatch</code> event is reported before 11960 any other event at the current location in the same thread. 11961 <p/> 11962 If a <code>singleStep</code> event or 11963 <code>breakpoint</code> event is triggered at the 11964 current location, the event is defined to occur 11965 immediately before the code at the current location is executed. 11966 These events are reported before any events which are triggered 11967 by the execution of code at the current location in the same 11968 thread (specifically: 11969 <code>exception</code>, 11970 <code>fieldAccess</code>, and 11971 <code>fieldModification</code>). 11972 If both a step and breakpoint event are triggered for the same thread and 11973 location, the step event is reported before the breakpoint event. 11974 <p/> 11975 If the current location is the exit point of a method (that is, the last 11976 location before returning to the caller), the 11977 <eventlink id="MethodExit"></eventlink> event and 11978 the <eventlink id="FramePop"></eventlink> event (if requested) 11979 are reported after all other events at the current location in the same 11980 thread. There is no specified ordering of these two events 11981 with respect to each other. 11982 <p/> 11983 Co-located events can be triggered during the processing of some other 11984 event by the agent at the same location in the same thread. 11985 If such an event, of type <i>y</i>, is triggered during the processing of 11986 an event of type <i>x</i>, and if <i>x</i> 11987 precedes <i>y</i> in the ordering specified above, the co-located event 11988 <i>y</i> is reported for the current thread and location. If <i>x</i> does not precede 11989 <i>y</i>, <i>y</i> is not reported for the current thread and location. 11990 For example, if a breakpoint is set at the current location 11991 during the processing of <eventlink id="SingleStep"></eventlink>, 11992 that breakpoint will be reported before the thread moves off the current 11993 location. 11994 <p/>The following events are never considered to be co-located with 11995 other events. 11996 <ul> 11997 <li><eventlink id="VMStart"></eventlink></li> 11998 <li><eventlink id="VMInit"></eventlink></li> 11999 <li><eventlink id="VMDeath"></eventlink></li> 12000 <li><eventlink id="ThreadStart"></eventlink></li> 12001 <li><eventlink id="ThreadEnd"></eventlink></li> 12002 <li><eventlink id="ClassLoad"></eventlink></li> 12003 <li><eventlink id="ClassPrepare"></eventlink></li> 12004 </ul> 12005 </intro> 12006 12007 <intro label="Event Callbacks" id="jvmtiEventCallbacks"> 12008 The event callback structure below is used to specify the handler function 12009 for events. It is set with the 12010 <functionlink id="SetEventCallbacks"></functionlink> function. 12011 </intro> 12012 12013 <event label="Single Step" 12014 id="SingleStep" const="JVMTI_EVENT_SINGLE_STEP" filtered="thread" num="60"> 12015 <description> 12016 Single step events allow the agent to trace thread execution 12017 at the finest granularity allowed by the VM. A single step event is 12018 generated whenever a thread reaches a new location. 12019 Typically, single step events represent the completion of one VM 12020 instruction as defined in <vmspec/>. However, some implementations 12021 may define locations differently. In any case the 12022 <code>method</code> and <code>location</code> 12023 parameters uniquely identify the current location and allow 12024 the mapping to source file and line number when that information is 12025 available. 12026 <p/> 12027 No single step events are generated from within native methods. 12028 </description> 12029 <origin>jvmdi</origin> 12030 <capabilities> 12031 <required id="can_generate_single_step_events"></required> 12032 </capabilities> 12033 <parameters> 12034 <param id="jni_env"> 12035 <outptr> 12036 <struct>JNIEnv</struct> 12037 </outptr> 12038 <description> 12039 The JNI environment of the event (current) thread 12040 </description> 12041 </param> 12042 <param id="thread"> 12043 <jthread/> 12044 <description> 12045 Thread about to execution a new instruction 12046 </description> 12047 </param> 12048 <param id="klass"> 12049 <jclass method="method"/> 12050 <description> 12051 Class of the method about to execute a new instruction 12052 </description> 12053 </param> 12054 <param id="method"> 12055 <jmethodID class="klass"/> 12056 <description> 12057 Method about to execute a new instruction 12058 </description> 12059 </param> 12060 <param id="location"> 12061 <jlocation/> 12062 <description> 12063 Location of the new instruction 12064 </description> 12065 </param> 12066 </parameters> 12067 </event> 12068 12069 <event label="Breakpoint" 12070 id="Breakpoint" const="JVMTI_EVENT_BREAKPOINT" filtered="thread" num="62"> 12071 <description> 12072 Breakpoint events are generated whenever a thread reaches a location 12073 designated as a breakpoint with <functionlink id="SetBreakpoint"></functionlink>. 12074 The <code>method</code> and <code>location</code> 12075 parameters uniquely identify the current location and allow 12076 the mapping to source file and line number when that information is 12077 available. 12078 </description> 12079 <origin>jvmdi</origin> 12080 <capabilities> 12081 <required id="can_generate_breakpoint_events"></required> 12082 </capabilities> 12083 <parameters> 12084 <param id="jni_env"> 12085 <outptr> 12086 <struct>JNIEnv</struct> 12087 </outptr> 12088 <description> 12089 The JNI environment of the event (current) thread. 12090 </description> 12091 </param> 12092 <param id="thread"> 12093 <jthread/> 12094 <description> 12095 Thread that hit the breakpoint 12096 </description> 12097 </param> 12098 <param id="klass"> 12099 <jclass method="method"/> 12100 <description> 12101 Class of the method that hit the breakpoint 12102 </description> 12103 </param> 12104 <param id="method"> 12105 <jmethodID class="klass"/> 12106 <description> 12107 Method that hit the breakpoint 12108 </description> 12109 </param> 12110 <param id="location"> 12111 <jlocation/> 12112 <description> 12113 location of the breakpoint 12114 </description> 12115 </param> 12116 </parameters> 12117 </event> 12118 12119 <event label="Field Access" 12120 id="FieldAccess" const="JVMTI_EVENT_FIELD_ACCESS" filtered="thread" num="63"> 12121 <description> 12122 Field access events are generated whenever a thread accesses 12123 a field that was designated as a watchpoint 12124 with <functionlink id="SetFieldAccessWatch"></functionlink>. 12125 The <code>method</code> and <code>location</code> 12126 parameters uniquely identify the current location and allow 12127 the mapping to source file and line number when that information is 12128 available. 12129 </description> 12130 <origin>jvmdi</origin> 12131 <capabilities> 12132 <required id="can_generate_field_access_events"></required> 12133 </capabilities> 12134 <parameters> 12135 <param id="jni_env"> 12136 <outptr> 12137 <struct>JNIEnv</struct> 12138 </outptr> 12139 <description> 12140 The JNI environment of the event (current) thread 12141 </description> 12142 </param> 12143 <param id="thread"> 12144 <jthread/> 12145 <description> 12146 Thread accessing the field 12147 </description> 12148 </param> 12149 <param id="klass"> 12150 <jclass method="method"/> 12151 <description> 12152 Class of the method where the access is occurring 12153 </description> 12154 </param> 12155 <param id="method"> 12156 <jmethodID class="klass"/> 12157 <description> 12158 Method where the access is occurring 12159 </description> 12160 </param> 12161 <param id="location"> 12162 <jlocation/> 12163 <description> 12164 Location where the access is occurring 12165 </description> 12166 </param> 12167 <param id="field_klass"> 12168 <jclass field="field"/> 12169 <description> 12170 Class of the field being accessed 12171 </description> 12172 </param> 12173 <param id="object"> 12174 <jobject/> 12175 <description> 12176 Object with the field being accessed if the field is an 12177 instance field; <code>NULL</code> otherwise 12178 </description> 12179 </param> 12180 <param id="field"> 12181 <jfieldID class="field_klass"/> 12182 <description> 12183 Field being accessed 12184 </description> 12185 </param> 12186 </parameters> 12187 </event> 12188 12189 <event label="Field Modification" 12190 id="FieldModification" const="JVMTI_EVENT_FIELD_MODIFICATION" filtered="thread" num="64"> 12191 <description> 12192 Field modification events are generated whenever a thread modifies 12193 a field that was designated as a watchpoint 12194 with <functionlink id="SetFieldModificationWatch"></functionlink>. 12195 The <code>method</code> and <code>location</code> 12196 parameters uniquely identify the current location and allow 12197 the mapping to source file and line number when that information is 12198 available. 12199 </description> 12200 <origin>jvmdi</origin> 12201 <capabilities> 12202 <required id="can_generate_field_modification_events"></required> 12203 </capabilities> 12204 <parameters> 12205 <param id="jni_env"> 12206 <outptr> 12207 <struct>JNIEnv</struct> 12208 </outptr> 12209 <description> 12210 The JNI environment of the event (current) thread 12211 </description> 12212 </param> 12213 <param id="thread"> 12214 <jthread/> 12215 <description> 12216 Thread modifying the field 12217 </description> 12218 </param> 12219 <param id="klass"> 12220 <jclass method="method"/> 12221 <description> 12222 Class of the method where the modification is occurring 12223 </description> 12224 </param> 12225 <param id="method"> 12226 <jmethodID class="klass"/> 12227 <description> 12228 Method where the modification is occurring 12229 </description> 12230 </param> 12231 <param id="location"> 12232 <jlocation/> 12233 <description> 12234 Location where the modification is occurring 12235 </description> 12236 </param> 12237 <param id="field_klass"> 12238 <jclass field="field"/> 12239 <description> 12240 Class of the field being modified 12241 </description> 12242 </param> 12243 <param id="object"> 12244 <jobject/> 12245 <description> 12246 Object with the field being modified if the field is an 12247 instance field; <code>NULL</code> otherwise 12248 </description> 12249 </param> 12250 <param id="field"> 12251 <jfieldID class="field_klass"/> 12252 <description> 12253 Field being modified 12254 </description> 12255 </param> 12256 <param id="signature_type"> 12257 <char/> 12258 <description> 12259 Signature type of the new value 12260 </description> 12261 </param> 12262 <param id="new_value"> 12263 <jvalue/> 12264 <description> 12265 The new value 12266 </description> 12267 </param> 12268 </parameters> 12269 </event> 12270 12271 <event label="Frame Pop" 12272 id="FramePop" const="JVMTI_EVENT_FRAME_POP" filtered="thread" num="61"> 12273 <description> 12274 Frame pop events are generated upon exit from a single method 12275 in a single frame as specified 12276 in a call to <functionlink id="NotifyFramePop"></functionlink>. 12277 This is true whether termination is caused by 12278 executing its return instruction 12279 or by throwing an exception to its caller 12280 (see <paramlink id="was_popped_by_exception"></paramlink>). 12281 However, frame pops caused by the <functionlink id="PopFrame"/> 12282 function are not reported. 12283 <p/> 12284 The location reported by <functionlink id="GetFrameLocation"></functionlink> 12285 identifies the executable location in the returning method, 12286 immediately prior to the return. 12287 </description> 12288 <origin>jvmdi</origin> 12289 <capabilities> 12290 <required id="can_generate_frame_pop_events"></required> 12291 </capabilities> 12292 <parameters> 12293 <param id="jni_env"> 12294 <outptr> 12295 <struct>JNIEnv</struct> 12296 </outptr> 12297 <description> 12298 The JNI environment of the event (current) thread 12299 </description> 12300 </param> 12301 <param id="thread"> 12302 <jthread/> 12303 <description> 12304 Thread that is popping the frame 12305 </description> 12306 </param> 12307 <param id="klass"> 12308 <jclass method="method"/> 12309 <description> 12310 Class of the method being popped 12311 </description> 12312 </param> 12313 <param id="method"> 12314 <jmethodID class="klass"/> 12315 <description> 12316 Method being popped 12317 </description> 12318 </param> 12319 <param id="was_popped_by_exception"> 12320 <jboolean/> 12321 <description> 12322 True if frame was popped by a thrown exception. 12323 False if method exited through its return instruction. 12324 </description> 12325 </param> 12326 </parameters> 12327 </event> 12328 12329 <event label="Method Entry" 12330 id="MethodEntry" const="JVMTI_EVENT_METHOD_ENTRY" filtered="thread" num="65"> 12331 <description> 12332 Method entry events are generated upon entry of Java 12333 programming language methods (including native methods). 12334 <p/> 12335 The location reported by <functionlink id="GetFrameLocation"></functionlink> 12336 identifies the initial executable location in 12337 the method. 12338 <p/> 12339 Enabling method 12340 entry or exit events will significantly degrade performance on many platforms and is thus 12341 not advised for performance critical usage (such as profiling). 12342 <internallink id="bci">Bytecode instrumentation</internallink> should be 12343 used in these cases. 12344 </description> 12345 <origin>jvmdi</origin> 12346 <capabilities> 12347 <required id="can_generate_method_entry_events"></required> 12348 </capabilities> 12349 <parameters> 12350 <param id="jni_env"> 12351 <outptr> 12352 <struct>JNIEnv</struct> 12353 </outptr> 12354 <description> 12355 The JNI environment of the event (current) thread 12356 </description> 12357 </param> 12358 <param id="thread"> 12359 <jthread/> 12360 <description> 12361 Thread entering the method 12362 </description> 12363 </param> 12364 <param id="klass"> 12365 <jclass method="method"/> 12366 <description> 12367 Class of the method being entered 12368 </description> 12369 </param> 12370 <param id="method"> 12371 <jmethodID class="klass"/> 12372 <description> 12373 Method being entered 12374 </description> 12375 </param> 12376 </parameters> 12377 </event> 12378 12379 <event label="Method Exit" 12380 id="MethodExit" const="JVMTI_EVENT_METHOD_EXIT" filtered="thread" num="66"> 12381 <description> 12382 Method exit events are generated upon exit from Java 12383 programming language methods (including native methods). 12384 This is true whether termination is caused by 12385 executing its return instruction 12386 or by throwing an exception to its caller 12387 (see <paramlink id="was_popped_by_exception"></paramlink>). 12388 <p/> 12389 The <code>method</code> field uniquely identifies the 12390 method being entered or exited. The <code>frame</code> field provides 12391 access to the stack frame for the method. 12392 <p/> 12393 The location reported by <functionlink id="GetFrameLocation"></functionlink> 12394 identifies the executable location in the returning method 12395 immediately prior to the return. 12396 <p/> 12397 Enabling method 12398 entry or exit events will significantly degrade performance on many platforms and is thus 12399 not advised for performance critical usage (such as profiling). 12400 <internallink id="bci">Bytecode instrumentation</internallink> should be 12401 used in these cases. 12402 </description> 12403 <origin>jvmdi</origin> 12404 <capabilities> 12405 <required id="can_generate_method_exit_events"></required> 12406 </capabilities> 12407 <parameters> 12408 <param id="jni_env"> 12409 <outptr> 12410 <struct>JNIEnv</struct> 12411 </outptr> 12412 <description> 12413 The JNI environment of the event (current) thread 12414 </description> 12415 </param> 12416 <param id="thread"> 12417 <jthread/> 12418 <description> 12419 Thread exiting the method 12420 </description> 12421 </param> 12422 <param id="klass"> 12423 <jclass method="method"/> 12424 <description> 12425 Class of the method being exited 12426 </description> 12427 </param> 12428 <param id="method"> 12429 <jmethodID class="klass"/> 12430 <description> 12431 Method being exited 12432 </description> 12433 </param> 12434 <param id="was_popped_by_exception"> 12435 <jboolean/> 12436 <description> 12437 True if frame was popped by a thrown exception. 12438 False if method exited through its return instruction. 12439 </description> 12440 </param> 12441 <param id="return_value"> 12442 <jvalue/> 12443 <description> 12444 The return value of the method being exited. 12445 Undefined and should not be used if 12446 <paramlink id="was_popped_by_exception"></paramlink> 12447 is true. 12448 </description> 12449 </param> 12450 </parameters> 12451 </event> 12452 12453 <event label="Native Method Bind" phase="any" 12454 id="NativeMethodBind" const="JVMTI_EVENT_NATIVE_METHOD_BIND" num="67"> 12455 <description> 12456 A Native Method Bind event is sent when a VM binds a 12457 Java programming language native method 12458 to the address of a function that implements the native method. 12459 This will occur when the native method is called for the first time 12460 and also occurs when the JNI function <code>RegisterNatives</code> is called. 12461 This event allows the bind to be redirected to an agent-specified 12462 proxy function. 12463 This event is not sent when the native method is unbound. 12464 Typically, this proxy function will need to be specific to a 12465 particular method or, to handle the general case, automatically 12466 generated assembly code, since after instrumentation code is 12467 executed the function at the original binding 12468 address will usually be invoked. 12469 The original binding can be restored or the redirection changed 12470 by use of the JNI function <code>RegisterNatives</code>. 12471 Some events may be sent during the primordial phase, JNI and 12472 most of <jvmti/> cannot be used at this time but the method and 12473 address can be saved for use later. 12474 </description> 12475 <origin>new</origin> 12476 <capabilities> 12477 <required id="can_generate_native_method_bind_events"></required> 12478 </capabilities> 12479 <parameters> 12480 <param id="jni_env"> 12481 <outptr> 12482 <struct>JNIEnv</struct> 12483 </outptr> 12484 <description> 12485 The JNI environment of the event (current) thread 12486 Will be <code>NULL</code> if sent during the primordial 12487 <functionlink id="GetPhase">phase</functionlink>. 12488 </description> 12489 </param> 12490 <param id="thread"> 12491 <jthread/> 12492 <description> 12493 Thread requesting the bind 12494 </description> 12495 </param> 12496 <param id="klass"> 12497 <jclass method="method"/> 12498 <description> 12499 Class of the method being bound 12500 </description> 12501 </param> 12502 <param id="method"> 12503 <jmethodID class="klass"/> 12504 <description> 12505 Native method being bound 12506 </description> 12507 </param> 12508 <param id="address"> 12509 <outptr><void/></outptr> 12510 <description> 12511 The address the VM is about to bind to--that is, the 12512 address of the implementation of the native method 12513 </description> 12514 </param> 12515 <param id="new_address_ptr"> 12516 <agentbuf><void/></agentbuf> 12517 <description> 12518 if the referenced address is changed (that is, if 12519 <code>*new_address_ptr</code> is set), the binding 12520 will instead be made to the supplied address. 12521 </description> 12522 </param> 12523 </parameters> 12524 </event> 12525 12526 <event label="Exception" 12527 id="Exception" const="JVMTI_EVENT_EXCEPTION" filtered="thread" num="58"> 12528 <description> 12529 Exception events are generated whenever an exception is first detected 12530 in a Java programming language method. 12531 Where "exception" means any <code>java.lang.Throwable</code>. 12532 The exception may have been thrown by a Java programming language or native 12533 method, but in the case of native methods, the event is not generated 12534 until the exception is first seen by a Java programming language method. If an exception is 12535 set and cleared in a native method (and thus is never visible to Java programming language code), 12536 no exception event is generated. 12537 <p/> 12538 The <code>method</code> and <code>location</code> 12539 parameters uniquely identify the current location 12540 (where the exception was detected) and allow 12541 the mapping to source file and line number when that information is 12542 available. The <code>exception</code> field identifies the thrown 12543 exception object. The <code>catch_method</code> 12544 and <code>catch_location</code> identify the location of the catch clause, 12545 if any, that handles the thrown exception. If there is no such catch clause, 12546 each field is set to 0. There is no guarantee that the thread will ever 12547 reach this catch clause. If there are native methods on the call stack 12548 between the throw location and the catch clause, the exception may 12549 be reset by one of those native methods. 12550 Similarly, exceptions that are reported as uncaught (<code>catch_klass</code> 12551 et al. set to 0) may in fact be caught by native code. 12552 Agents can check for these occurrences by monitoring 12553 <eventlink id="ExceptionCatch"></eventlink> events. 12554 Note that finally clauses are implemented as catch and re-throw. Therefore they 12555 will be reported in the catch location. 12556 </description> 12557 <origin>jvmdi</origin> 12558 <capabilities> 12559 <required id="can_generate_exception_events"></required> 12560 </capabilities> 12561 <parameters> 12562 <param id="jni_env"> 12563 <outptr> 12564 <struct>JNIEnv</struct> 12565 </outptr> 12566 <description> 12567 The JNI environment of the event (current) thread 12568 </description> 12569 </param> 12570 <param id="thread"> 12571 <jthread/> 12572 <description> 12573 Thread generating the exception 12574 </description> 12575 </param> 12576 <param id="klass"> 12577 <jclass method="method"/> 12578 <description> 12579 Class generating the exception 12580 </description> 12581 </param> 12582 <param id="method"> 12583 <jmethodID class="klass"/> 12584 <description> 12585 Method generating the exception 12586 </description> 12587 </param> 12588 <param id="location"> 12589 <jlocation/> 12590 <description> 12591 Location where exception occurred 12592 </description> 12593 </param> 12594 <param id="exception"> 12595 <jobject/> 12596 <description> 12597 The exception being thrown 12598 </description> 12599 </param> 12600 <param id="catch_klass"> 12601 <jclass method="catch_method"/> 12602 <description> 12603 Class that will catch the exception, or <code>NULL</code> if no known catch 12604 </description> 12605 </param> 12606 <param id="catch_method"> 12607 <jmethodID class="catch_klass"/> 12608 <description> 12609 Method that will catch the exception, or <code>NULL</code> if no known catch 12610 </description> 12611 </param> 12612 <param id="catch_location"> 12613 <jlocation/> 12614 <description> 12615 location which will catch the exception or zero if no known catch 12616 </description> 12617 </param> 12618 </parameters> 12619 </event> 12620 12621 <event label="Exception Catch" 12622 id="ExceptionCatch" const="JVMTI_EVENT_EXCEPTION_CATCH" filtered="thread" num="59"> 12623 <description> 12624 Exception catch events are generated whenever a thrown exception is caught. 12625 Where "exception" means any <code>java.lang.Throwable</code>. 12626 If the exception is caught in a Java programming language method, the event is generated 12627 when the catch clause is reached. If the exception is caught in a native 12628 method, the event is generated as soon as control is returned to a Java programming language 12629 method. Exception catch events are generated for any exception for which 12630 a throw was detected in a Java programming language method. 12631 Note that finally clauses are implemented as catch and re-throw. Therefore they 12632 will generate exception catch events. 12633 <p/> 12634 The <code>method</code> and <code>location</code> 12635 parameters uniquely identify the current location 12636 and allow the mapping to source file and line number when that information is 12637 available. For exceptions caught in a Java programming language method, the 12638 <code>exception</code> object identifies the exception object. Exceptions 12639 caught in native methods are not necessarily available by the time the 12640 exception catch is reported, so the <code>exception</code> field is set 12641 to <code>NULL</code>. 12642 </description> 12643 <origin>jvmdi</origin> 12644 <capabilities> 12645 <required id="can_generate_exception_events"></required> 12646 </capabilities> 12647 <parameters> 12648 <param id="jni_env"> 12649 <outptr> 12650 <struct>JNIEnv</struct> 12651 </outptr> 12652 <description> 12653 The JNI environment of the event (current) thread 12654 </description> 12655 </param> 12656 <param id="thread"> 12657 <jthread/> 12658 <description> 12659 Thread catching the exception 12660 </description> 12661 </param> 12662 <param id="klass"> 12663 <jclass method="method"/> 12664 <description> 12665 Class catching the exception 12666 </description> 12667 </param> 12668 <param id="method"> 12669 <jmethodID class="klass"/> 12670 <description> 12671 Method catching the exception 12672 </description> 12673 </param> 12674 <param id="location"> 12675 <jlocation/> 12676 <description> 12677 Location where exception is being caught 12678 </description> 12679 </param> 12680 <param id="exception"> 12681 <jobject/> 12682 <description> 12683 Exception being caught 12684 </description> 12685 </param> 12686 </parameters> 12687 </event> 12688 12689 <event label="Thread Start" 12690 id="ThreadStart" const="JVMTI_EVENT_THREAD_START" num="52" phase="start"> 12691 <description> 12692 Thread start events are generated by a new thread before its initial 12693 method executes. 12694 <p/> 12695 A thread may be listed in the array returned by 12696 <functionlink id="GetAllThreads"></functionlink> 12697 before its thread start event is generated. 12698 It is possible for other events to be generated 12699 on a thread before its thread start event. 12700 <p/> 12701 The event is sent on the newly started <paramlink id="thread"></paramlink>. 12702 </description> 12703 <origin>jvmdi</origin> 12704 <capabilities> 12705 </capabilities> 12706 <parameters> 12707 <param id="jni_env"> 12708 <outptr> 12709 <struct>JNIEnv</struct> 12710 </outptr> 12711 <description> 12712 The JNI environment of the event (current) thread. 12713 </description> 12714 </param> 12715 <param id="thread"> 12716 <jthread/> 12717 <description> 12718 Thread starting 12719 </description> 12720 </param> 12721 </parameters> 12722 </event> 12723 12724 <event label="Thread End" 12725 id="ThreadEnd" const="JVMTI_EVENT_THREAD_END" filtered="thread" num="53" phase="start"> 12726 <description> 12727 Thread end events are generated by a terminating thread 12728 after its initial method has finished execution. 12729 <p/> 12730 A thread may be listed in the array returned by 12731 <functionlink id="GetAllThreads"></functionlink> 12732 after its thread end event is generated. 12733 No events are generated on a thread 12734 after its thread end event. 12735 <p/> 12736 The event is sent on the dying <paramlink id="thread"></paramlink>. 12737 </description> 12738 <origin>jvmdi</origin> 12739 <capabilities> 12740 </capabilities> 12741 <parameters> 12742 <param id="jni_env"> 12743 <outptr> 12744 <struct>JNIEnv</struct> 12745 </outptr> 12746 <description> 12747 The JNI environment of the event (current) thread. 12748 </description> 12749 </param> 12750 <param id="thread"> 12751 <jthread/> 12752 <description> 12753 Thread ending 12754 </description> 12755 </param> 12756 </parameters> 12757 </event> 12758 12759 <event label="Class Load" 12760 id="ClassLoad" const="JVMTI_EVENT_CLASS_LOAD" filtered="thread" phase="start" num="55"> 12761 <description> 12762 A class load event is generated 12763 <functionlink id="GetLoadedClasses">when a class or interface is created.</functionlink>. 12764 <p/> 12765 Array class creation does not generate a class load event. 12766 The creation of a primitive class (for example, java.lang.Integer.TYPE) 12767 does not generate a class load event. 12768 <p/> 12769 The order of class load events generated by a particular thread is guaranteed 12770 to match the order of class loading within that thread. 12771 <p/> 12772 This event is sent at an early stage in loading the class. As 12773 a result the class should be used carefully. Note, for example, 12774 that methods and fields are not yet loaded, so queries for methods, 12775 fields, subclasses, and so on will not give correct results. 12776 See "Loading of Classes and Interfaces" in the <i>Java Language 12777 Specification</i>. For most 12778 purposes the <eventlink id="ClassPrepare"></eventlink> event will 12779 be more useful. 12780 </description> 12781 <origin>jvmdi</origin> 12782 <capabilities> 12783 </capabilities> 12784 <parameters> 12785 <param id="jni_env"> 12786 <outptr> 12787 <struct>JNIEnv</struct> 12788 </outptr> 12789 <description> 12790 The JNI environment of the event (current) thread 12791 </description> 12792 </param> 12793 <param id="thread"> 12794 <jthread/> 12795 <description> 12796 Thread loading the class 12797 </description> 12798 </param> 12799 <param id="klass"> 12800 <jclass/> 12801 <description> 12802 Class being loaded 12803 </description> 12804 </param> 12805 </parameters> 12806 </event> 12807 12808 <elide> 12809 <event label="Class Unload" 12810 id="ClassUnload" const="JVMTI_EVENT_CLASS_UNLOAD" num="57"> 12811 <description> 12812 A class unload event is generated when the class is about to be unloaded. 12813 Class unload events take place during garbage collection and must be 12814 handled extremely carefully. The garbage collector holds many locks 12815 and has suspended all other threads, so the event handler cannot depend 12816 on the ability to acquire any locks. The class unload event handler should 12817 do as little as possible, perhaps by queuing information to be processed 12818 later. In particular, the <code>jclass</code> should be used only in 12819 the JNI function <code>isSameObject</code> or in the following <jvmti/> functions: 12820 <ul> 12821 <li><functionlink id="GetClassSignature"></functionlink></li> 12822 <li><functionlink id="GetSourceFileName"></functionlink></li> 12823 <li><functionlink id="IsInterface"></functionlink></li> 12824 <li><functionlink id="IsArrayClass"></functionlink></li> 12825 </ul> 12826 </description> 12827 <origin>jvmdi</origin> 12828 <capabilities> 12829 </capabilities> 12830 <parameters> 12831 <param id="jni_env"> 12832 <outptr> 12833 <struct>JNIEnv</struct> 12834 </outptr> 12835 <description> 12836 The JNI environment of the event (current) thread 12837 </description> 12838 </param> 12839 <param id="thread"> 12840 <jthread/> 12841 <description> 12842 Thread generating the class unload 12843 </description> 12844 </param> 12845 <param id="klass"> 12846 <jclass/> 12847 <description> 12848 Class being unloaded 12849 </description> 12850 </param> 12851 </parameters> 12852 </event> 12853 </elide> 12854 12855 <event label="Class Prepare" 12856 id="ClassPrepare" const="JVMTI_EVENT_CLASS_PREPARE" filtered="thread" phase="start" num="56"> 12857 <description> 12858 A class prepare event is generated when class preparation is complete. 12859 At this point, class fields, methods, and implemented interfaces are 12860 available, and no code from the class has been executed. Since array 12861 classes never have fields or methods, class prepare events are not 12862 generated for them. Class prepare events are not generated for 12863 primitive classes (for example, <code>java.lang.Integer.TYPE</code>). 12864 </description> 12865 <origin>jvmdi</origin> 12866 <capabilities> 12867 </capabilities> 12868 <parameters> 12869 <param id="jni_env"> 12870 <outptr> 12871 <struct>JNIEnv</struct> 12872 </outptr> 12873 <description> 12874 The JNI environment of the event (current) thread 12875 </description> 12876 </param> 12877 <param id="thread"> 12878 <jthread/> 12879 <description> 12880 Thread generating the class prepare 12881 </description> 12882 </param> 12883 <param id="klass"> 12884 <jclass/> 12885 <description> 12886 Class being prepared 12887 </description> 12888 </param> 12889 </parameters> 12890 </event> 12891 12892 <event label="Class File Load Hook" phase="any" 12893 id="ClassFileLoadHook" const="JVMTI_EVENT_CLASS_FILE_LOAD_HOOK" num="54"> 12894 <description> 12895 This event is sent when the VM obtains class file data, 12896 but before it constructs 12897 the in-memory representation for that class. 12898 This event is also sent when the class is being modified by the 12899 <functionlink id="RetransformClasses"/> function or 12900 the <functionlink id="RedefineClasses"/> function, 12901 called in any <jvmti/> environment. 12902 The agent can instrument 12903 the existing class file data sent by the VM to include profiling/debugging hooks. 12904 See the description of 12905 <internallink id="bci">bytecode instrumentation</internallink> 12906 for usage information. 12907 <p/> 12908 When the capabilities 12909 <internallink id="jvmtiCapabilities.can_generate_early_class_hook_events"> 12910 <code>can_generate_early_class_hook_events</code></internallink> and 12911 <internallink id="jvmtiCapabilities.can_generate_all_class_hook_events"> 12912 <code>can_generate_all_class_hook_events</code></internallink> 12913 are enabled then this event may be sent in the primordial phase. 12914 Otherwise, this event may be sent before the VM is initialized (the start 12915 <functionlink id="GetPhase">phase</functionlink>). 12916 Some classes might not be compatible 12917 with the function (eg. ROMized classes or implementation defined classes) and this event will 12918 not be generated for these classes. 12919 <p/> 12920 The agent must allocate the space for the modified 12921 class file data buffer 12922 using the memory allocation function 12923 <functionlink id="Allocate"></functionlink> because the 12924 VM is responsible for freeing the new class file data buffer 12925 using <functionlink id="Deallocate"></functionlink>. 12926 <p/> 12927 If the agent wishes to modify the class file, it must set 12928 <code>new_class_data</code> to point 12929 to the newly instrumented class file data buffer and set 12930 <code>new_class_data_len</code> to the length of that 12931 buffer before returning 12932 from this call. If no modification is desired, the agent simply 12933 does not set <code>new_class_data</code>. If multiple agents 12934 have enabled this event the results are chained. That is, if 12935 <code>new_class_data</code> has been set, it becomes the 12936 <code>class_data</code> for the next agent. 12937 <p/> 12938 When handling a class load in the live phase, then the 12939 <functionlink id="GetNamedModule"></functionlink> 12940 function can be used to map class loader and a package name to a module. 12941 When a class is being redefined or retransformed then 12942 <code>class_being_redefined</code> is non <code>NULL</code> and so 12943 the JNI <code>GetModule</code> function can also be used 12944 to obtain the Module. 12945 <p/> 12946 The order that this event is sent to each environment differs 12947 from other events. 12948 This event is sent to environments in the following order: 12949 <ul> 12950 <li><fieldlink id="can_retransform_classes" 12951 struct="jvmtiCapabilities">retransformation 12952 incapable</fieldlink> 12953 environments, in the 12954 order in which they were created 12955 </li> 12956 <li><fieldlink id="can_retransform_classes" 12957 struct="jvmtiCapabilities">retransformation 12958 capable</fieldlink> 12959 environments, in the 12960 order in which they were created 12961 </li> 12962 </ul> 12963 When triggered by <functionlink id="RetransformClasses"/>, 12964 this event is sent only to <fieldlink id="can_retransform_classes" 12965 struct="jvmtiCapabilities">retransformation 12966 capable</fieldlink> 12967 environments. 12968 </description> 12969 <origin>jvmpi</origin> 12970 <capabilities> 12971 <capability id="can_generate_all_class_hook_events"></capability> 12972 <capability id="can_generate_early_class_hook_events"></capability> 12973 </capabilities> 12974 <parameters> 12975 <param id="jni_env"> 12976 <outptr> 12977 <struct>JNIEnv</struct> 12978 </outptr> 12979 <description> 12980 The JNI environment of the event (current) thread. 12981 </description> 12982 </param> 12983 <param id="class_being_redefined"> 12984 <jclass/> 12985 <description> 12986 The class being 12987 <functionlink id="RedefineClasses">redefined</functionlink> or 12988 <functionlink id="RetransformClasses">retransformed</functionlink>. 12989 <code>NULL</code> if sent by class load. 12990 </description> 12991 </param> 12992 <param id="loader"> 12993 <jobject/> 12994 <description> 12995 The class loader loading the class. 12996 <code>NULL</code> if the bootstrap class loader. 12997 </description> 12998 </param> 12999 <param id="name"> 13000 <vmbuf><char/></vmbuf> 13001 <description> 13002 Name of class being loaded as a VM internal qualified name 13003 (for example, "java/util/List"), encoded as a 13004 <internallink id="mUTF">modified UTF-8</internallink> string. 13005 Note: if the class is defined with a <code>NULL</code> name or 13006 without a name specified, <code>name</code> will be <code>NULL</code>. 13007 </description> 13008 </param> 13009 <param id="protection_domain"> 13010 <jobject/> 13011 <description> 13012 The <code>ProtectionDomain</code> of the class. 13013 </description> 13014 </param> 13015 <param id="class_data_len"> 13016 <jint/> 13017 <description> 13018 Length of current class file data buffer. 13019 </description> 13020 </param> 13021 <param id="class_data"> 13022 <vmbuf><uchar/></vmbuf> 13023 <description> 13024 Pointer to the current class file data buffer. 13025 </description> 13026 </param> 13027 <param id="new_class_data_len"> 13028 <outptr><jint/></outptr> 13029 <description> 13030 Pointer to the length of the new class file data buffer. 13031 </description> 13032 </param> 13033 <param id="new_class_data"> 13034 <agentbuf incount="new_class_data_len"><uchar/></agentbuf> 13035 <description> 13036 Pointer to the pointer to the instrumented class file data buffer. 13037 </description> 13038 </param> 13039 </parameters> 13040 </event> 13041 13042 <event label="VM Start Event" 13043 id="VMStart" const="JVMTI_EVENT_VM_START" num="57" phase="start"> 13044 <description> 13045 The VM start event signals the start of the VM. 13046 At this time JNI is live but the VM is not yet fully initialized. 13047 Once this event is generated, the agent is free to call any JNI function. 13048 This event signals the beginning of the start phase, 13049 <jvmti/> functions permitted in the start phase may be called. 13050 <p/> 13051 The timing of this event may depend on whether the agent has added the 13052 <internallink id="jvmtiCapabilities.can_generate_early_vmstart"> 13053 <code>can_generate_early_vmstart</code></internallink> capability or not. 13054 If the capability has been added then the VM posts the event as early 13055 as possible. The VM is capable of executing bytecode but it may not have 13056 initialized to the point where it can load classes in modules other than 13057 <code>java.base</code>, or even arbitrary classes in <code>java.base</code>. 13058 Agents that do load-time instrumentation in this 13059 phase must take great care when instrumenting code that potentially 13060 executes in this phase. Extreme care should also be taken with JNI 13061 <code>FindClass</code> as it may not be possible to load classes and attempts 13062 to do so may result in unpredictable behavior, maybe even stability issues 13063 on some VM implementations. 13064 If the capability has not been added then the VM delays posting this 13065 event until it is capable of loading classes in modules other than 13066 <code>java.base</code> or the VM has completed its initialization. 13067 Agents that create more than one JVM TI environment, where the 13068 capability is added to some but not all environments, may observe the 13069 start phase beginning earlier in the JVM TI environments that possess 13070 the capability. 13071 <p/> 13072 In the case of VM start-up failure, this event will not be sent. 13073 </description> 13074 <origin>jvmdi</origin> 13075 <capabilities> 13076 </capabilities> 13077 <parameters> 13078 <param id="jni_env"> 13079 <outptr> 13080 <struct>JNIEnv</struct> 13081 </outptr> 13082 <description> 13083 The JNI environment of the event (current) thread. 13084 </description> 13085 </param> 13086 </parameters> 13087 </event> 13088 13089 <event label="VM Initialization Event" 13090 id="VMInit" const="JVMTI_EVENT_VM_INIT" num="50"> 13091 <description> 13092 The VM initialization event signals the completion of VM initialization. Once 13093 this event is generated, the agent is free to call any JNI or <jvmti/> 13094 function. The VM initialization event can be preceded by or can be concurrent 13095 with other events, but 13096 the preceding events should be handled carefully, if at all, because the 13097 VM has not completed its initialization. The thread start event for the 13098 main application thread is guaranteed not to occur until after the 13099 handler for the VM initialization event returns. 13100 <p/> 13101 In the case of VM start-up failure, this event will not be sent. 13102 </description> 13103 <origin>jvmdi</origin> 13104 <capabilities> 13105 </capabilities> 13106 <parameters> 13107 <param id="jni_env"> 13108 <outptr> 13109 <struct>JNIEnv</struct> 13110 </outptr> 13111 <description> 13112 The JNI environment of the event (current) thread. 13113 </description> 13114 </param> 13115 <param id="thread"> 13116 <jthread/> 13117 <description> 13118 The initial thread 13119 </description> 13120 </param> 13121 </parameters> 13122 </event> 13123 13124 <event label="VM Death Event" 13125 id="VMDeath" const="JVMTI_EVENT_VM_DEATH" num="51"> 13126 <description> 13127 The VM death event notifies the agent of the termination of the VM. 13128 No events will occur after the VMDeath event. 13129 <p/> 13130 In the case of VM start-up failure, this event will not be sent. 13131 Note that <internallink id="onunload">Agent_OnUnload</internallink> 13132 will still be called in these cases. 13133 </description> 13134 <origin>jvmdi</origin> 13135 <capabilities> 13136 </capabilities> 13137 <parameters> 13138 <param id="jni_env"> 13139 <outptr> 13140 <struct>JNIEnv</struct> 13141 </outptr> 13142 <description> 13143 The JNI environment of the event (current) thread 13144 </description> 13145 </param> 13146 </parameters> 13147 </event> 13148 13149 <event label="Compiled Method Load" phase="start" 13150 id="CompiledMethodLoad" const="JVMTI_EVENT_COMPILED_METHOD_LOAD" num="68"> 13151 <description> 13152 Sent when a method is compiled and loaded into memory by the VM. 13153 If it is unloaded, the <eventlink id="CompiledMethodUnload"/> event is sent. 13154 If it is moved, the <eventlink id="CompiledMethodUnload"/> event is sent, 13155 followed by a new <code>CompiledMethodLoad</code> event. 13156 Note that a single method may have multiple compiled forms, and that 13157 this event will be sent for each form. 13158 Note also that several methods may be inlined into a single 13159 address range, and that this event will be sent for each method. 13160 <p/> 13161 These events can be sent after their initial occurrence with 13162 <functionlink id="GenerateEvents"></functionlink>. 13163 </description> 13164 <origin>jvmpi</origin> 13165 <typedef id="jvmtiAddrLocationMap" label="Native address to location entry"> 13166 <field id="start_address"> 13167 <vmbuf><void/></vmbuf> 13168 <description> 13169 Starting native address of code corresponding to a location 13170 </description> 13171 </field> 13172 <field id="location"> 13173 <jlocation/> 13174 <description> 13175 Corresponding location. See 13176 <functionlink id="GetJLocationFormat"></functionlink> 13177 for the meaning of location. 13178 </description> 13179 </field> 13180 </typedef> 13181 <capabilities> 13182 <required id="can_generate_compiled_method_load_events"></required> 13183 </capabilities> 13184 <parameters> 13185 <param id="klass"> 13186 <jclass method="method"/> 13187 <description> 13188 Class of the method being compiled and loaded 13189 </description> 13190 </param> 13191 <param id="method"> 13192 <jmethodID class="klass"/> 13193 <description> 13194 Method being compiled and loaded 13195 </description> 13196 </param> 13197 <param id="code_size"> 13198 <jint/> 13199 <description> 13200 Size of compiled code 13201 </description> 13202 </param> 13203 <param id="code_addr"> 13204 <vmbuf><void/></vmbuf> 13205 <description> 13206 Address where compiled method code is loaded 13207 </description> 13208 </param> 13209 <param id="map_length"> 13210 <jint/> 13211 <description> 13212 Number of <typelink id="jvmtiAddrLocationMap"></typelink> 13213 entries in the address map. 13214 Zero if mapping information cannot be supplied. 13215 </description> 13216 </param> 13217 <param id="map"> 13218 <vmbuf><struct>jvmtiAddrLocationMap</struct></vmbuf> 13219 <description> 13220 Map from native addresses to location. 13221 The native address range of each entry is from 13222 <fieldlink id="start_address" struct="jvmtiAddrLocationMap"></fieldlink> 13223 to <code>start_address-1</code> of the next entry. 13224 <code>NULL</code> if mapping information cannot be supplied. 13225 </description> 13226 </param> 13227 <param id="compile_info"> 13228 <vmbuf><void/></vmbuf> 13229 <description> 13230 VM-specific compilation information. 13231 The referenced compile information is managed by the VM 13232 and must not depend on the agent for collection. 13233 A VM implementation defines the content and lifetime 13234 of the information. 13235 </description> 13236 </param> 13237 </parameters> 13238 </event> 13239 13240 <event label="Compiled Method Unload" phase="start" 13241 id="CompiledMethodUnload" const="JVMTI_EVENT_COMPILED_METHOD_UNLOAD" num="69"> 13242 <description> 13243 Sent when a compiled method is unloaded from memory. 13244 This event might not be sent on the thread which performed the unload. 13245 This event may be sent sometime after the unload occurs, but 13246 will be sent before the memory is reused 13247 by a newly generated compiled method. This event may be sent after 13248 the class is unloaded. 13249 </description> 13250 <origin>jvmpi</origin> 13251 <capabilities> 13252 <required id="can_generate_compiled_method_load_events"></required> 13253 </capabilities> 13254 <parameters> 13255 <param id="klass"> 13256 <jclass method="method"/> 13257 <description> 13258 Class of the compiled method being unloaded. 13259 </description> 13260 </param> 13261 <param id="method"> 13262 <jmethodID class="klass"/> 13263 <description> 13264 Compiled method being unloaded. 13265 For identification of the compiled method only -- the class 13266 may be unloaded and therefore the method should not be used 13267 as an argument to further JNI or <jvmti/> functions. 13268 </description> 13269 </param> 13270 <param id="code_addr"> 13271 <vmbuf><void/></vmbuf> 13272 <description> 13273 Address where compiled method code was loaded. 13274 For identification of the compiled method only -- 13275 the space may have been reclaimed. 13276 </description> 13277 </param> 13278 </parameters> 13279 </event> 13280 13281 <event label="Dynamic Code Generated" phase="any" 13282 id="DynamicCodeGenerated" const="JVMTI_EVENT_DYNAMIC_CODE_GENERATED" num="70"> 13283 <description> 13284 Sent when a component of the virtual machine is generated dynamically. 13285 This does not correspond to Java programming language code that is 13286 compiled--see <eventlink id="CompiledMethodLoad"></eventlink>. 13287 This is for native code--for example, an interpreter that is generated 13288 differently depending on command-line options. 13289 <p/> 13290 Note that this event has no controlling capability. 13291 If a VM cannot generate these events, it simply does not send any. 13292 <p/> 13293 These events can be sent after their initial occurrence with 13294 <functionlink id="GenerateEvents"></functionlink>. 13295 </description> 13296 <origin>jvmpi</origin> 13297 <capabilities> 13298 </capabilities> 13299 <parameters> 13300 <param id="name"> 13301 <vmbuf><char/></vmbuf> 13302 <description> 13303 Name of the code, encoded as a 13304 <internallink id="mUTF">modified UTF-8</internallink> string. 13305 Intended for display to an end-user. 13306 The name might not be unique. 13307 </description> 13308 </param> 13309 <param id="address"> 13310 <vmbuf><void/></vmbuf> 13311 <description> 13312 Native address of the code 13313 </description> 13314 </param> 13315 <param id="length"> 13316 <jint/> 13317 <description> 13318 Length in bytes of the code 13319 </description> 13320 </param> 13321 </parameters> 13322 </event> 13323 13324 <event label="Data Dump Request" 13325 id="DataDumpRequest" const="JVMTI_EVENT_DATA_DUMP_REQUEST" num="71"> 13326 <description> 13327 Sent by the VM to request the agent to dump its data. This 13328 is just a hint and the agent need not react to this event. 13329 This is useful for processing command-line signals from users. For 13330 example, in the Java 2 SDK a CTRL-Break on Win32 and a CTRL-\ on Solaris 13331 causes the VM to send this event to the agent. 13332 </description> 13333 <origin>jvmpi</origin> 13334 <capabilities> 13335 </capabilities> 13336 <parameters> 13337 </parameters> 13338 </event> 13339 13340 <event label="Monitor Contended Enter" 13341 id="MonitorContendedEnter" const="JVMTI_EVENT_MONITOR_CONTENDED_ENTER" filtered="thread" num="75"> 13342 <description> 13343 Sent when a thread is attempting to enter a Java programming language 13344 monitor already acquired by another thread. 13345 </description> 13346 <origin>jvmpi</origin> 13347 <capabilities> 13348 <required id="can_generate_monitor_events"></required> 13349 </capabilities> 13350 <parameters> 13351 <param id="jni_env"> 13352 <outptr> 13353 <struct>JNIEnv</struct> 13354 </outptr> 13355 <description> 13356 The JNI environment of the event (current) thread 13357 </description> 13358 </param> 13359 <param id="thread"> 13360 <jthread/> 13361 <description> 13362 JNI local reference to the thread 13363 attempting to enter the monitor 13364 </description> 13365 </param> 13366 <param id="object"> 13367 <jobject/> 13368 <description> 13369 JNI local reference to the monitor 13370 </description> 13371 </param> 13372 </parameters> 13373 </event> 13374 13375 <event label="Monitor Contended Entered" 13376 id="MonitorContendedEntered" const="JVMTI_EVENT_MONITOR_CONTENDED_ENTERED" filtered="thread" num="76"> 13377 <description> 13378 Sent when a thread enters a Java programming language 13379 monitor after waiting for it to be released by another thread. 13380 </description> 13381 <origin>jvmpi</origin> 13382 <capabilities> 13383 <required id="can_generate_monitor_events"></required> 13384 </capabilities> 13385 <parameters> 13386 <param id="jni_env"> 13387 <outptr> 13388 <struct>JNIEnv</struct> 13389 </outptr> 13390 <description> 13391 The JNI environment of the event (current) thread 13392 </description> 13393 </param> 13394 <param id="thread"> 13395 <jthread/> 13396 <description> 13397 JNI local reference to the thread entering 13398 the monitor 13399 </description> 13400 </param> 13401 <param id="object"> 13402 <jobject/> 13403 <description> 13404 JNI local reference to the monitor 13405 </description> 13406 </param> 13407 </parameters> 13408 </event> 13409 13410 <event label="Monitor Wait" 13411 id="MonitorWait" const="JVMTI_EVENT_MONITOR_WAIT" filtered="thread" num="73"> 13412 <description> 13413 Sent when a thread is about to wait on an object. 13414 </description> 13415 <origin>jvmpi</origin> 13416 <capabilities> 13417 <required id="can_generate_monitor_events"></required> 13418 </capabilities> 13419 <parameters> 13420 <param id="jni_env"> 13421 <outptr> 13422 <struct>JNIEnv</struct> 13423 </outptr> 13424 <description> 13425 The JNI environment of the event (current) thread 13426 </description> 13427 </param> 13428 <param id="thread"> 13429 <jthread/> 13430 <description> 13431 JNI local reference to the thread about to wait 13432 </description> 13433 </param> 13434 <param id="object"> 13435 <jobject/> 13436 <description> 13437 JNI local reference to the monitor 13438 </description> 13439 </param> 13440 <param id="timeout"> 13441 <jlong/> 13442 <description> 13443 The number of milliseconds the thread will wait 13444 </description> 13445 </param> 13446 </parameters> 13447 </event> 13448 13449 <event label="Monitor Waited" 13450 id="MonitorWaited" const="JVMTI_EVENT_MONITOR_WAITED" filtered="thread" num="74"> 13451 <description> 13452 Sent when a thread finishes waiting on an object. 13453 </description> 13454 <origin>jvmpi</origin> 13455 <capabilities> 13456 <required id="can_generate_monitor_events"></required> 13457 </capabilities> 13458 <parameters> 13459 <param id="jni_env"> 13460 <outptr> 13461 <struct>JNIEnv</struct> 13462 </outptr> 13463 <description> 13464 The JNI environment of the event (current) thread 13465 </description> 13466 </param> 13467 <param id="thread"> 13468 <jthread/> 13469 <description> 13470 JNI local reference to the thread that was finished waiting 13471 </description> 13472 </param> 13473 <param id="object"> 13474 <jobject/> 13475 <description> 13476 JNI local reference to the monitor. 13477 </description> 13478 </param> 13479 <param id="timed_out"> 13480 <jboolean/> 13481 <description> 13482 True if the monitor timed out 13483 </description> 13484 </param> 13485 </parameters> 13486 </event> 13487 13488 <event label="Resource Exhausted" 13489 id="ResourceExhausted" const="JVMTI_EVENT_RESOURCE_EXHAUSTED" num="80" 13490 since="1.1"> 13491 <description> 13492 Sent when a VM resource needed by a running application has been exhausted. 13493 Except as required by the optional capabilities, the set of resources 13494 which report exhaustion is implementation dependent. 13495 <p/> 13496 The following bit flags define the properties of the resource exhaustion: 13497 <constants id="jvmtiResourceExhaustionFlags" 13498 label="Resource Exhaustion Flags" 13499 kind="bits" 13500 since="1.1"> 13501 <constant id="JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR" num="0x0001"> 13502 After this event returns, the VM will throw a 13503 <code>java.lang.OutOfMemoryError</code>. 13504 </constant> 13505 <constant id="JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP" num="0x0002"> 13506 The VM was unable to allocate memory from the <tm>Java</tm> 13507 platform <i>heap</i>. 13508 The <i>heap</i> is the runtime 13509 data area from which memory for all class instances and 13510 arrays are allocated. 13511 </constant> 13512 <constant id="JVMTI_RESOURCE_EXHAUSTED_THREADS" num="0x0004"> 13513 The VM was unable to create a thread. 13514 </constant> 13515 </constants> 13516 </description> 13517 <origin>new</origin> 13518 <capabilities> 13519 <capability id="can_generate_resource_exhaustion_heap_events"> 13520 Can generate events when the VM is unable to allocate memory from the 13521 <internallink id="JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP">heap</internallink>. 13522 </capability> 13523 <capability id="can_generate_resource_exhaustion_threads_events"> 13524 Can generate events when the VM is unable to 13525 <internallink id="JVMTI_RESOURCE_EXHAUSTED_THREADS">create 13526 a thread</internallink>. 13527 </capability> 13528 </capabilities> 13529 <parameters> 13530 <param id="jni_env"> 13531 <outptr> 13532 <struct>JNIEnv</struct> 13533 </outptr> 13534 <description> 13535 The JNI environment of the event (current) thread 13536 </description> 13537 </param> 13538 <param id="flags"> 13539 <jint/> 13540 <description> 13541 Flags defining the properties of the of resource exhaustion 13542 as specified by the 13543 <internallink id="jvmtiResourceExhaustionFlags">Resource 13544 Exhaustion Flags</internallink>. 13545 </description> 13546 </param> 13547 <param id="reserved"> 13548 <vmbuf><void/></vmbuf> 13549 <description> 13550 Reserved. 13551 </description> 13552 </param> 13553 <param id="description"> 13554 <vmbuf><char/></vmbuf> 13555 <description> 13556 Description of the resource exhaustion, encoded as a 13557 <internallink id="mUTF">modified UTF-8</internallink> string. 13558 </description> 13559 </param> 13560 </parameters> 13561 </event> 13562 13563 <event label="VM Object Allocation" 13564 id="VMObjectAlloc" const="JVMTI_EVENT_VM_OBJECT_ALLOC" num="84"> 13565 <description> 13566 Sent when a method causes the virtual machine to directly allocate an 13567 Object visible to Java programming language code. 13568 Generally object allocation should be detected by instrumenting 13569 the bytecodes of allocating methods. 13570 Object allocation generated in native code by JNI function 13571 calls should be detected using 13572 <internallink id="jniIntercept">JNI function interception</internallink>. 13573 Some methods might not have associated bytecodes and are not 13574 native methods, they instead are executed directly by the 13575 VM. These methods should send this event. 13576 Virtual machines which are incapable of bytecode instrumentation 13577 for some or all of their methods can send this event. 13578 13579 Note that the <internallink 13580 id="SampledObjectAlloc">SampledObjectAlloc</internallink> 13581 event is triggered on all Java object allocations, including those 13582 caused by bytecode method execution, JNI method execution, and 13583 directly by VM methods. 13584 <p/> 13585 Typical examples where this event might be sent: 13586 <ul> 13587 <li>Reflection -- for example, <code>java.lang.Class.newInstance()</code></li> 13588 <li>Methods not represented by bytecodes -- for example, VM intrinsics and 13589 J2ME preloaded classes</li> 13590 </ul> 13591 Cases where this event would not be generated: 13592 <ul> 13593 <li>Allocation due to bytecodes -- for example, the <code>new</code> 13594 and <code>newarray</code> VM instructions</li> 13595 <li>Allocation due to JNI function calls -- for example, 13596 <code>AllocObject</code></li> 13597 <li>Allocations during VM initialization</li> 13598 <li>VM internal objects</li> 13599 </ul> 13600 </description> 13601 <origin>new</origin> 13602 <capabilities> 13603 <required id="can_generate_vm_object_alloc_events"></required> 13604 </capabilities> 13605 <parameters> 13606 <param id="jni_env"> 13607 <outptr> 13608 <struct>JNIEnv</struct> 13609 </outptr> 13610 <description> 13611 The JNI environment of the event (current) thread 13612 </description> 13613 </param> 13614 <param id="thread"> 13615 <jthread/> 13616 <description> 13617 Thread allocating the object. 13618 </description> 13619 </param> 13620 <param id="object"> 13621 <jobject/> 13622 <description> 13623 JNI local reference to the object that was allocated. 13624 </description> 13625 </param> 13626 <param id="object_klass"> 13627 <jclass/> 13628 <description> 13629 JNI local reference to the class of the object. 13630 </description> 13631 </param> 13632 <param id="size"> 13633 <jlong/> 13634 <description> 13635 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 13636 </description> 13637 </param> 13638 </parameters> 13639 </event> 13640 13641 <event label="Sampled Object Allocation" 13642 id="SampledObjectAlloc" const="JVMTI_EVENT_SAMPLED_OBJECT_ALLOC" filtered="thread" num="86" since="11"> 13643 <description> 13644 Sent when an allocated object is sampled. 13645 By default, the sampling interval is set to 512KB. The sampling is semi-random to avoid 13646 pattern-based bias and provides an approximate overall average interval over long periods of 13647 sampling. 13648 <p/> 13649 Each thread tracks how many bytes it has allocated since it sent the last event. 13650 When the number of bytes exceeds the sampling interval, it will send another event. 13651 This implies that, on average, one object will be sampled every time a thread has 13652 allocated 512KB bytes since the last sample. 13653 <p/> 13654 Note that the sampler is pseudo-random: it will not sample every 512KB precisely. 13655 The goal of this is to ensure high quality sampling even if allocation is 13656 happening in a fixed pattern (i.e., the same set of objects are being allocated 13657 every 512KB). 13658 <p/> 13659 If another sampling interval is required, the user can call 13660 <functionlink id="SetHeapSamplingInterval"></functionlink> with a strictly positive integer value, 13661 representing the new sampling interval. 13662 <p/> 13663 This event is sent once the sampled allocation has been performed. It provides the object, stack trace 13664 of the allocation, the thread allocating, the size of allocation, and the object's class. 13665 <p/> 13666 A typical use case of this system is to determine where heap allocations originate. 13667 In conjunction with weak references and the function 13668 <functionlink id="GetStackTrace"></functionlink>, a user can track which objects were allocated from which 13669 stack trace, and which are still live during the execution of the program. 13670 </description> 13671 <origin>new</origin> 13672 <capabilities> 13673 <required id="can_generate_sampled_object_alloc_events"></required> 13674 </capabilities> 13675 <parameters> 13676 <param id="jni_env"> 13677 <outptr> 13678 <struct>JNIEnv</struct> 13679 </outptr> 13680 <description> 13681 The JNI environment of the event (current) thread. 13682 </description> 13683 </param> 13684 <param id="thread"> 13685 <jthread/> 13686 <description> 13687 Thread allocating the object. 13688 </description> 13689 </param> 13690 <param id="object"> 13691 <jobject/> 13692 <description> 13693 JNI local reference to the object that was allocated. 13694 </description> 13695 </param> 13696 <param id="object_klass"> 13697 <jclass/> 13698 <description> 13699 JNI local reference to the class of the object 13700 </description> 13701 </param> 13702 <param id="size"> 13703 <jlong/> 13704 <description> 13705 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>. 13706 </description> 13707 </param> 13708 </parameters> 13709 </event> 13710 13711 <event label="Object Free" 13712 id="ObjectFree" const="JVMTI_EVENT_OBJECT_FREE" num="83"> 13713 <description> 13714 An Object Free event is sent when the garbage collector frees an object. 13715 Events are only sent for tagged objects--see 13716 <internallink id="Heap">heap functions</internallink>. 13717 <p/> 13718 The event handler must not use JNI functions and 13719 must not use <jvmti/> functions except those which 13720 specifically allow such use (see the raw monitor, memory management, 13721 and environment local storage functions). 13722 </description> 13723 <origin>new</origin> 13724 <capabilities> 13725 <required id="can_generate_object_free_events"></required> 13726 </capabilities> 13727 <parameters> 13728 <param id="tag"> 13729 <jlong/> 13730 <description> 13731 The freed object's tag 13732 </description> 13733 </param> 13734 </parameters> 13735 </event> 13736 13737 <event label="Garbage Collection Start" 13738 id="GarbageCollectionStart" const="JVMTI_EVENT_GARBAGE_COLLECTION_START" num="81"> 13739 <description> 13740 A Garbage Collection Start event is sent when a 13741 garbage collection pause begins. 13742 Only stop-the-world collections are reported--that is, collections during 13743 which all threads cease to modify the state of the Java virtual machine. 13744 This means that some collectors will never generate these events. 13745 This event is sent while the VM is still stopped, thus 13746 the event handler must not use JNI functions and 13747 must not use <jvmti/> functions except those which 13748 specifically allow such use (see the raw monitor, memory management, 13749 and environment local storage functions). 13750 <p/> 13751 This event is always sent as a matched pair with 13752 <eventlink id="GarbageCollectionFinish"/> 13753 (assuming both events are enabled) and no garbage collection 13754 events will occur between them. 13755 </description> 13756 <origin>new</origin> 13757 <capabilities> 13758 <required id="can_generate_garbage_collection_events"></required> 13759 </capabilities> 13760 <parameters> 13761 </parameters> 13762 </event> 13763 13764 <event label="Garbage Collection Finish" 13765 id="GarbageCollectionFinish" const="JVMTI_EVENT_GARBAGE_COLLECTION_FINISH" num="82"> 13766 <description> 13767 A Garbage Collection Finish event is sent when a 13768 garbage collection pause ends. 13769 This event is sent while the VM is still stopped, thus 13770 the event handler must not use JNI functions and 13771 must not use <jvmti/> functions except those which 13772 specifically allow such use (see the raw monitor, memory management, 13773 and environment local storage functions). 13774 <p/> 13775 Some agents may need to do post garbage collection operations that 13776 require the use of the disallowed <jvmti/> or JNI functions. For these 13777 cases an agent thread can be created which waits on a raw monitor, 13778 and the handler for the Garbage Collection Finish event simply 13779 notifies the raw monitor 13780 <p/> 13781 This event is always sent as a matched pair with 13782 <eventlink id="GarbageCollectionStart"/> (assuming both events are enabled). 13783 <issue> 13784 The most important use of this event is to provide timing information, 13785 and thus additional information is not required. However, 13786 information about the collection which is "free" should be included - 13787 what that information is needs to be determined. 13788 </issue> 13789 </description> 13790 <origin>new</origin> 13791 <capabilities> 13792 <required id="can_generate_garbage_collection_events"></required> 13793 </capabilities> 13794 <parameters> 13795 </parameters> 13796 </event> 13797 13798 <elide> 13799 <event label="Verbose Output" phase="any" 13800 id="VerboseOutput" const="JVMTI_EVENT_VERBOSE_OUTPUT" num="85"> 13801 <description> 13802 Send verbose messages as strings. 13803 <issue> 13804 This format is extremely fragile, as it can change with each 13805 platform, collector and version. Alternatives include: 13806 <ul> 13807 <li>building off Java programming language M and M APIs</li> 13808 <li>XML</li> 13809 <li>key/value pairs</li> 13810 <li>removing it</li> 13811 </ul> 13812 </issue> 13813 <issue> 13814 Though this seemed trivial to implement. 13815 In the RI it appears this will be quite complex. 13816 </issue> 13817 </description> 13818 <origin>new</origin> 13819 <capabilities> 13820 </capabilities> 13821 <parameters> 13822 <param id="flag"> 13823 <enum>jvmtiVerboseFlag</enum> 13824 <description> 13825 Which verbose output is being sent. 13826 </description> 13827 </param> 13828 <param id="message"> 13829 <vmbuf><char/></vmbuf> 13830 <description> 13831 Message text, encoded as a 13832 <internallink id="mUTF">modified UTF-8</internallink> string. 13833 </description> 13834 </param> 13835 </parameters> 13836 </event> 13837 </elide> 13838 13839 </eventsection> 13840 13841 <datasection> 13842 <intro> 13843 <jvmti/> extends the data types defined by JNI. 13844 </intro> 13845 <basetypes id="jniTypes" label="JNI Types Used in the JVM Tool Interface"> 13846 <basetype id="jboolean"> 13847 <description> 13848 Holds a Java programming language <code>boolean</code>. 13849 Unsigned 8 bits. 13850 </description> 13851 </basetype> 13852 <basetype id="jchar"> 13853 <description> 13854 Holds a Java programming language <code>char</code>. 13855 Unsigned 16 bits. 13856 </description> 13857 </basetype> 13858 <basetype id="jint"> 13859 <description> 13860 Holds a Java programming language <code>int</code>. 13861 Signed 32 bits. 13862 </description> 13863 </basetype> 13864 <basetype id="jlong"> 13865 <description> 13866 Holds a Java programming language <code>long</code>. 13867 Signed 64 bits. 13868 </description> 13869 </basetype> 13870 <basetype id="jfloat"> 13871 <description> 13872 Holds a Java programming language <code>float</code>. 13873 32 bits. 13874 </description> 13875 </basetype> 13876 <basetype id="jdouble"> 13877 <description> 13878 Holds a Java programming language <code>double</code>. 13879 64 bits. 13880 </description> 13881 </basetype> 13882 <basetype id="jobject"> 13883 <description> 13884 Holds a Java programming language object. 13885 </description> 13886 </basetype> 13887 <basetype id="jclass"> 13888 <description> 13889 Holds a Java programming language class. 13890 </description> 13891 </basetype> 13892 <basetype id="jvalue"> 13893 <description> 13894 Is a union of all primitive types and <code>jobject</code>. Thus, holds any Java 13895 programming language value. 13896 </description> 13897 </basetype> 13898 <basetype id="jfieldID"> 13899 <description> 13900 Identifies a Java programming language field. 13901 <code>jfieldID</code>s returned by <jvmti/> functions and events may be 13902 safely stored. 13903 </description> 13904 </basetype> 13905 <basetype id="jmethodID"> 13906 <description> 13907 Identifies a Java programming language method, initializer, or constructor. 13908 <code>jmethodID</code>s returned by <jvmti/> functions and events may be 13909 safely stored. However, if the class is unloaded, they become invalid 13910 and must not be used. 13911 </description> 13912 </basetype> 13913 <basetype id="JNIEnv"> 13914 <description> 13915 Pointer to the JNI function table. Pointer to this (<code>JNIEnv *</code>) 13916 is a JNI environment. 13917 </description> 13918 </basetype> 13919 </basetypes> 13920 13921 <basetypes id="jvmtiTypes" label="JVM Tool Interface Base Types"> 13922 <basetype id="jvmtiEnv"> 13923 <description> 13924 The <jvmti/> <internallink id="environments">environment</internallink> pointer. 13925 See the <internallink id="FunctionSection">Function Section</internallink>. 13926 <code>jvmtiEnv</code> points to the 13927 <internallink id="FunctionTable">function table</internallink> pointer. 13928 </description> 13929 </basetype> 13930 <basetype id="jthread"> 13931 <definition>typedef jobject jthread;</definition> 13932 <description> 13933 Subtype of <datalink id="jobject"></datalink> that holds a thread. 13934 </description> 13935 </basetype> 13936 <basetype id="jthreadGroup"> 13937 <definition>typedef jobject jthreadGroup;</definition> 13938 <description> 13939 Subtype of <datalink id="jobject"></datalink> that holds a thread group. 13940 </description> 13941 </basetype> 13942 <basetype id="jlocation"> 13943 <definition>typedef jlong jlocation;</definition> 13944 <description> 13945 A 64 bit value, representing a monotonically increasing 13946 executable position within a method. 13947 <code>-1</code> indicates a native method. 13948 See <functionlink id="GetJLocationFormat"></functionlink> for the format on a 13949 given VM. 13950 </description> 13951 </basetype> 13952 <basetype id="jrawMonitorID"> 13953 <definition>struct _jrawMonitorID; 13954 typedef struct _jrawMonitorID *jrawMonitorID;</definition> 13955 <description> 13956 A raw monitor. 13957 </description> 13958 </basetype> 13959 <basetype id="jvmtiError"> 13960 <description> 13961 Holds an error return code. 13962 See the <internallink id="ErrorSection">Error section</internallink> for possible values. 13963 <example> 13964 typedef enum { 13965 JVMTI_ERROR_NONE = 0, 13966 JVMTI_ERROR_INVALID_THREAD = 10, 13967 ... 13968 } jvmtiError; 13969 </example> 13970 </description> 13971 </basetype> 13972 <basetype id="jvmtiEvent"> 13973 <description> 13974 An identifier for an event type. 13975 See the <internallink id="EventSection">Event section</internallink> for possible values. 13976 It is guaranteed that future versions of this specification will 13977 never assign zero as an event type identifier. 13978 <example> 13979 typedef enum { 13980 JVMTI_EVENT_SINGLE_STEP = 1, 13981 JVMTI_EVENT_BREAKPOINT = 2, 13982 ... 13983 } jvmtiEvent; 13984 </example> 13985 </description> 13986 </basetype> 13987 <basetype id="jvmtiEventCallbacks" name="eventCallbacks"> 13988 <description> 13989 The callbacks used for events. 13990 <example> 13991 typedef struct { 13992 jvmtiEventVMInit VMInit; 13993 jvmtiEventVMDeath VMDeath; 13994 ... 13995 } jvmtiEventCallbacks; 13996 </example> 13997 See <internallink id="jvmtiEventCallbacks">event callbacks</internallink> 13998 for the complete structure. 13999 <p/> 14000 Where, for example, the VM initialization callback is defined: 14001 <example> 14002 typedef void (JNICALL *jvmtiEventVMInit) 14003 (jvmtiEnv *jvmti_env, 14004 JNIEnv* jni_env, 14005 jthread thread); 14006 </example> 14007 See the individual events for the callback function definition. 14008 </description> 14009 </basetype> 14010 <basetype id="jniNativeInterface"> 14011 <definition>typedef struct JNINativeInterface_ jniNativeInterface;</definition> 14012 <description> 14013 Typedef for the JNI function table <code>JNINativeInterface</code> 14014 defined in the 14015 <externallink id="jni/functions.html#interface-function-table"> 14016 JNI Specification</externallink>. 14017 The JNI reference implementation defines this with an underscore. 14018 </description> 14019 </basetype> 14020 </basetypes> 14021 14022 </datasection> 14023 14024 <issuessection label="Issues"> 14025 <intro id="suspendRequired" label="Resolved Issue: Suspend - Required or Automatic"> 14026 JVMDI requires that the agent suspend threads before calling 14027 certain sensitive functions. JVMPI requires garbage collection to be 14028 disabled before calling certain sensitive functions. 14029 It was suggested that rather than have this requirement, that 14030 VM place itself in a suitable state before performing an 14031 operation. This makes considerable sense since each VM 14032 knows its requirements and can most easily arrange a 14033 safe state. 14034 <p/> 14035 The ability to externally suspend/resume threads will, of 14036 course, remain. The ability to enable/disable garbage collection will not. 14037 <p/> 14038 This issue is resolved--suspend will not 14039 be required. The spec has been updated to reflect this. 14040 </intro> 14041 14042 <intro id="stackSampling" label="Resolved Issue: Call Stack Sampling"> 14043 There are a variety of approaches to sampling call stacks. 14044 The biggest bifurcation is between VM controlled and agent 14045 controlled. 14046 <p/> 14047 This issue is resolved--agent controlled 14048 sampling will be the approach. 14049 </intro> 14050 14051 <intro id="threadRepresentation" label="Resolved Issue: Thread Representation"> 14052 JVMDI represents threads as jthread. JVMPI primarily 14053 uses JNIEnv* to represent threads. 14054 <p/> 14055 The Expert Group has chosen jthread as the representation 14056 for threads in <jvmti/>. 14057 JNIEnv* is sent by 14058 events since it is needed to JNI functions. JNIEnv, per the 14059 JNI spec, are not supposed to be used outside their thread. 14060 </intro> 14061 14062 <intro id="design" label="Resolved Issue: Method Representation"> 14063 The JNI spec allows an implementation to depend on jclass/jmethodID 14064 pairs, rather than simply a jmethodID, to reference a method. 14065 JVMDI, for consistency, choose the same representation. 14066 JVMPI, however, specifies that a jmethodID alone maps to a 14067 method. Both of the Sun <tm>J2SE</tm> virtual machines (Classic and <tm>HotSpot</tm>) store 14068 pointers in jmethodIDs, and as a result, a jmethodID is sufficient. 14069 In fact, any JVM implementation that supports JVMPI must have 14070 such a representation. 14071 <jvmti/> will use jmethodID as a unique representation of a method 14072 (no jclass is used). 14073 There should be efficiency gains, particularly in 14074 functionality like stack dumping, to this representation. 14075 <p/> 14076 Note that fields were not used in JVMPI and that the access profile 14077 of fields differs from methods--for implementation efficiency 14078 reasons, a jclass/jfieldID pair will still be needed for field 14079 reference. 14080 </intro> 14081 14082 <intro id="localReferenceIssue" label="Resolved Issue: Local References"> 14083 Functions return local references. 14084 </intro> 14085 14086 <intro id="frameRep" label="Resolved Issue: Representation of frames"> 14087 In JVMDI, a frame ID is used to represent a frame. Problem with this 14088 is that a VM must track when a frame becomes invalid, a far better 14089 approach, and the one used in <jvmti/>, is to reference frames by depth. 14090 </intro> 14091 14092 <intro id="requiredCapabilities" label="Issue: Required Capabilities"> 14093 Currently, having a required capabilities means that the functionality 14094 is optional. Capabilities are useful even for required functionality 14095 since they can inform the VM is needed set-up. Thus, there should be 14096 a set of capabilities that a conformant implementation must provide 14097 (if requested during Agent_OnLoad). 14098 </intro> 14099 14100 <intro id="taghint" label="Proposal: add tag hint function"> 14101 A hint of the percentage of objects that will be tagged would 14102 help the VM pick a good implementation. 14103 </intro> 14104 14105 <intro id="moreMonitorQueries" label="Request: More Monitor Quires"> 14106 How difficult or easy would be to extend the monitor_info category to include 14107 <pre> 14108 - current number of monitors 14109 - enumeration of monitors 14110 - enumeration of threads waiting on a given monitor 14111 </pre> 14112 The reason for my question is the fact that current get_monitor_info support 14113 requires the agent to specify a given thread to get the info which is probably 14114 OK in the profiling/debugging space, while in the monitoring space the agent 14115 could be watching the monitor list and then decide which thread to ask for 14116 the info. You might ask why is this important for monitoring .... I think it 14117 can aid in the detection/prediction of application contention caused by hot-locks. 14118 </intro> 14119 </issuessection> 14120 14121 <changehistory id="ChangeHistory" update="09/05/07"> 14122 <intro> 14123 The <jvmti/> specification is an evolving document with major, minor, 14124 and micro version numbers. 14125 A released version of the specification is uniquely identified 14126 by its major and minor version. 14127 The functions, events, and capabilities in this specification 14128 indicate a "Since" value which is the major and minor version in 14129 which it was introduced. 14130 The version of the specification implemented by the VM can 14131 be retrieved at runtime with the <functionlink id="GetVersionNumber"/> 14132 function. 14133 </intro> 14134 <change date="14 Nov 2002"> 14135 Converted to XML document. 14136 </change> 14137 <change date="14 Nov 2002"> 14138 Elided heap dump functions (for now) since what was there 14139 was wrong. 14140 </change> 14141 <change date="18 Nov 2002"> 14142 Added detail throughout. 14143 </change> 14144 <change date="18 Nov 2002"> 14145 Changed JVMTI_THREAD_STATUS_RUNNING to JVMTI_THREAD_STATUS_RUNNABLE. 14146 </change> 14147 <change date="19 Nov 2002"> 14148 Added AsyncGetStackTrace. 14149 </change> 14150 <change date="19 Nov 2002"> 14151 Added jframeID return to GetStackTrace. 14152 </change> 14153 <change date="19 Nov 2002"> 14154 Elided GetCurrentFrame and GetCallingFrame functions (for now) since what was there 14155 since they are redundant with GetStackTrace. 14156 </change> 14157 <change date="19 Nov 2002"> 14158 Elided ClearAllBreakpoints since it has always been redundant. 14159 </change> 14160 <change date="19 Nov 2002"> 14161 Added GetSystemProperties. 14162 </change> 14163 <change date="19 Nov 2002"> 14164 Changed the thread local storage functions to use jthread. 14165 </change> 14166 <change date="20 Nov 2002"> 14167 Added GetJLocationFormat. 14168 </change> 14169 <change date="22 Nov 2002"> 14170 Added events and introductory text. 14171 </change> 14172 <change date="22 Nov 2002"> 14173 Cross reference type and constant definitions. 14174 </change> 14175 <change date="24 Nov 2002"> 14176 Added DTD. 14177 </change> 14178 <change date="24 Nov 2002"> 14179 Added capabilities function section. 14180 </change> 14181 <change date="29 Nov 2002"> 14182 Assign capabilities to each function and event. 14183 </change> 14184 <change date="29 Nov 2002"> 14185 Add <internallink id="jniIntercept">JNI interception functions</internallink>. 14186 </change> 14187 <change date="30 Nov 2002"> 14188 Auto generate SetEventNotificationMode capabilities. 14189 </change> 14190 <change date="30 Nov 2002"> 14191 Add <eventlink id="VMObjectAlloc"></eventlink> event. 14192 </change> 14193 <change date="30 Nov 2002"> 14194 Add <eventlink id="DynamicCodeGenerated"></eventlink> event. 14195 </change> 14196 <change date="30 Nov 2002"> 14197 Add const to declarations. 14198 </change> 14199 <change date="30 Nov 2002"> 14200 Change method exit and frame pop to send on exception. 14201 </change> 14202 <change date="1 Dec 2002"> 14203 Add ForceGarbageCollection. 14204 </change> 14205 <change date="2 Dec 2002"> 14206 Redo Xrun section; clarify GetStackTrace and add example; 14207 Fix width problems; use "agent" consistently. 14208 </change> 14209 <change date="8 Dec 2002"> 14210 Remove previous start-up intro. 14211 Add <internallink id="environments"><jvmti/> Environments</internallink> 14212 section. 14213 </change> 14214 <change date="8 Dec 2002"> 14215 Add <functionlink id="DisposeEnvironment"></functionlink>. 14216 </change> 14217 <change date="9 Dec 2002"> 14218 Numerous minor updates. 14219 </change> 14220 <change date="15 Dec 2002"> 14221 Add heap profiling functions added: 14222 get/set annotation, iterate live objects/heap. 14223 Add heap profiling functions place holder added: 14224 heap roots. 14225 Heap profiling event added: object free. 14226 Heap profiling event redesigned: vm object allocation. 14227 Heap profiling event placeholders added: garbage collection start/finish. 14228 Native method bind event added. 14229 </change> 14230 <change date="19 Dec 2002"> 14231 Revamp suspend/resume functions. 14232 Add origin information with jvmdi tag. 14233 Misc fixes. 14234 </change> 14235 <change date="24 Dec 2002"> 14236 Add semantics to types. 14237 </change> 14238 <change date="27 Dec 2002"> 14239 Add local reference section. 14240 Autogenerate parameter descriptions from types. 14241 </change> 14242 <change date="28 Dec 2002"> 14243 Document that RunAgentThread sends threadStart. 14244 </change> 14245 <change date="29 Dec 2002"> 14246 Remove redundant local ref and dealloc warning. 14247 Convert GetRawMonitorName to allocated buffer. 14248 Add GenerateEvents. 14249 </change> 14250 <change date="30 Dec 2002"> 14251 Make raw monitors a type and rename to "jrawMonitorID". 14252 </change> 14253 <change date="1 Jan 2003"> 14254 Include origin information. 14255 Clean-up JVMDI issue references. 14256 Remove Deallocate warnings which are now automatically generated. 14257 </change> 14258 <change date="2 Jan 2003"> 14259 Fix representation issues for jthread. 14260 </change> 14261 <change date="3 Jan 2003"> 14262 Make capabilities buffered out to 64 bits - and do it automatically. 14263 </change> 14264 <change date="4 Jan 2003"> 14265 Make constants which are enumeration into enum types. 14266 Parameters now of enum type. 14267 Clean-up and index type section. 14268 Replace remaining datadef entities with callback. 14269 </change> 14270 <change date="7 Jan 2003"> 14271 Correct GenerateEvents description. 14272 More internal semantics work. 14273 </change> 14274 <change date="9 Jan 2003"> 14275 Replace previous GetSystemProperties with two functions 14276 which use allocated information instead fixed. 14277 Add SetSystemProperty. 14278 More internal semantics work. 14279 </change> 14280 <change date="12 Jan 2003"> 14281 Add varargs to end of SetEventNotificationMode. 14282 </change> 14283 <change date="20 Jan 2003"> 14284 Finish fixing spec to reflect that alloc sizes are jlong. 14285 </change> 14286 <change date="22 Jan 2003"> 14287 Allow NULL as RunAgentThread arg. 14288 </change> 14289 <change date="22 Jan 2003"> 14290 Fixed names to standardized naming convention 14291 Removed AsyncGetStackTrace. 14292 </change> 14293 <change date="29 Jan 2003"> 14294 Since we are using jthread, removed GetThread. 14295 </change> 14296 <change date="31 Jan 2003"> 14297 Change GetFieldName to allow NULLs like GetMethodName. 14298 </change> 14299 <change date="29 Feb 2003" version="v40"> 14300 Rewrite the introductory text, adding sections on 14301 start-up, environments and bytecode instrumentation. 14302 Change the command line arguments per EG discussions. 14303 Add an introduction to the capabilities section. 14304 Add the extension mechanism category and functions. 14305 Mark for deletion, but clarified anyhow, SuspendAllThreads. 14306 Rename IterateOverLiveObjects to IterateOverReachableObjects and 14307 change the text accordingly. 14308 Clarify IterateOverHeap. 14309 Clarify CompiledMethodLoad. 14310 Discuss prerequisite state for Calling Functions. 14311 Clarify SetAllocationHooks. 14312 Added issues ("To be resolved:") through-out. 14313 And so on... 14314 </change> 14315 <change date="6 Mar 2003" version="v41"> 14316 Remove struct from the call to GetOwnedMonitorInfo. 14317 Automatically generate most error documentation, remove 14318 (rather broken) hand written error doc. 14319 Better describe capability use (empty initial set). 14320 Add min value to jint params. 14321 Remove the capability can_access_thread_local_storage. 14322 Rename error JVMTI_ERROR_NOT_IMPLEMENTED to JVMTI_ERROR_MUST_POSSESS_CAPABILITY; 14323 same for *NOT_IMPLEMENTED. 14324 Description fixes. 14325 </change> 14326 <change date="8 Mar 2003" version="v42"> 14327 Rename GetClassSignature to GetClassName. 14328 Rename IterateOverClassObjects to IterateOverInstancesOfClass. 14329 Remove GetMaxStack (operand stack isn't used in <jvmti/>). 14330 Description fixes: define launch-time, remove native frame pop 14331 from PopFrame, and assorted clarifications. 14332 </change> 14333 <change date="8 Mar 2003" version="v43"> 14334 Fix minor editing problem. 14335 </change> 14336 <change date="10 Mar 2003" version="v44"> 14337 Add phase information. 14338 Remap (compact) event numbers. 14339 </change> 14340 <change date="11 Mar 2003" version="v45"> 14341 More phase information - allow "any". 14342 Elide raw monitor queries and events. 14343 Minor description fixes. 14344 </change> 14345 <change date="12 Mar 2003" version="v46"> 14346 Add GetPhase. 14347 Use "phase" through document. 14348 Elide GetRawMonitorName. 14349 Elide GetObjectMonitors. 14350 </change> 14351 <change date="12 Mar 2003" version="v47"> 14352 Fixes from link, XML, and spell checking. 14353 Auto-generate the callback structure. 14354 </change> 14355 <change date="13 Mar 2003" version="v48"> 14356 One character XML fix. 14357 </change> 14358 <change date="13 Mar 2003" version="v49"> 14359 Change function parameter names to be consistent with 14360 event parameters (fooBarBaz becomes foo_bar_baz). 14361 </change> 14362 <change date="14 Mar 2003" version="v50"> 14363 Fix broken link. Fix thread markers. 14364 </change> 14365 <change date="14 Mar 2003" version="v51"> 14366 Change constants so they are under 128 to workaround 14367 compiler problems. 14368 </change> 14369 <change date="23 Mar 2003" version="v52"> 14370 Overhaul capabilities. Separate GetStackTrace into 14371 GetStackTrace and GetStackFrames. 14372 </change> 14373 <change date="8 Apr 2003" version="v54"> 14374 Use depth instead of jframeID to reference frames. 14375 Remove the now irrelevant GetCurrentFrame, GetCallerFrame and GetStackFrames. 14376 Remove frame arg from events. 14377 </change> 14378 <change date="9 Apr 2003" version="v55"> 14379 Remove GetObjectWithAnnotation since tests show bufferred approach more efficient. 14380 Add missing annotation_count to GetObjectsWithAnnotations 14381 </change> 14382 <change date="10 Apr 2003" version="v56"> 14383 Remove confusing parenthetical statement in GetObjectsWithAnnotations 14384 </change> 14385 <change date="13 Apr 2003" version="v58"> 14386 Replace jclass/jmethodID representation of method with simply jmethodID; 14387 Pass JvmtiEnv* as first arg of every event; remove JNIEnv* where inappropriate. 14388 Replace can_access_frames with can_access_local_variables; remove from purely stack access. 14389 Use can_get_synthetic_attribute; fix description. 14390 Clarify that zero length arrays must be deallocated. 14391 Clarify RelinquishCapabilities. 14392 Generalize JVMTI_ERROR_VM_DEAD to JVMTI_ERROR_WRONG_PHASE. 14393 </change> 14394 <change date="27 Apr 2003" version="v59"> 14395 Remove lingering indirect references to OBSOLETE_METHOD_ID. 14396 </change> 14397 <change date="4 May 2003" version="v60"> 14398 Allow DestroyRawMonitor during OnLoad. 14399 </change> 14400 <change date="7 May 2003" version="v61"> 14401 Added not monitor owner error return to DestroyRawMonitor. 14402 </change> 14403 <change date="13 May 2003" version="v62"> 14404 Clarify semantics of raw monitors. 14405 Change flags on <code>GetThreadStatus</code>. 14406 <code>GetClassLoader</code> return NULL for the bootstrap class loader. 14407 Add <code>GetClassName</code> issue. 14408 Define local variable signature. 14409 Disallow zero in annotations array of <code>GetObjectsWithAnnotations</code>. 14410 Remove over specification in <code>GetObjectsWithAnnotations</code>. 14411 Elide <code>SetAllocationHooks</code>. 14412 Elide <code>SuspendAllThreads</code>. 14413 </change> 14414 <change date="14 May 2003" version="v63"> 14415 Define the data type <code>jvmtiEventCallbacks</code>. 14416 Zero length allocations return NULL. 14417 Keep SetAllocationHooks in JVMDI, but remove from <jvmti/>. 14418 Add JVMTI_THREAD_STATUS_FLAG_INTERRUPTED. 14419 </change> 14420 <change date="15 May 2003" version="v64"> 14421 Better wording, per review. 14422 </change> 14423 <change date="15 May 2003" version="v65"> 14424 First Alpha. 14425 Make jmethodID and jfieldID unique, jclass not used. 14426 </change> 14427 <change date="27 May 2003" version="v66"> 14428 Fix minor XSLT errors. 14429 </change> 14430 <change date="13 June 2003" version="v67"> 14431 Undo making jfieldID unique (jmethodID still is). 14432 </change> 14433 <change date="17 June 2003" version="v68"> 14434 Changes per June 11th Expert Group meeting -- 14435 Overhaul Heap functionality: single callback, 14436 remove GetHeapRoots, add reachable iterators, 14437 and rename "annotation" to "tag". 14438 NULL thread parameter on most functions is current 14439 thread. 14440 Add timers. 14441 Remove ForceExit. 14442 Add GetEnvironmentLocalStorage. 14443 Add verbose flag and event. 14444 Add AddToBootstrapClassLoaderSearch. 14445 Update ClassFileLoadHook. 14446 </change> 14447 <change date="18 June 2003" version="v69"> 14448 Clean up issues sections. 14449 Rename GetClassName back to GetClassSignature and 14450 fix description. 14451 Add generic signature to GetClassSignature, 14452 GetFieldSignature, GetMethodSignature, and 14453 GetLocalVariableTable. 14454 Elide EstimateCostOfCapabilities. 14455 Clarify that the system property functions operate 14456 on the VM view of system properties. 14457 Clarify Agent_OnLoad. 14458 Remove "const" from JNIEnv* in events. 14459 Add metadata accessors. 14460 </change> 14461 <change date="18 June 2003" version="v70"> 14462 Add start_depth to GetStackTrace. 14463 Move system properties to a new category. 14464 Add GetObjectSize. 14465 Remove "X" from command line flags. 14466 XML, HTML, and spell check corrections. 14467 </change> 14468 <change date="19 June 2003" version="v71"> 14469 Fix JVMTI_HEAP_ROOT_THREAD to be 6. 14470 Make each synopsis match the function name. 14471 Fix unclear wording. 14472 </change> 14473 <change date="26 June 2003" version="v72"> 14474 SetThreadLocalStorage and SetEnvironmentLocalStorage should allow value 14475 to be set to NULL. 14476 NotifyFramePop, GetFrameLocationm and all the local variable operations 14477 needed to have their wording about frames fixed. 14478 Grammar and clarity need to be fixed throughout. 14479 Capitalization and puntuation need to be consistent. 14480 Need micro version number and masks for accessing major, minor, and micro. 14481 The error code lists should indicate which must be returned by 14482 an implementation. 14483 The command line properties should be visible in the properties functions. 14484 Disallow popping from the current thread. 14485 Allow implementations to return opaque frame error when they cannot pop. 14486 The NativeMethodBind event should be sent during any phase. 14487 The DynamicCodeGenerated event should be sent during any phase. 14488 The following functions should be allowed to operate before VMInit: 14489 Set/GetEnvironmentLocalStorage 14490 GetMethodDeclaringClass 14491 GetClassSignature 14492 GetClassModifiers 14493 IsInterface 14494 IsArrayClass 14495 GetMethodName 14496 GetMethodModifiers 14497 GetMaxLocals 14498 GetArgumentsSize 14499 GetLineNumberTable 14500 GetMethodLocation 14501 IsMethodNative 14502 IsMethodSynthetic. 14503 Other changes (to XSL): 14504 Argument description should show asterisk after not before pointers. 14505 NotifyFramePop, GetFrameLocationm and all the local variable operations 14506 should hsve the NO_MORE_FRAMES error added. 14507 Not alive threads should have a different error return than invalid thread. 14508 </change> 14509 <change date="7 July 2003" version="v73"> 14510 VerboseOutput event was missing message parameter. 14511 Minor fix-ups. 14512 </change> 14513 <change date="14 July 2003" version="v74"> 14514 Technical Publications Department corrections. 14515 Allow thread and environment local storage to be set to NULL. 14516 </change> 14517 <change date="23 July 2003" version="v75"> 14518 Use new Agent_OnLoad rather than overloaded JVM_OnLoad. 14519 Add JNICALL to callbacks (XSL). 14520 Document JNICALL requirement for both events and callbacks (XSL). 14521 Restrict RedefineClasses to methods and attributes. 14522 Elide the VerboseOutput event. 14523 VMObjectAlloc: restrict when event is sent and remove method parameter. 14524 Finish loose ends from Tech Pubs edit. 14525 </change> 14526 <change date="24 July 2003" version="v76"> 14527 Change ClassFileLoadHook event to send the class instead of a boolean of redefine. 14528 </change> 14529 <change date="24 July 2003" version="v77"> 14530 XML fixes. 14531 Minor text clarifications and corrections. 14532 </change> 14533 <change date="24 July 2003" version="v78"> 14534 Remove GetExceptionHandlerTable and GetThrownExceptions from <jvmti/>. 14535 Clarify that stack frames are JVM Spec frames. 14536 Split can_get_source_info into can_get_source_file_name, can_get_line_numbers, 14537 and can_get_source_debug_extension. 14538 PopFrame cannot have a native calling method. 14539 Removed incorrect statement in GetClassloaderClasses 14540 (see <vmspec chapter="4.4"/>). 14541 </change> 14542 <change date="24 July 2003" version="v79"> 14543 XML and text fixes. 14544 Move stack frame description into Stack Frame category. 14545 </change> 14546 <change date="26 July 2003" version="v80"> 14547 Allow NULL (means bootstrap loader) for GetClassloaderClasses. 14548 Add new heap reference kinds for references from classes. 14549 Add timer information struct and query functions. 14550 Add AvailableProcessors. 14551 Rename GetOtherThreadCpuTime to GetThreadCpuTime. 14552 Explicitly add JVMTI_ERROR_INVALID_THREAD and JVMTI_ERROR_THREAD_NOT_ALIVE 14553 to SetEventNotification mode. 14554 Add initial thread to the VM_INIT event. 14555 Remove platform assumptions from AddToBootstrapClassLoaderSearch. 14556 </change> 14557 <change date="26 July 2003" version="v81"> 14558 Grammar and clarity changes per review. 14559 </change> 14560 <change date="27 July 2003" version="v82"> 14561 More grammar and clarity changes per review. 14562 Add Agent_OnUnload. 14563 </change> 14564 <change date="28 July 2003" version="v83"> 14565 Change return type of Agent_OnUnload to void. 14566 </change> 14567 <change date="28 July 2003" version="v84"> 14568 Rename JVMTI_REFERENCE_ARRAY to JVMTI_REFERENCE_ARRAY_ELEMENT. 14569 </change> 14570 <change date="28 July 2003" version="v85"> 14571 Steal java.lang.Runtime.availableProcessors() wording for 14572 AvailableProcessors(). 14573 Guarantee that zero will never be an event ID. 14574 Remove some issues which are no longer issues. 14575 Per review, rename and more completely document the timer 14576 information functions. 14577 </change> 14578 <change date="29 July 2003" version="v86"> 14579 Non-spec visible change to XML controlled implementation: 14580 SetThreadLocalStorage must run in VM mode. 14581 </change> 14582 <change date="5 August 2003" version="0.1.87"> 14583 Add GetErrorName. 14584 Add varargs warning to jvmtiExtensionEvent. 14585 Remove "const" on the jvmtiEnv* of jvmtiExtensionEvent. 14586 Remove unused can_get_exception_info capability. 14587 Pass jvmtiEnv* and JNIEnv* to the jvmtiStartFunction. 14588 Fix jvmtiExtensionFunctionInfo.func declared type. 14589 Extension function returns error code. 14590 Use new version numbering. 14591 </change> 14592 <change date="5 August 2003" version="0.2.88"> 14593 Remove the ClassUnload event. 14594 </change> 14595 <change date="8 August 2003" version="0.2.89"> 14596 Heap reference iterator callbacks return an enum that 14597 allows outgoing object references to be ignored. 14598 Allow JNIEnv as a param type to extension events/functions. 14599 </change> 14600 <change date="15 August 2003" version="0.2.90"> 14601 Fix a typo. 14602 </change> 14603 <change date="2 September 2003" version="0.2.91"> 14604 Remove all metadata functions: GetClassMetadata, 14605 GetFieldMetadata, and GetMethodMetadata. 14606 </change> 14607 <change date="1 October 2003" version="0.2.92"> 14608 Mark the functions Allocate. Deallocate, RawMonitor*, 14609 SetEnvironmentLocalStorage, and GetEnvironmentLocalStorage 14610 as safe for use in heap callbacks and GC events. 14611 </change> 14612 <change date="24 November 2003" version="0.2.93"> 14613 Add pass through opaque user data pointer to heap iterate 14614 functions and callbacks. 14615 In the CompiledMethodUnload event, send the code address. 14616 Add GarbageCollectionOccurred event. 14617 Add constant pool reference kind. 14618 Mark the functions CreateRawMonitor and DestroyRawMonitor 14619 as safe for use in heap callbacks and GC events. 14620 Clarify: VMDeath, GetCurrentThreadCpuTimerInfo, 14621 GetThreadCpuTimerInfo, IterateOverReachableObjects, 14622 IterateOverObjectsReachableFromObject, GetTime and 14623 JVMTI_ERROR_NULL_POINTER. 14624 Add missing errors to: GenerateEvents and 14625 AddToBootstrapClassLoaderSearch. 14626 Fix description of ClassFileLoadHook name parameter. 14627 In heap callbacks and GC/ObjectFree events, specify 14628 that only explicitly allowed functions can be called. 14629 Allow GetCurrentThreadCpuTimerInfo, GetCurrentThreadCpuTime, 14630 GetTimerInfo, and GetTime during callback. 14631 Allow calling SetTag/GetTag during the onload phase. 14632 SetEventNotificationMode, add: error attempted inappropriate 14633 thread level control. 14634 Remove jvmtiExceptionHandlerEntry. 14635 Fix handling of native methods on the stack -- 14636 location_ptr param of GetFrameLocation, remove 14637 JVMTI_ERROR_OPAQUE_FRAME from GetFrameLocation, 14638 jvmtiFrameInfo.location, and jlocation. 14639 Remove typo (from JVMPI) implying that the MonitorWaited 14640 event is sent on sleep. 14641 </change> 14642 <change date="25 November 2003" version="0.2.94"> 14643 Clarifications and typos. 14644 </change> 14645 <change date="3 December 2003" version="0.2.95"> 14646 Allow NULL user_data in heap iterators. 14647 </change> 14648 <change date="28 January 2004" version="0.2.97"> 14649 Add GetThreadState, deprecate GetThreadStatus. 14650 </change> 14651 <change date="29 January 2004" version="0.2.98"> 14652 INVALID_SLOT and TYPE_MISMATCH errors should be optional. 14653 </change> 14654 <change date="12 February 2004" version="0.2.102"> 14655 Remove MonitorContendedExit. 14656 Added JNIEnv parameter to VMObjectAlloc. 14657 Clarified definition of class_tag and referrer_index 14658 parameters to heap callbacks. 14659 </change> 14660 <change date="16 Febuary 2004" version="0.2.103"> 14661 Document JAVA_TOOL_OPTIONS. 14662 </change> 14663 <change date="17 Febuary 2004" version="0.2.105"> 14664 Divide start phase into primordial and start. 14665 Add VMStart event 14666 Change phase associations of functions and events. 14667 </change> 14668 <change date="18 Febuary 2004" version="0.3.6"> 14669 Elide deprecated GetThreadStatus. 14670 Bump minor version, subtract 100 from micro version 14671 </change> 14672 <change date="18 Febuary 2004" version="0.3.7"> 14673 Document that timer nanosecond values are unsigned. 14674 Clarify text having to do with native methods. 14675 </change> 14676 <change date="19 Febuary 2004" version="0.3.8"> 14677 Fix typos. 14678 Remove elided deprecated GetThreadStatus. 14679 </change> 14680 <change date="23 Febuary 2004" version="0.3.9"> 14681 Require NotifyFramePop to act on suspended threads. 14682 </change> 14683 <change date="24 Febuary 2004" version="0.3.10"> 14684 Add capabilities 14685 (<internallink id="jvmtiCapabilities.can_redefine_any_class" 14686 ><code>can_redefine_any_class</code></internallink> 14687 and 14688 <internallink id="jvmtiCapabilities.can_generate_all_class_hook_events" 14689 ><code>can_generate_all_class_hook_events</code></internallink>) 14690 and an error (<errorlink id="JVMTI_ERROR_UNMODIFIABLE_CLASS"></errorlink>) 14691 which allow some classes to be unmodifiable. 14692 </change> 14693 <change date="28 Febuary 2004" version="0.3.11"> 14694 Add JVMTI_ERROR_MUST_POSSESS_CAPABILITY to SetEventNotificationMode. 14695 </change> 14696 <change date="8 March 2004" version="0.3.12"> 14697 Clarified CompiledMethodUnload so that it is clear the event 14698 may be posted after the class has been unloaded. 14699 </change> 14700 <change date="5 March 2004" version="0.3.13"> 14701 Change the size parameter of VMObjectAlloc to jlong to match GetObjectSize. 14702 </change> 14703 <change date="13 March 2004" version="0.3.14"> 14704 Added guideline for the use of the JNI FindClass function in event 14705 callback functions. 14706 </change> 14707 <change date="15 March 2004" version="0.3.15"> 14708 Add GetAllStackTraces and GetThreadListStackTraces. 14709 </change> 14710 <change date="19 March 2004" version="0.3.16"> 14711 ClassLoad and ClassPrepare events can be posted during start phase. 14712 </change> 14713 <change date="25 March 2004" version="0.3.17"> 14714 Add JVMTI_ERROR_NATIVE_METHOD to GetLineNumberTable, GetLocalVariableTable, 14715 GetMaxLocals, GetArgumentsSize, GetMethodLocation, GetBytecodes. 14716 </change> 14717 <change date="29 March 2004" version="0.3.18"> 14718 Return the timer kind in the timer information structure. 14719 </change> 14720 <change date="31 March 2004" version="0.3.19"> 14721 Spec clarifications: 14722 JVMTI_THREAD_STATE_IN_NATIVE might not include JNI or <jvmti/>. 14723 ForceGarbageCollection does not run finalizers. 14724 The context of the specification is the Java platform. 14725 Warn about early instrumentation. 14726 </change> 14727 <change date="1 April 2004" version="0.3.20"> 14728 Refinements to the above clarifications and 14729 Clarify that an error returned by Agent_OnLoad terminates the VM. 14730 </change> 14731 <change date="1 April 2004" version="0.3.21"> 14732 Array class creation does not generate a class load event. 14733 </change> 14734 <change date="7 April 2004" version="0.3.22"> 14735 Align thread state hierarchy more closely with java.lang.Thread.State. 14736 </change> 14737 <change date="12 April 2004" version="0.3.23"> 14738 Clarify the documentation of thread state. 14739 </change> 14740 <change date="19 April 2004" version="0.3.24"> 14741 Remove GarbageCollectionOccurred event -- can be done by agent. 14742 </change> 14743 <change date="22 April 2004" version="0.3.25"> 14744 Define "command-line option". 14745 </change> 14746 <change date="29 April 2004" version="0.3.26"> 14747 Describe the intended use of bytecode instrumentation. 14748 Fix description of extension event first parameter. 14749 </change> 14750 <change date="30 April 2004" version="0.3.27"> 14751 Clarification and typos. 14752 </change> 14753 <change date="18 May 2004" version="0.3.28"> 14754 Remove DataDumpRequest event. 14755 </change> 14756 <change date="18 May 2004" version="0.3.29"> 14757 Clarify RawMonitorWait with zero timeout. 14758 Clarify thread state after RunAgentThread. 14759 </change> 14760 <change date="24 May 2004" version="0.3.30"> 14761 Clean-up: fix bad/old links, etc. 14762 </change> 14763 <change date="30 May 2004" version="0.3.31"> 14764 Clarifications including: 14765 All character strings are modified UTF-8. 14766 Agent thread visibiity. 14767 Meaning of obsolete method version. 14768 Thread invoking heap callbacks, 14769 </change> 14770 <change date="1 June 2004" version="1.0.32"> 14771 Bump major.minor version numbers to "1.0". 14772 </change> 14773 <change date="2 June 2004" version="1.0.33"> 14774 Clarify interaction between ForceGarbageCollection 14775 and ObjectFree. 14776 </change> 14777 <change date="6 June 2004" version="1.0.34"> 14778 Restrict AddToBootstrapClassLoaderSearch and 14779 SetSystemProperty to the OnLoad phase only. 14780 </change> 14781 <change date="11 June 2004" version="1.0.35"> 14782 Fix typo in SetTag. 14783 </change> 14784 <change date="18 June 2004" version="1.0.36"> 14785 Fix trademarks. 14786 Add missing parameter in example GetThreadState usage. 14787 </change> 14788 <change date="4 August 2004" version="1.0.37"> 14789 Copyright updates. 14790 </change> 14791 <change date="5 November 2004" version="1.0.38"> 14792 Add missing function table layout. 14793 Add missing description of C++ member function format of functions. 14794 Clarify that name in CFLH can be NULL. 14795 Released as part of <tm>J2SE</tm> 5.0. 14796 </change> 14797 <change date="24 April 2005" version="1.1.47"> 14798 Bump major.minor version numbers to "1.1". 14799 Add ForceEarlyReturn* functions. 14800 Add GetOwnedMonitorStackDepthInfo function. 14801 Add GetCurrentThread function. 14802 Add "since" version marker. 14803 Add AddToSystemClassLoaderSearch. 14804 Allow AddToBootstrapClassLoaderSearch be used in live phase. 14805 Fix historic rubbish in the descriptions of the heap_object_callback 14806 parameter of IterateOverHeap and IterateOverInstancesOfClass functions; 14807 disallow NULL for this parameter. 14808 Clarify, correct and make consistent: wording about current thread, 14809 opaque frames and insufficient number of frames in PopFrame. 14810 Consistently use "current frame" rather than "topmost". 14811 Clarify the JVMTI_ERROR_TYPE_MISMATCH errors in GetLocal* and SetLocal* 14812 by making them compatible with those in ForceEarlyReturn*. 14813 Many other clarifications and wording clean ups. 14814 </change> 14815 <change date="25 April 2005" version="1.1.48"> 14816 Add GetConstantPool. 14817 Switch references to the first edition of the VM Spec, to the seconds edition. 14818 </change> 14819 <change date="26 April 2005" version="1.1.49"> 14820 Clarify minor/major version order in GetConstantPool. 14821 </change> 14822 <change date="26 April 2005" version="1.1.50"> 14823 Add SetNativeMethodPrefix and SetNativeMethodPrefixes. 14824 Reassign GetOwnedMonitorStackDepthInfo to position 153. 14825 Break out Class Loader Search in its own documentation category. 14826 Deal with overly long lines in XML source. 14827 </change> 14828 <change date="29 April 2005" version="1.1.51"> 14829 Allow agents be started in the live phase. 14830 Added paragraph about deploying agents. 14831 </change> 14832 <change date="30 April 2005" version="1.1.52"> 14833 Add specification description to SetNativeMethodPrefix(es). 14834 Better define the conditions on GetConstantPool. 14835 </change> 14836 <change date="30 April 2005" version="1.1.53"> 14837 Break out the GetClassVersionNumber function from GetConstantPool. 14838 Clean-up the references to the VM Spec. 14839 </change> 14840 <change date="1 May 2005" version="1.1.54"> 14841 Allow SetNativeMethodPrefix(es) in any phase. 14842 Add clarifications about the impact of redefinition on GetConstantPool. 14843 </change> 14844 <change date="2 May 2005" version="1.1.56"> 14845 Various clarifications to SetNativeMethodPrefix(es). 14846 </change> 14847 <change date="2 May 2005" version="1.1.57"> 14848 Add missing performance warning to the method entry event. 14849 </change> 14850 <change date="5 May 2005" version="1.1.58"> 14851 Remove internal JVMDI support. 14852 </change> 14853 <change date="8 May 2005" version="1.1.59"> 14854 Add <functionlink id="RetransformClasses"/>. 14855 Revamp the bytecode instrumentation documentation. 14856 Change <functionlink id="IsMethodObsolete"/> to no longer 14857 require the can_redefine_classes capability. 14858 </change> 14859 <change date="11 May 2005" version="1.1.63"> 14860 Clarifications for retransformation. 14861 </change> 14862 <change date="11 May 2005" version="1.1.64"> 14863 Clarifications for retransformation, per review. 14864 Lock "retransformation (in)capable" at class load enable time. 14865 </change> 14866 <change date="4 June 2005" version="1.1.67"> 14867 Add new heap functionity which supports reporting primitive values, 14868 allows setting the referrer tag, and has more powerful filtering: 14869 FollowReferences, IterateThroughHeap, and their associated 14870 callbacks, structs, enums, and constants. 14871 </change> 14872 <change date="4 June 2005" version="1.1.68"> 14873 Clarification. 14874 </change> 14875 <change date="6 June 2005" version="1.1.69"> 14876 FollowReferences, IterateThroughHeap: Put callbacks in a struct; 14877 Add missing error codes; reduce bits in the visit control flags. 14878 </change> 14879 <change date="14 June 2005" version="1.1.70"> 14880 More on new heap functionity: spec clean-up per review. 14881 </change> 14882 <change date="15 June 2005" version="1.1.71"> 14883 More on new heap functionity: Rename old heap section to Heap (1.0). 14884 </change> 14885 <change date="21 June 2005" version="1.1.72"> 14886 Fix typos. 14887 </change> 14888 <change date="27 June 2005" version="1.1.73"> 14889 Make referrer info structure a union. 14890 </change> 14891 <change date="9 September 2005" version="1.1.74"> 14892 In new heap functions: 14893 Add missing superclass reference kind. 14894 Use a single scheme for computing field indexes. 14895 Remove outdated references to struct based referrer info. 14896 </change> 14897 <change date="12 September 2005" version="1.1.75"> 14898 Don't callback during FollowReferences on frivolous java.lang.Object superclass. 14899 </change> 14900 <change date="13 September 2005" version="1.1.76"> 14901 In string primitive callback, length now Unicode length. 14902 In array and string primitive callbacks, value now "const". 14903 Note possible compiler impacts on setting JNI function table. 14904 </change> 14905 <change date="13 September 2005" version="1.1.77"> 14906 GetClassVersionNumbers() and GetConstantPool() should return 14907 error on array or primitive class. 14908 </change> 14909 <change date="14 September 2005" version="1.1.78"> 14910 Grammar fixes. 14911 </change> 14912 <change date="26 September 2005" version="1.1.79"> 14913 Add IsModifiableClass query. 14914 </change> 14915 <change date="9 February 2006" version="1.1.81"> 14916 Add referrer_class_tag parameter to jvmtiHeapReferenceCallback. 14917 </change> 14918 <change date="13 February 2006" version="1.1.82"> 14919 Doc fixes: update can_redefine_any_class to include retransform. 14920 Clarify that exception events cover all Throwables. 14921 In GetStackTrace, no test is done for start_depth too big if start_depth is zero, 14922 Clarify fields reported in Primitive Field Callback -- static vs instance. 14923 Repair confusing names of heap types, including callback names. 14924 Require consistent usage of stack depth in the face of thread launch methods. 14925 Note incompatibility of <jvmti/> memory management with other systems. 14926 </change> 14927 <change date="14 February 2006" version="1.1.85"> 14928 Fix typos and missing renames. 14929 </change> 14930 <change date="13 March 2006" version="1.1.86"> 14931 Clarify that jmethodIDs and jfieldIDs can be saved. 14932 Clarify that Iterate Over Instances Of Class includes subclasses. 14933 </change> 14934 <change date="14 March 2006" version="1.1.87"> 14935 Better phrasing. 14936 </change> 14937 <change date="16 March 2006" version="1.1.88"> 14938 Match the referrer_index for static fields in Object Reference Callback 14939 with the Reference Implementation (and all other known implementations); 14940 that is, make it match the definition for instance fields. 14941 In GetThreadListStackTraces, add JVMTI_ERROR_INVALID_THREAD to cover 14942 an invalid thread in the list; and specify that not started threads 14943 return empty stacks. 14944 </change> 14945 <change date="17 March 2006" version="1.1.89"> 14946 Typo. 14947 </change> 14948 <change date="25 March 2006" version="1.1.90"> 14949 Typo. 14950 </change> 14951 <change date="6 April 2006" version="1.1.91"> 14952 Remove restrictions on AddToBootstrapClassLoaderSearch and 14953 AddToSystemClassLoaderSearch. 14954 </change> 14955 <change date="1 May 2006" version="1.1.93"> 14956 Changed spec to return -1 for monitor stack depth for the 14957 implementation which can not determine stack depth. 14958 </change> 14959 <change date="3 May 2006" version="1.1.94"> 14960 Corrections for readability and accuracy courtesy of Alan Pratt of IBM. 14961 List the object relationships reported in FollowReferences. 14962 </change> 14963 <change date="5 May 2006" version="1.1.95"> 14964 Clarify the object relationships reported in FollowReferences. 14965 </change> 14966 <change date="28 June 2006" version="1.1.98"> 14967 Clarify DisposeEnvironment; add warning. 14968 Fix typos in SetLocalXXX "retrieve" => "set". 14969 Clarify that native method prefixes must remain set while used. 14970 Clarify that exactly one Agent_OnXXX is called per agent. 14971 Clarify that library loading is independent from start-up. 14972 Remove ambiguous reference to Agent_OnLoad in the Agent_OnUnload spec. 14973 </change> 14974 <change date="31 July 2006" version="1.1.99"> 14975 Clarify the interaction between functions and exceptions. 14976 Clarify and give examples of field indices. 14977 Remove confusing "That is" sentence from MonitorWait and MonitorWaited events. 14978 Update links to point to Java 6. 14979 </change> 14980 <change date="6 August 2006" version="1.1.102"> 14981 Add ResourceExhaustedEvent. 14982 </change> 14983 <change date="11 October 2012" version="1.2.2"> 14984 Fixed the "HTTP" and "Missing Anchor" errors reported by the LinkCheck tool. 14985 </change> 14986 <change date="19 June 2013" version="1.2.3"> 14987 Added support for statically linked agents. 14988 </change> 14989 <change date="13 October 2016" version="9.0.0"> 14990 Support for modules: 14991 - The majorversion is 9 now 14992 - The ClassFileLoadHook events are not sent during the primordial phase anymore. 14993 - Allow CompiledMethodLoad events at start phase 14994 - Add new capabilities: 14995 - can_generate_early_vmstart 14996 - can_generate_early_class_hook_events 14997 - Add new functions: 14998 - GetAllModules 14999 - AddModuleReads, AddModuleExports, AddModuleOpens, AddModuleUses, AddModuleProvides 15000 - IsModifiableModule 15001 Clarified can_redefine_any_classes, can_retransform_any_classes and IsModifiableClass API to 15002 disallow some implementation defined classes. 15003 </change> 15004 <change date="12 February 2017" version="9.0.0"> 15005 Minor update for GetCurrentThread function: 15006 - The function may return NULL in the start phase if the 15007 can_generate_early_vmstart capability is enabled. 15008 </change> 15009 <change date="7 February 2018" version="11.0.0"> 15010 Minor update for new class file NestHost and NestMembers attributes: 15011 - Specify that RedefineClasses and RetransformClasses are not allowed 15012 to change the class file NestHost and NestMembers attributes. 15013 - Add new error JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED 15014 that can be returned by RedefineClasses and RetransformClasses. 15015 </change> 15016 <change date="20 May 2019" version="13.0.0"> 15017 Minor spec update for the capability "can_redefine_any_class". 15018 It now says: 15019 "RedefineClasses can be called on any modifiable class. See IsModifiableClass. 15020 (can_redefine_classes must also be set)" 15021 </change> 15022 <change date="5 June 2019" version="13.0.0"> 15023 Minor PopFrame spec update: 15024 - The specified thread must be suspended or must be the current thread. 15025 (It was not allowed to be the current thread before.) 15026 </change> 15027 <change date="10 October 2019" version="14.0.0"> 15028 Minor update for new class file Record attribute: 15029 - Specify that RedefineClasses and RetransformClasses are not allowed 15030 to change the class file Record attribute. 15031 </change> 15032 </changehistory> 15033 15034 </specification> 15035 <!-- Keep this comment at the end of the file 15036 Local variables: 15037 mode: sgml 15038 sgml-omittag:t 15039 sgml-shorttag:t 15040 sgml-namecase-general:t 15041 sgml-general-insert-case:lower 15042 sgml-minimize-attributes:nil 15043 sgml-always-quote-attributes:t 15044 sgml-indent-step:2 15045 sgml-indent-data:t 15046 sgml-parent-document:nil 15047 sgml-exposed-tags:nil 15048 sgml-local-catalogs:nil 15049 sgml-local-ecat-files:nil 15050 End: 15051 -->