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